Source:
public void onCreate() { super.onCreate(); if (sInstance != null) { Timber.i("onCreate() called multiple times"); if (sInstance.getResources() == null) { Timber.w("Skipping re-initialisation - no resources. Maybe uninstalling app?"); return; } } sInstance = this; SharedPreferences preferences = getSharedPrefs(this); UpdateContextWithLanguage(getApplicationContext()); acraCoreConfigBuilder = new CoreConfigurationBuilder(this); if (BuildConfig.DEBUG) { Timber.plant(new DebugTree()); setDebugACRAConfig(preferences); } else { Timber.plant(new ProductionCrashReportingTree()); setProductionACRAConfig(preferences); } Timber.tag(TAG); UsageAnalytics.initialize(this); if (BuildConfig.DEBUG) { UsageAnalytics.setDryRun(true); } NotificationChannels.setup(getApplicationContext()); CookieManager.setAcceptFileSchemeCookies(true); CompatHelper.getCompat().prepareWebViewCookies(this.getApplicationContext()); final ViewConfiguration vc = ViewConfiguration.get(this); DEFAULT_SWIPE_MIN_DISTANCE = vc.getScaledPagingTouchSlop(); DEFAULT_SWIPE_THRESHOLD_VELOCITY = vc.getScaledMinimumFlingVelocity(); CardBrowser.clearLastDeckId(); if (Permissions.hasStorageAccessPermission(this)) { try { String dir = CollectionHelper.getCurrentAnkiDroidDirectory(this); CollectionHelper.initializeAnkiDroidDirectory(dir); } catch (StorageAccessException e) { Timber.e(e, "Could not initialize AnkiDroid directory"); String defaultDir = CollectionHelper.getDefaultAnkiDroidDirectory(); if (isSdCardMounted() && CollectionHelper.getCurrentAnkiDroidDirectory(this).equals(defaultDir)) { sendExceptionReport(e, "AnkiDroidApp.onCreate"); } } } Timber.i("AnkiDroidApp: Starting Services"); new BootService().onReceive(this, new Intent(this, BootService.class)); NotificationService ns = new NotificationService(); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); lbm.registerReceiver(ns, new IntentFilter(NotificationService.INTENT_ACTION)); }

Target:
public void onCreate() { super.onCreate(); if (sInstance != null) { Timber.i("onCreate() called multiple times"); if (sInstance.getResources() == null) { Timber.w("Skipping re-initialisation - no resources. Maybe uninstalling app?"); return; } } sInstance = this; SharedPreferences preferences = getSharedPrefs(this); acraCoreConfigBuilder = new CoreConfigurationBuilder(this); if (BuildConfig.DEBUG) { Timber.plant(new DebugTree()); setDebugACRAConfig(preferences); } else { Timber.plant(new ProductionCrashReportingTree()); setProductionACRAConfig(preferences); } Timber.tag(TAG); UsageAnalytics.initialize(this); if (BuildConfig.DEBUG) { UsageAnalytics.setDryRun(true); } CardBrowserContextMenu.ensureConsistentStateWithSharedPreferences(this); NotificationChannels.setup(getApplicationContext()); CookieManager.setAcceptFileSchemeCookies(true); CompatHelper.getCompat().prepareWebViewCookies(this.getApplicationContext()); final ViewConfiguration vc = ViewConfiguration.get(this); DEFAULT_SWIPE_MIN_DISTANCE = vc.getScaledPagingTouchSlop(); DEFAULT_SWIPE_THRESHOLD_VELOCITY = vc.getScaledMinimumFlingVelocity(); CardBrowser.clearLastDeckId(); if (Permissions.hasStorageAccessPermission(this)) { try { String dir = CollectionHelper.getCurrentAnkiDroidDirectory(this); CollectionHelper.initializeAnkiDroidDirectory(dir); } catch (StorageAccessException e) { Timber.e(e, "Could not initialize AnkiDroid directory"); String defaultDir = CollectionHelper.getDefaultAnkiDroidDirectory(); if (isSdCardMounted() && CollectionHelper.getCurrentAnkiDroidDirectory(this).equals(defaultDir)) { sendExceptionReport(e, "AnkiDroidApp.onCreate"); } } } Timber.i("AnkiDroidApp: Starting Services"); new BootService().onReceive(this, new Intent(this, BootService.class)); NotificationService ns = new NotificationService(); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); lbm.registerReceiver(ns, new IntentFilter(NotificationService.INTENT_ACTION)); }