@Test public void isAutomaticDataCollectionEnabled_prefOverridesManifest() { when(sharedPreferencesUtils.isPreferenceSet(DataCollectionHelper.AUTO_INIT_PREFERENCES)) .thenReturn(true); when(firebaseApp.isDataCollectionDefaultEnabled()).thenReturn(true); when(sharedPreferencesUtils.getBooleanPreference( DataCollectionHelper.AUTO_INIT_PREFERENCES, true)) .thenReturn(true); dataCollectionHelper = new DataCollectionHelper(firebaseApp, sharedPreferencesUtils, subscriber); assertThat(dataCollectionHelper.isAutomaticDataCollectionEnabled()).isTrue(); verify(sharedPreferencesUtils, never()) .isManifestSet(DataCollectionHelper.MANIFEST_METADATA_AUTO_INIT_ENABLED); verify(sharedPreferencesUtils, never()) .getBooleanManifestValue(DataCollectionHelper.MANIFEST_METADATA_AUTO_INIT_ENABLED, true); }
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);  }