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