BridgeContext.java revision 70552fb92dbc5cb5b1d53b20f92f2a64969a50c4
1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.layoutlib.bridge.android;
18
19import com.android.ide.common.rendering.api.IProjectCallback;
20import com.android.ide.common.rendering.api.LayoutLog;
21import com.android.ide.common.rendering.api.RenderResources;
22import com.android.ide.common.rendering.api.ResourceValue;
23import com.android.ide.common.rendering.api.StyleResourceValue;
24import com.android.layoutlib.bridge.Bridge;
25import com.android.layoutlib.bridge.BridgeConstants;
26import com.android.layoutlib.bridge.impl.Stack;
27
28import android.app.Activity;
29import android.app.Fragment;
30import android.content.BroadcastReceiver;
31import android.content.ComponentName;
32import android.content.ContentResolver;
33import android.content.Context;
34import android.content.Intent;
35import android.content.IntentFilter;
36import android.content.IntentSender;
37import android.content.ServiceConnection;
38import android.content.SharedPreferences;
39import android.content.pm.ApplicationInfo;
40import android.content.pm.PackageManager;
41import android.content.res.AssetManager;
42import android.content.res.Configuration;
43import android.content.res.Resources;
44import android.content.res.TypedArray;
45import android.content.res.Resources.Theme;
46import android.database.DatabaseErrorHandler;
47import android.database.sqlite.SQLiteDatabase;
48import android.database.sqlite.SQLiteDatabase.CursorFactory;
49import android.graphics.Bitmap;
50import android.graphics.drawable.Drawable;
51import android.net.Uri;
52import android.os.Bundle;
53import android.os.Handler;
54import android.os.Looper;
55import android.util.AttributeSet;
56import android.util.DisplayMetrics;
57import android.view.LayoutInflater;
58import android.view.View;
59
60import java.io.File;
61import java.io.FileInputStream;
62import java.io.FileNotFoundException;
63import java.io.FileOutputStream;
64import java.io.IOException;
65import java.io.InputStream;
66import java.util.HashMap;
67import java.util.IdentityHashMap;
68import java.util.Map;
69import java.util.TreeMap;
70import java.util.Map.Entry;
71
72/**
73 * Custom implementation of Context/Activity to handle non compiled resources.
74 */
75public final class BridgeContext extends Activity {
76
77    private Resources mSystemResources;
78    private Theme mTheme;
79    private final HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>();
80    private final Object mProjectKey;
81    private final DisplayMetrics mMetrics;
82    private final RenderResources mRenderResources;
83
84    private final Map<Object, Map<String, String>> mDefaultPropMaps =
85        new IdentityHashMap<Object, Map<String,String>>();
86
87    // maps for dynamically generated id representing style objects (IStyleResourceValue)
88    private Map<Integer, StyleResourceValue> mDynamicIdToStyleMap;
89    private Map<StyleResourceValue, Integer> mStyleToDynamicIdMap;
90    private int mDynamicIdGenerator = 0x01030000; // Base id for framework R.style
91
92    // cache for TypedArray generated from IStyleResourceValue object
93    private Map<int[], Map<Integer, TypedArray>> mTypedArrayCache;
94    private BridgeInflater mBridgeInflater;
95
96    private final IProjectCallback mProjectCallback;
97    private BridgeContentResolver mContentResolver;
98
99    private final Stack<BridgeXmlBlockParser> mParserStack = new Stack<BridgeXmlBlockParser>();
100
101    /**
102     * @param projectKey An Object identifying the project. This is used for the cache mechanism.
103     * @param metrics the {@link DisplayMetrics}.
104     * @param themeName The name of the theme to use.
105     * @param projectResources the resources of the project. The map contains (String, map) pairs
106     * where the string is the type of the resource reference used in the layout file, and the
107     * map contains (String, {@link }) pairs where the key is the resource name,
108     * and the value is the resource value.
109     * @param frameworkResources the framework resources. The map contains (String, map) pairs
110     * where the string is the type of the resource reference used in the layout file, and the map
111     * contains (String, {@link ResourceValue}) pairs where the key is the resource name, and the
112     * value is the resource value.
113     * @param styleInheritanceMap
114     * @param projectCallback
115     */
116    public BridgeContext(Object projectKey, DisplayMetrics metrics,
117            RenderResources renderResources,
118            IProjectCallback projectCallback) {
119        mProjectKey = projectKey;
120        mMetrics = metrics;
121        mProjectCallback = projectCallback;
122
123        mRenderResources = renderResources;
124
125        mFragments.mCurState = Fragment.CREATED;
126        mFragments.mActivity = this;
127    }
128
129    /**
130     * Initializes the {@link Resources} singleton to be linked to this {@link Context}, its
131     * {@link DisplayMetrics}, {@link Configuration}, and {@link IProjectCallback}.
132     *
133     * @see #disposeResources()
134     */
135    public void initResources() {
136        AssetManager assetManager = AssetManager.getSystem();
137        Configuration config = new Configuration();
138
139        mSystemResources = BridgeResources.initSystem(
140                this,
141                assetManager,
142                mMetrics,
143                config,
144                mProjectCallback);
145        mTheme = mSystemResources.newTheme();
146    }
147
148    /**
149     * Disposes the {@link Resources} singleton.
150     */
151    public void disposeResources() {
152        BridgeResources.disposeSystem();
153    }
154
155    public void setBridgeInflater(BridgeInflater inflater) {
156        mBridgeInflater = inflater;
157    }
158
159    public void addViewKey(View view, Object viewKey) {
160        mViewKeyMap.put(view, viewKey);
161    }
162
163    public Object getViewKey(View view) {
164        return mViewKeyMap.get(view);
165    }
166
167    public Object getProjectKey() {
168        return mProjectKey;
169    }
170
171    public IProjectCallback getProjectCallback() {
172        return mProjectCallback;
173    }
174
175    public RenderResources getRenderResources() {
176        return mRenderResources;
177    }
178
179    public Map<String, String> getDefaultPropMap(Object key) {
180        return mDefaultPropMaps.get(key);
181    }
182
183    /**
184     * Adds a parser to the stack.
185     * @param parser the parser to add.
186     */
187    public void pushParser(BridgeXmlBlockParser parser) {
188        mParserStack.push(parser);
189    }
190
191    /**
192     * Removes the parser at the top of the stack
193     */
194    public void popParser() {
195        mParserStack.pop();
196    }
197
198    /**
199     * Returns the current parser at the top the of the stack.
200     * @return a parser or null.
201     */
202    public BridgeXmlBlockParser getCurrentParser() {
203        return mParserStack.peek();
204    }
205
206    /**
207     * Returns the previous parser.
208     * @return a parser or null if there isn't any previous parser
209     */
210    public BridgeXmlBlockParser getPreviousParser() {
211        if (mParserStack.size() < 2) {
212            return null;
213        }
214        return mParserStack.get(mParserStack.size() - 2);
215    }
216
217    // ------------- Activity Methods
218
219    @Override
220    public LayoutInflater getLayoutInflater() {
221        return mBridgeInflater;
222    }
223
224    // ------------ Context methods
225
226    @Override
227    public Resources getResources() {
228        return mSystemResources;
229    }
230
231    @Override
232    public Theme getTheme() {
233        return mTheme;
234    }
235
236    @Override
237    public ClassLoader getClassLoader() {
238        return this.getClass().getClassLoader();
239    }
240
241    @Override
242    public Object getSystemService(String service) {
243        if (LAYOUT_INFLATER_SERVICE.equals(service)) {
244            return mBridgeInflater;
245        }
246
247        // AutoCompleteTextView and MultiAutoCompleteTextView want a window
248        // service. We don't have any but it's not worth an exception.
249        if (WINDOW_SERVICE.equals(service)) {
250            return null;
251        }
252
253        // needed by SearchView
254        if (INPUT_METHOD_SERVICE.equals(service)) {
255            return null;
256        }
257
258        throw new UnsupportedOperationException("Unsupported Service: " + service);
259    }
260
261
262    @Override
263    public final TypedArray obtainStyledAttributes(int[] attrs) {
264        return createStyleBasedTypedArray(mRenderResources.getTheme(), attrs);
265    }
266
267    @Override
268    public final TypedArray obtainStyledAttributes(int resid, int[] attrs)
269            throws Resources.NotFoundException {
270        // get the IStyleResourceValue based on the resId;
271        StyleResourceValue style = getStyleByDynamicId(resid);
272
273        if (style == null) {
274            throw new Resources.NotFoundException();
275        }
276
277        if (mTypedArrayCache == null) {
278            mTypedArrayCache = new HashMap<int[], Map<Integer,TypedArray>>();
279
280            Map<Integer, TypedArray> map = new HashMap<Integer, TypedArray>();
281            mTypedArrayCache.put(attrs, map);
282
283            BridgeTypedArray ta = createStyleBasedTypedArray(style, attrs);
284            map.put(resid, ta);
285
286            return ta;
287        }
288
289        // get the 2nd map
290        Map<Integer, TypedArray> map = mTypedArrayCache.get(attrs);
291        if (map == null) {
292            map = new HashMap<Integer, TypedArray>();
293            mTypedArrayCache.put(attrs, map);
294        }
295
296        // get the array from the 2nd map
297        TypedArray ta = map.get(resid);
298
299        if (ta == null) {
300            ta = createStyleBasedTypedArray(style, attrs);
301            map.put(resid, ta);
302        }
303
304        return ta;
305    }
306
307    @Override
308    public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) {
309        return obtainStyledAttributes(set, attrs, 0, 0);
310    }
311
312    @Override
313    public TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs,
314            int defStyleAttr, int defStyleRes) {
315
316        Map<String, String> defaultPropMap = null;
317        boolean isPlatformFile = true;
318
319        // Hint: for XmlPullParser, attach source //DEVICE_SRC/dalvik/libcore/xml/src/java
320        if (set instanceof BridgeXmlBlockParser) {
321            BridgeXmlBlockParser parser = null;
322            parser = (BridgeXmlBlockParser)set;
323
324            isPlatformFile = parser.isPlatformFile();
325
326            Object key = parser.getViewCookie();
327            if (key != null) {
328                defaultPropMap = mDefaultPropMaps.get(key);
329                if (defaultPropMap == null) {
330                    defaultPropMap = new HashMap<String, String>();
331                    mDefaultPropMaps.put(key, defaultPropMap);
332                }
333            }
334
335        } else if (set instanceof BridgeLayoutParamsMapAttributes) {
336            // this is only for temp layout params generated dynamically, so this is never
337            // platform content.
338            isPlatformFile = false;
339        } else if (set != null) { // null parser is ok
340            // really this should not be happening since its instantiated in Bridge
341            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
342                    "Parser is not a BridgeXmlBlockParser!", null /*data*/);
343            return null;
344        }
345
346        boolean[] frameworkAttributes = new boolean[1];
347        TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
348
349        BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
350                isPlatformFile);
351
352        // resolve the defStyleAttr value into a IStyleResourceValue
353        StyleResourceValue defStyleValues = null;
354
355        // look for a custom style.
356        String customStyle = null;
357        if (set != null) {
358            customStyle = set.getAttributeValue(null /* namespace*/, "style");
359        }
360        if (customStyle != null) {
361            ResourceValue item = mRenderResources.findResValue(customStyle,
362                    false /*forceFrameworkOnly*/);
363
364            if (item instanceof StyleResourceValue) {
365                defStyleValues = (StyleResourceValue)item;
366            }
367        }
368
369        if (defStyleValues == null && defStyleAttr != 0) {
370            // get the name from the int.
371            String defStyleName = searchAttr(defStyleAttr);
372
373            if (defaultPropMap != null) {
374                defaultPropMap.put("style", defStyleName);
375            }
376
377            // look for the style in the current theme, and its parent:
378            ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
379
380            if (item != null) {
381                // item is a reference to a style entry. Search for it.
382                item = mRenderResources.findResValue(item.getValue(),
383                        false /*forceFrameworkOnly*/);
384
385                if (item instanceof StyleResourceValue) {
386                    defStyleValues = (StyleResourceValue)item;
387                }
388            } else {
389                Bridge.getLog().error(null,
390                        String.format(
391                                "Failed to find style '%s' in current theme", defStyleName),
392                        null /*data*/);
393            }
394        }
395
396        if (defStyleRes != 0) {
397            // FIXME: See what we need to do with this.
398            throw new UnsupportedOperationException();
399        }
400
401        String namespace = BridgeConstants.NS_RESOURCES;
402        if (frameworkAttributes[0] == false) {
403            // need to use the application namespace
404            namespace = mProjectCallback.getNamespace();
405        }
406
407        if (styleNameMap != null) {
408            for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
409                int index = styleAttribute.getKey().intValue();
410
411                String name = styleAttribute.getValue();
412                String value = null;
413                if (set != null) {
414                    value = set.getAttributeValue(namespace, name);
415                }
416
417                // if there's no direct value for this attribute in the XML, we look for default
418                // values in the widget defStyle, and then in the theme.
419                if (value == null) {
420                    ResourceValue resValue = null;
421
422                    // look for the value in the defStyle first (and its parent if needed)
423                    if (defStyleValues != null) {
424                        resValue = mRenderResources.findItemInStyle(defStyleValues, name);
425                    }
426
427                    // if the item is not present in the defStyle, we look in the main theme (and
428                    // its parent themes)
429                    if (resValue == null) {
430                        resValue = mRenderResources.findItemInTheme(name);
431                    }
432
433                    // if we found a value, we make sure this doesn't reference another value.
434                    // So we resolve it.
435                    if (resValue != null) {
436                        // put the first default value, before the resolution.
437                        if (defaultPropMap != null) {
438                            defaultPropMap.put(name, resValue.getValue());
439                        }
440
441                        resValue = mRenderResources.resolveResValue(resValue);
442                    }
443
444                    ta.bridgeSetValue(index, name, resValue);
445                } else {
446                    // there is a value in the XML, but we need to resolve it in case it's
447                    // referencing another resource or a theme value.
448                    ta.bridgeSetValue(index, name,
449                            mRenderResources.resolveValue(null, name, value, isPlatformFile));
450                }
451            }
452        }
453
454        ta.sealArray();
455
456        return ta;
457    }
458
459    @Override
460    public Looper getMainLooper() {
461        return Looper.myLooper();
462    }
463
464
465    // ------------- private new methods
466
467    /**
468     * Creates a {@link BridgeTypedArray} by filling the values defined by the int[] with the
469     * values found in the given style.
470     * @see #obtainStyledAttributes(int, int[])
471     */
472    private BridgeTypedArray createStyleBasedTypedArray(StyleResourceValue style, int[] attrs)
473            throws Resources.NotFoundException {
474        TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, null);
475
476        BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
477                false /* platformResourceFlag */);
478
479        // loop through all the values in the style map, and init the TypedArray with
480        // the style we got from the dynamic id
481        for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
482            int index = styleAttribute.getKey().intValue();
483
484            String name = styleAttribute.getValue();
485
486            // get the value from the style, or its parent styles.
487            ResourceValue resValue = mRenderResources.findItemInStyle(style, name);
488
489            // resolve it to make sure there are no references left.
490            ta.bridgeSetValue(index, name, mRenderResources.resolveResValue(resValue));
491        }
492
493        ta.sealArray();
494
495        return ta;
496    }
497
498
499    /**
500     * The input int[] attrs is one of com.android.internal.R.styleable fields where the name
501     * of the field is the style being referenced and the array contains one index per attribute.
502     * <p/>
503     * searchAttrs() finds all the names of the attributes referenced so for example if
504     * attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
505     * there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
506     * that is used to reference the attribute later in the TypedArray.
507     *
508     * @param attrs An attribute array reference given to obtainStyledAttributes.
509     * @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
510     *         attribute array. Returns null if nothing is found.
511     */
512    private TreeMap<Integer,String> searchAttrs(int[] attrs, boolean[] outFrameworkFlag) {
513        // get the name of the array from the framework resources
514        String arrayName = Bridge.resolveResourceValue(attrs);
515        if (arrayName != null) {
516            // if we found it, get the name of each of the int in the array.
517            TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
518            for (int i = 0 ; i < attrs.length ; i++) {
519                String[] info = Bridge.resolveResourceValue(attrs[i]);
520                if (info != null) {
521                    attributes.put(i, info[0]);
522                } else {
523                    // FIXME Not sure what we should be doing here...
524                    attributes.put(i, null);
525                }
526            }
527
528            if (outFrameworkFlag != null) {
529                outFrameworkFlag[0] = true;
530            }
531
532            return attributes;
533        }
534
535        // if the name was not found in the framework resources, look in the project
536        // resources
537        arrayName = mProjectCallback.resolveResourceValue(attrs);
538        if (arrayName != null) {
539            TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
540            for (int i = 0 ; i < attrs.length ; i++) {
541                String[] info = mProjectCallback.resolveResourceValue(attrs[i]);
542                if (info != null) {
543                    attributes.put(i, info[0]);
544                } else {
545                    // FIXME Not sure what we should be doing here...
546                    attributes.put(i, null);
547                }
548            }
549
550            if (outFrameworkFlag != null) {
551                outFrameworkFlag[0] = false;
552            }
553
554            return attributes;
555        }
556
557        return null;
558    }
559
560    /**
561     * Searches for the attribute referenced by its internal id.
562     *
563     * @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
564     * @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
565     *         if nothing is found.
566     */
567    public String searchAttr(int attr) {
568        String[] info = Bridge.resolveResourceValue(attr);
569        if (info != null) {
570            return info[0];
571        }
572
573        info = mProjectCallback.resolveResourceValue(attr);
574        if (info != null) {
575            return info[0];
576        }
577
578        return null;
579    }
580
581    int getDynamicIdByStyle(StyleResourceValue resValue) {
582        if (mDynamicIdToStyleMap == null) {
583            // create the maps.
584            mDynamicIdToStyleMap = new HashMap<Integer, StyleResourceValue>();
585            mStyleToDynamicIdMap = new HashMap<StyleResourceValue, Integer>();
586        }
587
588        // look for an existing id
589        Integer id = mStyleToDynamicIdMap.get(resValue);
590
591        if (id == null) {
592            // generate a new id
593            id = Integer.valueOf(++mDynamicIdGenerator);
594
595            // and add it to the maps.
596            mDynamicIdToStyleMap.put(id, resValue);
597            mStyleToDynamicIdMap.put(resValue, id);
598        }
599
600        return id;
601    }
602
603    private StyleResourceValue getStyleByDynamicId(int i) {
604        if (mDynamicIdToStyleMap != null) {
605            return mDynamicIdToStyleMap.get(i);
606        }
607
608        return null;
609    }
610
611    int getFrameworkResourceValue(String resType, String resName, int defValue) {
612        Integer value = Bridge.getResourceValue(resType, resName);
613        if (value != null) {
614            return value.intValue();
615        }
616
617        return defValue;
618    }
619
620    int getProjectResourceValue(String resType, String resName, int defValue) {
621        if (mProjectCallback != null) {
622            Integer value = mProjectCallback.getResourceValue(resType, resName);
623            if (value != null) {
624                return value.intValue();
625            }
626        }
627
628        return defValue;
629    }
630
631    //------------ NOT OVERRIDEN --------------------
632
633    @Override
634    public boolean bindService(Intent arg0, ServiceConnection arg1, int arg2) {
635        // TODO Auto-generated method stub
636        return false;
637    }
638
639    @Override
640    public int checkCallingOrSelfPermission(String arg0) {
641        // TODO Auto-generated method stub
642        return 0;
643    }
644
645    @Override
646    public int checkCallingOrSelfUriPermission(Uri arg0, int arg1) {
647        // TODO Auto-generated method stub
648        return 0;
649    }
650
651    @Override
652    public int checkCallingPermission(String arg0) {
653        // TODO Auto-generated method stub
654        return 0;
655    }
656
657    @Override
658    public int checkCallingUriPermission(Uri arg0, int arg1) {
659        // TODO Auto-generated method stub
660        return 0;
661    }
662
663    @Override
664    public int checkPermission(String arg0, int arg1, int arg2) {
665        // TODO Auto-generated method stub
666        return 0;
667    }
668
669    @Override
670    public int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3) {
671        // TODO Auto-generated method stub
672        return 0;
673    }
674
675    @Override
676    public int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3,
677            int arg4, int arg5) {
678        // TODO Auto-generated method stub
679        return 0;
680    }
681
682    @Override
683    public void clearWallpaper() {
684        // TODO Auto-generated method stub
685
686    }
687
688    @Override
689    public Context createPackageContext(String arg0, int arg1) {
690        // TODO Auto-generated method stub
691        return null;
692    }
693
694    @Override
695    public String[] databaseList() {
696        // TODO Auto-generated method stub
697        return null;
698    }
699
700    @Override
701    public boolean deleteDatabase(String arg0) {
702        // TODO Auto-generated method stub
703        return false;
704    }
705
706    @Override
707    public boolean deleteFile(String arg0) {
708        // TODO Auto-generated method stub
709        return false;
710    }
711
712    @Override
713    public void enforceCallingOrSelfPermission(String arg0, String arg1) {
714        // TODO Auto-generated method stub
715
716    }
717
718    @Override
719    public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
720            String arg2) {
721        // TODO Auto-generated method stub
722
723    }
724
725    @Override
726    public void enforceCallingPermission(String arg0, String arg1) {
727        // TODO Auto-generated method stub
728
729    }
730
731    @Override
732    public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
733        // TODO Auto-generated method stub
734
735    }
736
737    @Override
738    public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
739        // TODO Auto-generated method stub
740
741    }
742
743    @Override
744    public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
745            String arg4) {
746        // TODO Auto-generated method stub
747
748    }
749
750    @Override
751    public void enforceUriPermission(Uri arg0, String arg1, String arg2,
752            int arg3, int arg4, int arg5, String arg6) {
753        // TODO Auto-generated method stub
754
755    }
756
757    @Override
758    public String[] fileList() {
759        // TODO Auto-generated method stub
760        return null;
761    }
762
763    @Override
764    public AssetManager getAssets() {
765        // TODO Auto-generated method stub
766        return null;
767    }
768
769    @Override
770    public File getCacheDir() {
771        // TODO Auto-generated method stub
772        return null;
773    }
774
775    @Override
776    public File getExternalCacheDir() {
777        // TODO Auto-generated method stub
778        return null;
779    }
780
781    @Override
782    public ContentResolver getContentResolver() {
783        if (mContentResolver == null) {
784            mContentResolver = new BridgeContentResolver(this);
785        }
786        return mContentResolver;
787    }
788
789    @Override
790    public File getDatabasePath(String arg0) {
791        // TODO Auto-generated method stub
792        return null;
793    }
794
795    @Override
796    public File getDir(String arg0, int arg1) {
797        // TODO Auto-generated method stub
798        return null;
799    }
800
801    @Override
802    public File getFileStreamPath(String arg0) {
803        // TODO Auto-generated method stub
804        return null;
805    }
806
807    @Override
808    public File getFilesDir() {
809        // TODO Auto-generated method stub
810        return null;
811    }
812
813    @Override
814    public File getExternalFilesDir(String type) {
815        // TODO Auto-generated method stub
816        return null;
817    }
818
819    @Override
820    public String getPackageCodePath() {
821        // TODO Auto-generated method stub
822        return null;
823    }
824
825    @Override
826    public PackageManager getPackageManager() {
827        // TODO Auto-generated method stub
828        return null;
829    }
830
831    @Override
832    public String getPackageName() {
833        // TODO Auto-generated method stub
834        return null;
835    }
836
837    @Override
838    public ApplicationInfo getApplicationInfo() {
839        return new ApplicationInfo();
840    }
841
842    @Override
843    public String getPackageResourcePath() {
844        // TODO Auto-generated method stub
845        return null;
846    }
847
848    @Override
849    public File getSharedPrefsFile(String name) {
850        // TODO Auto-generated method stub
851        return null;
852    }
853
854    @Override
855    public SharedPreferences getSharedPreferences(String arg0, int arg1) {
856        // TODO Auto-generated method stub
857        return null;
858    }
859
860    @Override
861    public Drawable getWallpaper() {
862        // TODO Auto-generated method stub
863        return null;
864    }
865
866    @Override
867    public int getWallpaperDesiredMinimumWidth() {
868        return -1;
869    }
870
871    @Override
872    public int getWallpaperDesiredMinimumHeight() {
873        return -1;
874    }
875
876    @Override
877    public void grantUriPermission(String arg0, Uri arg1, int arg2) {
878        // TODO Auto-generated method stub
879
880    }
881
882    @Override
883    public FileInputStream openFileInput(String arg0) throws FileNotFoundException {
884        // TODO Auto-generated method stub
885        return null;
886    }
887
888    @Override
889    public FileOutputStream openFileOutput(String arg0, int arg1) throws FileNotFoundException {
890        // TODO Auto-generated method stub
891        return null;
892    }
893
894    @Override
895    public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, CursorFactory arg2) {
896        // TODO Auto-generated method stub
897        return null;
898    }
899
900    @Override
901    public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1,
902            CursorFactory arg2, DatabaseErrorHandler arg3) {
903        // TODO Auto-generated method stub
904        return null;
905    }
906
907    @Override
908    public Drawable peekWallpaper() {
909        // TODO Auto-generated method stub
910        return null;
911    }
912
913    @Override
914    public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1) {
915        // TODO Auto-generated method stub
916        return null;
917    }
918
919    @Override
920    public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1,
921            String arg2, Handler arg3) {
922        // TODO Auto-generated method stub
923        return null;
924    }
925
926    @Override
927    public void removeStickyBroadcast(Intent arg0) {
928        // TODO Auto-generated method stub
929
930    }
931
932    @Override
933    public void revokeUriPermission(Uri arg0, int arg1) {
934        // TODO Auto-generated method stub
935
936    }
937
938    @Override
939    public void sendBroadcast(Intent arg0) {
940        // TODO Auto-generated method stub
941
942    }
943
944    @Override
945    public void sendBroadcast(Intent arg0, String arg1) {
946        // TODO Auto-generated method stub
947
948    }
949
950    @Override
951    public void sendOrderedBroadcast(Intent arg0, String arg1) {
952        // TODO Auto-generated method stub
953
954    }
955
956    @Override
957    public void sendOrderedBroadcast(Intent arg0, String arg1,
958            BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
959            Bundle arg6) {
960        // TODO Auto-generated method stub
961
962    }
963
964    @Override
965    public void sendStickyBroadcast(Intent arg0) {
966        // TODO Auto-generated method stub
967
968    }
969
970    @Override
971    public void sendStickyOrderedBroadcast(Intent intent,
972            BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
973           Bundle initialExtras) {
974        // TODO Auto-generated method stub
975    }
976
977    @Override
978    public void setTheme(int arg0) {
979        // TODO Auto-generated method stub
980
981    }
982
983    @Override
984    public void setWallpaper(Bitmap arg0) throws IOException {
985        // TODO Auto-generated method stub
986
987    }
988
989    @Override
990    public void setWallpaper(InputStream arg0) throws IOException {
991        // TODO Auto-generated method stub
992
993    }
994
995    @Override
996    public void startActivity(Intent arg0) {
997        // TODO Auto-generated method stub
998
999    }
1000
1001    @Override
1002    public void startIntentSender(IntentSender intent,
1003            Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
1004            throws IntentSender.SendIntentException {
1005        // TODO Auto-generated method stub
1006    }
1007
1008    @Override
1009    public boolean startInstrumentation(ComponentName arg0, String arg1,
1010            Bundle arg2) {
1011        // TODO Auto-generated method stub
1012        return false;
1013    }
1014
1015    @Override
1016    public ComponentName startService(Intent arg0) {
1017        // TODO Auto-generated method stub
1018        return null;
1019    }
1020
1021    @Override
1022    public boolean stopService(Intent arg0) {
1023        // TODO Auto-generated method stub
1024        return false;
1025    }
1026
1027    @Override
1028    public void unbindService(ServiceConnection arg0) {
1029        // TODO Auto-generated method stub
1030
1031    }
1032
1033    @Override
1034    public void unregisterReceiver(BroadcastReceiver arg0) {
1035        // TODO Auto-generated method stub
1036
1037    }
1038
1039    @Override
1040    public Context getApplicationContext() {
1041        throw new UnsupportedOperationException();
1042    }
1043
1044    @Override
1045    public void startActivities(Intent[] arg0) {
1046        // TODO Auto-generated method stub
1047
1048    }
1049
1050    @Override
1051    public boolean isRestricted() {
1052        return false;
1053    }
1054}
1055