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 sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, String[] receiverPermissions)378 public void sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user, 379 String[] receiverPermissions) { 380 throw new UnsupportedOperationException(); 381 } 382 383 /** @hide */ 384 @SystemApi 385 @Override sendBroadcast(Intent intent, String receiverPermission, Bundle options)386 public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) { 387 throw new UnsupportedOperationException(); 388 } 389 390 /** @hide */ 391 @Override sendBroadcast(Intent intent, String receiverPermission, int appOp)392 public void sendBroadcast(Intent intent, String receiverPermission, int appOp) { 393 throw new UnsupportedOperationException(); 394 } 395 396 @Override sendOrderedBroadcast(Intent intent, String receiverPermission)397 public void sendOrderedBroadcast(Intent intent, 398 String receiverPermission) { 399 throw new UnsupportedOperationException(); 400 } 401 402 @Override sendOrderedBroadcast(Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)403 public void sendOrderedBroadcast(Intent intent, String receiverPermission, 404 BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 405 Bundle initialExtras) { 406 throw new UnsupportedOperationException(); 407 } 408 409 /** @hide */ 410 @SystemApi 411 @Override sendOrderedBroadcast(Intent intent, String receiverPermission, Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)412 public void sendOrderedBroadcast(Intent intent, String receiverPermission, 413 Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 414 Bundle initialExtras) { 415 throw new UnsupportedOperationException(); 416 } 417 418 /** @hide */ 419 @Override sendOrderedBroadcast(Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)420 public void sendOrderedBroadcast(Intent intent, String receiverPermission, int appOp, 421 BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 422 Bundle initialExtras) { 423 throw new UnsupportedOperationException(); 424 } 425 426 @Override sendBroadcastAsUser(Intent intent, UserHandle user)427 public void sendBroadcastAsUser(Intent intent, UserHandle user) { 428 throw new UnsupportedOperationException(); 429 } 430 431 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission)432 public void sendBroadcastAsUser(Intent intent, UserHandle user, 433 String receiverPermission) { 434 throw new UnsupportedOperationException(); 435 } 436 437 /** @hide */ 438 @SystemApi 439 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, Bundle options)440 public void sendBroadcastAsUser(Intent intent, UserHandle user, 441 String receiverPermission, Bundle options) { 442 throw new UnsupportedOperationException(); 443 } 444 445 /** @hide */ 446 @Override sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp)447 public void sendBroadcastAsUser(Intent intent, UserHandle user, 448 String receiverPermission, int appOp) { 449 throw new UnsupportedOperationException(); 450 } 451 452 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)453 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 454 String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, 455 int initialCode, String initialData, Bundle initialExtras) { 456 throw new UnsupportedOperationException(); 457 } 458 459 /** @hide */ 460 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)461 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 462 String receiverPermission, int appOp, BroadcastReceiver resultReceiver, 463 Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { 464 throw new UnsupportedOperationException(); 465 } 466 467 /** @hide */ 468 @Override sendOrderedBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp, Bundle options, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)469 public void sendOrderedBroadcastAsUser(Intent intent, UserHandle user, 470 String receiverPermission, int appOp, Bundle options, BroadcastReceiver resultReceiver, 471 Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { 472 throw new UnsupportedOperationException(); 473 } 474 475 @Override sendOrderedBroadcast(Intent intent, String receiverPermission, String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)476 public void sendOrderedBroadcast(Intent intent, String receiverPermission, 477 String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, 478 int initialCode, String initialData, Bundle initialExtras) { 479 throw new UnsupportedOperationException(); 480 } 481 482 /** @hide */ 483 @Override sendOrderedBroadcast(Intent intent, int initialCode, String receiverPermission, String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, String initialData, Bundle initialExtras, Bundle options)484 public void sendOrderedBroadcast(Intent intent, int initialCode, String receiverPermission, 485 String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler, 486 String initialData, Bundle initialExtras, Bundle options) { 487 throw new UnsupportedOperationException(); 488 } 489 490 @Override sendStickyBroadcast(Intent intent)491 public void sendStickyBroadcast(Intent intent) { 492 throw new UnsupportedOperationException(); 493 } 494 495 @Override sendStickyOrderedBroadcast(Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)496 public void sendStickyOrderedBroadcast(Intent intent, 497 BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 498 Bundle initialExtras) { 499 throw new UnsupportedOperationException(); 500 } 501 502 @Override removeStickyBroadcast(Intent intent)503 public void removeStickyBroadcast(Intent intent) { 504 throw new UnsupportedOperationException(); 505 } 506 507 @Override sendStickyBroadcastAsUser(Intent intent, UserHandle user)508 public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) { 509 throw new UnsupportedOperationException(); 510 } 511 512 /** @hide */ 513 @Override sendStickyBroadcastAsUser(Intent intent, UserHandle user, Bundle options)514 public void sendStickyBroadcastAsUser(Intent intent, UserHandle user, Bundle options) { 515 throw new UnsupportedOperationException(); 516 } 517 518 @Override sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras)519 public void sendStickyOrderedBroadcastAsUser(Intent intent, 520 UserHandle user, BroadcastReceiver resultReceiver, 521 Handler scheduler, int initialCode, String initialData, 522 Bundle initialExtras) { 523 throw new UnsupportedOperationException(); 524 } 525 526 @Override removeStickyBroadcastAsUser(Intent intent, UserHandle user)527 public void removeStickyBroadcastAsUser(Intent intent, UserHandle user) { 528 throw new UnsupportedOperationException(); 529 } 530 531 @Override registerReceiver(BroadcastReceiver receiver, IntentFilter filter)532 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { 533 throw new UnsupportedOperationException(); 534 } 535 536 @Override registerReceiver(BroadcastReceiver receiver, IntentFilter filter, int flags)537 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, 538 int flags) { 539 throw new UnsupportedOperationException(); 540 } 541 542 @Override registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler)543 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, 544 String broadcastPermission, Handler scheduler) { 545 throw new UnsupportedOperationException(); 546 } 547 548 @Override registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler, int flags)549 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, 550 String broadcastPermission, Handler scheduler, int flags) { 551 throw new UnsupportedOperationException(); 552 } 553 554 /** @hide */ 555 @Override 556 @SystemApi registerReceiverForAllUsers(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler)557 public Intent registerReceiverForAllUsers(BroadcastReceiver receiver, 558 IntentFilter filter, String broadcastPermission, Handler scheduler) { 559 throw new UnsupportedOperationException(); 560 } 561 562 /** @hide */ 563 @Override registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, IntentFilter filter, String broadcastPermission, Handler scheduler)564 public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user, 565 IntentFilter filter, String broadcastPermission, Handler scheduler) { 566 throw new UnsupportedOperationException(); 567 } 568 569 @Override unregisterReceiver(BroadcastReceiver receiver)570 public void unregisterReceiver(BroadcastReceiver receiver) { 571 throw new UnsupportedOperationException(); 572 } 573 574 @Override startService(Intent service)575 public ComponentName startService(Intent service) { 576 throw new UnsupportedOperationException(); 577 } 578 579 @Override startForegroundService(Intent service)580 public ComponentName startForegroundService(Intent service) { 581 throw new UnsupportedOperationException(); 582 } 583 584 @Override stopService(Intent service)585 public boolean stopService(Intent service) { 586 throw new UnsupportedOperationException(); 587 } 588 589 /** @hide */ 590 @Override startServiceAsUser(Intent service, UserHandle user)591 public ComponentName startServiceAsUser(Intent service, UserHandle user) { 592 throw new UnsupportedOperationException(); 593 } 594 595 /** @hide */ 596 @Override startForegroundServiceAsUser(Intent service, UserHandle user)597 public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) { 598 throw new UnsupportedOperationException(); 599 } 600 601 /** @hide */ 602 @Override stopServiceAsUser(Intent service, UserHandle user)603 public boolean stopServiceAsUser(Intent service, UserHandle user) { 604 throw new UnsupportedOperationException(); 605 } 606 607 @Override bindService(Intent service, ServiceConnection conn, int flags)608 public boolean bindService(Intent service, ServiceConnection conn, int flags) { 609 throw new UnsupportedOperationException(); 610 } 611 612 @Override bindService(Intent service, int flags, Executor executor, ServiceConnection conn)613 public boolean bindService(Intent service, int flags, Executor executor, 614 ServiceConnection conn) { 615 throw new UnsupportedOperationException(); 616 } 617 618 @Override bindIsolatedService(Intent service, int flags, String instanceName, Executor executor, ServiceConnection conn)619 public boolean bindIsolatedService(Intent service, int flags, String instanceName, 620 Executor executor, ServiceConnection conn) { 621 throw new UnsupportedOperationException(); 622 } 623 624 /** @hide */ 625 @Override bindServiceAsUser(Intent service, ServiceConnection conn, int flags, UserHandle user)626 public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, 627 UserHandle user) { 628 throw new UnsupportedOperationException(); 629 } 630 631 @Override updateServiceGroup(ServiceConnection conn, int group, int importance)632 public void updateServiceGroup(ServiceConnection conn, int group, int importance) { 633 throw new UnsupportedOperationException(); 634 } 635 636 @Override unbindService(ServiceConnection conn)637 public void unbindService(ServiceConnection conn) { 638 throw new UnsupportedOperationException(); 639 } 640 641 @Override startInstrumentation(ComponentName className, String profileFile, Bundle arguments)642 public boolean startInstrumentation(ComponentName className, 643 String profileFile, Bundle arguments) { 644 throw new UnsupportedOperationException(); 645 } 646 647 @Override getSystemService(String name)648 public Object getSystemService(String name) { 649 throw new UnsupportedOperationException(); 650 } 651 652 @Override getSystemServiceName(Class<?> serviceClass)653 public String getSystemServiceName(Class<?> serviceClass) { 654 throw new UnsupportedOperationException(); 655 } 656 657 @Override checkPermission(String permission, int pid, int uid)658 public int checkPermission(String permission, int pid, int uid) { 659 throw new UnsupportedOperationException(); 660 } 661 662 /** @hide */ 663 @Override checkPermission(String permission, int pid, int uid, IBinder callerToken)664 public int checkPermission(String permission, int pid, int uid, IBinder callerToken) { 665 return checkPermission(permission, pid, uid); 666 } 667 668 @Override checkCallingPermission(String permission)669 public int checkCallingPermission(String permission) { 670 throw new UnsupportedOperationException(); 671 } 672 673 @Override checkCallingOrSelfPermission(String permission)674 public int checkCallingOrSelfPermission(String permission) { 675 throw new UnsupportedOperationException(); 676 } 677 678 @Override checkSelfPermission(String permission)679 public int checkSelfPermission(String permission) { 680 throw new UnsupportedOperationException(); 681 } 682 683 @Override enforcePermission( String permission, int pid, int uid, String message)684 public void enforcePermission( 685 String permission, int pid, int uid, String message) { 686 throw new UnsupportedOperationException(); 687 } 688 689 @Override enforceCallingPermission(String permission, String message)690 public void enforceCallingPermission(String permission, String message) { 691 throw new UnsupportedOperationException(); 692 } 693 694 @Override enforceCallingOrSelfPermission(String permission, String message)695 public void enforceCallingOrSelfPermission(String permission, String message) { 696 throw new UnsupportedOperationException(); 697 } 698 699 @Override grantUriPermission(String toPackage, Uri uri, int modeFlags)700 public void grantUriPermission(String toPackage, Uri uri, int modeFlags) { 701 throw new UnsupportedOperationException(); 702 } 703 704 @Override revokeUriPermission(Uri uri, int modeFlags)705 public void revokeUriPermission(Uri uri, int modeFlags) { 706 throw new UnsupportedOperationException(); 707 } 708 709 @Override revokeUriPermission(String targetPackage, Uri uri, int modeFlags)710 public void revokeUriPermission(String targetPackage, Uri uri, int modeFlags) { 711 throw new UnsupportedOperationException(); 712 } 713 714 @Override checkUriPermission(Uri uri, int pid, int uid, int modeFlags)715 public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) { 716 throw new UnsupportedOperationException(); 717 } 718 719 /** @hide */ 720 @Override checkUriPermission(Uri uri, int pid, int uid, int modeFlags, IBinder callerToken)721 public int checkUriPermission(Uri uri, int pid, int uid, int modeFlags, IBinder callerToken) { 722 return checkUriPermission(uri, pid, uid, modeFlags); 723 } 724 725 @Override checkCallingUriPermission(Uri uri, int modeFlags)726 public int checkCallingUriPermission(Uri uri, int modeFlags) { 727 throw new UnsupportedOperationException(); 728 } 729 730 @Override checkCallingOrSelfUriPermission(Uri uri, int modeFlags)731 public int checkCallingOrSelfUriPermission(Uri uri, int modeFlags) { 732 throw new UnsupportedOperationException(); 733 } 734 735 @Override checkUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags)736 public int checkUriPermission(Uri uri, String readPermission, 737 String writePermission, int pid, int uid, int modeFlags) { 738 throw new UnsupportedOperationException(); 739 } 740 741 @Override enforceUriPermission( Uri uri, int pid, int uid, int modeFlags, String message)742 public void enforceUriPermission( 743 Uri uri, int pid, int uid, int modeFlags, String message) { 744 throw new UnsupportedOperationException(); 745 } 746 747 @Override enforceCallingUriPermission( Uri uri, int modeFlags, String message)748 public void enforceCallingUriPermission( 749 Uri uri, int modeFlags, String message) { 750 throw new UnsupportedOperationException(); 751 } 752 753 @Override enforceCallingOrSelfUriPermission( Uri uri, int modeFlags, String message)754 public void enforceCallingOrSelfUriPermission( 755 Uri uri, int modeFlags, String message) { 756 throw new UnsupportedOperationException(); 757 } 758 enforceUriPermission( Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags, String message)759 public void enforceUriPermission( 760 Uri uri, String readPermission, String writePermission, 761 int pid, int uid, int modeFlags, String message) { 762 throw new UnsupportedOperationException(); 763 } 764 765 @Override createPackageContext(String packageName, int flags)766 public Context createPackageContext(String packageName, int flags) 767 throws PackageManager.NameNotFoundException { 768 throw new UnsupportedOperationException(); 769 } 770 771 /** {@hide} */ 772 @Override createApplicationContext(ApplicationInfo application, int flags)773 public Context createApplicationContext(ApplicationInfo application, int flags) 774 throws PackageManager.NameNotFoundException { 775 return null; 776 } 777 778 /** @hide */ 779 @Override createContextForSplit(String splitName)780 public Context createContextForSplit(String splitName) 781 throws PackageManager.NameNotFoundException { 782 throw new UnsupportedOperationException(); 783 } 784 785 /** {@hide} */ 786 @Override createPackageContextAsUser(String packageName, int flags, UserHandle user)787 public Context createPackageContextAsUser(String packageName, int flags, UserHandle user) 788 throws PackageManager.NameNotFoundException { 789 throw new UnsupportedOperationException(); 790 } 791 792 /** {@hide} */ 793 @Override createContextAsUser(UserHandle user, @CreatePackageOptions int flags)794 public Context createContextAsUser(UserHandle user, @CreatePackageOptions int flags) { 795 throw new UnsupportedOperationException(); 796 } 797 798 /** {@hide} */ 799 @Override getUserId()800 public int getUserId() { 801 throw new UnsupportedOperationException(); 802 } 803 804 @Override createConfigurationContext(Configuration overrideConfiguration)805 public Context createConfigurationContext(Configuration overrideConfiguration) { 806 throw new UnsupportedOperationException(); 807 } 808 809 @Override createDisplayContext(Display display)810 public Context createDisplayContext(Display display) { 811 throw new UnsupportedOperationException(); 812 } 813 814 @Override createWindowContext(int type, Bundle options)815 public @NonNull Context createWindowContext(int type, Bundle options) { 816 throw new UnsupportedOperationException(); 817 } 818 819 @Override isRestricted()820 public boolean isRestricted() { 821 throw new UnsupportedOperationException(); 822 } 823 824 /** @hide */ 825 @Override getDisplayAdjustments(int displayId)826 public DisplayAdjustments getDisplayAdjustments(int displayId) { 827 throw new UnsupportedOperationException(); 828 } 829 830 @Override getDisplay()831 public Display getDisplay() { 832 throw new UnsupportedOperationException(); 833 } 834 835 /** @hide */ 836 @Override getDisplayNoVerify()837 public Display getDisplayNoVerify() { 838 throw new UnsupportedOperationException(); 839 } 840 841 /** @hide */ 842 @Override getDisplayId()843 public int getDisplayId() { 844 throw new UnsupportedOperationException(); 845 } 846 847 /** @hide */ 848 @Override updateDisplay(int displayId)849 public void updateDisplay(int displayId) { 850 throw new UnsupportedOperationException(); 851 } 852 853 @Override getExternalFilesDirs(String type)854 public File[] getExternalFilesDirs(String type) { 855 throw new UnsupportedOperationException(); 856 } 857 858 @Override getObbDirs()859 public File[] getObbDirs() { 860 throw new UnsupportedOperationException(); 861 } 862 863 @Override getExternalCacheDirs()864 public File[] getExternalCacheDirs() { 865 throw new UnsupportedOperationException(); 866 } 867 868 @Override getExternalMediaDirs()869 public File[] getExternalMediaDirs() { 870 throw new UnsupportedOperationException(); 871 } 872 873 /** @hide **/ 874 @Override getPreloadsFileCache()875 public File getPreloadsFileCache() { throw new UnsupportedOperationException(); } 876 877 @Override createDeviceProtectedStorageContext()878 public Context createDeviceProtectedStorageContext() { 879 throw new UnsupportedOperationException(); 880 } 881 882 /** {@hide} */ 883 @SystemApi 884 @Override createCredentialProtectedStorageContext()885 public Context createCredentialProtectedStorageContext() { 886 throw new UnsupportedOperationException(); 887 } 888 889 @Override isDeviceProtectedStorage()890 public boolean isDeviceProtectedStorage() { 891 throw new UnsupportedOperationException(); 892 } 893 894 /** {@hide} */ 895 @SystemApi 896 @Override isCredentialProtectedStorage()897 public boolean isCredentialProtectedStorage() { 898 throw new UnsupportedOperationException(); 899 } 900 901 /** {@hide} */ 902 @Override canLoadUnsafeResources()903 public boolean canLoadUnsafeResources() { 904 throw new UnsupportedOperationException(); 905 } 906 907 /** {@hide} */ 908 @Override getActivityToken()909 public IBinder getActivityToken() { 910 throw new UnsupportedOperationException(); 911 } 912 913 /** {@hide} */ 914 @Override getServiceDispatcher(ServiceConnection conn, Handler handler, int flags)915 public IServiceConnection getServiceDispatcher(ServiceConnection conn, Handler handler, 916 int flags) { 917 throw new UnsupportedOperationException(); 918 } 919 920 /** {@hide} */ 921 @Override getIApplicationThread()922 public IApplicationThread getIApplicationThread() { 923 throw new UnsupportedOperationException(); 924 } 925 926 /** {@hide} */ 927 @Override getMainThreadHandler()928 public Handler getMainThreadHandler() { 929 throw new UnsupportedOperationException(); 930 } 931 932 /** {@hide} */ 933 @Override isUiContext()934 public boolean isUiContext() { 935 throw new UnsupportedOperationException(); 936 } 937 } 938