@Test public void isAutomaticDataCollectionEnabled_updatesOnDataCollectionDefaultChanges() { when(sharedPreferencesUtils.isPreferenceSet(DataCollectionHelper.AUTO_INIT_PREFERENCES)) .thenReturn(false); when(sharedPreferencesUtils.isManifestSet( DataCollectionHelper.MANIFEST_METADATA_AUTO_INIT_ENABLED)) .thenReturn(false); when(firebaseApp.isDataCollectionDefaultEnabled()).thenReturn(false); TestFirebaseEventSubscriber testFirebaseEventSubscriber = new TestFirebaseEventSubscriber(); dataCollectionHelper = new DataCollectionHelper(firebaseApp, sharedPreferencesUtils, testFirebaseEventSubscriber); assertThat(testFirebaseEventSubscriber.dataCollectionHandlers.size()).isEqualTo(1); testFirebaseEventSubscriber.notifySubscribers(new DataCollectionDefaultChange(true)); assertThat(dataCollectionHelper.isAutomaticDataCollectionEnabled()).isTrue(); }
public boolean isAutomaticDataCollectionEnabled() { if (isProductManuallySet()) { return sharedPreferencesUtils.getBooleanPreference(AUTO_INIT_PREFERENCES, true); } if (isProductManifestSet()) { return sharedPreferencesUtils.getBooleanManifestValue( MANIFEST_METADATA_AUTO_INIT_ENABLED, true); } return isGlobalAutomaticDataCollectionEnabled.get(); }
DataCollectionHelper { public boolean isAutomaticDataCollectionEnabled() { if (isProductManuallySet()) { return sharedPreferencesUtils.getBooleanPreference(AUTO_INIT_PREFERENCES, true); } if (isProductManifestSet()) { return sharedPreferencesUtils.getBooleanManifestValue( MANIFEST_METADATA_AUTO_INIT_ENABLED, true); } return isGlobalAutomaticDataCollectionEnabled.get(); } }
DataCollectionHelper { public boolean isAutomaticDataCollectionEnabled() { if (isProductManuallySet()) { return sharedPreferencesUtils.getBooleanPreference(AUTO_INIT_PREFERENCES, true); } if (isProductManifestSet()) { return sharedPreferencesUtils.getBooleanManifestValue( MANIFEST_METADATA_AUTO_INIT_ENABLED, true); } return isGlobalAutomaticDataCollectionEnabled.get(); } @Inject  DataCollectionHelper(
      FirebaseApp firebaseApp,
      SharedPreferencesUtils sharedPreferencesUtils,
      Subscriber firebaseEventsSubscriber); }
DataCollectionHelper { public boolean isAutomaticDataCollectionEnabled() { if (isProductManuallySet()) { return sharedPreferencesUtils.getBooleanPreference(AUTO_INIT_PREFERENCES, true); } if (isProductManifestSet()) { return sharedPreferencesUtils.getBooleanManifestValue( MANIFEST_METADATA_AUTO_INIT_ENABLED, true); } return isGlobalAutomaticDataCollectionEnabled.get(); } @Inject  DataCollectionHelper(
      FirebaseApp firebaseApp,
      SharedPreferencesUtils sharedPreferencesUtils,
      Subscriber firebaseEventsSubscriber); boolean isAutomaticDataCollectionEnabled(); void setAutomaticDataCollectionEnabled(boolean isEnabled); void setAutomaticDataCollectionEnabled(Boolean isEnabled); }
DataCollectionHelper { public boolean isAutomaticDataCollectionEnabled() { if (isProductManuallySet()) { return sharedPreferencesUtils.getBooleanPreference(AUTO_INIT_PREFERENCES, true); } if (isProductManifestSet()) { return sharedPreferencesUtils.getBooleanManifestValue( MANIFEST_METADATA_AUTO_INIT_ENABLED, true); } return isGlobalAutomaticDataCollectionEnabled.get(); } @Inject  DataCollectionHelper(
      FirebaseApp firebaseApp,
      SharedPreferencesUtils sharedPreferencesUtils,
      Subscriber firebaseEventsSubscriber); boolean isAutomaticDataCollectionEnabled(); void setAutomaticDataCollectionEnabled(boolean isEnabled); void setAutomaticDataCollectionEnabled(Boolean isEnabled);  }