Package 

Class RemoteLeakCanaryWorkerService

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2

    
    public final class RemoteLeakCanaryWorkerService
    extends RemoteWorkerService
                        

    Using a custom class name instead of RemoteWorkerService so that hosting apps can use RemoteWorkerService without a naming conflict.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class RemoteLeakCanaryWorkerService.FakeAppContextConfigurationProvider

      RemoteLeakCanaryWorkerService is running in the :leakcanary process, and androidx startup only initializes WorkManager in the main process. In RemoteWorkerService.onCreate(), WorkManager has not been init, so it would crash. We can't blindly call init() as developers might be calling WorkManager.initialize() from Application.onCreate() for all processes, in which case a 2nd init would fail. So we want to init if nothing has init WorkManager before. But there's no isInit() API. However, WorkManager will automatically pull in the application context and if that context implements Configuration.Provider then it'll pull the configuration from it. So we cheat WorkManager by returning a fake app context that provides our own custom configuration.

    • Method Summary

      Modifier and Type Method Description
      Context getApplicationContext()
      Unit onCreate()
      • Methods inherited from class android.app.Service

        bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationInfo, getAssets, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerComponentCallbacks, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterComponentCallbacks, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions
      • Methods inherited from class androidx.work.multiprocess.RemoteWorkerService

        attachBaseContext, dump, getApplication, getForegroundServiceType, onConfigurationChanged, onDestroy, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTimeout, onTrimMemory, onUnbind, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
      • Methods inherited from class leakcanary.internal.RemoteLeakCanaryWorkerService

        onBind
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait