Analytics extends AirshipComponent { public void setEnabled(boolean enabled) { boolean previousValue = getDataStore().getBoolean(ANALYTICS_ENABLED_KEY, true); if (previousValue && !enabled) { clearPendingEvents(); } if (enabled && !isDataCollectionEnabled()) { Logger.warn("Analytics - Analytics is disabled until data collection is opted in."); } getDataStore().put(ANALYTICS_ENABLED_KEY, enabled); } Analytics(@NonNull Context context,
                     @NonNull PreferenceDataStore dataStore,
                     @NonNull AirshipRuntimeConfig runtimeConfig,
                     @NonNull AirshipChannel channel,
                     @NonNull LocaleManager localeManager); @VisibleForTesting  Analytics(@NonNull Context context,
              @NonNull PreferenceDataStore dataStore,
              @NonNull AirshipRuntimeConfig runtimeConfig,
              @NonNull AirshipChannel airshipChannel,
              @NonNull ActivityMonitor activityMonitor,
              @NonNull LocaleManager localeManager,
              @NonNull Executor executor,
              @NonNull EventManager eventManager); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) void addHeaderDelegate(@NonNull AnalyticsHeaderDelegate headerDelegate); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) void addEventListener(@NonNull EventListener eventListener); @Override @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @AirshipComponentGroups.Group int getComponentGroup(); @Override @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @JobInfo.JobResult int onPerformJob(@NonNull UAirship airship, @NonNull JobInfo jobInfo); boolean isAppInForeground(); void addEvent(@NonNull final Event event); @Nullable String getConversionSendId(); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) void setConversionSendId(@Nullable String sendId); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) String getConversionMetadata(); void setConversionMetadata(@Nullable String metadata); @NonNull String getSessionId(); void setEnabled(boolean enabled); boolean isEnabled(); @NonNull AssociatedIdentifiers.Editor editAssociatedIdentifiers(); @NonNull AssociatedIdentifiers getAssociatedIdentifiers(); void trackScreen(@Nullable String screen); void uploadEvents(); void addAnalyticsListener(@NonNull AnalyticsListener analyticsListener); void removeAnalyticsListener(@NonNull AnalyticsListener analyticsListener); void registerSDKExtension(@ExtensionName @NonNull String extension, @NonNull String version); @NonNull
    static final String EXTENSION_CORDOVA; @NonNull
    static final String EXTENSION_FLUTTER; @NonNull
    static final String EXTENSION_REACT_NATIVE; @NonNull
    static final String EXTENSION_UNITY; @NonNull
    static final String EXTENSION_XAMARIN; @NonNull
    static final String EXTENSION_TITANIUM; }
@Test public void testDisableAnalytics() { analytics.setEnabled(false); verify(mockEventManager).deleteEvents(); }