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