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