Class ShadowContextImpl


  • @Implements(className="android.app.ContextImpl")
    public class ShadowContextImpl
    extends java.lang.Object
    • Constructor Detail

      • ShadowContextImpl

        public ShadowContextImpl()
    • Method Detail

      • setSystemService

        public void setSystemService​(java.lang.String key,
                                     java.lang.Object service)
      • removeSystemService

        public void removeSystemService​(java.lang.String name)
        Makes getSystemService(String) return null for the given system service name, mimicking a device that doesn't have that system service.
      • startIntentSender

        @Implementation
        protected void startIntentSender​(android.content.IntentSender intent,
                                         android.content.Intent fillInIntent,
                                         int flagsMask,
                                         int flagsValues,
                                         int extraFlags,
                                         android.os.Bundle options)
                                  throws android.content.IntentSender.SendIntentException
        Throws:
        android.content.IntentSender.SendIntentException
      • getClassLoader

        @Implementation
        protected java.lang.ClassLoader getClassLoader()
      • checkCallingPermission

        @Implementation
        protected int checkCallingPermission​(java.lang.String permission)
      • checkCallingOrSelfPermission

        @Implementation
        protected int checkCallingOrSelfPermission​(java.lang.String permission)
      • getContentResolver

        @Implementation
        protected android.content.ContentResolver getContentResolver()
      • sendBroadcast

        @Implementation
        protected void sendBroadcast​(android.content.Intent intent)
      • sendBroadcast

        @Implementation
        protected void sendBroadcast​(android.content.Intent intent,
                                     java.lang.String receiverPermission)
      • sendBroadcastAsUser

        @Implementation(minSdk=17)
        protected void sendBroadcastAsUser​(android.content.Intent intent,
                                           android.os.UserHandle user)
      • sendBroadcastAsUser

        @Implementation(minSdk=17)
        protected void sendBroadcastAsUser​(android.content.Intent intent,
                                           android.os.UserHandle user,
                                           java.lang.String receiverPermission)
      • sendOrderedBroadcast

        @Implementation
        protected void sendOrderedBroadcast​(android.content.Intent intent,
                                            java.lang.String receiverPermission)
      • sendOrderedBroadcast

        @Implementation
        protected void sendOrderedBroadcast​(android.content.Intent intent,
                                            java.lang.String receiverPermission,
                                            android.content.BroadcastReceiver resultReceiver,
                                            android.os.Handler scheduler,
                                            int initialCode,
                                            java.lang.String initialData,
                                            android.os.Bundle initialExtras)
      • sendStickyBroadcast

        @Implementation
        protected void sendStickyBroadcast​(android.content.Intent intent)
      • checkPermission

        @Implementation
        protected int checkPermission​(java.lang.String permission,
                                      int pid,
                                      int uid)
      • registerReceiver

        @Implementation
        protected android.content.Intent registerReceiver​(android.content.BroadcastReceiver receiver,
                                                          android.content.IntentFilter filter)
      • registerReceiver

        @Implementation
        protected android.content.Intent registerReceiver​(android.content.BroadcastReceiver receiver,
                                                          android.content.IntentFilter filter,
                                                          java.lang.String broadcastPermission,
                                                          android.os.Handler scheduler)
      • registerReceiverAsUser

        @Implementation(minSdk=17)
        protected android.content.Intent registerReceiverAsUser​(android.content.BroadcastReceiver receiver,
                                                                android.os.UserHandle user,
                                                                android.content.IntentFilter filter,
                                                                java.lang.String broadcastPermission,
                                                                android.os.Handler scheduler)
      • unregisterReceiver

        @Implementation
        protected void unregisterReceiver​(android.content.BroadcastReceiver broadcastReceiver)
      • startService

        @Implementation
        protected android.content.ComponentName startService​(android.content.Intent service)
      • startForegroundService

        @Implementation(minSdk=26)
        protected android.content.ComponentName startForegroundService​(android.content.Intent service)
      • stopService

        @Implementation
        protected boolean stopService​(android.content.Intent name)
      • bindService

        @Implementation
        protected boolean bindService​(android.content.Intent intent,
                                      android.content.ServiceConnection serviceConnection,
                                      int i)
      • bindServiceAsUser

        @Implementation(minSdk=21)
        protected boolean bindServiceAsUser​(android.content.Intent intent,
                                            android.content.ServiceConnection serviceConnection,
                                            int i,
                                            android.os.UserHandle userHandle)
        Binds to a service but ignores the given UserHandle.
      • unbindService

        @Implementation
        protected void unbindService​(android.content.ServiceConnection serviceConnection)
      • startActivityAsUser

        @Implementation(minSdk=21)
        protected void startActivityAsUser​(android.content.Intent intent,
                                           android.os.Bundle options,
                                           android.os.UserHandle user)
        Behaves as #startActivity. The user parameter is ignored.
      • setUserId

        public void setUserId​(int userId)
      • getUserId

        @Implementation(minSdk=18)
        protected int getUserId()
      • getExternalFilesDir

        @Implementation(maxSdk=18)
        protected java.io.File getExternalFilesDir​(java.lang.String type)
      • getExternalFilesDirs

        @Implementation(minSdk=19)
        protected java.io.File[] getExternalFilesDirs​(java.lang.String type)
      • reset

        @Resetter
        public static void reset()
      • getDatabasePath

        @Implementation
        public java.io.File getDatabasePath​(java.lang.String name)