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