diff --git a/app/src/main/java/org/oppia/android/app/application/BUILD.bazel b/app/src/main/java/org/oppia/android/app/application/BUILD.bazel index 593be4f261a..dee384ea6cc 100644 --- a/app/src/main/java/org/oppia/android/app/application/BUILD.bazel +++ b/app/src/main/java/org/oppia/android/app/application/BUILD.bazel @@ -115,7 +115,7 @@ android_library( "//domain/src/main/java/org/oppia/android/domain/classify/rules/ratioinput:ratio_input_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/textinput:text_input_rule_module", "//domain/src/main/java/org/oppia/android/domain/onboarding:retriever_prod_module", - "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:performance_metrics_logger_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:logger_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduler_module", diff --git a/app/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt index 102da66b0fd..40002aad5b7 100644 --- a/app/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt @@ -32,8 +32,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -95,9 +95,9 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - ActivityLifecycleObserverModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, AlphaBuildFlavorModule::class, - EventLoggingConfigurationModule::class + EventLoggingConfigurationModule::class, CpuPerformanceSnapshotterModule::class, + PerformanceMetricsAssessorModule::class, ] ) interface AlphaApplicationComponent : ApplicationComponent { diff --git a/app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt index 2bf219282eb..da83b853b69 100644 --- a/app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt @@ -33,8 +33,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -96,9 +96,9 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - ActivityLifecycleObserverModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, AlphaBuildFlavorModule::class, - KenyaAlphaEventLoggingConfigurationModule::class + KenyaAlphaEventLoggingConfigurationModule::class, CpuPerformanceSnapshotterModule::class, + PerformanceMetricsAssessorModule::class, ] ) interface AlphaKenyaApplicationComponent : ApplicationComponent { diff --git a/app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt index a7789a14b0b..cf40f81fd19 100644 --- a/app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt @@ -32,8 +32,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -95,9 +95,10 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - ActivityLifecycleObserverModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, BetaBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class, PerformanceMetricsAssessorModule::class, + ] ) interface BetaApplicationComponent : ApplicationComponent { diff --git a/app/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt index 9608f2ada18..0e3384804ec 100644 --- a/app/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt @@ -33,8 +33,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionDebugModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -99,7 +99,7 @@ import javax.inject.Singleton SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, DeveloperBuildFlavorModule::class, EventLoggingConfigurationModule::class, - ActivityLifecycleObserverModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface DeveloperApplicationComponent : ApplicationComponent { diff --git a/app/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt index d33378ccad2..1ed85c1b37a 100644 --- a/app/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt @@ -32,8 +32,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -95,9 +95,9 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - ActivityLifecycleObserverModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, GaBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class, PerformanceMetricsAssessorModule::class, ] ) interface GaApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt index 46822f21a0a..a7712133fd9 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt @@ -91,6 +91,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -848,7 +849,8 @@ class AdministratorControlsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt index a207829c2d4..491a413c544 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt @@ -81,6 +81,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -656,7 +657,8 @@ class AdministratorControlsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt index 1231cee1fa6..168d9e2eca1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt @@ -71,6 +71,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -303,7 +304,8 @@ class AppVersionActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt index b56b06789cb..fd903f50135 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt @@ -60,6 +60,8 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.ApplicationIdSeed import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory @@ -214,7 +216,8 @@ class ProfileAndDeviceIdActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, - ActivityRouterModule::class + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, + ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt index 871229964c6..c5c0e9de9af 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt @@ -76,6 +76,8 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.ApplicationIdSeed import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.analytics.LearnerAnalyticsLogger import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -629,7 +631,8 @@ class ProfileAndDeviceIdFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, - ActivityRouterModule::class + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, + ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt index e90c2364da4..b6ccfd47b3e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt @@ -72,6 +72,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -527,7 +528,8 @@ class CompletedStoryListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt index 9ca7bca188b..ac1c940b7ee 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -175,7 +176,8 @@ class LessonThumbnailImageViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt index 98f94fa8513..a74cf4af05b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1777,7 +1778,8 @@ class MathExpressionInteractionsViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt index d65aab6f807..0af0e47f590 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt @@ -60,6 +60,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -186,7 +187,8 @@ class DrawableBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt index 0728c9fbe2e..424dbf4ec43 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt @@ -64,6 +64,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -228,7 +229,8 @@ class ImageViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** Create a TestApplicationComponent. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt index eba64502f3d..66f0b4dd361 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt @@ -65,6 +65,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -316,7 +317,8 @@ class MarginBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** Create a TestApplicationComponent. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt index a63e5549193..d9c4f5eca57 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -504,7 +505,8 @@ class StateAssemblerMarginBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** Create a TestApplicationComponent. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt index 3166c10cffb..e290e80005d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt @@ -65,6 +65,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -502,7 +503,8 @@ class StateAssemblerPaddingBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt index b20ef9842ee..2a91bda124c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -335,7 +336,8 @@ class TextViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt index a12e1072adc..4c4202ef3b8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt @@ -62,6 +62,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -236,7 +237,8 @@ class ViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** Create a TestApplicationComponent. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt index e9c3d4a6c0f..ca0693755f6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt @@ -81,6 +81,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -338,7 +339,8 @@ class DeveloperOptionsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt index 509ab083eca..d714e8563da 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt @@ -76,6 +76,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -659,7 +660,8 @@ class DeveloperOptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt index a51d49ac9ab..c5b6f4c3364 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -200,7 +201,8 @@ class MarkChaptersCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt index bb30ba7fb63..7b8d2d9a2c5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -852,7 +853,8 @@ class MarkChaptersCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt index 8068c60af69..a9bd0848502 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -200,7 +201,8 @@ class MarkStoriesCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt index fd565e18a0e..e5166e4e55d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -567,7 +568,8 @@ class MarkStoriesCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt index a596f87c06d..f66ac6ddba7 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -200,7 +201,8 @@ class MarkTopicsCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt index 0c30ce8cfd3..53647c03de3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -548,7 +549,8 @@ class MarkTopicsCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt index b3bc95cd971..5e027e21ff2 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt @@ -59,6 +59,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -191,7 +192,7 @@ class ViewEventLogsActivityTest { SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, - ActivityRouterModule::class + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt index 4ab640a5d24..64701aa30bb 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt @@ -63,6 +63,7 @@ import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -581,7 +582,8 @@ class ViewEventLogsFragmentTest { LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt index 922f7f1ce05..573f69f7dfd 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt @@ -59,6 +59,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -191,7 +192,8 @@ class ForceNetworkTypeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** [ApplicationComponent] for [ForceNetworkTypeActivityTest]. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt index b99da448de8..cb85101c500 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt @@ -63,6 +63,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -398,7 +399,8 @@ class ForceNetworkTypeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) /** [ApplicationComponent] for [ForceNetworkTypeFragmentTest]. */ diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt index c24a328b65e..4753580f8ec 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt @@ -56,6 +56,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -176,7 +177,8 @@ class MathExpressionParserActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt index d0ce319aa76..94942a95384 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt @@ -65,6 +65,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1416,7 +1417,8 @@ class MathExpressionParserFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt index 3265712e306..3dbcfe14691 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -250,7 +251,8 @@ class FAQListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt index 7b46d1c9a2d..0086ba079a3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt @@ -65,6 +65,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -237,7 +238,8 @@ class FAQSingleActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt index 608e41e367e..4dfd3a46206 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -164,7 +165,8 @@ class FaqListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt index 26499ab1ab2..9ae90ce3165 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -166,7 +167,8 @@ class HelpActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt index 8e3d0c50a80..3625abba97f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt @@ -82,6 +82,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1445,7 +1446,8 @@ class HelpFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt index 6d4ecf49330..bd0def48687 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt @@ -99,6 +99,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1843,7 +1844,8 @@ class HomeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt index 08c73555952..e79381fe555 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt @@ -94,6 +94,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1506,7 +1507,8 @@ class RecentlyPlayedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt index 94c45083019..4a95eb2b53a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -387,7 +388,8 @@ class TopicSummaryViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt index b950b6ef853..8c29d818a5c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -360,7 +361,8 @@ class WelcomeViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt index 6480ab29fb9..74463608700 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -372,7 +373,8 @@ class PromotedStoryListViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt index 3066d3f7671..34621c5a1ac 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -390,7 +391,8 @@ class PromotedStoryViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt index a53ded6b5de..7267703d038 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt @@ -51,6 +51,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -157,7 +158,8 @@ class MyDownloadsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt index 7122fae10c5..362634d3c9b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt @@ -61,6 +61,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -236,7 +237,8 @@ class MyDownloadsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt index 0daad1ed8d4..daf9105d4c8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt @@ -64,6 +64,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -247,7 +248,8 @@ class BetaNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt index d60da9c176d..805c1322355 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt @@ -64,6 +64,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -254,7 +255,8 @@ class GeneralAvailabilityUpgradeNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt index a35f4d18999..6e18507256f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -163,7 +164,8 @@ class OnboardingActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt index 9116a556f27..57882de0527 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt @@ -79,6 +79,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -726,7 +727,8 @@ class OnboardingFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt index 2697b0bc999..527df2c924c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt @@ -71,6 +71,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -471,7 +472,8 @@ class OngoingTopicListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt index 2d0201ee318..c5ddeb19641 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -173,7 +174,8 @@ class AppLanguageActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt index cf0c1cc3af2..ac256f37e1a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt @@ -60,6 +60,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -259,7 +260,8 @@ class AppLanguageFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt index 5406fe632bb..bead08abd1c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -162,7 +163,8 @@ class AudioLanguageActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt index 57db9c5bb88..cda9ab89297 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt @@ -63,6 +63,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -297,7 +298,8 @@ class AudioLanguageFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt index 244db7a2275..2b6dc999382 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -165,7 +166,8 @@ class OptionsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt index 965dfd25f1d..d84721f0552 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt @@ -79,6 +79,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -671,7 +672,8 @@ class OptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt index 8aed5d4cb1f..6b7c2fefc33 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -162,7 +163,8 @@ class ReadingTextSizeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt index a57fe74dd4c..daf456a5f7d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -314,7 +315,8 @@ class ReadingTextSizeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt index 2b39ef109be..bc813eaf816 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt @@ -91,6 +91,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -910,7 +911,8 @@ class HtmlParserTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt index f45fb12cb31..1120d6e0796 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt @@ -75,6 +75,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -481,7 +482,8 @@ class AudioFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt index 917d12c0abe..3148dfb7ef5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt @@ -60,6 +60,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -190,7 +191,8 @@ class BottomSheetOptionsMenuTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt index 485226f4e34..3271fb3bd89 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt @@ -110,6 +110,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -2139,7 +2140,8 @@ class ExplorationActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt index 5ef1a4e5853..9e56f238c4b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt @@ -129,6 +129,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -4322,7 +4323,8 @@ class StateFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt index d61c1bff7d6..cd0fcf0ab02 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt @@ -70,6 +70,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -277,7 +278,8 @@ class PoliciesActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt index 81f727dbe45..bad23ffbd40 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt @@ -82,6 +82,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -357,7 +358,8 @@ class PoliciesFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt index 203f586fcad..a01e795d64b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt @@ -86,6 +86,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1816,7 +1817,8 @@ class AddProfileActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt index f303890bc4d..cb7243d2ee6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt @@ -72,6 +72,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -690,7 +691,8 @@ class AdminAuthActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt index f4d41e0a7cc..be1b5700d5f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt @@ -81,6 +81,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1107,7 +1108,8 @@ class AdminPinActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt index 4a6313b819f..aa13b692db8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt @@ -76,6 +76,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1200,7 +1201,8 @@ class PinPasswordActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt index 86a2794b546..d15dd0e247a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -161,7 +162,8 @@ class ProfileChooserActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt index 203cdc3f94f..6880cf384f6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt @@ -73,6 +73,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -532,7 +533,8 @@ class ProfileChooserFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt index 76b7ccfc861..d816efeb938 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt @@ -60,6 +60,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -217,7 +218,8 @@ class ProfilePictureActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt index bcb8fd90041..b378501cf82 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -167,7 +168,8 @@ class ProfileProgressActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt index d7f9505d58c..a2b39bf089d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt @@ -97,6 +97,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -920,7 +921,8 @@ class ProfileProgressFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt b/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt index 945d185bcc1..f23583af490 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt @@ -88,6 +88,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -680,7 +681,8 @@ class BindableAdapterTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt index 8a81395fe4e..35f01e1cbcd 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -237,7 +238,8 @@ class ResumeLessonActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt index 36dc8256b60..a28f4ec1a8d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -317,7 +318,8 @@ class ResumeLessonFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt index c82ecbdceba..1f13ea7cc43 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -393,7 +394,8 @@ class ProfileEditActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt index 68fc525d6a5..07517ff7359 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -363,7 +364,8 @@ class ProfileEditFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt index cfe3fa7d134..d8c05e7e346 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -163,7 +164,8 @@ class ProfileListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt index 935a4b654f0..ed97d76a3d0 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt @@ -66,6 +66,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -392,7 +393,8 @@ class ProfileListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt index 481d510a8eb..72b180d9e97 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -189,7 +190,8 @@ class ProfileRenameActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt index c97ff75adf2..e64f3f663e8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -466,7 +467,8 @@ class ProfileRenameFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt index d68bc4a09de..6980813ee24 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -198,7 +199,8 @@ class ProfileResetPinActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt index 671a2e6e5bb..b78663964f6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1030,7 +1031,8 @@ class ProfileResetPinFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt index 7eed3e3e8c8..1011414acc3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt @@ -82,6 +82,7 @@ import org.oppia.android.domain.onboarding.testing.FakeExpirationMetaDataRetriev import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1219,7 +1220,8 @@ class SplashActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt index 18949814fa8..0ab8aed5fe3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt @@ -72,6 +72,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -277,7 +278,8 @@ class StoryActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt index 56b13f6c727..97503f7cae7 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt @@ -101,6 +101,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -963,7 +964,8 @@ class StoryFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt index 2b84966d8cc..8d0ec384da0 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt @@ -62,6 +62,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -234,7 +235,8 @@ class DragDropTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt index f9c25835bca..cd5ea7ab47b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt @@ -72,6 +72,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -401,7 +402,8 @@ class ImageRegionSelectionInteractionViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt index a782d5699fe..71558d11fdc 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1129,7 +1130,8 @@ class InputInteractionViewTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt index 024b739a251..0ec584eca30 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt @@ -88,6 +88,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -442,7 +443,8 @@ class NavigationDrawerActivityDebugTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt index d3a39fd703a..d29e65127a0 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt @@ -96,6 +96,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -991,7 +992,8 @@ class NavigationDrawerActivityProdTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt index 1d9a2c4616f..297d7a42119 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt @@ -57,6 +57,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -209,7 +210,8 @@ class TestFontScaleConfigurationUtilActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt index 3558c7d1a24..208077d8931 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt @@ -62,6 +62,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -210,7 +211,8 @@ class TopicTestActivityForStoryTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt index 2f3f58b1843..b74798643e8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -176,7 +177,8 @@ class LicenseListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt index 5170d5c4daa..0904ac73567 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -376,7 +377,8 @@ class LicenseListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt index f2719021d0d..00da241dd60 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -185,7 +186,8 @@ class LicenseTextViewerActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt index 747896b0272..257ce6413d5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -354,7 +355,8 @@ class LicenseTextViewerFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt index 8fb026e3051..86277a97f9b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -173,7 +174,8 @@ class ThirdPartyDependencyListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt index ac8ca64d358..33d50dd5277 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -486,7 +487,8 @@ class ThirdPartyDependencyListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt index da5075c8edb..8d1eab0e8fa 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt @@ -66,6 +66,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -232,7 +233,8 @@ class TopicActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt index 775d03f0949..3ac8d6fcfb8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt @@ -76,6 +76,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -694,7 +695,8 @@ class TopicFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt index fd15e2b92a4..9549cb0e2de 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt @@ -73,6 +73,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -438,7 +439,8 @@ class ConceptCardFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt index 66a2f96f365..0f82783c0dd 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt @@ -77,6 +77,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -495,7 +496,8 @@ class TopicInfoFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt index d01401649b9..605a88364a8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt @@ -90,6 +90,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -1091,7 +1092,8 @@ class TopicLessonsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt index 1cf3ad6e30d..fa72aa5a98e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt @@ -73,6 +73,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -440,7 +441,8 @@ class TopicPracticeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt index fcb1989f505..a52ed5e4364 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt @@ -102,6 +102,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -808,7 +809,8 @@ class QuestionPlayerActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt index 7f3707175dd..9282f5766b5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt @@ -74,6 +74,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -336,7 +337,8 @@ class TopicRevisionFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt index aeacb5b49e7..8c18ea0419d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -308,7 +309,8 @@ class RevisionCardActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt index 33d19e2f5d5..6ddeb935742 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt @@ -85,6 +85,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -718,7 +719,8 @@ class RevisionCardFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt b/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt index 2cbefc007df..4bf9a987769 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt @@ -50,6 +50,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -162,7 +163,8 @@ class RatioExtensionsTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt index 59db9b5fdc2..9d92b5f3951 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt @@ -64,6 +64,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -251,7 +252,8 @@ class WalkthroughActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt index 06a4b77f6c9..c56d1d066a6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt @@ -66,6 +66,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -297,7 +298,8 @@ class WalkthroughFinalFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt index 3877ab5e72c..64efd099619 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -323,7 +324,8 @@ class WalkthroughTopicListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt index a7b1edf7733..818e85f5230 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt @@ -62,6 +62,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -220,7 +221,8 @@ class WalkthroughWelcomeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt b/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt index beea5020a25..96bf0dfdce1 100644 --- a/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -188,7 +189,8 @@ class ActivityIntentFactoriesTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt index 418d633c793..e078032f890 100644 --- a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -158,7 +159,8 @@ class ActivityRouterModuleTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt index c965118576b..972e2050b1b 100644 --- a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt @@ -65,6 +65,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -208,7 +209,8 @@ class ActivityRouterTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt index f16e45210b0..e66f5784ef1 100644 --- a/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -157,7 +158,8 @@ class HomeActivityLocalTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt b/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt index 840327b63b2..703d4bceeb9 100644 --- a/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt @@ -49,6 +49,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -267,7 +268,8 @@ class FractionParsingUiErrorTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt b/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt index 2010b9aa233..c9ab51ff0a9 100644 --- a/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt @@ -73,6 +73,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1109,7 +1110,8 @@ class ListItemLeadingMarginSpanTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) diff --git a/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt b/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt index 86f8de98dc8..e1e3ff5b26d 100644 --- a/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt @@ -50,6 +50,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -271,7 +272,8 @@ class StringToRatioParserTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt index 86a5a423082..16017631ee3 100644 --- a/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt @@ -57,6 +57,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -220,7 +221,8 @@ class ExplorationActivityLocalTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt index 40c10395201..0460fd7e601 100644 --- a/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt @@ -110,6 +110,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -2395,7 +2396,8 @@ class StateFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt index a4b85a75ce3..bde97726d06 100644 --- a/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt @@ -51,6 +51,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -146,7 +147,8 @@ class ProfileChooserFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt index e6240b78e77..3625e32df45 100644 --- a/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt @@ -53,6 +53,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -171,7 +172,8 @@ class StoryActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt index 2eb63996148..c2ae4e9cefa 100644 --- a/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -180,7 +181,8 @@ class CompletedStoryListSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt index c88cb0cbc8e..5d3c910a3ea 100644 --- a/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -194,7 +195,8 @@ class HomeSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt index 7c898df1d96..7f6bdbfeac1 100644 --- a/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt @@ -56,6 +56,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -191,7 +192,8 @@ class OngoingTopicListSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt b/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt index e846e10a3f7..937631989f3 100644 --- a/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt @@ -69,6 +69,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterController @@ -364,7 +365,8 @@ class PlatformParameterIntegrationTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt index c8e15e825ba..08d4dc929e1 100644 --- a/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -393,7 +394,8 @@ class ProfileChooserSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt b/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt index 1520034bd75..bad45f68718 100644 --- a/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt @@ -55,6 +55,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -177,7 +178,8 @@ class ProfileProgressSpanCountTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt index 08e90feb8d7..cbc70b6719d 100644 --- a/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -318,7 +319,8 @@ class RecentlyPlayedSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt index 6ece8232c80..6732817b226 100644 --- a/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt @@ -54,6 +54,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -177,7 +178,8 @@ class TopicRevisionSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt b/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt index e3545555406..486d40b5648 100644 --- a/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt @@ -51,6 +51,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -202,7 +203,8 @@ class TestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt b/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt index 875948b5972..0b30bce9628 100644 --- a/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt @@ -61,6 +61,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -201,7 +202,8 @@ class AdministratorControlsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt b/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt index dfe70b6302e..19c743cccc9 100644 --- a/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt @@ -62,6 +62,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -255,7 +256,8 @@ class OptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt b/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt index 6afa85f8b18..e4ff46c031a 100644 --- a/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -210,7 +211,8 @@ class PlayerSplitScreenTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt b/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt index c078cdd37bf..576ce166578 100644 --- a/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt @@ -58,6 +58,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -217,7 +218,8 @@ class StateFragmentAccessibilityTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt index 595e72420a5..97ffc4805fd 100644 --- a/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt @@ -51,6 +51,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -160,7 +161,8 @@ class TopicInfoFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt index 6148973bf37..ab4b498b317 100644 --- a/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt @@ -50,6 +50,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -162,7 +163,8 @@ class TopicLessonsFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt index fe6978aa3da..e2509afa43a 100644 --- a/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt @@ -67,6 +67,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -510,7 +511,8 @@ class QuestionPlayerActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt index d0ec6228a14..1bbe5bc907c 100644 --- a/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt @@ -50,6 +50,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -153,7 +154,8 @@ class RevisionCardActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/translation/AppLanguageLocaleHandlerTest.kt b/app/src/test/java/org/oppia/android/app/translation/AppLanguageLocaleHandlerTest.kt index 8de8c9b2410..942fb06d5b6 100644 --- a/app/src/test/java/org/oppia/android/app/translation/AppLanguageLocaleHandlerTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/AppLanguageLocaleHandlerTest.kt @@ -22,6 +22,7 @@ import org.oppia.android.app.model.ProfileId import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.translation.TranslationController @@ -332,7 +333,7 @@ class AppLanguageLocaleHandlerTest { AssetModule::class, LocaleProdModule::class, FakeOppiaClockModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, PlatformParameterModule::class, - PlatformParameterSingletonModule::class + PlatformParameterSingletonModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt b/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt index 6e8faa783b2..ffb6f273680 100644 --- a/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt @@ -56,6 +56,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -596,7 +597,8 @@ class AppLanguageResourceHandlerTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt b/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt index 651f35655b0..71942a57a2a 100644 --- a/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt @@ -61,6 +61,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -275,7 +276,8 @@ class AppLanguageWatcherMixinTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel b/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel index 891a9399d13..052cf78e9b4 100644 --- a/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel @@ -17,6 +17,7 @@ oppia_android_test( "//domain", "//domain/src/main/java/org/oppia/android/domain/onboarding/testing:retriever_test_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/translation:translation_controller", "//testing", @@ -59,6 +60,7 @@ oppia_android_test( "//domain", "//domain/src/main/java/org/oppia/android/domain/onboarding/testing:retriever_test_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/translation:translation_controller", "//testing", @@ -107,6 +109,7 @@ oppia_android_test( "//data/src/main/java/org/oppia/android/data/backends/gae:prod_module", "//domain/src/main/java/org/oppia/android/domain/onboarding/testing:retriever_test_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/translation:translation_controller", "//testing", diff --git a/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt b/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt index 83b3c576bb9..287b7b4c1a0 100644 --- a/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt +++ b/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -188,7 +189,8 @@ class DateTimeUtilTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt b/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt index 139f75cb62d..4347ce41e26 100644 --- a/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt +++ b/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt @@ -68,6 +68,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -1334,7 +1335,8 @@ class MathExpressionAccessibilityUtilTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index 051b26fb6df..f69de1ff7e7 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -183,6 +183,7 @@ TEST_DEPS = [ "//domain/src/main/java/org/oppia/android/domain/onboarding:retriever_prod_module", "//domain/src/main/java/org/oppia/android/domain/onboarding:state_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing:fake_log_scheduler", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:logger_module", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserver.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserver.kt deleted file mode 100644 index 489e88a9e91..00000000000 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserver.kt +++ /dev/null @@ -1,100 +0,0 @@ -package org.oppia.android.domain.oppialogger.analytics - -import android.app.Activity -import android.app.Application -import android.os.Bundle -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch -import org.oppia.android.app.model.ScreenName -import org.oppia.android.app.model.ScreenName.BACKGROUND_SCREEN -import org.oppia.android.app.model.ScreenName.SCREEN_NAME_UNSPECIFIED -import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.domain.oppialogger.OppiaLogger -import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.system.OppiaClock -import org.oppia.android.util.threading.BackgroundDispatcher -import javax.inject.Inject -import javax.inject.Singleton - -/** Observer that observes activity lifecycle and further logs analytics events on its basis. */ -@Singleton -class ActivityLifecycleObserver @Inject constructor( - private val oppiaClock: OppiaClock, - private val application: Application, - private val performanceMetricsLogger: PerformanceMetricsLogger, - private val oppiaLogger: OppiaLogger, - @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher -) : Application.ActivityLifecycleCallbacks, ApplicationStartupListener { - - /** - * Timestamp indicating the time of application start-up. It will be used to calculate the - * cold-startup latency of the application. - * - * We're using a large Long value such that the time difference based on any timestamp will be - * negative and thus ignored until the app records initial time during [onCreate]. - */ - private var appStartTimeMillis: Long = Long.MAX_VALUE - - /** - * Returns a boolean flag that makes sure that startup latency is logged only once in the entire - * application lifecycle. - */ - private var isStartupLatencyLogged: Boolean = false - - private var currentScreen: ScreenName = SCREEN_NAME_UNSPECIFIED - - /** - * Returns the current active UI screen that's visible to the user. - * - * If the UI is inactive or the app backgrounded, [BACKGROUND_SCREEN] is returned. - */ - fun getCurrentScreen(): ScreenName = currentScreen - - override fun onCreate() { - appStartTimeMillis = oppiaClock.getCurrentTimeMs() - application.registerActivityLifecycleCallbacks(this) - - CoroutineScope(backgroundDispatcher).launch { - performanceMetricsLogger.logApkSize(currentScreen) - performanceMetricsLogger.logStorageUsage(currentScreen) - }.invokeOnCompletion { failure -> - if (failure != null) { - oppiaLogger.e( - "ActivityLifecycleObserver", - "Encountered error while trying to log app's performance metrics.", - failure - ) - } - } - } - - override fun onActivityResumed(activity: Activity) { - currentScreen = activity.intent.extractCurrentAppScreenName() - if (!isStartupLatencyLogged) { - performanceMetricsLogger.logStartupLatency( - getStartupLatencyMillis(appStartTimeMillis), - currentScreen - ) - isStartupLatencyLogged = true - } - performanceMetricsLogger.logMemoryUsage(currentScreen) - } - - override fun onActivityPaused(activity: Activity) { - currentScreen = BACKGROUND_SCREEN - } - - override fun onActivityCreated(activity: Activity, bundle: Bundle?) {} - - override fun onActivityStarted(activity: Activity) {} - - override fun onActivityStopped(activity: Activity) {} - - override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {} - - override fun onActivityDestroyed(activity: Activity) {} - - private fun getStartupLatencyMillis(initialTimestampMillis: Long): Long = - oppiaClock.getCurrentTimeMs() - initialTimestampMillis -} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModule.kt deleted file mode 100644 index 8c4545cef43..00000000000 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModule.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.oppia.android.domain.oppialogger.analytics - -import dagger.Binds -import dagger.Module -import dagger.multibindings.IntoSet -import org.oppia.android.domain.oppialogger.ApplicationStartupListener - -/** Binds [ActivityLifecycleObserver] as an [ApplicationStartupListener] */ -@Module -interface ActivityLifecycleObserverModule { - @Binds - @IntoSet - fun bindActivityLifecycleObserver( - activityLifecycleObserver: ActivityLifecycleObserver - ): ApplicationStartupListener -} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt index 5a9dd411387..0b38a58e7b4 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt @@ -1,5 +1,8 @@ package org.oppia.android.domain.oppialogger.analytics +import android.app.Activity +import android.app.Application +import android.os.Bundle import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.OnLifecycleEvent @@ -7,30 +10,78 @@ import androidx.lifecycle.ProcessLifecycleOwner import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch +import org.oppia.android.app.model.ScreenName +import org.oppia.android.app.model.ScreenName.BACKGROUND_SCREEN +import org.oppia.android.app.model.ScreenName.FOREGROUND_SCREEN import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.LoggingIdentifierController import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.profile.ProfileManagementController +import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_BACKGROUND +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_FOREGROUND +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.system.OppiaClock import org.oppia.android.util.threading.BackgroundDispatcher import javax.inject.Inject import javax.inject.Singleton -/** Observer that observes application lifecycle. */ +/** Observer that observes application and activity lifecycle. */ @Singleton class ApplicationLifecycleObserver @Inject constructor( + private val application: Application, private val oppiaClock: OppiaClock, private val loggingIdentifierController: LoggingIdentifierController, private val learnerAnalyticsLogger: LearnerAnalyticsLogger, private val profileManagementController: ProfileManagementController, private val oppiaLogger: OppiaLogger, + private val performanceMetricsLogger: PerformanceMetricsLogger, private val performanceMetricsController: PerformanceMetricsController, + private val cpuPerformanceSnapshotter: CpuPerformanceSnapshotter, @LearnerAnalyticsInactivityLimitMillis private val inactivityLimitMillis: Long, - @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher -) : ApplicationStartupListener, LifecycleObserver { + @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher, + @EnablePerformanceMetricsCollection + private val enablePerformanceMetricsCollection: PlatformParameterValue +) : ApplicationStartupListener, LifecycleObserver, Application.ActivityLifecycleCallbacks { + + /** + * Timestamp indicating the time of application start-up. It will be used to calculate the + * cold-startup latency of the application. + * + * We're using a large Long value such that the time difference based on any timestamp will be + * negative and thus ignored until the app records initial time during [onCreate]. + */ + private var appStartTimeMillis: Long = Long.MAX_VALUE + + /** + * Returns a boolean flag that makes sure that startup latency is logged only once in the entire + * application lifecycle. + */ + private var isStartupLatencyLogged: Boolean = false + + private var currentScreen: ScreenName = ScreenName.SCREEN_NAME_UNSPECIFIED + + /** + * Returns the current active UI screen that's visible to the user. + * + * A few exceptions: + * [BACKGROUND_SCREEN] is returned when the UI is inactive or when the app is backgrounded. + * [FOREGROUND_SCREEN] is never returned. + * [SCREEN_NAME_UNSPECIFIED] is the default value for [currentScreen] and is returned until a + * currentScreen value has been set by the launcher activity's onResume method. + */ + fun getCurrentScreen(): ScreenName = currentScreen + + /** Returns the time in millis at which the application started. */ + fun getAppStartupTimeMs(): Long = appStartTimeMillis override fun onCreate() { + appStartTimeMillis = oppiaClock.getCurrentTimeMs() ProcessLifecycleOwner.get().lifecycle.addObserver(this) + application.registerActivityLifecycleCallbacks(this) + logApplicationStartupMetrics() + cpuPerformanceSnapshotter.initialiseSnapshotter() } // Use a large Long value such that the time difference based on any timestamp will be negative @@ -40,22 +91,44 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application comes to foreground. */ @OnLifecycleEvent(Lifecycle.Event.ON_START) fun onAppInForeground() { - performanceMetricsController.setAppInForeground() val timeDifferenceMs = oppiaClock.getCurrentTimeMs() - firstTimestamp if (timeDifferenceMs > inactivityLimitMillis) { loggingIdentifierController.updateSessionId() } + if (enablePerformanceMetricsCollection.value) { + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + } + performanceMetricsController.setAppInForeground() logAppLifecycleEventInBackground(learnerAnalyticsLogger::logAppInForeground) } /** Occurs when application goes to background. */ @OnLifecycleEvent(Lifecycle.Event.ON_STOP) fun onAppInBackground() { - performanceMetricsController.setAppInBackground() firstTimestamp = oppiaClock.getCurrentTimeMs() + if (enablePerformanceMetricsCollection.value) { + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + } + performanceMetricsController.setAppInBackground() logAppLifecycleEventInBackground(learnerAnalyticsLogger::logAppInBackground) } + override fun onActivityResumed(activity: Activity) { + currentScreen = activity.intent.extractCurrentAppScreenName() + if (!isStartupLatencyLogged) { + performanceMetricsLogger.logStartupLatency( + getStartupLatencyMillis(appStartTimeMillis), + currentScreen + ) + isStartupLatencyLogged = true + } + performanceMetricsLogger.logMemoryUsage(currentScreen) + } + + override fun onActivityPaused(activity: Activity) { + currentScreen = BACKGROUND_SCREEN + } + private fun logAppLifecycleEventInBackground(logMethod: (String?, String?) -> Unit) { CoroutineScope(backgroundDispatcher).launch { val installationId = loggingIdentifierController.fetchInstallationId() @@ -71,4 +144,32 @@ class ApplicationLifecycleObserver @Inject constructor( } } } + + private fun logApplicationStartupMetrics() { + CoroutineScope(backgroundDispatcher).launch { + performanceMetricsLogger.logApkSize(currentScreen) + performanceMetricsLogger.logStorageUsage(currentScreen) + }.invokeOnCompletion { failure -> + if (failure != null) { + oppiaLogger.e( + "ActivityLifecycleObserver", + "Encountered error while trying to log app's performance metrics.", + failure + ) + } + } + } + + private fun getStartupLatencyMillis(initialTimestampMillis: Long): Long = + oppiaClock.getCurrentTimeMs() - initialTimestampMillis + + override fun onActivityCreated(activity: Activity, bundle: Bundle?) {} + + override fun onActivityStarted(activity: Activity) {} + + override fun onActivityStopped(activity: Activity) {} + + override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {} + + override fun onActivityDestroyed(activity: Activity) {} } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel index a991ab5b9fc..0f900a822bc 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel @@ -78,22 +78,20 @@ kt_android_library( ) kt_android_library( - name = "performance_metrics_logger_module", + name = "learner_analytics_inactivity_limit_millis", srcs = [ - "ActivityLifecycleObserverModule.kt", + "LearnerAnalyticsInactivityLimitMillis.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ - ":activity_lifecycle_observer", - ":dagger", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//third_party:javax_inject_javax_inject", ], ) kt_android_library( - name = "learner_analytics_inactivity_limit_millis", + name = "cpu_performance_logging_time_period_millis", srcs = [ - "LearnerAnalyticsInactivityLimitMillis.kt", + "CpuPerformanceLoggingTimePeriodMillis.kt", ], visibility = ["//:oppia_api_visibility"], deps = [ @@ -108,25 +106,44 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":cpu_performance_snapshotter", ":dagger", ":learner_analytics_inactivity_limit_millis", ":performance_metrics_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:performance_metrics_logger", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", + "//model/src/main/proto:screens_java_proto_lite", "//third_party:androidx_lifecycle_lifecycle-extensions", + "//utility/src/main/java/org/oppia/android/util/logging:current_app_screen_name_intent_decorator", "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", ], ) kt_android_library( - name = "activity_lifecycle_observer", + name = "prod_module", srcs = [ - "ActivityLifecycleObserver.kt", + "ApplicationLifecycleModule.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ + ":application_lifecycle_observer", ":dagger", + ":learner_analytics_inactivity_limit_millis", + ], +) + +kt_android_library( + name = "cpu_performance_snapshotter", + srcs = [ + "CpuPerformanceSnapshotter.kt", + ], + visibility = ["//:oppia_testing_visibility"], + deps = [ + ":cpu_performance_logging_time_period_millis", + ":dagger", + ":learner_analytics_inactivity_limit_millis", ":performance_metrics_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", @@ -135,18 +152,19 @@ kt_android_library( "//model/src/main/proto:screens_java_proto_lite", "//third_party:androidx_lifecycle_lifecycle-extensions", "//utility/src/main/java/org/oppia/android/util/logging:current_app_screen_name_intent_decorator", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", ], ) kt_android_library( - name = "prod_module", + name = "cpu_module", srcs = [ - "ApplicationLifecycleModule.kt", + "CpuPerformanceSnapshotterModule.kt", ], visibility = ["//:oppia_prod_module_visibility"], deps = [ - ":application_lifecycle_observer", + ":cpu_performance_snapshotter", ":dagger", ":learner_analytics_inactivity_limit_millis", ], diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceLoggingTimePeriodMillis.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceLoggingTimePeriodMillis.kt new file mode 100644 index 00000000000..c666ee702d2 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceLoggingTimePeriodMillis.kt @@ -0,0 +1,25 @@ +package org.oppia.android.domain.oppialogger.analytics + +import javax.inject.Qualifier + +/** + * Corresponds to an injectable application-level [Long] that corresponds to the number of + * milliseconds after which the foregrounded app logs another CPU usage metric event. + */ +@Qualifier +annotation class ForegroundCpuLoggingTimePeriodMillis + +/** + * Corresponds to an injectable application-level [Long] that corresponds to the number of + * milliseconds after which the backgrounded app logs another CPU usage metric event. + */ +@Qualifier +annotation class BackgroundCpuLoggingTimePeriodMillis + +/** + * Corresponds to an injectable application-level [Long] that corresponds to the number of + * milliseconds after which the initial iconification is set to background if it is uninitialized + * until that point. + */ +@Qualifier +annotation class InitialIconificationCutOffTimePeriodMillis diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotter.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotter.kt new file mode 100644 index 00000000000..51ae249d0ef --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotter.kt @@ -0,0 +1,230 @@ +package org.oppia.android.domain.oppialogger.analytics + +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.channels.SendChannel +import kotlinx.coroutines.channels.actor +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import org.oppia.android.app.model.ScreenName +import org.oppia.android.app.model.ScreenName.BACKGROUND_SCREEN +import org.oppia.android.app.model.ScreenName.FOREGROUND_SCREEN +import org.oppia.android.app.model.ScreenName.SCREEN_NAME_UNSPECIFIED +import org.oppia.android.util.logging.ConsoleLogger +import org.oppia.android.util.logging.ExceptionLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_BACKGROUND +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_FOREGROUND +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.UNINITIALIZED +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.CpuSnapshot + +/** + * Snapshotter that gracefully and sequentially logs CPU usage across foreground and background + * moves of the application. + */ +class CpuPerformanceSnapshotter( + private val backgroundCoroutineDispatcher: CoroutineDispatcher, + private val performanceMetricsLogger: PerformanceMetricsLogger, + private val consoleLogger: ConsoleLogger, + private val exceptionLogger: ExceptionLogger, + private val performanceMetricsAssessor: PerformanceMetricsAssessor, + private val foregroundCpuLoggingTimePeriodMillis: Long, + private val backgroundCpuLoggingTimePeriodMillis: Long, + private val initialIconificationCutOffTimePeriodMillis: Long +) { + + private var currentIconification = UNINITIALIZED + private var isSnapshotterInitialized = false + private val commandQueue by lazy { createCommandQueueActor() } + + /** + * Initialises the snapshotter by calling the commandQueue to start recording CPU Usage. + * + * It must be noted that the class can only be initialized once in the app's lifecycle. In case + * a re-initialization is attempted, the app will throw error. + */ + fun initialiseSnapshotter() { + require(!isSnapshotterInitialized) { + "CpuPerformanceSnapshotter: Class has already been initialized." + } + isSnapshotterInitialized = true + CoroutineScope(backgroundCoroutineDispatcher).launch { + delay(initialIconificationCutOffTimePeriodMillis) + if (currentIconification == UNINITIALIZED) { + sendSwitchIconificationCommand(APP_IN_BACKGROUND) + } + } + } + + /** + * Updates the current [AppIconification] in accordance with the app's state changes. + * + * This update only takes place if the app has been previously initialized and the + * [newIconification] does not equal to UNINITIALIZED. + */ + fun updateAppIconification(newIconification: AppIconification) { + if (newIconification != UNINITIALIZED && isSnapshotterInitialized) { + sendSwitchIconificationCommand(newIconification) + } + } + + private fun createCommandQueueActor(): SendChannel { + var previousSnapshot = performanceMetricsAssessor.computeCpuSnapshotAtCurrentTime() + var switchIconificationCount = 0 + val coroutineScope = CoroutineScope(backgroundCoroutineDispatcher) + return coroutineScope.actor(capacity = Channel.UNLIMITED) { + for (message in channel) { + when (message) { + is CommandMessage.SwitchIconification -> { + ++switchIconificationCount + if (currentIconification != UNINITIALIZED) { + // Since there's a switch in the current iconification of the app, we'd cut short the + // existing delay and log the current CPU usage relative to the previously logged one + // without this explicit log command. + performanceMetricsAssessor.getRelativeCpuUsage( + previousSnapshot, + performanceMetricsAssessor.computeCpuSnapshotAtCurrentTime() + )?.let { relativeCpuUsage -> + sendLogSnapshotDiffCommand(relativeCpuUsage, currentIconification) + } + } + currentIconification = message.newIconification + previousSnapshot = performanceMetricsAssessor.computeCpuSnapshotAtCurrentTime() + // Schedule CPU usage logging for the new app iconification. + sendScheduleTakeSnapshotCommand(currentIconification, switchIconificationCount) + } + is CommandMessage.ScheduleTakeSnapshot -> scheduleTakeSnapshot( + message.currentIconification, + switchIconificationCount + ) + is CommandMessage.TakeSnapshot -> { + if (message.switchId == switchIconificationCount) { + val newSnapshot = performanceMetricsAssessor.computeCpuSnapshotAtCurrentTime() + performanceMetricsAssessor.getRelativeCpuUsage( + previousSnapshot, + performanceMetricsAssessor.computeCpuSnapshotAtCurrentTime() + )?.let { relativeCpuUsage -> + sendLogSnapshotDiffCommand(relativeCpuUsage, currentIconification) + } + previousSnapshot = newSnapshot + sendScheduleTakeSnapshotCommand(currentIconification, switchIconificationCount) + } + } + is CommandMessage.LogSnapshotDiff -> { + performanceMetricsLogger.logCpuUsage( + message.screenName, + message.relativeCpuUsage + ) + } + } + } + } + } + + private fun sendSwitchIconificationCommand(newIconification: AppIconification) { + commandQueue.offer(CommandMessage.SwitchIconification(newIconification)).apply { + if (!this) { + val exception = IllegalStateException("Iconification switching failed") + consoleLogger.e( + "CpuPerformanceSnapshotter", + "Failure while switching AppIconification.", + exception + ) + exceptionLogger.logException(exception) + } + } + } + + private suspend fun sendScheduleTakeSnapshotCommand( + currentIconification: AppIconification, + switchId: Int + ) { commandQueue.send(CommandMessage.ScheduleTakeSnapshot(currentIconification, switchId)) } + + private suspend fun sendTakeSnapshotCommand(switchId: Int) { + commandQueue.send(CommandMessage.TakeSnapshot(switchId)) + } + + private suspend fun sendLogSnapshotDiffCommand( + relativeCpuUsage: Double, + currentIconification: AppIconification + ) { + commandQueue.send( + CommandMessage.LogSnapshotDiff( + relativeCpuUsage, + currentIconification.toScreenName() + ) + ) + } + + /** + * Schedules a delay on the basis of [currentIconification] and then sends the [CommandMessage] + * for taking a [CpuSnapshot] that'll be used for logging the relative CPU usage of the application. + */ + private fun scheduleTakeSnapshot(currentIconification: AppIconification, switchId: Int) { + CoroutineScope(backgroundCoroutineDispatcher).launch { + delay(currentIconification.getDelay()) + sendTakeSnapshotCommand(switchId) + }.invokeOnCompletion { + it?.let { + consoleLogger.e( + "PerformanceMetricsController", + "Failed to schedule a delay and send CommandMessage to log CPU usage.", + it + ) + } + } + } + + /** + * Represents a message that can be sent to [commandQueue] to process CPU usage logging. + * + * Messages are expected to be resolved serially (though their scheduling can occur across + * multiple threads, so order cannot be guaranteed until they're enqueued). + */ + private sealed class CommandMessage { + + /** [CommandMessage] for switching the current [AppIconification]. */ + data class SwitchIconification(val newIconification: AppIconification) : CommandMessage() + + /** + * [CommandMessage] that schedules [TakeSnapshot] for the [currentIconification] and [switchId] + * to take a [CpuSnapshot] and log CPU usage after a specific delay period. + */ + data class ScheduleTakeSnapshot( + val currentIconification: AppIconification, + val switchId: Int + ) : CommandMessage() + + /** + * [CommandMessage] that takes a real-time [CpuSnapshot] and calls [LogSnapshotDiff] for logging + * the relative CPU usage of the application. + * + * This relative CPU usage is calculated by comparing the real-time [CpuSnapshot] with a previous + * [CpuSnapshot]. The current [CpuSnapshot] is then put on as the previous [CpuSnapshot] for the next + * relative comparison. + */ + data class TakeSnapshot(val switchId: Int) : CommandMessage() + + /** [CommandMessage] for logging the relative CPU usage of the application. */ + data class LogSnapshotDiff( + val relativeCpuUsage: Double, + val screenName: ScreenName + ) : CommandMessage() + } + + /** Returns an appropriate [ScreenName] on the basis of [AppIconification]. */ + private fun AppIconification.toScreenName(): ScreenName = when (this) { + APP_IN_BACKGROUND -> BACKGROUND_SCREEN + APP_IN_FOREGROUND -> FOREGROUND_SCREEN + UNINITIALIZED -> SCREEN_NAME_UNSPECIFIED + } + + /** Returns an appropriate delay time period in millis on the basis of [AppIconification]. */ + private fun AppIconification.getDelay(): Long = when (this) { + APP_IN_BACKGROUND -> backgroundCpuLoggingTimePeriodMillis + APP_IN_FOREGROUND -> foregroundCpuLoggingTimePeriodMillis + UNINITIALIZED -> initialIconificationCutOffTimePeriodMillis + } +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModule.kt new file mode 100644 index 00000000000..feb8d01eddc --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModule.kt @@ -0,0 +1,50 @@ +package org.oppia.android.domain.oppialogger.analytics + +import dagger.Module +import dagger.Provides +import kotlinx.coroutines.CoroutineDispatcher +import org.oppia.android.util.logging.ConsoleLogger +import org.oppia.android.util.logging.ExceptionLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.threading.BackgroundDispatcher +import java.util.concurrent.TimeUnit +import javax.inject.Singleton + +/** Provides dependencies that are needed for logging CPU usage. */ +@Module +class CpuPerformanceSnapshotterModule { + + @Singleton + @Provides + fun providesCpuPerformanceSnapshotter( + performanceMetricsLogger: PerformanceMetricsLogger, + consoleLogger: ConsoleLogger, + exceptionLogger: ExceptionLogger, + performanceMetricsAssessor: PerformanceMetricsAssessor, + @BackgroundDispatcher backgroundCoroutineDispatcher: CoroutineDispatcher, + @ForegroundCpuLoggingTimePeriodMillis foregroundCpuLoggingTimePeriodMillis: Long, + @BackgroundCpuLoggingTimePeriodMillis backgroundCpuLoggingTimePeriodMillis: Long, + @InitialIconificationCutOffTimePeriodMillis initialIconificationCutOffTimePeriodMillis: Long + ): CpuPerformanceSnapshotter = CpuPerformanceSnapshotter( + backgroundCoroutineDispatcher, + performanceMetricsLogger, + consoleLogger, + exceptionLogger, + performanceMetricsAssessor, + foregroundCpuLoggingTimePeriodMillis, + backgroundCpuLoggingTimePeriodMillis, + initialIconificationCutOffTimePeriodMillis + ) + + @Provides + @ForegroundCpuLoggingTimePeriodMillis + fun provideForegroundCpuLoggingTimePeriodMillis(): Long = TimeUnit.MINUTES.toMillis(5) + + @Provides + @BackgroundCpuLoggingTimePeriodMillis + fun provideBackgroundCpuLoggingTimePeriodMillis(): Long = TimeUnit.MINUTES.toMillis(60) + + @Provides + @InitialIconificationCutOffTimePeriodMillis + fun provideInitialIconificationCutOffTimePeriodMillis(): Long = TimeUnit.SECONDS.toMillis(60) +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt index 1a41b275428..710679e58f3 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt @@ -11,6 +11,7 @@ import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.networking.ConnectionStatus import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject @@ -114,6 +115,7 @@ class PerformanceMetricsController @Inject constructor( this.isAppInForeground = this@PerformanceMetricsController.isAppInForeground this.storageTier = performanceMetricsAssessor.getDeviceStorageTier() this.memoryTier = performanceMetricsAssessor.getDeviceMemoryTier() + this.networkType = networkConnectionUtil.getCurrentConnectionStatus().toNetworkType() }.build() } @@ -191,4 +193,13 @@ class PerformanceMetricsController @Inject constructor( /** Returns a boolean value indicating whether the application is currently in foreground or not. */ fun getIsAppInForeground() = this.isAppInForeground + + private fun ConnectionStatus.toNetworkType(): OppiaMetricLog.NetworkType { + return when (this) { + NetworkConnectionUtil.ProdConnectionStatus.NONE -> OppiaMetricLog.NetworkType.NONE + NetworkConnectionUtil.ProdConnectionStatus.LOCAL -> OppiaMetricLog.NetworkType.WIFI + NetworkConnectionUtil.ProdConnectionStatus.CELLULAR -> OppiaMetricLog.NetworkType.CELLULAR + else -> OppiaMetricLog.NetworkType.UNRECOGNIZED + } + } } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt index 5ba57bead6a..8592ad19a5f 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt @@ -3,6 +3,8 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.ScreenName import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.system.OppiaClock import javax.inject.Inject import javax.inject.Singleton @@ -17,7 +19,9 @@ import javax.inject.Singleton class PerformanceMetricsLogger @Inject constructor( private val performanceMetricsController: PerformanceMetricsController, private val performanceMetricsAssessor: PerformanceMetricsAssessor, - private val oppiaClock: OppiaClock + private val oppiaClock: OppiaClock, + @EnablePerformanceMetricsCollection + private val enablePerformanceMetricsCollection: PlatformParameterValue ) { /** @@ -28,11 +32,13 @@ class PerformanceMetricsLogger @Inject constructor( * @param currentScreen denotes the application screen at which this metric has been logged */ fun logApkSize(currentScreen: ScreenName) { - performanceMetricsController.logLowPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - createApkSizeLoggableMetric(performanceMetricsAssessor.getApkSize()) - ) + if (enablePerformanceMetricsCollection.value) { + performanceMetricsController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + createApkSizeLoggableMetric(performanceMetricsAssessor.getApkSize()) + ) + } } /** @@ -43,11 +49,13 @@ class PerformanceMetricsLogger @Inject constructor( * @param currentScreen denotes the application screen at which this metric has been logged */ fun logStorageUsage(currentScreen: ScreenName) { - performanceMetricsController.logLowPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - createStorageUsageLoggableMetric(performanceMetricsAssessor.getUsedStorage()) - ) + if (enablePerformanceMetricsCollection.value) { + performanceMetricsController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + createStorageUsageLoggableMetric(performanceMetricsAssessor.getUsedStorage()) + ) + } } /** @@ -58,7 +66,7 @@ class PerformanceMetricsLogger @Inject constructor( * @param currentScreen denotes the application screen at which this metric has been logged */ fun logStartupLatency(startupLatency: Long, currentScreen: ScreenName) { - if (startupLatency >= 0) { + if (startupLatency >= 0 && enablePerformanceMetricsCollection.value) { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), currentScreen, @@ -75,11 +83,13 @@ class PerformanceMetricsLogger @Inject constructor( * @param currentScreen denotes the application screen at which this metric has been logged */ fun logMemoryUsage(currentScreen: ScreenName) { - performanceMetricsController.logMediumPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - createMemoryUsageLoggableMetric(performanceMetricsAssessor.getTotalPssUsed()) - ) + if (enablePerformanceMetricsCollection.value) { + performanceMetricsController.logMediumPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + createMemoryUsageLoggableMetric(performanceMetricsAssessor.getTotalPssUsed()) + ) + } } /** @@ -90,30 +100,35 @@ class PerformanceMetricsLogger @Inject constructor( * @param currentScreen denotes the application screen at which this metric has been logged */ fun logNetworkUsage(currentScreen: ScreenName) { - performanceMetricsController.logHighPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - createNetworkUsageLoggableMetric( - performanceMetricsAssessor.getTotalReceivedBytes(), - performanceMetricsAssessor.getTotalSentBytes() + if (enablePerformanceMetricsCollection.value) { + performanceMetricsController.logHighPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + createNetworkUsageLoggableMetric( + performanceMetricsAssessor.getTotalReceivedBytes(), + performanceMetricsAssessor.getTotalSentBytes() + ) ) - ) + } } /** - * Logs the cpu usage of the application as a performance metric for the current state of the + * Logs the CPU usage of the application as a performance metric for the current state of the * app. It must be noted that the value of this metric will change across calls during the same * application instance. * * @param currentScreen denotes the application screen at which this metric has been logged - * @param cpuUsage denotes the current cpu usage of the application + * @param cpuUsage denotes the relative CPU usage of the application which is measured across two + * time-separated points in the application. */ - fun logCpuUsage(cpuUsage: Long, currentScreen: ScreenName) { - performanceMetricsController.logHighPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - createCpuUsageLoggableMetric(cpuUsage) - ) + fun logCpuUsage(currentScreen: ScreenName, cpuUsage: Double) { + if (enablePerformanceMetricsCollection.value) { + performanceMetricsController.logHighPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + createCpuUsageLoggableMetric(cpuUsage) + ) + } } internal companion object { @@ -123,7 +138,7 @@ class PerformanceMetricsLogger @Inject constructor( * This will schedule a background upload of the event if there's internet connectivity, otherwise * it will cache the event for a later upload. * - * This method should only be used for logging periodic metrics like network and cpu usage of the + * This method should only be used for logging periodic metrics like network and CPU usage of the * application. These metrics are important to log and should be prioritized over metrics logged * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. */ @@ -263,7 +278,7 @@ class PerformanceMetricsLogger @Inject constructor( * CPU used by the application on user's device. */ private fun createCpuUsageLoggableMetric( - cpuUsage: Long + cpuUsage: Double ): OppiaMetricLog.LoggableMetric { return OppiaMetricLog.LoggableMetric.newBuilder() .setCpuUsageMetric( diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel index fbbcdc080ba..8b62f56b4ac 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel @@ -24,7 +24,7 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:activity_lifecycle_observer", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:application_lifecycle_observer", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:performance_metrics_logger", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", "//domain/src/main/java/org/oppia/android/domain/util:extensions", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt index de34dad9965..36d1a9b05e1 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.async import org.oppia.android.app.model.ScreenName.BACKGROUND_SCREEN -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserver +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleObserver import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLogger import org.oppia.android.domain.util.getStringFromData import org.oppia.android.util.logging.ConsoleLogger @@ -25,7 +25,7 @@ class MetricLogSchedulingWorker private constructor( params: WorkerParameters, private val consoleLogger: ConsoleLogger, private val performanceMetricsLogger: PerformanceMetricsLogger, - private val activityLifecycleObserver: ActivityLifecycleObserver, + private val applicationLifecycleObserver: ApplicationLifecycleObserver, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) : ListenableWorker(context, params) { @@ -80,7 +80,6 @@ class MetricLogSchedulingWorker private constructor( private fun schedulePeriodicBackgroundMetricLogging(): Result { return try { performanceMetricsLogger.logNetworkUsage(BACKGROUND_SCREEN) - // TODO(#4466): Add functionality to log cpu usage performance metrics. Result.success() } catch (e: Exception) { consoleLogger.e(TAG, e.toString(), e) @@ -100,7 +99,7 @@ class MetricLogSchedulingWorker private constructor( private fun schedulePeriodicUiMetricLogging(): Result { return try { - val currentScreen = activityLifecycleObserver.getCurrentScreen() + val currentScreen = applicationLifecycleObserver.getCurrentScreen() performanceMetricsLogger.logMemoryUsage(currentScreen) Result.success() } catch (e: Exception) { @@ -113,7 +112,7 @@ class MetricLogSchedulingWorker private constructor( class Factory @Inject constructor( private val consoleLogger: ConsoleLogger, private val performanceMetricsLogger: PerformanceMetricsLogger, - private val activityLifecycleObserver: ActivityLifecycleObserver, + private val applicationLifecycleObserver: ApplicationLifecycleObserver, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) { /** @@ -128,7 +127,7 @@ class MetricLogSchedulingWorker private constructor( params, consoleLogger, performanceMetricsLogger, - activityLifecycleObserver, + applicationLifecycleObserver, backgroundDispatcher ) } diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverTest.kt deleted file mode 100644 index fbf65e2da90..00000000000 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverTest.kt +++ /dev/null @@ -1,323 +0,0 @@ -package org.oppia.android.domain.oppialogger.analytics - -import android.app.Application -import android.content.Context -import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.rules.ActivityScenarioRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.google.common.truth.Truth.assertThat -import dagger.BindsInstance -import dagger.Component -import dagger.Module -import dagger.Provides -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC -import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC -import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STARTUP_LATENCY_METRIC -import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STORAGE_USAGE_METRIC -import org.oppia.android.app.model.ScreenName -import org.oppia.android.domain.oppialogger.ApplicationIdSeed -import org.oppia.android.domain.oppialogger.LogStorageModule -import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule -import org.oppia.android.testing.FakePerformanceMetricsEventLogger -import org.oppia.android.testing.TestLogReportingModule -import org.oppia.android.testing.TextInputActionTestActivity -import org.oppia.android.testing.robolectric.RobolectricModule -import org.oppia.android.testing.threading.TestCoroutineDispatchers -import org.oppia.android.testing.threading.TestDispatcherModule -import org.oppia.android.testing.time.FakeOppiaClock -import org.oppia.android.testing.time.FakeOppiaClockModule -import org.oppia.android.util.data.DataProvidersInjector -import org.oppia.android.util.data.DataProvidersInjectorProvider -import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName -import org.oppia.android.util.logging.EnableConsoleLog -import org.oppia.android.util.logging.EnableFileLog -import org.oppia.android.util.logging.GlobalLogLevel -import org.oppia.android.util.logging.LogLevel -import org.oppia.android.util.logging.SyncStatusModule -import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PlatformParameterValue -import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg -import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton - -private const val TEST_TIMESTAMP_IN_MILLIS_ONE = 1556094000000 -private const val TEST_TIMESTAMP_IN_MILLIS_TWO = 1556094100000 - -/** Tests for [ActivityLifecycleObserver]. */ -// FunctionName: test names are conventionally named with underscores. -@Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) -@LooperMode(LooperMode.Mode.PAUSED) -@Config(application = ActivityLifecycleObserverTest.TestApplication::class) -class ActivityLifecycleObserverTest { - - @get:Rule - var activityRule = - ActivityScenarioRule( - TextInputActionTestActivity.createIntent(ApplicationProvider.getApplicationContext()).apply { - decorateWithScreenName(ScreenName.HOME_ACTIVITY) - } - ) - - @get:Rule - var activityRuleForUnspecifiedActivity = - ActivityScenarioRule( - TextInputActionTestActivity.createIntent(ApplicationProvider.getApplicationContext()) - ) - - @Inject - lateinit var activityLifecycleObserver: ActivityLifecycleObserver - - @Inject - lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger - - @Inject - lateinit var fakeOppiaClock: FakeOppiaClock - - @Inject - lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - - @Before - fun setUp() { - setUpTestApplicationComponent() - fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) - fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_ONE) - } - - @Test - fun testObserver_getCurrentScreen_verifyInitialValueIsUnspecified() { - assertThat(activityLifecycleObserver.getCurrentScreen()) - .isEqualTo(ScreenName.SCREEN_NAME_UNSPECIFIED) - } - - @Test - fun testObserver_onUnspecifiedActivityResume_verifyCurrentScreenReturnsUnspecifiedValue() { - activityRuleForUnspecifiedActivity.scenario.onActivity { activity -> - activityLifecycleObserver.onActivityResumed(activity) - val currentScreenValue = activityLifecycleObserver.getCurrentScreen() - assertThat(currentScreenValue).isEqualTo(ScreenName.SCREEN_NAME_UNSPECIFIED) - } - } - - @Test - fun testObserver_onCreate_verifyPerformanceMetricsLoggingWithCorrectDetails() { - activityLifecycleObserver.onCreate() - testCoroutineDispatchers.runCurrent() - - val loggedMetrics = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(2) - assertThat(loggedMetrics[0].loggableMetric.loggableMetricTypeCase).isEqualTo(APK_SIZE_METRIC) - assertThat(loggedMetrics[1].loggableMetric.loggableMetricTypeCase).isEqualTo( - STORAGE_USAGE_METRIC - ) - assertThat(loggedMetrics[0].timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) - assertThat(loggedMetrics[1].timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) - } - - @Test - fun testObserver_onFirstActivityResume_verifyCurrentScreenReturnsCorrectValue() { - activityRule.scenario.onActivity { activity -> - activityLifecycleObserver.onActivityResumed(activity) - val currentScreenValue = activityLifecycleObserver.getCurrentScreen() - assertThat(currentScreenValue).isEqualTo(ScreenName.HOME_ACTIVITY) - } - } - - @Test - fun testObserver_onFirstActivityResume_verifyLogsStartupLatency() { - activityLifecycleObserver.onCreate() - testCoroutineDispatchers.runCurrent() - fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_TWO) - activityRule.scenario.onActivity { activity -> - val expectedStartupLatency = TEST_TIMESTAMP_IN_MILLIS_TWO - TEST_TIMESTAMP_IN_MILLIS_ONE - activityLifecycleObserver.onActivityResumed(activity) - val startupLatencyEvents = - fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(3) - val startupLatencyEvent = startupLatencyEvents[1] - - assertThat(startupLatencyEvent.loggableMetric.loggableMetricTypeCase).isEqualTo( - STARTUP_LATENCY_METRIC - ) - assertThat(startupLatencyEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_TWO) - assertThat(startupLatencyEvent.currentScreen).isEqualTo(ScreenName.HOME_ACTIVITY) - assertThat(startupLatencyEvent.loggableMetric.startupLatencyMetric.startupLatencyMillis) - .isEqualTo(expectedStartupLatency) - } - } - - @Test - fun testObserver_onSecondActivityResume_verifyStartupLatencyIsLoggedOnce() { - activityLifecycleObserver.onCreate() - testCoroutineDispatchers.runCurrent() - fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_TWO) - activityRule.scenario.onActivity { activity -> - activityLifecycleObserver.onActivityResumed(activity) - activityLifecycleObserver.onActivityResumed(activity) - - val loggedEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( - fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() - ) - - assertThat(loggedEvents.size).isEqualTo(5) - assertThat(loggedEvents[0].loggableMetric.loggableMetricTypeCase).isEqualTo(APK_SIZE_METRIC) - assertThat(loggedEvents[1].loggableMetric.loggableMetricTypeCase) - .isEqualTo(STORAGE_USAGE_METRIC) - assertThat(loggedEvents[2].loggableMetric.loggableMetricTypeCase) - .isEqualTo(STARTUP_LATENCY_METRIC) - assertThat(loggedEvents[3].loggableMetric.loggableMetricTypeCase) - .isEqualTo(MEMORY_USAGE_METRIC) - assertThat(loggedEvents[4].loggableMetric.loggableMetricTypeCase) - .isEqualTo(MEMORY_USAGE_METRIC) - } - } - - @Test - fun testObserver_activityResumed_verifyLogsMemoryUsage() { - activityRule.scenario.onActivity { activity -> - activityLifecycleObserver.onActivityResumed(activity) - - val memoryUsageEvent = - fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() - - assertThat(memoryUsageEvent.loggableMetric.loggableMetricTypeCase).isEqualTo( - MEMORY_USAGE_METRIC - ) - assertThat(memoryUsageEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) - assertThat(memoryUsageEvent.currentScreen).isEqualTo(ScreenName.HOME_ACTIVITY) - } - } - - @Test - fun testObserver_activityResumed_activityPaused_verifyCurrentScreenReturnsBackgroundValue() { - activityRule.scenario.onActivity { activity -> - activityLifecycleObserver.onActivityResumed(activity) - activityLifecycleObserver.onActivityPaused(activity) - val currentScreen = activityLifecycleObserver.getCurrentScreen() - - assertThat(currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) - } - } - - private fun setUpTestApplicationComponent() { - ApplicationProvider.getApplicationContext().inject(this) - } - - // TODO(#89): Move this to a common test application component. - @Module - class TestModule { - @Provides - @Singleton - fun provideContext(application: Application): Context { - return application - } - - // TODO(#59): Either isolate these to their own shared test module, or use the real logging - // module in tests to avoid needing to specify these settings for tests. - @EnableConsoleLog - @Provides - fun provideEnableConsoleLog(): Boolean = true - - @EnableFileLog - @Provides - fun provideEnableFileLog(): Boolean = false - - @GlobalLogLevel - @Provides - fun provideGlobalLogLevel(): LogLevel = LogLevel.VERBOSE - } - - @Module - class TestLoggingIdentifierModule { - companion object { - const val applicationIdSeed = 1L - } - - @Provides - @ApplicationIdSeed - fun provideApplicationIdSeed(): Long = applicationIdSeed - } - - @Module - class TestPlatformParameterModule { - companion object { - var forceLearnerAnalyticsStudy: Boolean = false - } - - @Provides - @SplashScreenWelcomeMsg - fun provideSplashScreenWelcomeMsgParam(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE) - } - - @Provides - @SyncUpWorkerTimePeriodHours - fun provideSyncUpWorkerTimePeriod(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE - ) - } - - @Provides - @EnableLanguageSelectionUi - fun provideEnableLanguageSelectionUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE - ) - } - - @Provides - @LearnerStudyAnalytics - fun provideLearnerStudyAnalytics(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(forceLearnerAnalyticsStudy) - } - } - - // TODO(#89): Move this to a common test application component. - @Singleton - @Component( - modules = [ - TestModule::class, TestLogReportingModule::class, LogStorageModule::class, - TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, - NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, - TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, - TestLoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class, ActivityLifecycleObserverModule::class - ] - ) - interface TestApplicationComponent : DataProvidersInjector { - @Component.Builder - interface Builder { - @BindsInstance - fun setApplication(application: Application): Builder - fun build(): TestApplicationComponent - } - - fun inject(activityLifecycleObserverTest: ActivityLifecycleObserverTest) - } - - class TestApplication : Application(), DataProvidersInjectorProvider { - private val component: TestApplicationComponent by lazy { - DaggerActivityLifecycleObserverTest_TestApplicationComponent.builder() - .setApplication(this) - .build() - } - - fun inject(activityLifecycleObserverTest: ActivityLifecycleObserverTest) { - component.inject(activityLifecycleObserverTest) - } - - override fun getDataProvidersInjector(): DataProvidersInjector = component - } -} diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleModuleTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleModuleTest.kt index 6c332314dd0..ebe4684dbee 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleModuleTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleModuleTest.kt @@ -19,6 +19,7 @@ import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.testing.time.FakeOppiaClockModule @@ -28,14 +29,6 @@ import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PlatformParameterValue -import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg -import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import java.util.concurrent.TimeUnit @@ -98,42 +91,6 @@ class ApplicationLifecycleModuleTest { fun provideApplicationIdSeed(): Long = applicationIdSeed } - @Module - class TestPlatformParameterModule { - - companion object { - var forceLearnerAnalyticsStudy: Boolean = false - } - - @Provides - @SplashScreenWelcomeMsg - fun provideSplashScreenWelcomeMsgParam(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE) - } - - @Provides - @SyncUpWorkerTimePeriodHours - fun provideSyncUpWorkerTimePeriod(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE - ) - } - - @Provides - @EnableLanguageSelectionUi - fun provideEnableLanguageSelectionUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE - ) - } - - @Provides - @LearnerStudyAnalytics - fun provideLearnerStudyAnalytics(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(forceLearnerAnalyticsStudy) - } - } - // TODO(#89): Move this to a common test application component. @Singleton @Component( @@ -143,7 +100,7 @@ class ApplicationLifecycleModuleTest { NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, TestLoggingIdentifierModule::class, ApplicationLifecycleModule::class, - LoggerModule::class, SyncStatusModule::class + LoggerModule::class, SyncStatusModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserverTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserverTest.kt index 2127964d663..d1e51da4a69 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserverTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserverTest.kt @@ -3,24 +3,32 @@ package org.oppia.android.domain.oppialogger.analytics import android.app.Application import android.content.Context import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides +import org.junit.After +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ScreenName import org.oppia.android.domain.oppialogger.ApplicationIdSeed import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierController import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.profile.ProfileManagementController import org.oppia.android.testing.FakeEventLogger +import org.oppia.android.testing.FakePerformanceMetricsEventLogger import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.TextInputActionTestActivity import org.oppia.android.testing.data.DataProviderTestMonitor import org.oppia.android.testing.logging.EventLogSubject.Companion.assertThat +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -29,26 +37,22 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.data.DataProvidersInjector import org.oppia.android.util.data.DataProvidersInjectorProvider import org.oppia.android.util.locale.LocaleProdModule +import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName import org.oppia.android.util.logging.EnableConsoleLog import org.oppia.android.util.logging.EnableFileLog import org.oppia.android.util.logging.GlobalLogLevel import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PlatformParameterValue -import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg -import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +private const val TEST_TIMESTAMP_IN_MILLIS_ONE = 1556094000000 +private const val TEST_TIMESTAMP_IN_MILLIS_TWO = 1556094100000 + /** Tests for [ApplicationLifecycleObserver]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @@ -56,14 +60,65 @@ import javax.inject.Singleton @LooperMode(LooperMode.Mode.PAUSED) @Config(application = ApplicationLifecycleObserverTest.TestApplication::class) class ApplicationLifecycleObserverTest { - @Inject lateinit var loggingIdentifierController: LoggingIdentifierController - @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - @Inject lateinit var applicationLifecycleObserver: ApplicationLifecycleObserver - @Inject lateinit var fakeOppiaClock: FakeOppiaClock - @Inject lateinit var monitorFactory: DataProviderTestMonitor.Factory - @Inject lateinit var fakeEventLogger: FakeEventLogger - @Inject lateinit var profileManagementController: ProfileManagementController - @Inject lateinit var performanceMetricsController: PerformanceMetricsController + @Inject + lateinit var loggingIdentifierController: LoggingIdentifierController + + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + + @Inject + lateinit var applicationLifecycleObserver: ApplicationLifecycleObserver + + @Inject + lateinit var fakeOppiaClock: FakeOppiaClock + + @Inject + lateinit var monitorFactory: DataProviderTestMonitor.Factory + + @Inject + lateinit var fakeEventLogger: FakeEventLogger + + @Inject + lateinit var profileManagementController: ProfileManagementController + + @Inject + lateinit var performanceMetricsController: PerformanceMetricsController + + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + + @field:[JvmField Inject ForegroundCpuLoggingTimePeriodMillis] + var foregroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE + + @field:[JvmField Inject BackgroundCpuLoggingTimePeriodMillis] + var backgroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE + + @get:Rule + var activityRule = + ActivityScenarioRule( + TextInputActionTestActivity.createIntent(ApplicationProvider.getApplicationContext()).apply { + decorateWithScreenName(ScreenName.HOME_ACTIVITY) + } + ) + + @get:Rule + var activityRuleForUnspecifiedActivity = + ActivityScenarioRule( + TextInputActionTestActivity.createIntent(ApplicationProvider.getApplicationContext()) + ) + + @After + fun tearDown() { + TestPlatformParameterModule.reset() + } + + @Test + fun testObserver_withDisabledMetricsCollection_doesNotLogAnyEvent() { + setUpTestApplicationComponent() + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } @Test fun testObserver_getSessionId_backgroundApp_thenForeground_limitExceeded_sessionIdUpdated() { @@ -169,6 +224,150 @@ class ApplicationLifecycleObserverTest { assertThat(performanceMetricsController.getIsAppInForeground()).isFalse() } + @Test + fun testObserver_getCurrentScreen_verifyInitialValueIsUnspecified() { + setUpTestApplicationComponent() + assertThat(applicationLifecycleObserver.getCurrentScreen()) + .isEqualTo(ScreenName.SCREEN_NAME_UNSPECIFIED) + } + + @Test + fun testObserver_onUnspecifiedActivityResume_verifyCurrentScreenReturnsUnspecifiedValue() { + setUpTestApplicationComponent() + activityRuleForUnspecifiedActivity.scenario.onActivity { activity -> + applicationLifecycleObserver.onActivityResumed(activity) + val currentScreenValue = applicationLifecycleObserver.getCurrentScreen() + assertThat(currentScreenValue).isEqualTo(ScreenName.SCREEN_NAME_UNSPECIFIED) + } + } + + @Test + fun testObserver_onCreate_performanceMetricsLoggingWithCorrectDetailsOccurs() { + setUpTestApplicationWithPerformanceMetricsCollection() + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + + val loggedMetrics = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(2) + assertThat(loggedMetrics[0].loggableMetric.loggableMetricTypeCase) + .isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC) + assertThat(loggedMetrics[1].loggableMetric.loggableMetricTypeCase).isEqualTo( + OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STORAGE_USAGE_METRIC + ) + assertThat(loggedMetrics[0].timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) + assertThat(loggedMetrics[1].timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) + } + + @Test + fun testObserver_onFirstActivityResume_verifyCurrentScreenReturnsCorrectValue() { + setUpTestApplicationComponent() + activityRule.scenario.onActivity { activity -> + applicationLifecycleObserver.onActivityResumed(activity) + val currentScreenValue = applicationLifecycleObserver.getCurrentScreen() + assertThat(currentScreenValue).isEqualTo(ScreenName.HOME_ACTIVITY) + } + } + + @Test + fun testObserver_onFirstActivityResume_logsStartupLatency() { + setUpTestApplicationWithPerformanceMetricsCollection() + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_TWO) + activityRule.scenario.onActivity { activity -> + val expectedStartupLatency = TEST_TIMESTAMP_IN_MILLIS_TWO - TEST_TIMESTAMP_IN_MILLIS_ONE + applicationLifecycleObserver.onActivityResumed(activity) + val startupLatencyEvents = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(3) + val startupLatencyEvent = startupLatencyEvents[1] + + assertThat(startupLatencyEvent.loggableMetric.loggableMetricTypeCase).isEqualTo( + OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STARTUP_LATENCY_METRIC + ) + assertThat(startupLatencyEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_TWO) + assertThat(startupLatencyEvent.currentScreen).isEqualTo(ScreenName.HOME_ACTIVITY) + assertThat(startupLatencyEvent.loggableMetric.startupLatencyMetric.startupLatencyMillis) + .isEqualTo(expectedStartupLatency) + } + } + + @Test + fun testObserver_onSecondActivityResume_startupLatencyIsLoggedOnce() { + setUpTestApplicationWithPerformanceMetricsCollection() + + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_TWO) + activityRule.scenario.onActivity { activity -> + applicationLifecycleObserver.onActivityResumed(activity) + applicationLifecycleObserver.onActivityResumed(activity) + + val loggedStartupLatencyEvents = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + ).filter { + it.loggableMetric.hasStartupLatencyMetric() + } + + assertThat(loggedStartupLatencyEvents.size).isEqualTo(1) + } + } + + @Test + fun testObserver_activityResumed_logsMemoryUsage() { + setUpTestApplicationWithPerformanceMetricsCollection() + + activityRule.scenario.onActivity { activity -> + applicationLifecycleObserver.onActivityResumed(activity) + + val memoryUsageEvent = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(memoryUsageEvent.loggableMetric.loggableMetricTypeCase).isEqualTo( + OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC + ) + assertThat(memoryUsageEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP_IN_MILLIS_ONE) + assertThat(memoryUsageEvent.currentScreen).isEqualTo(ScreenName.HOME_ACTIVITY) + } + } + + @Test + fun testObserver_activityResumed_activityPaused_currentScreenReturnsBackgroundValue() { + setUpTestApplicationComponent() + activityRule.scenario.onActivity { activity -> + applicationLifecycleObserver.onActivityResumed(activity) + applicationLifecycleObserver.onActivityPaused(activity) + val currentScreen = applicationLifecycleObserver.getCurrentScreen() + + assertThat(currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + } + + @Test + fun testObserver_onAppInForeground_logsCpuUsageWithCurrentScreenForeground() { + setUpTestApplicationWithPerformanceMetricsCollection() + applicationLifecycleObserver.onCreate() + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event.currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testObserver_onAppInBackground_logsCpuUsageWithCurrentScreenBackground() { + setUpTestApplicationWithPerformanceMetricsCollection() + applicationLifecycleObserver.onCreate() + applicationLifecycleObserver.onAppInBackground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event.currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + private fun waitInBackgroundFor(millis: Long) { applicationLifecycleObserver.onAppInBackground() testCoroutineDispatchers.runCurrent() @@ -196,12 +395,19 @@ class ApplicationLifecycleObserverTest { } private fun setUpTestApplicationWithLearnerStudy() { - TestPlatformParameterModule.forceLearnerAnalyticsStudy = true + TestPlatformParameterModule.forceEnableLearnerStudyAnalytics(true) + setUpTestApplicationComponent() + } + + private fun setUpTestApplicationWithPerformanceMetricsCollection() { + TestPlatformParameterModule.forceEnablePerformanceMetricsCollection(true) setUpTestApplicationComponent() } private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP_IN_MILLIS_ONE) } // TODO(#89): Move this to a common test application component. @@ -239,41 +445,6 @@ class ApplicationLifecycleObserverTest { fun provideApplicationIdSeed(): Long = applicationIdSeed } - @Module - class TestPlatformParameterModule { - companion object { - var forceLearnerAnalyticsStudy: Boolean = false - } - - @Provides - @SplashScreenWelcomeMsg - fun provideSplashScreenWelcomeMsgParam(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE) - } - - @Provides - @SyncUpWorkerTimePeriodHours - fun provideSyncUpWorkerTimePeriod(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE - ) - } - - @Provides - @EnableLanguageSelectionUi - fun provideEnableLanguageSelectionUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE - ) - } - - @Provides - @LearnerStudyAnalytics - fun provideLearnerStudyAnalytics(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter(forceLearnerAnalyticsStudy) - } - } - // TODO(#89): Move this to a common test application component. @Singleton @Component( @@ -283,7 +454,7 @@ class ApplicationLifecycleObserverTest { NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, TestLoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel index e1cfbe236f8..4f297af4edb 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel @@ -43,9 +43,11 @@ oppia_android_test( test_manifest = "//domain:test_manifest", deps = [ ":dagger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//testing", "//testing/src/main/java/org/oppia/android/testing/data:data_provider_test_monitor", + "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module", "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", "//testing/src/main/java/org/oppia/android/testing/threading:test_coroutine_dispatchers", "//testing/src/main/java/org/oppia/android/testing/threading:test_module", @@ -69,10 +71,12 @@ oppia_android_test( test_manifest = "//domain:test_manifest", deps = [ ":dagger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:cpu_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//testing", "//testing/src/main/java/org/oppia/android/testing/data:data_provider_test_monitor", "//testing/src/main/java/org/oppia/android/testing/logging:event_log_subject", + "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module", "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", "//testing/src/main/java/org/oppia/android/testing/threading:test_coroutine_dispatchers", "//testing/src/main/java/org/oppia/android/testing/threading:test_module", diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModuleTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModuleTest.kt similarity index 66% rename from domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModuleTest.kt rename to domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModuleTest.kt index 84cf132055c..25d84be598b 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/ActivityLifecycleObserverModuleTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModuleTest.kt @@ -9,13 +9,14 @@ import dagger.Binds import dagger.BindsInstance import dagger.Component import dagger.Module +import dagger.Provides import dagger.multibindings.Multibinds import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.oppia.android.domain.oppialogger.ApplicationIdSeed import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.LogStorageModule -import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.platformparameter.TestPlatformParameterModule @@ -30,18 +31,22 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton -/** Tests for [ActivityLifecycleObserverModule]. */ +/** Tests for [CpuPerformanceSnapshotter]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) -@Config(application = ActivityLifecycleObserverModuleTest.TestApplication::class) -class ActivityLifecycleObserverModuleTest { - @Inject - lateinit var startupListeners: Set<@JvmSuppressWildcards ApplicationStartupListener> +@Config(application = CpuPerformanceSnapshotterModuleTest.TestApplication::class) +class CpuPerformanceSnapshotterModuleTest { + @field:[JvmField Inject ForegroundCpuLoggingTimePeriodMillis] + var foregroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE + + @field:[JvmField Inject BackgroundCpuLoggingTimePeriodMillis] + var backgroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE @Before fun setUp() { @@ -49,8 +54,12 @@ class ActivityLifecycleObserverModuleTest { } @Test - fun testInjectApplicationStartupListenerSet_includesPerformanceMetricsLogger() { - assertThat(startupListeners.any { it is ActivityLifecycleObserver }).isTrue() + fun testCpuPerformanceLoggingTimePeriods_areDefaultValuesAsExpected() { + // This is a change detector test to ensure that changes to the CPU performance logging time + // period are explicitly considered to help avoid potential unintended changes to this analytics + // behavioral configuration property. + assertThat(foregroundCpuLoggingTimePeriodMillis).isEqualTo(TimeUnit.MINUTES.toMillis(5)) + assertThat(backgroundCpuLoggingTimePeriodMillis).isEqualTo(TimeUnit.MINUTES.toMillis(60)) } private fun setUpTestApplicationComponent() { @@ -67,6 +76,18 @@ class ActivityLifecycleObserverModuleTest { fun bindStartupListenerSet(): Set } + @Module + class TestLoggingIdentifierModule { + + companion object { + const val applicationIdSeed = 1L + } + + @Provides + @ApplicationIdSeed + fun provideApplicationIdSeed(): Long = applicationIdSeed + } + // TODO(#89): Move this to a common test application component. @Singleton @Component( @@ -75,8 +96,8 @@ class ActivityLifecycleObserverModuleTest { TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - LoggerModule::class, SyncStatusModule::class, ActivityLifecycleObserverModule::class + TestLoggingIdentifierModule::class, ApplicationLifecycleModule::class, + LoggerModule::class, SyncStatusModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { @@ -87,17 +108,17 @@ class ActivityLifecycleObserverModuleTest { fun build(): TestApplicationComponent } - fun inject(test: ActivityLifecycleObserverModuleTest) + fun inject(test: CpuPerformanceSnapshotterModuleTest) } class TestApplication : Application(), DataProvidersInjectorProvider { private val component: TestApplicationComponent by lazy { - DaggerActivityLifecycleObserverModuleTest_TestApplicationComponent.builder() + DaggerCpuPerformanceSnapshotterModuleTest_TestApplicationComponent.builder() .setApplication(this) .build() } - fun inject(test: ActivityLifecycleObserverModuleTest) { + fun inject(test: CpuPerformanceSnapshotterModuleTest) { component.inject(test) } diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterTest.kt new file mode 100644 index 00000000000..09c11bc62b6 --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterTest.kt @@ -0,0 +1,516 @@ +package org.oppia.android.domain.oppialogger.analytics + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC +import org.oppia.android.app.model.ScreenName +import org.oppia.android.domain.oppialogger.EventLogStorageCacheSize +import org.oppia.android.domain.oppialogger.ExceptionLogStorageCacheSize +import org.oppia.android.domain.oppialogger.LoggingIdentifierModule +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize +import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule +import org.oppia.android.testing.FakePerformanceMetricAssessor +import org.oppia.android.testing.FakePerformanceMetricsEventLogger +import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.assertThrows +import org.oppia.android.testing.logging.SyncStatusTestModule +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestCoroutineDispatchers +import org.oppia.android.testing.threading.TestDispatcherModule +import org.oppia.android.testing.time.FakeOppiaClock +import org.oppia.android.testing.time.FakeOppiaClockModule +import org.oppia.android.util.data.DataProvidersInjector +import org.oppia.android.util.data.DataProvidersInjectorProvider +import org.oppia.android.util.locale.LocaleProdModule +import org.oppia.android.util.logging.EnableConsoleLog +import org.oppia.android.util.logging.EnableFileLog +import org.oppia.android.util.logging.GlobalLogLevel +import org.oppia.android.util.logging.LogLevel +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_BACKGROUND +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.APP_IN_FOREGROUND +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.AppIconification.UNINITIALIZED +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import java.util.concurrent.TimeUnit +import javax.inject.Inject +import javax.inject.Singleton + +private const val TEST_CPU_USAGE_ONE = 0.07192 +private const val TEST_CPU_USAGE_TWO = 0.32192 + +/** Tests for [CpuPerformanceSnapshotter]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = CpuPerformanceSnapshotterTest.TestApplication::class) +class CpuPerformanceSnapshotterTest { + + @Inject + lateinit var cpuPerformanceSnapshotter: CpuPerformanceSnapshotter + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + @Inject + lateinit var applicationLifecycleObserver: ApplicationLifecycleObserver + @Inject + lateinit var fakePerformanceMetricAssessor: FakePerformanceMetricAssessor + @Inject + lateinit var fakeOppiaClock: FakeOppiaClock + + @field:[JvmField Inject ForegroundCpuLoggingTimePeriodMillis] + var foregroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE + + @field:[JvmField Inject BackgroundCpuLoggingTimePeriodMillis] + var backgroundCpuLoggingTimePeriodMillis: Long = Long.MIN_VALUE + + @field:[JvmField Inject InitialIconificationCutOffTimePeriodMillis] + var initialIconificationCutOffTimePeriodMillis: Long = Long.MIN_VALUE + + @Before + fun setUp() { + TestPlatformParameterModule.forceEnablePerformanceMetricsCollection(true) + setUpTestApplicationComponent() + } + + @Test + fun testSnapshotter_updateIconificationToBackground_logsCpuUsageInBackgroundState() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_ONE) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event.loggableMetric.loggableMetricTypeCase).isEqualTo(CPU_USAGE_METRIC) + assertThat(event.loggableMetric.cpuUsageMetric.cpuUsageMetric).isEqualTo(TEST_CPU_USAGE_ONE) + assertThat(event.currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + + @Test + fun testSnapshotter_updateIconificationToForeground_logsCpuUsageInForegroundState() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_ONE) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event.loggableMetric.loggableMetricTypeCase).isEqualTo(CPU_USAGE_METRIC) + assertThat(event.loggableMetric.cpuUsageMetric.cpuUsageMetric).isEqualTo(TEST_CPU_USAGE_ONE) + assertThat(event.currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testSnapshotter_moveToForeground_moveToBackground_logsSequentially() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val latestEvents = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + // Event that got logged on third update call. + val latestEvent = latestEvents[count - 1] + // Event that got logged after time advancement. + val secondLatestEvent = latestEvents[count - 2] + // Event that got logged on second update call. + val thirdLatestEvent = latestEvents[count - 3] + + assertThat(latestEvent.currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + assertThat(secondLatestEvent.currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + assertThat(thirdLatestEvent.currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testSnapshotter_moveToForegorund_logsCpuUsage_logsCpuUsageAfterCorrectDelay() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_ONE) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + val firstEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_TWO) + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + val latestEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(latestEvent.isInitialized).isTrue() + assertThat(latestEvent.currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + // Verifying that a CPU usage metric is logged after delay. + assertThat(latestEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + .isWithin(1e-5).of(TEST_CPU_USAGE_TWO) + // Verifying that the logged CPU usage metric does not equal to the previously logged metric. + assertThat(latestEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + .isNotWithin(1e-5).of(firstEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + } + + @Test + fun testSnapshotter_moveToFg_logsCpuUsage_failsToLogSecondCpuLogBeforeCorrectDelay() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + val timePeriodLessThanFgCpuLoggingTimePeriod = foregroundCpuLoggingTimePeriodMillis - 1000 + testCoroutineDispatchers.advanceTimeBy(timePeriodLessThanFgCpuLoggingTimePeriod) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_moveToBackgorund_logsCpuUsage_logsCpuUsageAfterCorrectDelay() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_ONE) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + val firstEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_TWO) + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + val latestEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(latestEvent.isInitialized).isTrue() + assertThat(latestEvent.currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + // Verifying that a CPU usage metric is logged after delay. + assertThat(latestEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + .isWithin(1e-5).of(TEST_CPU_USAGE_TWO) + // Verifying that the logged CPU usage metric does not equal to the previously logged metric. + assertThat(latestEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + .isNotWithin(1e-5).of(firstEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + } + + @Test + fun testSnapshotter_moveToBg_logsCpuUsage_failsToLogSecondCpuLogBeforeCorrectDelay() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + testCoroutineDispatchers.runCurrent() + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + val timePeriodLessThanBgCpuLoggingTimePeriod = backgroundCpuLoggingTimePeriodMillis - 1000 + testCoroutineDispatchers.advanceTimeBy(timePeriodLessThanBgCpuLoggingTimePeriod) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_moveToBg_logsCpuUsage_moveToFg_logsTailEventBeforeNewEvent() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + testCoroutineDispatchers.runCurrent() + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + val timePeriodLessThanBgCpuLoggingTimePeriod = backgroundCpuLoggingTimePeriodMillis - 1000 + testCoroutineDispatchers.advanceTimeBy(timePeriodLessThanBgCpuLoggingTimePeriod) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + + val latestEventCount = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val latestEvents = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(latestEventCount) + + assertThat(latestEvents[latestEventCount - 1].currentScreen) + .isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + + @Test + fun testSnapshotter_logCpuUsage_correctCpuUsageValueIsLogged() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(TEST_CPU_USAGE_ONE) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val latestEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(latestEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric) + .isWithin(1e-5).of(TEST_CPU_USAGE_ONE) + } + + @Test + fun testSnapshotter_relativeCpuUsageEqualsNull_doesNotLogCpuUsage() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + fakePerformanceMetricAssessor.setRelativeCpuUsage(null) + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_onCreate_moveToForegroundBeforeCutOff_logsCpuUsageInForegroundAfterDelay() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy(1000) + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(count).isEqualTo(1) + assertThat(event.currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testSnapshotter_moveToFgBeforeCutOff_moveToBgBeforeDelayEnds_logsInFg_logsInBgAfterDelay() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy(1000) + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(TimeUnit.MINUTES.toMillis(2)) + applicationLifecycleObserver.onAppInBackground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val events = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + + assertThat(count).isEqualTo(2) + assertThat(events[0].currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + assertThat(events[1].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + + @Test + fun testSnapshotter_moveToFgBeforeCutOff_moveToBgAfterFirstDelay_logsCpuWithCorrectIcon() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy(1000) + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + testCoroutineDispatchers.advanceTimeBy(TimeUnit.MINUTES.toMillis(1)) + applicationLifecycleObserver.onAppInBackground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(backgroundCpuLoggingTimePeriodMillis) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val events = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + + assertThat(count).isEqualTo(3) + assertThat(events[0].currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + assertThat(events[1].currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + assertThat(events[2].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + + @Test + fun testSnapshotter_onCreate_setsIconificationToBgAfterCutOff_logsCpuInBgAfterCorrectDelay() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy( + initialIconificationCutOffTimePeriodMillis + backgroundCpuLoggingTimePeriodMillis + ) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val events = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + + assertThat(count).isEqualTo(1) + assertThat(events[0].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + } + + @Test + fun testSnapshotter_onCreate_setsIconToBgAfterCutOff_moveToFgAndLogsCpuInBg_logsCpuInFg() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy(TimeUnit.MINUTES.toMillis(5)) + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val events = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + + assertThat(count).isEqualTo(2) + assertThat(events[0].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + assertThat(events[1].currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testSnapshotter_setsIconToBgAfterCutOff_logsCpuInBg_moveToFgAndLogsCpuInBg_logsCpuInFg() { + applicationLifecycleObserver.onCreate() + testCoroutineDispatchers.runCurrent() + // Clearing up all app startup performance metrics: apk size and storage usage. + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + testCoroutineDispatchers.advanceTimeBy( + backgroundCpuLoggingTimePeriodMillis + TimeUnit.MINUTES.toMillis( + 3 + ) + ) + applicationLifecycleObserver.onAppInForeground() + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + val count = fakePerformanceMetricsEventLogger.getPerformanceMetricsEventListCount() + val events = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count) + + assertThat(count).isEqualTo(3) + assertThat(events[0].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + assertThat(events[1].currentScreen).isEqualTo(ScreenName.BACKGROUND_SCREEN) + assertThat(events[2].currentScreen).isEqualTo(ScreenName.FOREGROUND_SCREEN) + } + + @Test + fun testSnapshotter_updateIconification_withoutInitialization_doesNotLogAnyCpuUsage() { + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_BACKGROUND) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_updateToUninitializedIcon_withoutInitializingSnapshotter_noCpuLogExists() { + cpuPerformanceSnapshotter.updateAppIconification(UNINITIALIZED) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_updateToUninitializedIcon_withInitializedSnapshotter_noCpuLogExists() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + cpuPerformanceSnapshotter.updateAppIconification(UNINITIALIZED) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_withoutInitializing_doesNotLogEventAfterAutomaticBackgroundIconDelay() { + testCoroutineDispatchers.advanceTimeBy( + initialIconificationCutOffTimePeriodMillis + backgroundCpuLoggingTimePeriodMillis + ) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_withoutInitializing_updateIconToFg_doesNotLogEventAfterFgIconDelay() { + cpuPerformanceSnapshotter.updateAppIconification(APP_IN_FOREGROUND) + testCoroutineDispatchers.runCurrent() + testCoroutineDispatchers.advanceTimeBy(foregroundCpuLoggingTimePeriodMillis) + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + @Test + fun testSnapshotter_initializeOnce_initializeAgain_throwsErrorOnReinitialization() { + cpuPerformanceSnapshotter.initialiseSnapshotter() + val exception = assertThrows(IllegalArgumentException::class) { + cpuPerformanceSnapshotter.initialiseSnapshotter() + } + + assertThat(exception).hasMessageThat() + .contains("CpuPerformanceSnapshotter: Class has already been initialized.") + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + class TestModule { + @Provides + @Singleton + fun provideContext(application: Application): Context { + return application + } + + // TODO(#59): Either isolate these to their own shared test module, or use the real logging + // module in tests to avoid needing to specify these settings for tests. + @EnableConsoleLog + @Provides + fun provideEnableConsoleLog(): Boolean = true + + @EnableFileLog + @Provides + fun provideEnableFileLog(): Boolean = false + + @GlobalLogLevel + @Provides + fun provideGlobalLogLevel(): LogLevel = LogLevel.VERBOSE + } + + @Module + class TestLogStorageModule { + + @Provides + @EventLogStorageCacheSize + fun provideEventLogStorageCacheSize(): Int = 2 + + @Provides + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 5 + + @Provides + @ExceptionLogStorageCacheSize + fun provideExceptionLogStorageCacheSize(): Int = 2 + } + + // TODO(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class, TestLogReportingModule::class, RobolectricModule::class, + TestDispatcherModule::class, TestLogStorageModule::class, + NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, FakeOppiaClockModule::class, + TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, + LoggingIdentifierModule::class, SyncStatusTestModule::class, + CpuPerformanceSnapshotterModule::class, ApplicationLifecycleModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(cpuPerformanceSnapshotterTest: CpuPerformanceSnapshotterTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerCpuPerformanceSnapshotterTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(cpuPerformanceSnapshotterTest: CpuPerformanceSnapshotterTest) { + component.inject(cpuPerformanceSnapshotterTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt index 3eec3a60509..ba86c9946d7 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt @@ -47,6 +47,8 @@ import org.oppia.android.util.logging.EnableFileLog import org.oppia.android.util.logging.GlobalLogLevel import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.networking.NetworkConnectionDebugUtil +import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.CELLULAR +import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.LOCAL import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config @@ -55,7 +57,7 @@ import javax.inject.Inject import javax.inject.Singleton private const val TEST_TIMESTAMP = Long.MAX_VALUE -private const val TEST_CPU_USAGE = Long.MAX_VALUE +private const val TEST_CPU_USAGE = Double.MAX_VALUE private const val TEST_APK_SIZE = Long.MAX_VALUE private const val TEST_STORAGE_USAGE = Long.MAX_VALUE private const val TEST_STARTUP_LATENCY = Long.MAX_VALUE @@ -378,6 +380,53 @@ class PerformanceMetricsControllerTest { assertThat(secondMetricLog.timestampMillis).isEqualTo(1556094110000) } + @Test + fun testController_logPerformanceMetrics_withNoNetwork_logsEventWithNoneNetworkType() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_NAME_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val metricLogsProvider = performanceMetricsController.getMetricLogStore() + val metricLogs = monitorFactory.waitForNextSuccessfulResult(metricLogsProvider) + val loggedEvent = metricLogs.getOppiaMetricLog(0) + + assertThat(loggedEvent.networkType).isEqualTo(OppiaMetricLog.NetworkType.NONE) + } + + @Test + fun testController_logPerformanceMetrics_withCellularNetwork_logsEventWithCellularNetworkType() { + networkConnectionUtil.setCurrentConnectionStatus(CELLULAR) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_NAME_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(loggedEvent.networkType).isEqualTo(OppiaMetricLog.NetworkType.CELLULAR) + } + + @Test + fun testController_logPerformanceMetrics_withLocalNetwork_logsEventWithWifiNetworkType() { + networkConnectionUtil.setCurrentConnectionStatus(LOCAL) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_NAME_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(loggedEvent.networkType).isEqualTo(OppiaMetricLog.NetworkType.WIFI) + } + @Test fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue() { performanceMetricsController.setAppInForeground() diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt index 112cbefb640..d45e32f5f6e 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt @@ -10,7 +10,7 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import org.junit.Before +import org.junit.After import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock @@ -24,16 +24,17 @@ import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricT import org.oppia.android.app.model.OppiaMetricLog.Priority.HIGH_PRIORITY import org.oppia.android.app.model.OppiaMetricLog.Priority.LOW_PRIORITY import org.oppia.android.app.model.OppiaMetricLog.Priority.MEDIUM_PRIORITY +import org.oppia.android.app.model.ScreenName.HOME_ACTIVITY import org.oppia.android.app.model.ScreenName.SCREEN_NAME_UNSPECIFIED import org.oppia.android.domain.oppialogger.EventLogStorageCacheSize import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize -import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.testing.FakePerformanceMetricAssessor import org.oppia.android.testing.FakePerformanceMetricsEventLogger import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.logging.SyncStatusTestModule +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.testing.time.FakeOppiaClock @@ -53,7 +54,7 @@ import javax.inject.Inject import javax.inject.Singleton private const val TEST_TIMESTAMP = Long.MAX_VALUE -private const val TEST_CPU_USAGE = Long.MAX_VALUE +private const val TEST_CPU_USAGE = Double.MAX_VALUE private const val TEST_APK_SIZE = Long.MAX_VALUE private const val TEST_STORAGE_USAGE = Long.MAX_VALUE private const val TEST_TOTAL_PSS = Long.MAX_VALUE @@ -90,16 +91,29 @@ class PerformanceMetricsLoggerTest { private val testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE private val testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER - @Before - fun setUp() { - setUpTestApplicationComponent() - setUpFakePerformanceMetricsUtils() - fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) - fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) + @After + fun tearDown() { + TestPlatformParameterModule.reset() + } + + @Test + fun testLogger_inDefaultState_logPerformanceMetrics_verifyNoMetricsAreLogged() { + setUpApplicationInDefaultMode() + performanceMetricsLogger.apply { + logApkSize(SCREEN_NAME_UNSPECIFIED) + logStorageUsage(SCREEN_NAME_UNSPECIFIED) + logMemoryUsage(SCREEN_NAME_UNSPECIFIED) + logNetworkUsage(SCREEN_NAME_UNSPECIFIED) + logCpuUsage(SCREEN_NAME_UNSPECIFIED, TEST_CPU_USAGE) + logStartupLatency(TEST_STARTUP_LATENCY_IN_MILLISECONDS, SCREEN_NAME_UNSPECIFIED) + } + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() } @Test fun testLogger_logApkSizePerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val apkSize = fakePerformanceMetricAssessor.getApkSize() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() @@ -119,6 +133,7 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStorageUsagePerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() @@ -140,6 +155,7 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logMemoryUsagePerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val memoryUsage = fakePerformanceMetricAssessor.getTotalPssUsed() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() @@ -159,6 +175,7 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStartupLatencyPerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() @@ -184,12 +201,13 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logCpuUsagePerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logCpuUsage( - TEST_CPU_USAGE, - SCREEN_NAME_UNSPECIFIED + SCREEN_NAME_UNSPECIFIED, + TEST_CPU_USAGE ) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -205,6 +223,7 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logNetworkUsagePerformanceMetric_verifyLogsMetricCorrectly() { + setUpApplicationForPerformanceMetricsLogging() val bytesSent = fakePerformanceMetricAssessor.getTotalSentBytes() val bytesReceived = fakePerformanceMetricAssessor.getTotalReceivedBytes() val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() @@ -224,8 +243,34 @@ class PerformanceMetricsLoggerTest { assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) } - private fun setUpTestApplicationComponent() { + @Test + fun testLogger_inDefaultState_tryToLogMultipleEvents_doesNotLogAnyPerformanceMetric() { + setUpApplicationInDefaultMode() + performanceMetricsLogger.apply { + logApkSize(HOME_ACTIVITY) + logCpuUsage(HOME_ACTIVITY, TEST_CPU_USAGE) + logNetworkUsage(HOME_ACTIVITY) + logStartupLatency(TEST_STARTUP_LATENCY_IN_MILLISECONDS, HOME_ACTIVITY) + logMemoryUsage(HOME_ACTIVITY) + logStorageUsage(HOME_ACTIVITY) + } + + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + private fun setUpApplicationInDefaultMode() { ApplicationProvider.getApplicationContext().inject(this) + setUpFakePerformanceMetricsUtils() + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) + } + + private fun setUpApplicationForPerformanceMetricsLogging() { + TestPlatformParameterModule.forceEnablePerformanceMetricsCollection(true) + ApplicationProvider.getApplicationContext().inject(this) + setUpFakePerformanceMetricsUtils() + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) } private fun setUpFakePerformanceMetricsUtils() { @@ -291,9 +336,9 @@ class PerformanceMetricsLoggerTest { TestModule::class, TestLogReportingModule::class, RobolectricModule::class, TestDispatcherModule::class, TestLogStorageModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, FakeOppiaClockModule::class, - PlatformParameterModule::class, PlatformParameterSingletonModule::class, + TestPlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, - ActivityLifecycleObserverModule::class + ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt index a372ee99f40..bf49005ca20 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt @@ -21,7 +21,10 @@ import org.junit.Test import org.junit.runner.RunWith import org.oppia.android.domain.oppialogger.EventLogStorageCacheSize import org.oppia.android.domain.oppialogger.ExceptionLogStorageCacheSize +import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker @@ -177,7 +180,8 @@ class FakeLogSchedulerTest { PerformanceMetricsConfigurationsModule::class, LocaleProdModule::class, OppiaClockModule::class, NetworkConnectionUtilProdModule::class, TestLogStorageModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, - SyncStatusModule::class + SyncStatusModule::class, ApplicationLifecycleModule::class, LoggingIdentifierModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt index 3d951f148fd..6ad6f52cceb 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt @@ -31,16 +31,17 @@ import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker -import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.testing.oppialogger.loguploader.FakeLogUploader import org.oppia.android.testing.FakeEventLogger import org.oppia.android.testing.FakeExceptionLogger import org.oppia.android.testing.FakePerformanceMetricsEventLogger import org.oppia.android.testing.logging.SyncStatusTestModule +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -98,6 +99,7 @@ class MetricLogSchedulingWorkerTest { @Before fun setUp() { + TestPlatformParameterModule.forceEnablePerformanceMetricsCollection(true) setUpTestApplicationComponent() context = InstrumentationRegistry.getInstrumentation().targetContext val config = Configuration.Builder() @@ -149,7 +151,6 @@ class MetricLogSchedulingWorkerTest { assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(NETWORK_USAGE_METRIC) - // TODO(#4466): Verify functionality to log cpu usage performance metrics. } @Test @@ -266,10 +267,10 @@ class MetricLogSchedulingWorkerTest { TestDispatcherModule::class, LogReportWorkerModule::class, TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, - AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, - LoggingIdentifierModule::class, SyncStatusTestModule::class, + AssetModule::class, TestPlatformParameterModule::class, LoggingIdentifierModule::class, + SyncStatusTestModule::class, PlatformParameterSingletonModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, - ApplicationLifecycleModule::class + ApplicationLifecycleModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt index 547288c8ebc..8ba3115e5a5 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt @@ -22,6 +22,7 @@ import org.junit.runner.RunWith import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -178,7 +179,7 @@ class PerformanceMetricsLogSchedulerTest { AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, TestLogReportingModule::class, PerformanceMetricsConfigurationsModule::class, LogStorageModule::class, - ApplicationLifecycleModule::class, + ApplicationLifecycleModule::class, CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt index cb31d65425e..32470360703 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt @@ -27,6 +27,7 @@ import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.analytics.testing.FakeLogScheduler import org.oppia.android.domain.oppialogger.exceptions.ExceptionsController import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker @@ -301,7 +302,8 @@ class LogReportWorkManagerInitializerTest { FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, LoggerModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, - SyncStatusModule::class, ApplicationLifecycleModule::class + SyncStatusModule::class, ApplicationLifecycleModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent { diff --git a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt index 44571c46d54..2d3ff6c7591 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -33,8 +33,8 @@ import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule -import org.oppia.android.domain.oppialogger.analytics.ActivityLifecycleObserverModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule @@ -97,10 +97,10 @@ import javax.inject.Singleton MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, NetworkConnectionDebugUtilModule::class, - MetricLogSchedulerModule::class, ActivityLifecycleObserverModule::class, + MetricLogSchedulerModule::class, ActivityRouterModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, - ActivityRouterModule::class + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 448d680e471..d9b5fc432d2 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -51,7 +51,7 @@ message OppiaMetricLog { // The metric being logged is related to the network usage of the application. NetworkUsageMetric network_usage_metric = 5; - // The metric being logged is related to the cpu usage of the application. + // The metric being logged is related to the CPU usage of the application. CpuUsageMetric cpu_usage_metric = 6; } } @@ -98,11 +98,11 @@ message OppiaMetricLog { int64 bytes_sent = 2; } - // Structure of the cpu usage metric. + // Structure of the CPU usage metric. message CpuUsageMetric { - // Amount of cpu used by the application. - // TODO(#4466): Add correct proto definitions and comments for cpu usage metric logging. - int64 cpu_usage_metric = 1; + // Average ratio of app-specific CPU usage relative to available resources in the system, within + // a monitored time window. This is expected to always be between [0, 1]. + double cpu_usage_metric = 1; } // Supported priority of events for performance metric logging. diff --git a/model/src/main/proto/screens.proto b/model/src/main/proto/screens.proto index 5c682e536bb..dae4c8b99be 100644 --- a/model/src/main/proto/screens.proto +++ b/model/src/main/proto/screens.proto @@ -152,6 +152,9 @@ enum ScreenName { // Screen name value for the scenario when the policies activity is visible to the user. POLICIES_ACTIVITY = 47; + + // A generic foreground screen value for logging periodic metrics like CPU usage. + FOREGROUND_SCREEN = 48; } // Defines the current visible UI screen of the application. diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index fa6d09b9ce1..3a4f9b29086 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -651,8 +651,10 @@ exempted_file_path: "domain/src/main/java/org/oppia/android/domain/onboarding/te exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/ApplicationIdSeed.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/ApplicationStartupListener.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt" +exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceLoggingTimePeriodMillis.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/LearnerAnalyticsInactivityLimitMillis.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/UncaughtExceptionLoggerModule.kt" +exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerFactory.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkerModule.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt" @@ -847,4 +849,3 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/Disp exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt" -exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt" diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt index f797b922029..a67fcde8dcf 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt @@ -2,6 +2,7 @@ package org.oppia.android.testing import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.CpuSnapshot import javax.inject.Inject import javax.inject.Singleton @@ -15,6 +16,7 @@ class FakePerformanceMetricAssessor @Inject constructor() : PerformanceMetricsAs private var testTotalReceivedBytes = 0L private var testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE private var testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + private var testRelativeCpuUsage: Double? = 0.00 override fun getApkSize(): Long = testApkSize @@ -30,6 +32,16 @@ class FakePerformanceMetricAssessor @Inject constructor() : PerformanceMetricsAs override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier = testDeviceMemoryTier + override fun computeCpuSnapshotAtCurrentTime(): CpuSnapshot = + CpuSnapshot(appTimeMillis = 0L, cpuTimeMillis = 0L, numberOfOnlineCores = 1) + + override fun getRelativeCpuUsage( + firstCpuSnapshot: CpuSnapshot, + secondCpuSnapshot: CpuSnapshot + ): Double? { + return testRelativeCpuUsage + } + /** Sets [apkSize] as the value of [testApkSize]. */ fun setApkSize(apkSize: Long) { testApkSize = apkSize @@ -64,4 +76,9 @@ class FakePerformanceMetricAssessor @Inject constructor() : PerformanceMetricsAs fun setDeviceMemoryTier(memoryTier: OppiaMetricLog.MemoryTier) { testDeviceMemoryTier = memoryTier } + + /** Sets [relativeCpuUsage] as the value which is returned by [getRelativeCpuUsage]. */ + fun setRelativeCpuUsage(relativeCpuUsage: Double?) { + testRelativeCpuUsage = relativeCpuUsage + } } diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt index dddedc84f38..bf5c738a42b 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt @@ -12,7 +12,6 @@ import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_ import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi @@ -136,14 +135,8 @@ class TestPlatformParameterModule { @Provides @EnablePerformanceMetricsCollection - fun provideEnablePerformanceMetricCollection( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - ENABLE_PERFORMANCE_METRICS_COLLECTION - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE - ) + fun provideEnablePerformanceMetricCollection(): PlatformParameterValue { + return PlatformParameterValue.createDefaultParameter(enablePerformanceMetricsCollection) } @Provides @@ -206,6 +199,8 @@ class TestPlatformParameterModule { private var enableExtraTopicTabsUi = ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE private var enableInteractionConfigChangeStateRetention = ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION + private var enablePerformanceMetricsCollection = + ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE /** Enables forcing [EnableAutomaticUpdateTopicSettingUi] platform parameter flag from tests. */ @VisibleForTesting(otherwise = VisibleForTesting.NONE) @@ -242,5 +237,22 @@ class TestPlatformParameterModule { fun forceEnableInteractionConfigChangeStateRetention(value: Boolean) { enableInteractionConfigChangeStateRetention = value } + + /** Enables forcing [EnablePerformanceMetricsCollection] platform parameter flag from tests. */ + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + fun forceEnablePerformanceMetricsCollection(value: Boolean) { + enablePerformanceMetricsCollection = value + } + + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + fun reset() { + enableAutomaticUpdateTopicSettingUi = AUTOMATIC_UPDATE_TOPIC_SETTING_VALUE + enableLanguageSelectionUi = ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE + enableEditAccountsOptionsUi = ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE + enableLearnerStudyAnalytics = LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE + enableExtraTopicTabsUi = ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE + enableInteractionConfigChangeStateRetention = ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION + enablePerformanceMetricsCollection = ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE + } } } diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt index 5080fcae353..1ef9b5f22cd 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt @@ -51,6 +51,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -268,7 +269,8 @@ class InitializeDefaultLocaleRuleCustomContextTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt index a0870ac98ba..5e9e21e4f21 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt @@ -48,6 +48,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -144,7 +145,8 @@ class InitializeDefaultLocaleRuleOmissionTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt index 6b689b3766c..c261c4f27f4 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt @@ -52,6 +52,7 @@ import org.oppia.android.domain.onboarding.testing.ExpirationMetaDataRetrieverTe import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -148,7 +149,8 @@ class InitializeDefaultLocaleRuleTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class + EventLoggingConfigurationModule::class, ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/utility/src/main/java/org/oppia/android/util/logging/EventBundleCreator.kt b/utility/src/main/java/org/oppia/android/util/logging/EventBundleCreator.kt index 90b6106fa44..1b2d9876fd8 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/EventBundleCreator.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/EventBundleCreator.kt @@ -128,6 +128,9 @@ class EventBundleCreator @Inject constructor( * [OppiaMetricLog.LoggableMetric.getLoggableMetricTypeCase]). */ fun fillPerformanceMetricsEventBundle(oppiaMetricLog: OppiaMetricLog, bundle: Bundle): String { + bundle.putInt("android_sdk", androidSdkVersion) + bundle.putString("app_version_name", appVersionName) + bundle.putInt("app_version_code", appVersionCode) bundle.putLong("timestamp", oppiaMetricLog.timestampMillis) bundle.putString("priority", oppiaMetricLog.priority.toAnalyticsName()) bundle.putString("is_app_in_foreground", oppiaMetricLog.isAppInForeground.toString()) @@ -237,6 +240,7 @@ class EventBundleCreator @Inject constructor( if (!isSensitive || allowUserIds) { val propertyName = computePropertyName(valueName) when (value) { + is Double -> bundle.putDouble(propertyName, value) is Long -> bundle.putLong(propertyName, value) is Iterable<*> -> bundle.putString(propertyName, value.joinToString(separator = ",")) else -> bundle.putString(propertyName, value.toString()) @@ -610,5 +614,6 @@ class EventBundleCreator @Inject constructor( ScreenName.ADMIN_PIN_ACTIVITY -> "admin_pin_activity" ScreenName.POLICIES_ACTIVITY -> "policies_activity" ScreenName.UNRECOGNIZED -> "unrecognized" + ScreenName.FOREGROUND_SCREEN -> "foreground_screen" } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel index 418b0023956..ff353d105be 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel @@ -52,6 +52,8 @@ kt_android_library( ":performance_metrics_configurations_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", ], ) @@ -65,6 +67,7 @@ kt_android_library( ":dagger", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", + "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", ], ) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt index 5bdd9ba5761..2bf6003b40b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt @@ -35,4 +35,49 @@ interface PerformanceMetricsAssessor { * capacity of the device. */ fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier + + /** Returns a [CpuSnapshot] with current values for CPU usage calculations. */ + fun computeCpuSnapshotAtCurrentTime(): CpuSnapshot + + /** + * Returns the relative CPU usage after comparing [firstCpuSnapshot] and [secondCpuSnapshot]. + * + * This value will return null in case any of the following cases return true: + * a) greater CPU time of [firstCpuSnapshot] than of [secondCpuSnapshot]. + * b) greater app time of [firstCpuSnapshot] than of [secondCpuSnapshot]. + * c) number of online CPU cores of either [firstCpuSnapshot] or [secondCpuSnapshot] are less + * than or equal to 0. + */ + fun getRelativeCpuUsage(firstCpuSnapshot: CpuSnapshot, secondCpuSnapshot: CpuSnapshot): Double? + + /** + * Container that consists of all the necessary values that are required for calculating CPU usage + * at that point of time. + * + * @property appTimeMillis denotes the amount of time since the current instance of the app begun + * @property cpuTimeMillis denotes the amount of time CPU ran for this process + * @property numberOfOnlineCores denotes the number of currently online/available CPU cores + */ + data class CpuSnapshot( + val appTimeMillis: Long, + val cpuTimeMillis: Long, + val numberOfOnlineCores: Int + ) { + /** Returns whether the current [CpuSnapshot] is newer than the [otherCpuSnapshot]. */ + fun isNewer(otherCpuSnapshot: CpuSnapshot) = cpuTimeMillis > otherCpuSnapshot.cpuTimeMillis || + appTimeMillis > otherCpuSnapshot.appTimeMillis + + /** Returns whether the current [CpuSnapshot] has invalid number of online CPU cores or not. */ + fun doesNotHaveValidNumberOfOnlineCores(): Boolean = numberOfOnlineCores <= 0 + } + + /** Represents the different states of the application. */ + enum class AppIconification { + /** Indicates that the iconification hasn't been initialized yet. */ + UNINITIALIZED, + /** Indicates that the app is in foreground. */ + APP_IN_FOREGROUND, + /** Indicates that the app is in background. */ + APP_IN_BACKGROUND + } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt index d8a0818c60c..436f83ba6ac 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt @@ -3,6 +3,10 @@ package org.oppia.android.util.logging.performancemetrics import android.app.ActivityManager import android.content.Context import android.net.TrafficStats +import android.os.Build +import android.os.Process +import android.system.Os +import android.system.OsConstants import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER import org.oppia.android.app.model.OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER @@ -10,6 +14,8 @@ import org.oppia.android.app.model.OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER import org.oppia.android.app.model.OppiaMetricLog.StorageTier.HIGH_STORAGE import org.oppia.android.app.model.OppiaMetricLog.StorageTier.LOW_STORAGE import org.oppia.android.app.model.OppiaMetricLog.StorageTier.MEDIUM_STORAGE +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor.CpuSnapshot +import org.oppia.android.util.system.OppiaClock import java.io.File import javax.inject.Inject import javax.inject.Singleton @@ -17,6 +23,7 @@ import javax.inject.Singleton /** Utility to extract performance metrics from the underlying Android system. */ @Singleton class PerformanceMetricsAssessorImpl @Inject constructor( + private val oppiaClock: OppiaClock, private val context: Context, @LowStorageTierUpperBound private val lowStorageTierUpperBound: Long, @MediumStorageTierUpperBound private val mediumStorageTierUpperBound: Long, @@ -46,7 +53,7 @@ class PerformanceMetricsAssessorImpl @Inject constructor( TrafficStats.getUidRxBytes(context.applicationInfo.uid) override fun getTotalPssUsed(): Long { - val pid = ActivityManager.RunningAppProcessInfo().pid + val pid = Process.myPid() val processMemoryInfo = activityManager.getProcessMemoryInfo(intArrayOf(pid)) return processMemoryInfo?.map { it.totalPss }?.sum()?.toLong() ?: 0L } @@ -70,4 +77,48 @@ class PerformanceMetricsAssessorImpl @Inject constructor( else -> HIGH_MEMORY_TIER } } + + override fun computeCpuSnapshotAtCurrentTime(): CpuSnapshot { + return CpuSnapshot( + appTimeMillis = oppiaClock.getCurrentTimeMs(), + cpuTimeMillis = Process.getElapsedCpuTime(), + numberOfOnlineCores = getNumberOfOnlineCores() + ) + } + + override fun getRelativeCpuUsage( + firstCpuSnapshot: CpuSnapshot, + secondCpuSnapshot: CpuSnapshot + ): Double? { + if ( + firstCpuSnapshot.isNewer(secondCpuSnapshot) || + firstCpuSnapshot.doesNotHaveValidNumberOfOnlineCores() || + secondCpuSnapshot.doesNotHaveValidNumberOfOnlineCores() + ) return null + + val deltaCpuTimeMs = secondCpuSnapshot.cpuTimeMillis - firstCpuSnapshot.cpuTimeMillis + val deltaProcessTimeMs = secondCpuSnapshot.appTimeMillis - firstCpuSnapshot.appTimeMillis + val numberOfCores = + (secondCpuSnapshot.numberOfOnlineCores + firstCpuSnapshot.numberOfOnlineCores) / 2.0 + return when (val relativeCpuUsage = deltaCpuTimeMs / (deltaProcessTimeMs * numberOfCores)) { + in 0.0..1.0 -> relativeCpuUsage + else -> null + } + } + + /** Returns the number of processors that are currently online/available. */ + private fun getNumberOfOnlineCores(): Int { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + // Returns the number of processors currently available in the system. This may be less than + // the total number of configured processors because some of them may be offline. It must also + // be noted that a similar OsConstant, _SC_NPROCESSORS_CONF also exists which provides the + // total number of configured processors in the system. This value is similar to that + // returned from Runtime.getRuntime().availableProcessors(). + // Reference: https://man7.org/linux/man-pages/man3/sysconf.3.html + Os.sysconf(OsConstants._SC_NPROCESSORS_ONLN).toInt() + } else { + // Returns the maximum number of processors available. This value is never smaller than one. + Runtime.getRuntime().availableProcessors() + } + } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt index 38c2d775097..91557d66f93 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt @@ -134,7 +134,7 @@ class EventBundleCreatorTest { private const val TEST_CONTENT_ID = "test_content_id" private const val TEST_APP_VERSION_NAME = "oppia-android-test-0123456789" private const val TEST_APP_VERSION_CODE = 125 - private const val TEST_CPU_USAGE = Long.MAX_VALUE + private const val TEST_CPU_USAGE = Double.MAX_VALUE private const val TEST_APK_SIZE = Long.MAX_VALUE private const val TEST_STORAGE_USAGE = Long.MAX_VALUE private const val TEST_STARTUP_LATENCY = Long.MAX_VALUE @@ -188,7 +188,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("unknown_loggable_metric") - assertThat(bundle).hasSize(7) + assertThat(bundle).hasSize(10) assertThat(bundle).longInt("timestamp").isEqualTo(0) assertThat(bundle).string("priority").isEqualTo("unspecified_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("false") @@ -196,6 +196,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("storage_tier").isEqualTo("unspecified_storage_tier") assertThat(bundle).string("network_type").isEqualTo("unspecified_network_type") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -258,7 +261,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("unknown_loggable_metric") - assertThat(bundle).hasSize(7) + assertThat(bundle).hasSize(10) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -266,6 +269,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("storage_tier").isEqualTo("high_storage") assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -451,7 +457,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("apk_size_metric") - assertThat(bundle).hasSize(8) + assertThat(bundle).hasSize(11) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -460,6 +466,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") assertThat(bundle).longInt("apk_size_bytes").isEqualTo(TEST_APK_SIZE) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -475,7 +484,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("storage_usage_metric") - assertThat(bundle).hasSize(8) + assertThat(bundle).hasSize(11) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -484,6 +493,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") assertThat(bundle).longInt("storage_usage_bytes").isEqualTo(TEST_STORAGE_USAGE) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -499,7 +511,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("startup_latency_metric") - assertThat(bundle).hasSize(8) + assertThat(bundle).hasSize(11) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -508,6 +520,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") assertThat(bundle).longInt("startup_latency_millis").isEqualTo(TEST_STARTUP_LATENCY) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -523,7 +538,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("memory_usage_metric") - assertThat(bundle).hasSize(8) + assertThat(bundle).hasSize(11) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -532,6 +547,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") assertThat(bundle).longInt("total_pss_bytes").isEqualTo(TEST_MEMORY_USAGE) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -547,7 +565,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("network_usage_metric") - assertThat(bundle).hasSize(9) + assertThat(bundle).hasSize(12) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -557,6 +575,9 @@ class EventBundleCreatorTest { assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") assertThat(bundle).longInt("bytes_received").isEqualTo(TEST_NETWORK_USAGE) assertThat(bundle).longInt("bytes_sent").isEqualTo(TEST_NETWORK_USAGE) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -572,7 +593,7 @@ class EventBundleCreatorTest { ) assertThat(typeName).isEqualTo("cpu_usage_metric") - assertThat(bundle).hasSize(8) + assertThat(bundle).hasSize(11) assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) assertThat(bundle).string("priority").isEqualTo("high_priority") assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") @@ -580,7 +601,10 @@ class EventBundleCreatorTest { assertThat(bundle).string("storage_tier").isEqualTo("high_storage") assertThat(bundle).string("network_type").isEqualTo("wifi") assertThat(bundle).string("current_screen").isEqualTo("screen_name_unspecified") - assertThat(bundle).longInt("cpu_usage").isEqualTo(TEST_CPU_USAGE) + assertThat(bundle.getDouble("cpu_usage")).isWithin(1e-5).of(TEST_CPU_USAGE) + assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) + assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) + assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) } @Test @@ -1615,6 +1639,7 @@ class EventBundleCreatorTest { Iteration("adminPin", "name=ADMIN_PIN_ACTIVITY", "expNameStr=admin_pin_activity"), Iteration("policies", "name=POLICIES_ACTIVITY", "expNameStr=policies_activity"), Iteration("unspecified", "name=SCREEN_NAME_UNSPECIFIED", "expNameStr=screen_name_unspecified"), + Iteration("foreground", "name=FOREGROUND_SCREEN", "expNameStr=foreground_screen"), ) fun testMetricsBundle_addScreenName_verifyConversionToCorrectAnalyticalName() { setUpTestApplicationComponent() diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel index c24d6682d12..9719a59c057 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel @@ -49,6 +49,7 @@ oppia_android_test( "//third_party:com_google_truth_truth", "//third_party:org_robolectric_robolectric", "//third_party:robolectric_android-all", + "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor_module", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_configurations_module", diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt index d6b3cb6185e..fade559675a 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt @@ -16,8 +16,10 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.testing.FakeExceptionLogger import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.junit.OppiaParameterizedTestRunner +import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.Iteration import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.Parameter import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.RunParameterized import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.SelectRunnerPlatform @@ -27,6 +29,7 @@ import org.oppia.android.testing.robolectric.OppiaShadowActivityManager import org.oppia.android.testing.robolectric.OppiaShadowTrafficStats import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule +import org.oppia.android.testing.time.FakeOppiaClock import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.data.DataProvidersInjector import org.oppia.android.util.data.DataProvidersInjectorProvider @@ -59,6 +62,7 @@ private const val THREE_MEGABYTES = ONE_MEGABYTE * 3L private const val ONE_GIGABYTE = ONE_MEGABYTE * 1024 private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L +private const val TEST_CURRENT_TIME = 1665790700L /** Tests for [PerformanceMetricsAssessorImpl]. */ // FunctionName: test names are conventionally named with underscores. @@ -72,14 +76,23 @@ private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L ) class PerformanceMetricsAssessorImplTest { - @Parameter - var totalMemory: Long = Long.MIN_VALUE // Inited because primitives can't be lateinit. + @Parameter var totalMemory: Long = Long.MIN_VALUE + @Parameter var secondCpuValue: Long = 1200L + @Parameter var secondAppTimeValue: Long = 1665790700L + @Parameter var secondNumberOfOnlineCoresValue: Int = 2 + @Parameter var firstCpuValue: Long = 1000L + @Parameter var firstAppTimeValue: Long = 1665790650L + @Parameter var firstNumberOfOnlineCoresValue: Int = 6 + @Parameter var relativeCpuUsage: Double = Double.MIN_VALUE @Inject lateinit var performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl - @Inject lateinit var context: Context + @Inject + lateinit var fakeOppiaClock: FakeOppiaClock + @Inject + lateinit var fakeExceptionLogger: FakeExceptionLogger private val shadowActivityManager by lazy { shadowOf( @@ -208,9 +221,169 @@ class PerformanceMetricsAssessorImplTest { @Test @RunParameterized( - OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=0"), - OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=1147483648"), - OppiaParameterizedTestRunner.Iteration("memoryJustBelowUpperBound", "totalMemory=2147483647") + Iteration( + "zeroDoubleValue", + "firstCpuValue=1000", + "secondCpuValue=1000", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=1665790700", + "firstNumberOfOnlineCoresValue=6", + "secondNumberOfOnlineCoresValue=2", + "relativeCpuUsage=0.00" + ), + Iteration( + "nonZeroDoubleValueTillTwoDecimalPoints", + "firstCpuValue=1000", + "secondCpuValue=1100", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=1665790700", + "firstNumberOfOnlineCoresValue=6", + "secondNumberOfOnlineCoresValue=2", + "relativeCpuUsage=0.50" + ), + Iteration( + "nonZeroDoubleValueTillSevenDecimalPoints", + "firstCpuValue=1000", + "secondCpuValue=12100", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=1869790700", + "firstNumberOfOnlineCoresValue=6", + "secondNumberOfOnlineCoresValue=8", + "relativeCpuUsage=0.0000077" + ), + Iteration( + "nonZeroDoubleValueTillElevenDecimalPoints", + "firstCpuValue=1000", + "secondCpuValue=2100", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=186933790700", + "firstNumberOfOnlineCoresValue=6", + "secondNumberOfOnlineCoresValue=3", + "relativeCpuUsage=0.00000000239" + ) + ) + fun testAssessor_setFirstAndSecondSnapshot_returnsCorrectRelativeCpuUsage() { + val firstSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + firstAppTimeValue, + firstCpuValue, + firstNumberOfOnlineCoresValue + ) + val secondSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + secondAppTimeValue, + secondCpuValue, + secondNumberOfOnlineCoresValue + ) + val returnedRelativeCpuUsage = + performanceMetricsAssessorImpl.getRelativeCpuUsage(firstSnapshot, secondSnapshot) + assertThat(returnedRelativeCpuUsage).isWithin(1e-5).of(relativeCpuUsage) + } + + @Test + @RunParameterized( + Iteration( + "zeroDeltaOnlineCores", + "firstNumberOfOnlineCoresValue=6", + "secondNumberOfOnlineCoresValue=0" + ), + Iteration( + "negativeOnlineCores", + "firstNumberOfOnlineCoresValue=-1", + "secondNumberOfOnlineCoresValue=6" + ) + ) + fun testAssessor_inputInvalidOnlineCoresValues_calculateCpuUsage_returnsNull() { + val firstSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + firstAppTimeValue, + firstCpuValue, + firstNumberOfOnlineCoresValue + ) + val secondSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + secondAppTimeValue, + secondCpuValue, + secondNumberOfOnlineCoresValue + ) + + val relativeCpuUsage = + performanceMetricsAssessorImpl.getRelativeCpuUsage(firstSnapshot, secondSnapshot) + + assertThat(relativeCpuUsage).isNull() + } + + @Test + @RunParameterized( + Iteration("negativeDeltaCpuValue", "firstCpuValue=1000", "secondCpuValue=900"), + Iteration("negativeCpuValue", "firstCpuValue=1000", "secondCpuValue=-900"), + Iteration("outOfBoundsCpuValue", "firstCpuValue=1000", "secondCpuValue=9223372036854775807"), + ) + fun testAssessor_inputInvalidCpuTimeValues_calculateCpuUsage_returnsNull() { + val firstSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + firstAppTimeValue, + firstCpuValue, + firstNumberOfOnlineCoresValue + ) + val secondSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + secondAppTimeValue, + secondCpuValue, + secondNumberOfOnlineCoresValue + ) + + val relativeCpuUsage = + performanceMetricsAssessorImpl.getRelativeCpuUsage(firstSnapshot, secondSnapshot) + + assertThat(relativeCpuUsage).isNull() + } + + @Test + @RunParameterized( + Iteration( + "negativeDeltaAppTimeValue", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=1665790050" + ), + Iteration( + "negativeAppTimeValue", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=-1665790050" + ), + Iteration( + "zeroDeltaAppTimeValue", + "firstAppTimeValue=1665790650", + "secondAppTimeValue=1665790650" + ), + ) + fun testAssessor_inputInvalidAppTimeValues_calculateCpuUsage_returnsNull() { + val firstSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + firstAppTimeValue, + firstCpuValue, + firstNumberOfOnlineCoresValue + ) + val secondSnapshot = PerformanceMetricsAssessor.CpuSnapshot( + secondAppTimeValue, + secondCpuValue, + secondNumberOfOnlineCoresValue + ) + + val relativeCpuUsage = + performanceMetricsAssessorImpl.getRelativeCpuUsage(firstSnapshot, secondSnapshot) + + assertThat(relativeCpuUsage).isNull() + } + + @Test + fun testAssessor_getCurrentCpuSnapshot_snapshotHasCurrentAppTime() { + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_CURRENT_TIME) + + val currentSnapshot = performanceMetricsAssessorImpl.computeCpuSnapshotAtCurrentTime() + + assertThat(currentSnapshot.appTimeMillis).isEqualTo(TEST_CURRENT_TIME) + } + + @Test + @RunParameterized( + Iteration("memoryEqualToLowerBound", "totalMemory=0"), + Iteration("memoryInRange", "totalMemory=1147483648"), + Iteration("memoryJustBelowUpperBound", "totalMemory=2147483647") ) fun testAssessor_setTotalMemoryForLowMemoryRange_returnsCorrectLowMemoryTier() { val memoryInfo = ActivityManager.MemoryInfo() @@ -223,9 +396,9 @@ class PerformanceMetricsAssessorImplTest { @Test @RunParameterized( - OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=2147483649"), - OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=2684354560"), - OppiaParameterizedTestRunner.Iteration("memoryEqualToUpperBound", "totalMemory=3221225472") + Iteration("memoryEqualToLowerBound", "totalMemory=2147483649"), + Iteration("memoryInRange", "totalMemory=2684354560"), + Iteration("memoryEqualToUpperBound", "totalMemory=3221225472") ) fun testAssessor_setTotalMemoryForMediumMemoryRange_retsCorrectMediumMemoryTier() { val memoryInfo = ActivityManager.MemoryInfo() @@ -238,9 +411,9 @@ class PerformanceMetricsAssessorImplTest { @Test @RunParameterized( - OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=3221225473"), - OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=5221225472"), - OppiaParameterizedTestRunner.Iteration( + Iteration("memoryEqualToLowerBound", "totalMemory=3221225473"), + Iteration("memoryInRange", "totalMemory=5221225472"), + Iteration( "memoryEqualToMaxValue", "totalMemory=9223372036854775807" ) diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt index 6a88d8522a2..056f3d76615 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt @@ -12,12 +12,18 @@ import dagger.Module import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.oppia.android.testing.FakeEventLogger +import org.oppia.android.testing.FakeExceptionLogger +import org.oppia.android.testing.FakePerformanceMetricsEventLogger import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.util.data.DataProvidersInjector import org.oppia.android.util.data.DataProvidersInjectorProvider +import org.oppia.android.util.locale.LocaleProdModule +import org.oppia.android.util.logging.EventLogger +import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.LoggerModule -import org.oppia.android.util.logging.firebase.LogReportingModule +import org.oppia.android.util.system.OppiaClockModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -55,13 +61,29 @@ class PerformanceMetricsAssessorModuleTest { fun provideContext(application: Application): Context } + @Module + interface TestLogReportingModule { + + @Binds + fun bindFakeExceptionLogger(fakeExceptionLogger: FakeExceptionLogger): ExceptionLogger + + @Binds + fun bindFakeEventLogger(fakeEventLogger: FakeEventLogger): EventLogger + + @Binds + fun bindFakePerformanceMetricsEventLogger( + fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger + } + // TODO(#89): Move this to a common test application component. @Singleton @Component( modules = [ TestModule::class, PerformanceMetricsAssessorModule::class, LoggerModule::class, - TestDispatcherModule::class, LogReportingModule::class, RobolectricModule::class, - PerformanceMetricsConfigurationsModule::class + TestDispatcherModule::class, TestLogReportingModule::class, RobolectricModule::class, + PerformanceMetricsConfigurationsModule::class, OppiaClockModule::class, + LocaleProdModule::class ] ) interface TestApplicationComponent : DataProvidersInjector {