1 /* 2 * Copyright (C) 2006 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 17 package android.content; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.RequiresPermission; 22 import android.annotation.SystemApi; 23 import android.annotation.TestApi; 24 import android.app.IApplicationThread; 25 import android.app.IServiceConnection; 26 import android.compat.annotation.UnsupportedAppUsage; 27 import android.content.pm.ApplicationInfo; 28 import android.content.pm.PackageManager; 29 import android.content.res.AssetManager; 30 import android.content.res.Configuration; 31 import android.content.res.Resources; 32 import android.database.DatabaseErrorHandler; 33 import android.database.sqlite.SQLiteDatabase; 34 import android.database.sqlite.SQLiteDatabase.CursorFactory; 35 import android.graphics.Bitmap; 36 import android.graphics.drawable.Drawable; 37 import android.net.Uri; 38 import android.os.Bundle; 39 import android.os.Handler; 40 import android.os.IBinder; 41 import android.os.Looper; 42 import android.os.UserHandle; 43 import android.view.Display; 44 import android.view.DisplayAdjustments; 45 import android.view.autofill.AutofillManager.AutofillClient; 46 47 import java.io.File; 48 import java.io.FileInputStream; 49 import java.io.FileNotFoundException; 50 import java.io.FileOutputStream; 51 import java.io.IOException; 52 import java.io.InputStream; 53 import java.util.concurrent.Executor; 54 55 /** 56 * Proxying implementation of Context that simply delegates all of its calls to 57 * another Context. Can be subclassed to modify behavior without changing 58 * the original Context. 59 */ 60 public class ContextWrapper extends Context { 61 @UnsupportedAppUsage 62 Context mBase; 63 ContextWrapper(Context base)64 public ContextWrapper(Context base) { 65 mBase = base; 66 } 67 68 /** 69 * Set the base context for this ContextWrapper. All calls will then be 70 * delegated to the base context. Throws 71 * IllegalStateException if a base context has already been set. 72 * 73 * @param base The new base context for this wrapper. 74 */ attachBaseContext(Context base)75 protected void attachBaseContext(Context base) { 76 if (mBase != null) { 77 throw new IllegalStateException("Base context already set"); 78 } 79 mBase = base; 80 } 81 82 /** 83 * @return the base context as set by the constructor or setBaseContext 84 */ getBaseContext()85 public Context getBaseContext() { 86 return mBase; 87 } 88 89 @Override getAssets()90 public AssetManager getAssets() { 91 return mBase.getAssets(); 92 } 93 94 @Override getResources()95 public Resources getResources() { 96 return mBase.getResources(); 97 } 98 99 @Override getPackageManager()100 public PackageManager getPackageManager() { 101 return mBase.getPackageManager(); 102 } 103 104 @Override getContentResolver()105 public ContentResolver getContentResolver() { 106 return mBase.getContentResolver(); 107 } 108 109 @Override getMainLooper()110 public Looper getMainLooper() { 111 return mBase.getMainLooper(); 112 } 113 114 @Override getMainExecutor()115 public Executor getMainExecutor() { 116 return mBase.getMainExecutor(); 117 } 118 119 @Override getApplicationContext()120 public Context getApplicationContext() { 121 return mBase.getApplicationContext(); 122 } 123 124 @Override setTheme(int resid)125 public void setTheme(int resid) { 126 mBase.setTheme(resid); 127 } 128 129 /** @hide */ 130 @Override 131 @UnsupportedAppUsage getThemeResId()132 public int getThemeResId() { 133 return mBase.getThemeResId(); 134 } 135 136 @Override getTheme()137 public Resources.Theme getTheme() { 138 return mBase.getTheme(); 139 } 140 141 @Override getClassLoader()142 public ClassLoader getClassLoader() { 143 return mBase.getClassLoader(); 144 } 145 146 @Override getPackageName()147 public String getPackageName() { 148 return mBase.getPackageName(); 149 } 150 151 /** @hide */ 152 @Override 153 @UnsupportedAppUsage getBasePackageName()154 public String getBasePackageName() { 155 return mBase.getBasePackageName(); 156 } 157 158 /** @hide */ 159 @Override getOpPackageName()160 public String getOpPackageName() { 161 return mBase.getOpPackageName(); 162 } 163 164 @Override getApplicationInfo()165 public ApplicationInfo getApplicationInfo() { 166 return mBase.getApplicationInfo(); 167 } 168 169 @Override getPackageResourcePath()170 public String getPackageResourcePath() { 171 return mBase.getPackageResourcePath(); 172 } 173 174 @Override getPackageCodePath()175 public String getPackageCodePath() { 176 return mBase.getPackageCodePath(); 177 } 178 179 @Override getSharedPreferences(String name, int mode)180 public SharedPreferences getSharedPreferences(String name, int mode) { 181 return mBase.getSharedPreferences(name, mode); 182 } 183 184 /** @removed */ 185 @Override getSharedPreferences(File file, int mode)186 public SharedPreferences getSharedPreferences(File file, int mode) { 187 return mBase.getSharedPreferences(file, mode); 188 } 189 190 /** @hide */ 191 @Override reloadSharedPreferences()192 public void reloadSharedPreferences() { 193 mBase.reloadSharedPreferences(); 194 } 195 196 @Override moveSharedPreferencesFrom(Context sourceContext, String name)197 public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { 198 return mBase.moveSharedPreferencesFrom(sourceContext, name); 199 } 200 201 @Override deleteSharedPreferences(String name)202 public boolean deleteSharedPreferences(String name) { 203 return mBase.deleteSharedPreferences(name); 204 } 205 206 @Override openFileInput(String name)207 public FileInputStream openFileInput(String name) 208 throws FileNotFoundException { 209 return mBase.openFileInput(name); 210 } 211 212 @Override openFileOutput(String name, int mode)213 public FileOutputStream openFileOutput(String name, int mode) 214 throws FileNotFoundException { 215 return mBase.openFileOutput(name, mode); 216 } 217 218 @Override deleteFile(String name)219 public boolean deleteFile(String name) { 220 return mBase.deleteFile(name); 221 } 222 223 @Override getFileStreamPath(String name)224 public File getFileStreamPath(String name) { 225 return mBase.getFileStreamPath(name); 226 } 227 228 /** @removed */ 229 @Override getSharedPreferencesPath(String name)230 public File getSharedPreferencesPath(String name) { 231 return mBase.getSharedPreferencesPath(name); 232 } 233 234 @Override fileList()235 public String[] fileList() { 236 return mBase.fileList(); 237 } 238 239 @Override getDataDir()240 public File getDataDir() { 241 return mBase.getDataDir(); 242 } 243 244 @Override getFilesDir()245 public File getFilesDir() { 246 return mBase.getFilesDir(); 247 } 248 249 @Override getNoBackupFilesDir()250 public File getNoBackupFilesDir() { 251 return mBase.getNoBackupFilesDir(); 252 } 253 254 @Override getExternalFilesDir(String type)255 public File getExternalFilesDir(String type) { 256 return mBase.getExternalFilesDir(type); 257 } 258 259 @Override getExternalFilesDirs(String type)260 public File[] getExternalFilesDirs(String type) { 261 return mBase.getExternalFilesDirs(type); 262 } 263 264 @Override getObbDir()265 public File getObbDir() { 266 return mBase.getObbDir(); 267 } 268 269 @Override getObbDirs()270 public File[] getObbDirs() { 271 return mBase.getObbDirs(); 272 } 273 274 @Override getCacheDir()275 public File getCacheDir() { 276 return mBase.getCacheDir(); 277 } 278 279 @Override getCodeCacheDir()280 public File getCodeCacheDir() { 281 return mBase.getCodeCacheDir(); 282 } 283 284 @Override getExternalCacheDir()285 public File getExternalCacheDir() { 286 return mBase.getExternalCacheDir(); 287 } 288 289 @Override getExternalCacheDirs()290 public File[] getExternalCacheDirs() { 291 return mBase.getExternalCacheDirs(); 292 } 293 294 @Override getExternalMediaDirs()295 public File[] getExternalMediaDirs() { 296 return mBase.getExternalMediaDirs(); 297 } 298 299 @Override getDir(String name, int mode)300 public File getDir(String name, int mode) { 301 return mBase.getDir(name, mode); 302 } 303 304 305 /** @hide **/ 306 @Override getPreloadsFileCache()307 public File getPreloadsFileCache() { 308 return mBase.getPreloadsFileCache(); 309 } 310 311 @Override openOrCreateDatabase(String name, int mode, CursorFactory factory)312 public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory) { 313 return mBase.openOrCreateDatabase(name, mode, factory); 314 } 315 316 @Override openOrCreateDatabase(String name, int mode, CursorFactory factory, DatabaseErrorHandler errorHandler)317 public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory, 318 DatabaseErrorHandler errorHandler) { 319 return mBase.openOrCreateDatabase(name, mode, factory, errorHandler); 320 } 321 322 @Override moveDatabaseFrom(Context sourceContext, String name)323 public boolean moveDatabaseFrom(Context sourceContext, String name) { 324 return mBase.moveDatabaseFrom(sourceContext, name); 325 } 326 327 @Override deleteDatabase(String name)328 public boolean deleteDatabase(String name) { 329 return mBase.deleteDatabase(name); 330 } 331 332 @Override getDatabasePath(String name)333 public File getDatabasePath(String name) { 334 return mBase.getDatabasePath(name); 335 } 336 337 @Override databaseList()338 public String[] databaseList() { 339 return mBase.databaseList(); 340 } 341 342 @Override 343 @Deprecated getWallpaper()344 public Drawable getWallpaper() { 345 return mBase.getWallpaper(); 346 } 347 348 @Override 349 @Deprecated peekWallpaper()350 public Drawable peekWallpaper() { 351 return mBase.peekWallpaper(); 352 } 353 354 @Override 355 @Deprecated getWallpaperDesiredMinimumWidth()356 public int getWallpaperDesiredMinimumWidth() { 357 return mBase.getWallpaperDesiredMinimumWidth(); 358 } 359 360 @Override 361 @Deprecated getWallpaperDesiredMinimumHeight()362 public int getWallpaperDesiredMinimumHeight() { 363 return mBase.getWallpaperDesiredMinimumHeight(); 364 } 365 366 @Override 367 @Deprecated setWallpaper(Bitmap bitmap)368 public void setWallpaper(Bitmap bitmap) throws IOException { 369 mBase.setWallpaper(bitmap); 370 } 371 372 @Override 373 @Deprecated setWallpaper(InputStream data)374 public void setWallpaper(InputStream data) throws IOException { 375 mBase.setWallpaper(data); 376 } 377 378 @Override 379 @Deprecated clearWallpaper()380 public void clearWallpaper() throws IOException { 381 mBase.clearWallpaper(); 382 } 383 384 @Override startActivity(Intent intent)385 public void startActivity(Intent intent) { 386 mBase.startActivity(intent); 387 } 388 389 /** @hide */ 390 @Override startActivityAsUser(Intent intent, UserHandle user)391 public void startActivityAsUser(Intent intent, UserHandle user) { 392 mBase.startActivityAsUser(intent, user); 393 } 394 395 /** @hide **/ startActivityForResult( String who, Intent intent, int requestCode, Bundle options)396 public void startActivityForResult( 397 String who, Intent intent, int requestCode, Bundle options) { 398 mBase.startActivityForResult(who, intent, requestCode, options); 399 } 400 401 /** @hide **/ canStartActivityForResult()402 public boolean canStartActivityForResult() { 403 return mBase.canStartActivityForResult(); 404 } 405 406 @Override startActivity(Intent intent, Bundle options)407 public void startActivity(Intent intent, Bundle options) { 408 mBase.startActivity(intent, options); 409 } 410 411 /** @hide */ 412 @Override startActivityAsUser(Intent intent, Bundle options, UserHandle user)413 public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) { 414 mBase.startActivityAsUser(intent, options, user); 415 } 416 417 @Override startActivities(Intent[] intents)418 public void startActivities(Intent[] intents) { 419 mBase.startActivities(intents); 420 } 421 422 @Override startActivities(Intent[] intents, Bundle options)423 public void startActivities(Intent[] intents, Bundle options) { 424 mBase.startActivities(intents, options); 425 } 426 427 /** @hide */ 428 @Override startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle)429 public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) { 430 return mBase.startActivitiesAsUser(intents, options, userHandle); 431 } 432 433 @Override startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)434 public void startIntentSender(IntentSender intent, 435 Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) 436 throws IntentSender.SendIntentException { 437 mBase.startIntentSender(intent, fillInIntent, flagsMask, 438 flagsValues, extraFlags); 439 } 440 441 @Override startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)442 public void startIntentSender(IntentSender intent, 443 Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, 444 Bundle options) throws IntentSender.SendIntentException { 445 mBase.startIntentSender(intent, fillInIntent, flagsMask, 446 flagsValues, extraFlags, options); 447 } 448 449 @Override sendBroadcast(Intent intent)450 public void sendBroadcast(Intent intent) { 451 mBase.sendBroadcast(intent); 452 } 453 454 @Override sendBroadcast(Intent intent, String receiverPermission)455 public void sendBroadcast(Intent intent, String receiverPermission) { 456 mBase.sendBroadcast(intent, receiverPermission); 457 } 458 459 /** @hide */ 460 @Override sendBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions)461 public void sendBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions) { 462 mBase.sendBroadcastMultiplePermissions(intent, receiverPermissions); 463 } 464 465 /** @hide */ 466 @Override sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, String[] receiverPermissions)467 public void sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, 468 String[] receiverPermissions) { 469 mBase.sendBroadcastAsUserMultiplePermissions(intent, user, receiverPermissions); 470 } 471 472 /** @hide */ 473 @SystemApi 474 @Override sendBroadcast(Intent intent, String receiverPermission, Bundle options)475 public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) { 476 mBase.sendBroadcast(intent, receiverPermission, options); 477 } 478 479 /** @hide */ 480 @Override sendBroadcast(Intent intent, String receiverPermission, int appOp)481 public void sendBroadcast(Intent intent, String receiverPermission, int appOp) { 482 mBase.sendBroadcast(intent, receiverPermission, appOp); 483 } 484 485 @Override sendOrderedBroadcast(Intent intent, String receiverPermission)486 public void sendOrderedBroadcast(Intent intent, 487 String receiverPermission) { 488 mBase.sendOrderedBroadcast(intent, receiverPermission); 489 } 490 491 @Override sendOrderedBroadcast( Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)492 public void sendOrderedBroadcast( 493 Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, 494 Handler scheduler, int initialCode, String initialData, 495 Bundle initialExtras) { 496 mBase.sendOrderedBroadcast(intent, receiverPermission, 497 resultReceiver, scheduler, initialCode, 498 initialData, initialExtras); 499 } 500 501 /** @hide */ 502 @SystemApi 503 @Override sendOrderedBroadcast( Intent intent, String receiverPermission, Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)504 public void sendOrderedBroadcast( 505 Intent intent, String receiverPermission, Bundle options, 506 BroadcastReceiver resultReceiver, 507 Handler scheduler, int initialCode, String initialData, 508 Bundle initialExtras) { 509 mBase.sendOrderedBroadcast(intent, receiverPermission, 510 options, resultReceiver, scheduler, initialCode, 511 initialData, initialExtras); 512 } 513 514 /** @hide */ 515 @Override sendOrderedBroadcast( Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)516 public void sendOrderedBroadcast( 517 Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, 518 Handler scheduler, int initialCode, String initialData, 519 Bundle initialExtras) { 520 mBase.sendOrderedBroadcast(intent, receiverPermission, appOp, 521 resultReceiver, scheduler, initialCode, 522 initialData, initialExtras); 523 } 524 525 @Override sendBroadcastAsUser(Intent intent, UserHandle user)526 public void sendBroadcastAsUser(Intent intent, UserHandle user) { 527 mBase.sendBroadcastAsUser(intent, user); 528 } 529 530 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission)531 public void sendBroadcastAsUser(Intent intent, UserHandle user, 532 String receiverPermission) { 533 mBase.sendBroadcastAsUser(intent, user, receiverPermission); 534 } 535 536 /** @hide */ 537 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, Bundle options)538 public void sendBroadcastAsUser(Intent intent, UserHandle user, 539 String receiverPermission, Bundle options) { 540 mBase.sendBroadcastAsUser(intent, user, receiverPermission, options); 541 } 542 543 /** @hide */ 544 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp)545 public void sendBroadcastAsUser(Intent intent, UserHandle user, 546 String receiverPermission, int appOp) { 547 mBase.sendBroadcastAsUser(intent, user, receiverPermission, appOp); 548 } 549 550 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)551 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 552 String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, 553 int initialCode, String initialData, Bundle initialExtras) { 554 mBase.sendOrderedBroadcastAsUser(intent, user, receiverPermission, resultReceiver, 555 scheduler, initialCode, initialData, initialExtras); 556 } 557 558 /** @hide */ 559 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)560 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 561 String receiverPermission, int appOp, BroadcastReceiver resultReceiver, 562 Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { 563 mBase.sendOrderedBroadcastAsUser(intent, user, receiverPermission, appOp, resultReceiver, 564 scheduler, initialCode, initialData, initialExtras); 565 } 566 567 /** @hide */ 568 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)569 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 570 String receiverPermission, int appOp, Bundle options, BroadcastReceiver resultReceiver, 571 Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { 572 mBase.sendOrderedBroadcastAsUser(intent, user, receiverPermission, appOp, options, 573 resultReceiver, scheduler, initialCode, initialData, initialExtras); 574 } 575 576 @Override sendOrderedBroadcast(@equiresPermission @onNull Intent intent, @Nullable String receiverPermission, @Nullable String receiverAppOp, @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler, int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras)577 public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent, 578 @Nullable String receiverPermission, @Nullable String receiverAppOp, 579 @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler, 580 int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) { 581 mBase.sendOrderedBroadcast(intent, receiverPermission, receiverAppOp, resultReceiver, 582 scheduler, initialCode, initialData, initialExtras); 583 } 584 585 @Override sendOrderedBroadcast(@equiresPermission @onNull Intent intent, int initialCode, @Nullable String receiverPermission, @Nullable String receiverAppOp, @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler, @Nullable String initialData, @Nullable Bundle initialExtras, @Nullable Bundle options)586 public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent, int initialCode, 587 @Nullable String receiverPermission, @Nullable String receiverAppOp, 588 @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler, 589 @Nullable String initialData, @Nullable Bundle initialExtras, 590 @Nullable Bundle options) { 591 mBase.sendOrderedBroadcast(intent, initialCode, receiverPermission, receiverAppOp, 592 resultReceiver, scheduler, initialData, initialExtras, options); 593 } 594 595 @Override 596 @Deprecated sendStickyBroadcast(Intent intent)597 public void sendStickyBroadcast(Intent intent) { 598 mBase.sendStickyBroadcast(intent); 599 } 600 601 @Override 602 @Deprecated sendStickyOrderedBroadcast( Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)603 public void sendStickyOrderedBroadcast( 604 Intent intent, BroadcastReceiver resultReceiver, 605 Handler scheduler, int initialCode, String initialData, 606 Bundle initialExtras) { 607 mBase.sendStickyOrderedBroadcast(intent, 608 resultReceiver, scheduler, initialCode, 609 initialData, initialExtras); 610 } 611 612 @Override 613 @Deprecated removeStickyBroadcast(Intent intent)614 public void removeStickyBroadcast(Intent intent) { 615 mBase.removeStickyBroadcast(intent); 616 } 617 618 @Override 619 @Deprecated sendStickyBroadcastAsUser(Intent intent, UserHandle user)620 public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { 621 mBase.sendStickyBroadcastAsUser(intent, user); 622 } 623 624 /** @hide */ 625 @Override 626 @Deprecated sendStickyBroadcastAsUser(Intent intent, UserHandle user, Bundle options)627 public void sendStickyBroadcastAsUser(Intent intent, UserHandle user, Bundle options) { 628 mBase.sendStickyBroadcastAsUser(intent, user, options); 629 } 630 631 @Override 632 @Deprecated sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)633 public void sendStickyOrderedBroadcastAsUser(Intent intent, 634 UserHandle user, BroadcastReceiver resultReceiver, 635 Handler scheduler, int initialCode, String initialData, 636 Bundle initialExtras) { 637 mBase.sendStickyOrderedBroadcastAsUser(intent, user, resultReceiver, 638 scheduler, initialCode, initialData, initialExtras); 639 } 640 641 @Override 642 @Deprecated removeStickyBroadcastAsUser(Intent intent, UserHandle user)643 public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { 644 mBase.removeStickyBroadcastAsUser(intent, user); 645 } 646 647 @Override registerReceiver( BroadcastReceiver receiver, IntentFilter filter)648 public Intent registerReceiver( 649 BroadcastReceiver receiver, IntentFilter filter) { 650 return mBase.registerReceiver(receiver, filter); 651 } 652 653 @Override registerReceiver( BroadcastReceiver receiver, IntentFilter filter, int flags)654 public Intent registerReceiver( 655 BroadcastReceiver receiver, IntentFilter filter, int flags) { 656 return mBase.registerReceiver(receiver, filter, flags); 657 } 658 659 @Override registerReceiver( BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler)660 public Intent registerReceiver( 661 BroadcastReceiver receiver, IntentFilter filter, 662 String broadcastPermission, Handler scheduler) { 663 return mBase.registerReceiver(receiver, filter, broadcastPermission, 664 scheduler); 665 } 666 667 @Override registerReceiver( BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler, int flags)668 public Intent registerReceiver( 669 BroadcastReceiver receiver, IntentFilter filter, 670 String broadcastPermission, Handler scheduler, int flags) { 671 return mBase.registerReceiver(receiver, filter, broadcastPermission, 672 scheduler, flags); 673 } 674 675 /** @hide */ 676 @Override 677 @Nullable registerReceiverForAllUsers(@ullable BroadcastReceiver receiver, @NonNull IntentFilter filter, @Nullable String broadcastPermission, @Nullable Handler scheduler)678 public Intent registerReceiverForAllUsers(@Nullable BroadcastReceiver receiver, 679 @NonNull IntentFilter filter, @Nullable String broadcastPermission, 680 @Nullable Handler scheduler) { 681 return mBase.registerReceiverForAllUsers(receiver, filter, broadcastPermission, 682 scheduler); 683 } 684 685 /** @hide */ 686 @Override 687 @UnsupportedAppUsage registerReceiverAsUser( BroadcastReceiver receiver, UserHandle user, IntentFilter filter, String broadcastPermission, Handler scheduler)688 public Intent registerReceiverAsUser( 689 BroadcastReceiver receiver, UserHandle user, IntentFilter filter, 690 String broadcastPermission, Handler scheduler) { 691 return mBase.registerReceiverAsUser(receiver, user, filter, broadcastPermission, 692 scheduler); 693 } 694 695 @Override unregisterReceiver(BroadcastReceiver receiver)696 public void unregisterReceiver(BroadcastReceiver receiver) { 697 mBase.unregisterReceiver(receiver); 698 } 699 700 @Override startService(Intent service)701 public ComponentName startService(Intent service) { 702 return mBase.startService(service); 703 } 704 705 @Override startForegroundService(Intent service)706 public ComponentName startForegroundService(Intent service) { 707 return mBase.startForegroundService(service); 708 } 709 710 @Override stopService(Intent name)711 public boolean stopService(Intent name) { 712 return mBase.stopService(name); 713 } 714 715 /** @hide */ 716 @Override 717 @UnsupportedAppUsage startServiceAsUser(Intent service, UserHandle user)718 public ComponentName startServiceAsUser(Intent service, UserHandle user) { 719 return mBase.startServiceAsUser(service, user); 720 } 721 722 /** @hide */ 723 @Override 724 @UnsupportedAppUsage startForegroundServiceAsUser(Intent service, UserHandle user)725 public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) { 726 return mBase.startForegroundServiceAsUser(service, user); 727 } 728 729 /** @hide */ 730 @Override stopServiceAsUser(Intent name, UserHandle user)731 public boolean stopServiceAsUser(Intent name, UserHandle user) { 732 return mBase.stopServiceAsUser(name, user); 733 } 734 735 @Override bindService(Intent service, ServiceConnection conn, int flags)736 public boolean bindService(Intent service, ServiceConnection conn, 737 int flags) { 738 return mBase.bindService(service, conn, flags); 739 } 740 741 @Override bindService(Intent service, int flags, Executor executor, ServiceConnection conn)742 public boolean bindService(Intent service, int flags, Executor executor, 743 ServiceConnection conn) { 744 return mBase.bindService(service, flags, executor, conn); 745 } 746 747 @Override bindIsolatedService(Intent service, int flags, String instanceName, Executor executor, ServiceConnection conn)748 public boolean bindIsolatedService(Intent service, int flags, String instanceName, 749 Executor executor, ServiceConnection conn) { 750 return mBase.bindIsolatedService(service, flags, instanceName, executor, conn); 751 } 752 753 /** @hide */ 754 @Override bindServiceAsUser(Intent service, ServiceConnection conn, int flags, UserHandle user)755 public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, 756 UserHandle user) { 757 return mBase.bindServiceAsUser(service, conn, flags, user); 758 } 759 760 /** @hide */ 761 @Override bindServiceAsUser(Intent service, ServiceConnection conn, int flags, Handler handler, UserHandle user)762 public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, 763 Handler handler, UserHandle user) { 764 return mBase.bindServiceAsUser(service, conn, flags, handler, user); 765 } 766 767 @Override updateServiceGroup(ServiceConnection conn, int group, int importance)768 public void updateServiceGroup(ServiceConnection conn, int group, int importance) { 769 mBase.updateServiceGroup(conn, group, importance); 770 } 771 772 @Override unbindService(ServiceConnection conn)773 public void unbindService(ServiceConnection conn) { 774 mBase.unbindService(conn); 775 } 776 777 @Override startInstrumentation(ComponentName className, String profileFile, Bundle arguments)778 public boolean startInstrumentation(ComponentName className, 779 String profileFile, Bundle arguments) { 780 return mBase.startInstrumentation(className, profileFile, arguments); 781 } 782 783 @Override getSystemService(String name)784 public Object getSystemService(String name) { 785 return mBase.getSystemService(name); 786 } 787 788 @Override getSystemServiceName(Class<?> serviceClass)789 public String getSystemServiceName(Class<?> serviceClass) { 790 return mBase.getSystemServiceName(serviceClass); 791 } 792 793 @Override checkPermission(String permission, int pid, int uid)794 public int checkPermission(String permission, int pid, int uid) { 795 return mBase.checkPermission(permission, pid, uid); 796 } 797 798 /** @hide */ 799 @Override checkPermission(String permission, int pid, int uid, IBinder callerToken)800 public int checkPermission(String permission, int pid, int uid, IBinder callerToken) { 801 return mBase.checkPermission(permission, pid, uid, callerToken); 802 } 803 804 @Override checkCallingPermission(String permission)805 public int checkCallingPermission(String permission) { 806 return mBase.checkCallingPermission(permission); 807 } 808 809 @Override checkCallingOrSelfPermission(String permission)810 public int checkCallingOrSelfPermission(String permission) { 811 return mBase.checkCallingOrSelfPermission(permission); 812 } 813 814 @Override checkSelfPermission(String permission)815 public int checkSelfPermission(String permission) { 816 return mBase.checkSelfPermission(permission); 817 } 818 819 @Override enforcePermission( String permission, int pid, int uid, String message)820 public void enforcePermission( 821 String permission, int pid, int uid, String message) { 822 mBase.enforcePermission(permission, pid, uid, message); 823 } 824 825 @Override enforceCallingPermission(String permission, String message)826 public void enforceCallingPermission(String permission, String message) { 827 mBase.enforceCallingPermission(permission, message); 828 } 829 830 @Override enforceCallingOrSelfPermission( String permission, String message)831 public void enforceCallingOrSelfPermission( 832 String permission, String message) { 833 mBase.enforceCallingOrSelfPermission(permission, message); 834 } 835 836 @Override grantUriPermission(String toPackage, Uri uri, int modeFlags)837 public void grantUriPermission(String toPackage, Uri uri, int modeFlags) { 838 mBase.grantUriPermission(toPackage, uri, modeFlags); 839 } 840 841 @Override revokeUriPermission(Uri uri, int modeFlags)842 public void revokeUriPermission(Uri uri, int modeFlags) { 843 mBase.revokeUriPermission(uri, modeFlags); 844 } 845 846 @Override revokeUriPermission(String targetPackage, Uri uri, int modeFlags)847 public void revokeUriPermission(String targetPackage, Uri uri, int modeFlags) { 848 mBase.revokeUriPermission(targetPackage, uri, modeFlags); 849 } 850 851 @Override checkUriPermission(Uri uri, int pid, int uid, int modeFlags)852 public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) { 853 return mBase.checkUriPermission(uri, pid, uid, modeFlags); 854 } 855 856 /** @hide */ 857 @Override checkUriPermission(Uri uri, int pid, int uid, int modeFlags, IBinder callerToken)858 public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags, IBinder callerToken) { 859 return mBase.checkUriPermission(uri, pid, uid, modeFlags, callerToken); 860 } 861 862 @Override checkCallingUriPermission(Uri uri, int modeFlags)863 public int checkCallingUriPermission(Uri uri, int modeFlags) { 864 return mBase.checkCallingUriPermission(uri, modeFlags); 865 } 866 867 @Override checkCallingOrSelfUriPermission(Uri uri, int modeFlags)868 public int checkCallingOrSelfUriPermission(Uri uri, int modeFlags) { 869 return mBase.checkCallingOrSelfUriPermission(uri, modeFlags); 870 } 871 872 @Override checkUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags)873 public int checkUriPermission(Uri uri, String readPermission, 874 String writePermission, int pid, int uid, int modeFlags) { 875 return mBase.checkUriPermission(uri, readPermission, writePermission, 876 pid, uid, modeFlags); 877 } 878 879 @Override enforceUriPermission( Uri uri, int pid, int uid, int modeFlags, String message)880 public void enforceUriPermission( 881 Uri uri, int pid, int uid, int modeFlags, String message) { 882 mBase.enforceUriPermission(uri, pid, uid, modeFlags, message); 883 } 884 885 @Override enforceCallingUriPermission( Uri uri, int modeFlags, String message)886 public void enforceCallingUriPermission( 887 Uri uri, int modeFlags, String message) { 888 mBase.enforceCallingUriPermission(uri, modeFlags, message); 889 } 890 891 @Override enforceCallingOrSelfUriPermission( Uri uri, int modeFlags, String message)892 public void enforceCallingOrSelfUriPermission( 893 Uri uri, int modeFlags, String message) { 894 mBase.enforceCallingOrSelfUriPermission(uri, modeFlags, message); 895 } 896 897 @Override enforceUriPermission( Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags, String message)898 public void enforceUriPermission( 899 Uri uri, String readPermission, String writePermission, 900 int pid, int uid, int modeFlags, String message) { 901 mBase.enforceUriPermission( 902 uri, readPermission, writePermission, pid, uid, modeFlags, 903 message); 904 } 905 906 @Override createPackageContext(String packageName, int flags)907 public Context createPackageContext(String packageName, int flags) 908 throws PackageManager.NameNotFoundException { 909 return mBase.createPackageContext(packageName, flags); 910 } 911 912 /** @hide */ 913 @Override createPackageContextAsUser(String packageName, int flags, UserHandle user)914 public Context createPackageContextAsUser(String packageName, int flags, UserHandle user) 915 throws PackageManager.NameNotFoundException { 916 return mBase.createPackageContextAsUser(packageName, flags, user); 917 } 918 919 /** @hide */ 920 @Override createContextAsUser(UserHandle user, @CreatePackageOptions int flags)921 public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) { 922 return mBase.createContextAsUser(user, flags); 923 } 924 925 /** @hide */ 926 @Override 927 @UnsupportedAppUsage createApplicationContext(ApplicationInfo application, int flags)928 public Context createApplicationContext(ApplicationInfo application, 929 int flags) throws PackageManager.NameNotFoundException { 930 return mBase.createApplicationContext(application, flags); 931 } 932 933 /** @hide */ 934 @Override createContextForSplit(String splitName)935 public Context createContextForSplit(String splitName) 936 throws PackageManager.NameNotFoundException { 937 return mBase.createContextForSplit(splitName); 938 } 939 940 /** @hide */ 941 @Override getUserId()942 public int getUserId() { 943 return mBase.getUserId(); 944 } 945 946 /** @hide */ 947 @Override getUser()948 public UserHandle getUser() { 949 return mBase.getUser(); 950 } 951 952 @Override createConfigurationContext(Configuration overrideConfiguration)953 public Context createConfigurationContext(Configuration overrideConfiguration) { 954 return mBase.createConfigurationContext(overrideConfiguration); 955 } 956 957 @Override createDisplayContext(Display display)958 public Context createDisplayContext(Display display) { 959 return mBase.createDisplayContext(display); 960 } 961 962 @Override isRestricted()963 public boolean isRestricted() { 964 return mBase.isRestricted(); 965 } 966 967 /** @hide */ 968 @Override getDisplayAdjustments(int displayId)969 public DisplayAdjustments getDisplayAdjustments(int displayId) { 970 return mBase.getDisplayAdjustments(displayId); 971 } 972 973 /** @hide */ 974 @UnsupportedAppUsage 975 @TestApi 976 @Override getDisplay()977 public Display getDisplay() { 978 return mBase.getDisplay(); 979 } 980 981 /** 982 * @hide 983 */ 984 @Override getDisplayId()985 public int getDisplayId() { 986 return mBase.getDisplayId(); 987 } 988 989 /** 990 * @hide 991 */ 992 @Override updateDisplay(int displayId)993 public void updateDisplay(int displayId) { 994 mBase.updateDisplay(displayId); 995 } 996 997 @Override createDeviceProtectedStorageContext()998 public Context createDeviceProtectedStorageContext() { 999 return mBase.createDeviceProtectedStorageContext(); 1000 } 1001 1002 /** {@hide} */ 1003 @SystemApi 1004 @Override createCredentialProtectedStorageContext()1005 public Context createCredentialProtectedStorageContext() { 1006 return mBase.createCredentialProtectedStorageContext(); 1007 } 1008 1009 @Override isDeviceProtectedStorage()1010 public boolean isDeviceProtectedStorage() { 1011 return mBase.isDeviceProtectedStorage(); 1012 } 1013 1014 /** {@hide} */ 1015 @SystemApi 1016 @Override isCredentialProtectedStorage()1017 public boolean isCredentialProtectedStorage() { 1018 return mBase.isCredentialProtectedStorage(); 1019 } 1020 1021 /** {@hide} */ 1022 @Override canLoadUnsafeResources()1023 public boolean canLoadUnsafeResources() { 1024 return mBase.canLoadUnsafeResources(); 1025 } 1026 1027 /** 1028 * @hide 1029 */ 1030 @Override getActivityToken()1031 public IBinder getActivityToken() { 1032 return mBase.getActivityToken(); 1033 } 1034 1035 /** 1036 * @hide 1037 */ 1038 @Override getServiceDispatcher(ServiceConnection conn, Handler handler, int flags)1039 public IServiceConnection getServiceDispatcher(ServiceConnection conn, Handler handler, 1040 int flags) { 1041 return mBase.getServiceDispatcher(conn, handler, flags); 1042 } 1043 1044 /** 1045 * @hide 1046 */ 1047 @Override getIApplicationThread()1048 public IApplicationThread getIApplicationThread() { 1049 return mBase.getIApplicationThread(); 1050 } 1051 1052 /** 1053 * @hide 1054 */ 1055 @Override getMainThreadHandler()1056 public Handler getMainThreadHandler() { 1057 return mBase.getMainThreadHandler(); 1058 } 1059 1060 /** 1061 * @hide 1062 */ 1063 @Override getNextAutofillId()1064 public int getNextAutofillId() { 1065 return mBase.getNextAutofillId(); 1066 } 1067 1068 /** 1069 * @hide 1070 */ 1071 @Override getAutofillClient()1072 public AutofillClient getAutofillClient() { 1073 return mBase.getAutofillClient(); 1074 } 1075 1076 /** 1077 * @hide 1078 */ 1079 @Override setAutofillClient(AutofillClient client)1080 public void setAutofillClient(AutofillClient client) { 1081 mBase.setAutofillClient(client); 1082 } 1083 1084 /** @hide */ 1085 @Override getAutofillOptions()1086 public AutofillOptions getAutofillOptions() { 1087 return mBase == null ? null : mBase.getAutofillOptions(); 1088 } 1089 1090 /** @hide */ 1091 @Override setAutofillOptions(AutofillOptions options)1092 public void setAutofillOptions(AutofillOptions options) { 1093 if (mBase != null) { 1094 mBase.setAutofillOptions(options); 1095 } 1096 } 1097 1098 /** 1099 * @hide 1100 */ 1101 @Override getContentCaptureOptions()1102 public ContentCaptureOptions getContentCaptureOptions() { 1103 return mBase == null ? null : mBase.getContentCaptureOptions(); 1104 } 1105 1106 /** 1107 * @hide 1108 */ 1109 @TestApi 1110 @Override setContentCaptureOptions(ContentCaptureOptions options)1111 public void setContentCaptureOptions(ContentCaptureOptions options) { 1112 if (mBase != null) { 1113 mBase.setContentCaptureOptions(options); 1114 } 1115 } 1116 } 1117