From ac1cb65a4a2b180e29a145eedf03b99ea8dfd80e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 27 Apr 2022 21:02:14 +0530 Subject: [PATCH 001/149] qualifiers and constants for metric record and upload times --- .../PlatformParameterConstants.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index 38d66b30d27..bf28a6f92ca 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -92,3 +92,36 @@ const val CACHE_LATEX_RENDERING = "cache_latex_rendering" /** Default value for whether to cache LaTeX rendering using Glide. */ const val CACHE_LATEX_RENDERING_DEFAULT_VALUE = true + +@Qualifier +annotation class PerformanceMetricsCollection + +const val PERFORMANCE_METRICS_COLLECTION = "performance_metrics_collection" + +const val PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false + +@Qualifier +annotation class PerformanceMetricsCollectionUploadTimeIntervalInMinutes + +const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_upload_time_interval_in_minutes" + +const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 + +@Qualifier +annotation class PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes + +const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_frequent_record_time_interval_in_minutes" + +const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 + +@Qualifier +annotation class PerformanceMetricsCollectionRecordTimeIntervalInMinutes + +const val PERFORMANCE_METRICS_COLLECTION_RECORD_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_record_time_interval_in_minutes" + +const val PERFORMANCE_METRICS_COLLECTION_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 + + From ee7df23b9edba5e001aa0af6f70796b3fbe86d3b Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 27 Apr 2022 22:42:15 +0530 Subject: [PATCH 002/149] comments --- .../PlatformParameterConstants.kt | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index bf28a6f92ca..a3aecba9093 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -93,35 +93,69 @@ const val CACHE_LATEX_RENDERING = "cache_latex_rendering" /** Default value for whether to cache LaTeX rendering using Glide. */ const val CACHE_LATEX_RENDERING_DEFAULT_VALUE = true +/** Qualifier for the platform parameter that controls whether to record performance metrics. */ @Qualifier annotation class PerformanceMetricsCollection +/** Name of the platform parameter that controls whether to record performance metrics. */ const val PERFORMANCE_METRICS_COLLECTION = "performance_metrics_collection" +/** Default value for whether to record performance metrics. */ const val PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false +/** + * Qualifier for the platform parameter that controls the time interval in minutes of uploading + * previously recorded performance metrics to the remote service. + */ @Qualifier annotation class PerformanceMetricsCollectionUploadTimeIntervalInMinutes +/** + * Name of the platform parameter that controls the time interval in minutes of uploading previously + * recorded performance metrics to the remote service. + */ const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES = "performance_metrics_collection_upload_time_interval_in_minutes" +/** + * Default value of the time interval in minutes of uploading previously recorded performance + * metrics to the remote service. + */ const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 +/** + * Qualifier for the platform parameter that controls the time interval in minutes of recording + * performance metrics that are to be recorded more frequently. + */ @Qualifier annotation class PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes +/** + * Name of the platform parameter that controls the time interval in minutes of recording + * performance metrics that are to be recorded more frequently. + */ const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = "performance_metrics_collection_frequent_record_time_interval_in_minutes" +/** + * Default value of the time interval in minutes of recording performance metrics that are to be + * recorded more frequently. + */ const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 +/** + * Qualifier for the platform parameter that controls the time interval in minutes of recording + * performance metrics. + */ @Qualifier -annotation class PerformanceMetricsCollectionRecordTimeIntervalInMinutes - -const val PERFORMANCE_METRICS_COLLECTION_RECORD_TIME_INTERVAL_IN_MINUTES = - "performance_metrics_collection_record_time_interval_in_minutes" - -const val PERFORMANCE_METRICS_COLLECTION_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 +annotation class PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes +/** + * Name of the platform parameter that controls the time interval in minutes of recording + * performance metrics. + */ +const val PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_regular_record_time_interval_in_minutes" +/** Default value of the time interval in minutes of recording performance metrics. */ +const val PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 From 0adaa4bc9803bb7973a776862ab1f8a5ac931ff8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 28 Apr 2022 00:35:35 +0530 Subject: [PATCH 003/149] dagger provides for flags --- .../PlatformParameterModule.kt | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index c228216d7f0..e7df962922c 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -10,6 +10,18 @@ import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG @@ -68,4 +80,49 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter(CACHE_LATEX_RENDERING) ?: PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE) } + + @Provides + @PerformanceMetricsCollection + fun providePerformanceMetricCollection( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(PERFORMANCE_METRICS_COLLECTION) + ?: PlatformParameterValue.createDefaultParameter(PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE) + } + + @Provides + @PerformanceMetricsCollectionUploadTimeIntervalInMinutes + fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes + fun providePerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes + fun providePerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } } From fee9bd681cfa16332714e0adf3d6730fb513f4eb Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 29 Apr 2022 22:10:18 +0530 Subject: [PATCH 004/149] rename to enablePerformanceMetricCollection --- .../platformparameter/PlatformParameterModule.kt | 14 +++++++------- .../PlatformParameterConstants.kt | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index e7df962922c..dfe04e4a0ab 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -10,15 +10,15 @@ import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_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.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollection +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes @@ -82,12 +82,12 @@ class PlatformParameterModule { } @Provides - @PerformanceMetricsCollection - fun providePerformanceMetricCollection( + @EnablePerformanceMetricsCollection + fun provideEnablePerformanceMetricCollection( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(PERFORMANCE_METRICS_COLLECTION) - ?: PlatformParameterValue.createDefaultParameter(PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE) + return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_PERFORMANCE_METRICS_COLLECTION) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE) } @Provides diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index a3aecba9093..d36ad3f5a6c 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -95,13 +95,13 @@ const val CACHE_LATEX_RENDERING_DEFAULT_VALUE = true /** Qualifier for the platform parameter that controls whether to record performance metrics. */ @Qualifier -annotation class PerformanceMetricsCollection +annotation class EnablePerformanceMetricsCollection /** Name of the platform parameter that controls whether to record performance metrics. */ -const val PERFORMANCE_METRICS_COLLECTION = "performance_metrics_collection" +const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_collection" /** Default value for whether to record performance metrics. */ -const val PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false +const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false /** * Qualifier for the platform parameter that controls the time interval in minutes of uploading From d3f746f65cf67905c22a49330318c6e5347c4227 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 30 Apr 2022 01:04:46 +0530 Subject: [PATCH 005/149] initial proto --- .../src/main/proto/performance_metrics.proto | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 model/src/main/proto/performance_metrics.proto diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto new file mode 100644 index 00000000000..ecaede86cf2 --- /dev/null +++ b/model/src/main/proto/performance_metrics.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; + +package model; + +option java_package = "org.oppia.android.app.model"; +option java_multiple_files = true; + +message OppiaMetricLog { + // unit: long/millis, timezone: UTC + int64 timestampMillis = 1; + Priority priority = 3; + bool isAppInForeground = 4; + MemoryTier memoryTier = 5; + StorageTier storageTier = 6; + NetworkType networkType = 7; + CurrentActivity currentActivity = 8; + + message ApkSize { + int64 apkSizeBytes = 1; //unit: bytes + } + + message StorageUsage { + int64 storageUsageBytes = 1; //unit: bytes + } + + message StartupLatency { + int64 startupLatencyMillis = 1; //unit: bytes + } + + message MemoryMetric { + int64 total_pss_bytes = 1; //unit: bytes + } + + message NetworkUsage{ + int64 bytesReceived = 1; + int64 bytesTransmitted = 2; + } + + message CpuUsage{ + int64 cpuUsage = 1; //unit: bytes + } + + enum Priority { + PRIORITY_UNSPECIFIED = 0; + LOW_PRIORITY = 1; + MEDIUM_PRIORITY = 2; + HIGH_PRIORITY = 3; + } + + enum CurrentActivity { + ACTIVITY_UNSPECIFIED = 0; + HOME_ACTIVITY = 1; + // this enum would contain the names of all the activities where logging metrics would be added. + // TODO(#): Add Activity + } + + enum MemoryTier { + MEMORY_TIER_UNSPECIFIED = 0; + LOW_MEMORY_TIER = 1; // =<1GB + MEDIUM_MEMORY_TIER = 2; // =<2GB && >1GB + HIGH_MEMORY_TIER = 3; // >2GB + } + + enum StorageTier { + STORAGE_TIER_UNSPECIFIED = 0; + LOW_STORAGE = 1; // =<5GB + MEDIUM_STORAGE = 2; // =<20GB && >5GB + HIGH_STORAGE = 3; // >20GB + } + + enum NetworkType { + NETWORK_UNSPECIFIED = 0; + NONE = 1; + WIFI = 2; + CELLULAR = 3; + } +} + +message OppiaMetricLogs { + repeated OppiaMetricLog oppiaMetricLog = 1; +} From 37a22c5d3f59c8aa4fc8fd6796faa0b5e1ca88bf Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 30 Apr 2022 09:19:39 +0530 Subject: [PATCH 006/149] nit fixes --- .../platformparameter/PlatformParameterModule.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index dfe04e4a0ab..1a20620c16b 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -6,19 +6,19 @@ import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering 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.EnableLanguageSelectionUi +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -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.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes @@ -86,8 +86,11 @@ class PlatformParameterModule { fun provideEnablePerformanceMetricCollection( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_PERFORMANCE_METRICS_COLLECTION) - ?: PlatformParameterValue.createDefaultParameter(ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE) + return platformParameterSingleton.getBooleanPlatformParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION + ) ?: PlatformParameterValue.createDefaultParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE + ) } @Provides From 2b3cc6f046b39ccf13e86fcea70988308ad9afe1 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 30 Apr 2022 09:22:29 +0530 Subject: [PATCH 007/149] nit fixes --- .../src/main/proto/performance_metrics.proto | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index ecaede86cf2..002ac19762a 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -7,24 +7,24 @@ option java_multiple_files = true; message OppiaMetricLog { // unit: long/millis, timezone: UTC - int64 timestampMillis = 1; + int64 timestamp_millis = 1; Priority priority = 3; - bool isAppInForeground = 4; - MemoryTier memoryTier = 5; - StorageTier storageTier = 6; - NetworkType networkType = 7; - CurrentActivity currentActivity = 8; + bool is_app_in_foreground = 4; + MemoryTier memory_tier = 5; + StorageTier storage_tier = 6; + NetworkType network_type = 7; + CurrentActivity current_activity = 8; message ApkSize { - int64 apkSizeBytes = 1; //unit: bytes + int64 apk_size_bytes = 1; //unit: bytes } message StorageUsage { - int64 storageUsageBytes = 1; //unit: bytes + int64 storage_usage_bytes = 1; //unit: bytes } message StartupLatency { - int64 startupLatencyMillis = 1; //unit: bytes + int64 startup_latency_millis = 1; //unit: bytes } message MemoryMetric { @@ -32,12 +32,12 @@ message OppiaMetricLog { } message NetworkUsage{ - int64 bytesReceived = 1; - int64 bytesTransmitted = 2; + int64 bytes_received = 1; + int64 bytes_transmitted = 2; } message CpuUsage{ - int64 cpuUsage = 1; //unit: bytes + int64 cpu_usage = 1; //unit: bytes } enum Priority { @@ -51,7 +51,6 @@ message OppiaMetricLog { ACTIVITY_UNSPECIFIED = 0; HOME_ACTIVITY = 1; // this enum would contain the names of all the activities where logging metrics would be added. - // TODO(#): Add Activity } enum MemoryTier { @@ -77,5 +76,5 @@ message OppiaMetricLog { } message OppiaMetricLogs { - repeated OppiaMetricLog oppiaMetricLog = 1; + repeated OppiaMetricLog oppia_metric_log = 1; } From 8d7ace6398e5b272adbcfd59a4c4c9a33442243c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 2 May 2022 05:10:01 +0530 Subject: [PATCH 008/149] comments. --- .../src/main/proto/performance_metrics.proto | 95 ++++++++++++++++--- 1 file changed, 82 insertions(+), 13 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 002ac19762a..d34f2b71da2 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -5,76 +5,145 @@ package model; option java_package = "org.oppia.android.app.model"; option java_multiple_files = true; +// Structure for an oppia metric log. message OppiaMetricLog { + // The timestamp of the event. // unit: long/millis, timezone: UTC int64 timestamp_millis = 1; - Priority priority = 3; - bool is_app_in_foreground = 4; - MemoryTier memory_tier = 5; - StorageTier storage_tier = 6; - NetworkType network_type = 7; - CurrentActivity current_activity = 8; + // The priority of the event. + Priority priority = 2; + + // Indicates whether the application is in foreground. + bool is_app_in_foreground = 3; + + // The memory tier of the current device. + MemoryTier memory_tier = 4; + + // The storage tier of the current device. + StorageTier storage_tier = 5; + + // The current network type of the device. + NetworkType network_type = 6; + + // The current activity where the event is getting logged. + CurrentActivity current_activity = 7; + + // Structure of the apk size package. message ApkSize { - int64 apk_size_bytes = 1; //unit: bytes + // Size of the android package file of the app on the device in bytes. + int64 apk_size_bytes = 1; } + // Structure of the storage usage package. message StorageUsage { - int64 storage_usage_bytes = 1; //unit: bytes + // Amount of storage usage by the app on user's device in bytes. + int64 storage_usage_bytes = 1; } + // Structure of the startup latency package. message StartupLatency { - int64 startup_latency_millis = 1; //unit: bytes + // Amount of latency on application startup in millis. + int64 startup_latency_millis = 1; } - message MemoryMetric { - int64 total_pss_bytes = 1; //unit: bytes + // Structure of the memory usage package. + message MemoryUsage { + // Amount of memory used by the application on the device in bytes. + int64 total_pss_bytes = 1; } + // Structure of the network usage package. message NetworkUsage{ + // Number of bytes received by the application on the device during the bucket's time interval. int64 bytes_received = 1; + + // Number of bytes transmitted by the application from the device during the bucket's time + // interval. int64 bytes_transmitted = 2; } + // Structure of the cpu usage package. message CpuUsage{ - int64 cpu_usage = 1; //unit: bytes + // Amount of cpu used by the application. + int64 cpu_usage = 1; } + // Supported priority of events for performance metric logging. enum Priority { + // The undefined priority of an event. PRIORITY_UNSPECIFIED = 0; + + // The priority of events whose logs will be the first to be removed from the storage if the + // size exceeds a certain limit LOW_PRIORITY = 1; + + // The priority of events whose logs will be the ones to be removed from the storage if the + // size exceeds a certain limit and no low priority logs exist. MEDIUM_PRIORITY = 2; + + // The priority of events whose logs should not be removed from the storage on most occasions + // but can be removed if they're the only ones there and size limit exceeds. HIGH_PRIORITY = 3; } + // Supported activities for indicating the current activity where the event logging is occuring. enum CurrentActivity { + // The undefined current activity of an event. ACTIVITY_UNSPECIFIED = 0; + + // The metric log was taken when home activity was opened. HOME_ACTIVITY = 1; - // this enum would contain the names of all the activities where logging metrics would be added. + // TODO(#4340): Add support for all activities which are going to be used for metric logging. } + // Supported memory tiers for indicating the total memory of user's device. enum MemoryTier { + // The undefined memory tier of a device. MEMORY_TIER_UNSPECIFIED = 0; + + // The memory tier where the amount of memory is less than or equal to 1GB. LOW_MEMORY_TIER = 1; // =<1GB + + // The memory tier where the amount of memory is less than or equal to 2GB and more than 1GB. MEDIUM_MEMORY_TIER = 2; // =<2GB && >1GB + + // The memory tier where the amount of memory is greater than 2GB. HIGH_MEMORY_TIER = 3; // >2GB } + // Supported storage tiers for indicating the total storage space on user's device. enum StorageTier { + // The undefined storage tier of a device. STORAGE_TIER_UNSPECIFIED = 0; + + // The storage tier where the amount of storage is less than or equal to 5GB. LOW_STORAGE = 1; // =<5GB + + // The storage tier where the amount of storage is less than or equal to 2GB and more than 1GB. MEDIUM_STORAGE = 2; // =<20GB && >5GB + + // The storage tier where the amount of storage is greater than 2GB. HIGH_STORAGE = 3; // >20GB } + // Supported network types for indicating the current network situation on user's device. enum NetworkType { + // The undefined network type of a device. NETWORK_UNSPECIFIED = 0; + + // Indicates that the device is not connected to any network. NONE = 1; + + // Indicates that the device is connected to wifi or ethernet. WIFI = 2; + + // Indicates that the device is connected to mobile or WiMax. CELLULAR = 3; } } +// Structure for a container that contains metric log reports. message OppiaMetricLogs { repeated OppiaMetricLog oppia_metric_log = 1; } From 49e2a9af30806292ba80bca665b111b258c49a4a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 14 May 2022 02:59:01 +0530 Subject: [PATCH 009/149] nits --- .../PlatformParameterModule.kt | 24 +++++++++---------- .../PlatformParameterConstants.kt | 23 +++++++++++------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index 1a20620c16b..f76d9325973 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -13,14 +13,14 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue @@ -106,26 +106,26 @@ class PlatformParameterModule { } @Provides - @PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes + @PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes fun providePerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES + PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL ) } @Provides - @PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes + @PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes fun providePerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES + PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL ) } } diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index d36ad3f5a6c..6f8b0ef407f 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -128,34 +128,39 @@ const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT * performance metrics that are to be recorded more frequently. */ @Qualifier -annotation class PerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes +annotation class PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes /** * Name of the platform parameter that controls the time interval in minutes of recording * performance metrics that are to be recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = +const val PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = "performance_metrics_collection_frequent_record_time_interval_in_minutes" /** * Default value of the time interval in minutes of recording performance metrics that are to be * recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 +const val PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = + 15 /** * Qualifier for the platform parameter that controls the time interval in minutes of recording - * performance metrics. + * performance metrics that are to be recorded less frequently. */ @Qualifier -annotation class PerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes +annotation class PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes /** * Name of the platform parameter that controls the time interval in minutes of recording - * performance metrics. + * performance metrics that are to be recorded less frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES = +const val PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = "performance_metrics_collection_regular_record_time_interval_in_minutes" -/** Default value of the time interval in minutes of recording performance metrics. */ -const val PERFORMANCE_METRICS_COLLECTION_REGULAR_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 +/** + * Default value of the time interval in minutes of recording performance metrics that are to be + * recorded less frequently. + */ +const val PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = + 1440 From c9a18407ef471924888fa30fc55f62fea8de25b1 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 14 May 2022 03:00:06 +0530 Subject: [PATCH 010/149] nit --- .../domain/platformparameter/PlatformParameterModule.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index f76d9325973..5bf12398e3c 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -13,14 +13,14 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue From 7dc2fa4520e9c5043ad421ed7408387c0fc2dbfe Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 7 Jun 2022 20:16:13 +0530 Subject: [PATCH 011/149] updates. --- .../src/main/proto/performance_metrics.proto | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index d34f2b71da2..5f21098dfe0 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -7,14 +7,13 @@ option java_multiple_files = true; // Structure for an oppia metric log. message OppiaMetricLog { - // The timestamp of the event. - // unit: long/millis, timezone: UTC + // The UTC timestamp of the event in long/millis. int64 timestamp_millis = 1; // The priority of the event. Priority priority = 2; - // Indicates whether the application is in foreground. + // Indicates whether the application is in the foreground. bool is_app_in_foreground = 3; // The memory tier of the current device. @@ -26,45 +25,51 @@ message OppiaMetricLog { // The current network type of the device. NetworkType network_type = 6; - // The current activity where the event is getting logged. - CurrentActivity current_activity = 7; + // The current screen where the event is getting logged. + CurrentScreen current_screen = 7; - // Structure of the apk size package. + message MetricLogType { + + } + + // Structure of the apk size metric. message ApkSize { - // Size of the android package file of the app on the device in bytes. + // Size of the app's installed APK file, in bytes. int64 apk_size_bytes = 1; } - // Structure of the storage usage package. + // Structure of the storage usage metric. message StorageUsage { // Amount of storage usage by the app on user's device in bytes. int64 storage_usage_bytes = 1; } - // Structure of the startup latency package. + // Structure of the startup latency metric. message StartupLatency { - // Amount of latency on application startup in millis. + // Number of milliseconds required to start up the application from a cold start. int64 startup_latency_millis = 1; } - // Structure of the memory usage package. + // Structure of the memory usage metric. message MemoryUsage { // Amount of memory used by the application on the device in bytes. int64 total_pss_bytes = 1; } - // Structure of the network usage package. - message NetworkUsage{ - // Number of bytes received by the application on the device during the bucket's time interval. + // Structure of the network usage metric. + message NetworkUsage { + // Usage data is collected in discrete bins of time called 'Buckets'. This fields denotes the + // number of bytes received by the application on the device during this bucket's time interval. int64 bytes_received = 1; - // Number of bytes transmitted by the application from the device during the bucket's time + // Usage data is collected in discrete bins of time called 'Buckets'. This fields denotes the + // number of bytes transmitted by the application on the device during this bucket's time // interval. int64 bytes_transmitted = 2; } - // Structure of the cpu usage package. - message CpuUsage{ + // Structure of the cpu usage metric. + message CpuUsage { // Amount of cpu used by the application. int64 cpu_usage = 1; } @@ -87,14 +92,14 @@ message OppiaMetricLog { HIGH_PRIORITY = 3; } - // Supported activities for indicating the current activity where the event logging is occuring. - enum CurrentActivity { - // The undefined current activity of an event. - ACTIVITY_UNSPECIFIED = 0; + // Supported screens for indicating the current screen where the event logging is occurring. + enum CurrentScreen { + // The undefined current screen of an event. + SCREEN_UNSPECIFIED = 0; - // The metric log was taken when home activity was opened. - HOME_ACTIVITY = 1; - // TODO(#4340): Add support for all activities which are going to be used for metric logging. + // The metric log was taken when home screen was opened. + HOME_SCREEN = 1; + // TODO(#4340): Add support for all screens which are going to be used for metric logging. } // Supported memory tiers for indicating the total memory of user's device. From c515e7d0242236aab617f463f2324e3972bac778 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 7 Jun 2022 20:21:38 +0530 Subject: [PATCH 012/149] updates. --- .../platformparameter/PlatformParameterModule.kt | 16 ++++++++-------- .../PlatformParameterConstants.kt | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index 5bf12398e3c..b6d667bc557 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -15,12 +15,12 @@ import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_ import org.oppia.android.util.platformparameter.LearnerStudyAnalytics import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue @@ -106,20 +106,20 @@ class PlatformParameterModule { } @Provides - @PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes - fun providePerformanceMetricsCollectionFrequentRecordTimeIntervalInMinutes( + @PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes + fun providePerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL ) } @Provides @PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes - fun providePerformanceMetricsCollectionRegularRecordTimeIntervalInMinutes( + fun providePerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index 6f8b0ef407f..814981cc31d 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -128,20 +128,20 @@ const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT * performance metrics that are to be recorded more frequently. */ @Qualifier -annotation class PerformanceMetricsCollectionMoreFrequentRecordTimeIntervalInMinutes +annotation class PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes /** * Name of the platform parameter that controls the time interval in minutes of recording * performance metrics that are to be recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = - "performance_metrics_collection_frequent_record_time_interval_in_minutes" +const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_high_frequent_record_time_interval_in_minutes" /** * Default value of the time interval in minutes of recording performance metrics that are to be * recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_MORE_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = +const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 /** From 9e98a40dbb835968d69bcd69ae0be754f451d129 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 7 Jun 2022 20:23:30 +0530 Subject: [PATCH 013/149] nits. --- .../domain/platformparameter/PlatformParameterModule.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index b6d667bc557..27a3fad2a49 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -13,14 +13,14 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue From 1ae4e175a601b01cbeefb34db10b6da25362591b Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 8 Jun 2022 03:01:32 +0530 Subject: [PATCH 014/149] metric log inclusion. --- .../src/main/proto/performance_metrics.proto | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 5f21098dfe0..3842dd80f39 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -25,11 +25,33 @@ message OppiaMetricLog { // The current network type of the device. NetworkType network_type = 6; + // The metric log of the event. + MetricLog metric_log = 7; + // The current screen where the event is getting logged. - CurrentScreen current_screen = 7; + CurrentScreen current_screen = 8; + + // Structure of a metric log. + message MetricLog { + oneof metric_log_type { + // The metric being logged is related to the apk size of the application. + ApkSize apk_size = 1; + + // The metric being logged is related to the storage usage of the application. + StorageUsage storage_usage = 2; + + // The metric being logged is related to the startup latency of the application. + StartupLatency startup_latency = 3; + + // The metric being logged is related to the memory usage of the application. + MemoryUsage memory_usage = 4; + + // The metric being logged is related to the network usage of the application. + NetworkUsage network_usage = 5; - message MetricLogType { - + // The metric being logged is related to the cpu usage of the application. + CpuUsage cpu_usage = 6; + } } // Structure of the apk size metric. From 16603dda70b3ade87ea7f1bc3176318af498d716 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 04:21:23 +0530 Subject: [PATCH 015/149] base setup. --- .../android/domain/oppialogger/OppiaLogger.kt | 12 +++ .../analytics/AppHealthMetricController.kt | 24 ++++++ .../loggenerator/LogGenerationWorker.kt | 79 +++++++++++++++++ .../LogGenerationWorkerFactory.kt | 22 +++++ .../LogUploadWorkManagerInitializer.kt | 85 +++++++++++++++++-- .../WorkManagerConfigurationModule.kt | 5 +- .../android/util/logging/LogGenerator.kt | 25 ++++++ .../performancemetrics/MetricLogGenerator.kt | 49 +++++++++++ .../MetricLogGeneratorModule.kt | 12 +++ .../PerformanceMetricLogger.kt | 7 ++ .../metriccollection/AppHealthMetricUtils.kt | 5 ++ .../metriccollection/AppStartupMetrics.kt | 9 ++ .../util/metriccollection/PeriodicMetrics.kt | 6 ++ .../metriccollection/UiSpecificMetrics.kt | 8 ++ 14 files changed, 342 insertions(+), 6 deletions(-) create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt create mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt create mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt create mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt create mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 12ff9e6a5c2..3bccbdd347f 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -5,6 +5,7 @@ import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject +import org.oppia.android.app.model.OppiaMetricLog /** Logger that handles general-purpose logging throughout the domain & UI layers. */ class OppiaLogger @Inject constructor( @@ -218,4 +219,15 @@ class OppiaLogger @Inject constructor( ) .build() } + + fun createApkSizeMetricLog( + apkSize: Long + ): OppiaMetricLog.MetricLog { + return OppiaMetricLog.MetricLog.newBuilder() + .setApkSize( + OppiaMetricLog.ApkSize.newBuilder() + .setApkSizeBytes(apkSize) + .build() + ).build() + } } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt new file mode 100644 index 00000000000..c2f3626355d --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt @@ -0,0 +1,24 @@ +package org.oppia.android.domain.oppialogger.analytics + +import org.oppia.android.domain.oppialogger.ApplicationStartupListener + +interface AppHealthMetricController: ApplicationStartupListener { + + override fun onCreate() {} + + fun logHighPriorityEvent() + + fun logMediumPriorityEvent() + + fun logLowPriorityEvent() + + fun uploadOrCacheLog() + + fun cacheMetricLog() + + fun createMetricLog() + + fun removeFirstLog() + + fun getStore() +} \ No newline at end of file diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt new file mode 100644 index 00000000000..e8086b435f8 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt @@ -0,0 +1,79 @@ +package org.oppia.android.domain.oppialogger.loggenerator + +import android.content.Context +import androidx.work.ListenableWorker +import androidx.work.WorkerParameters +import com.google.common.util.concurrent.ListenableFuture +import com.google.common.util.concurrent.SettableFuture +import javax.inject.Inject +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.async +import org.oppia.android.domain.util.getStringFromData +import org.oppia.android.util.threading.BackgroundDispatcher + +/** + * Worker class that generates metric log reports regarding the performance of the application + * and then stores it in in device cache. + */ +class LogGenerationWorker private constructor( + context: Context, + params: WorkerParameters, + @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher +): ListenableWorker(context, params) { + + companion object { + const val WORKER_CASE_KEY = "worker_case_key" + const val TAG = "LogGenerationWorker.tag" + const val PERIODIC_METRIC_WORKER = "periodic_metric_worker" + const val STORAGE_USAGE_WORKER = "storage_usage_worker" + const val MEMORY_USAGE_WORKER = "memory_usage_worker" + } + + override fun startWork(): ListenableFuture { + val backgroundScope = CoroutineScope(backgroundDispatcher) + val result = backgroundScope.async { + when(inputData.getStringFromData(WORKER_CASE_KEY)) { + PERIODIC_METRIC_WORKER -> generatePeriodicMetricLog() + STORAGE_USAGE_WORKER -> generateStorageUsageMetricLog() + MEMORY_USAGE_WORKER -> generateMemoryUsageMetricLog() + else -> Result.failure() + } + } + + val future = SettableFuture.create() + result.invokeOnCompletion { failure -> + if (failure != null) { + future.setException(failure) + } else { + future.set(result.getCompleted()) + } + } + // TODO(#3715): Add withTimeout() to avoid potential hanging. + return future + } + + private fun generatePeriodicMetricLog(): Result { + // TODO(#4334): Add functionality to generate metric log reports for periodic events. + return Result.failure() + } + + private fun generateStorageUsageMetricLog(): Result { + // TODO(#4334): Add functionality to generate metric log reports for storage usage. + return Result.failure() + } + + private fun generateMemoryUsageMetricLog(): Result { + // TODO(#4334): Add functionality to generate metric log reports for memory usage. + return Result.failure() + } + + /** Creates an instance of [LogGenerationWorker] by properly injecting dependencies. */ + class Factory @Inject constructor( + @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher + ) { + fun create(context: Context, params: WorkerParameters): ListenableWorker { + return LogGenerationWorker(context, params, backgroundDispatcher) + } + } +} \ No newline at end of file diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt new file mode 100644 index 00000000000..50a8c89e35a --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt @@ -0,0 +1,22 @@ +package org.oppia.android.domain.oppialogger.loggenerator + +import android.content.Context +import androidx.work.ListenableWorker +import androidx.work.WorkerFactory +import androidx.work.WorkerParameters +import javax.inject.Inject + +/** Custom [WorkerFactory] for the [LogGenerationWorker]. */ +class LogGenerationWorkerFactory @Inject constructor( + private val workerFactory: LogGenerationWorker.Factory +) : WorkerFactory() { + + /** Returns a new [LogGenerationWorker] for the given context and parameters. */ + override fun createWorker( + appContext: Context, + workerClassName: String, + workerParameters: WorkerParameters + ): ListenableWorker { + return workerFactory.create(appContext, workerParameters) + } +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 5eafd701c40..c01db0f36d5 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -12,15 +12,25 @@ import java.util.UUID import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker +import org.oppia.android.util.logging.LogGenerator +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PlatformParameterValue /** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ @Singleton class LogUploadWorkManagerInitializer @Inject constructor( private val context: Context, - private val logUploader: LogUploader + private val logUploader: LogUploader, + private val logGenerator: LogGenerator, + @PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes + performanceMetricsCollectionHighFrequencyTimeInterval: PlatformParameterValue, + @PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes + performanceMetricCollectionLowFrequencyTimeInterval: PlatformParameterValue ) : ApplicationStartupListener { - private val logUploadWorkerConstraints = Constraints.Builder() + private val logReportWorkerConstraints = Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .setRequiresBatteryNotLow(true) .build() @@ -39,26 +49,91 @@ class LogUploadWorkManagerInitializer @Inject constructor( ) .build() + private val workerCaseForCreatingPeriodicMetricLogs: Data = Data.Builder() + .putString( + LogGenerationWorker.WORKER_CASE_KEY, + LogGenerationWorker.PERIODIC_METRIC_WORKER + ) + .build() + + private val workerCaseForCreatingStorageUsageMetricLogs: Data = Data.Builder() + .putString( + LogGenerationWorker.WORKER_CASE_KEY, + LogGenerationWorker.STORAGE_USAGE_WORKER + ) + .build() + + private val workerCaseForCreatingMemoryUsageMetricLogs: Data = Data.Builder() + .putString( + LogGenerationWorker.WORKER_CASE_KEY, + LogGenerationWorker.MEMORY_USAGE_WORKER + ) + .build() + private val workRequestForUploadingEvents: PeriodicWorkRequest = PeriodicWorkRequest .Builder(LogUploadWorker::class.java, 6, TimeUnit.HOURS) .setInputData(workerCaseForUploadingEvents) - .setConstraints(logUploadWorkerConstraints) + .setConstraints(logReportWorkerConstraints) .build() private val workRequestForUploadingExceptions: PeriodicWorkRequest = PeriodicWorkRequest .Builder(LogUploadWorker::class.java, 6, TimeUnit.HOURS) .setInputData(workerCaseForUploadingExceptions) - .setConstraints(logUploadWorkerConstraints) + .setConstraints(logReportWorkerConstraints) + .build() + + private val workRequestForGeneratingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest + .Builder( + LogGenerationWorker::class.java, + performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), + TimeUnit.MINUTES + ) + .setInputData(workerCaseForCreatingPeriodicMetricLogs) + .setConstraints(logReportWorkerConstraints) .build() + private val workRequestForGeneratingStorageUsageMetricLogs: PeriodicWorkRequest = + PeriodicWorkRequest + .Builder( + LogGenerationWorker::class.java, + performanceMetricCollectionLowFrequencyTimeInterval.value.toLong(), + TimeUnit.MINUTES + ) + .setInputData(workerCaseForCreatingStorageUsageMetricLogs) + .setConstraints(logReportWorkerConstraints) + .build() + + private val workRequestForGeneratingMemoryUsageMetricLogs: PeriodicWorkRequest = + PeriodicWorkRequest + .Builder( + LogGenerationWorker::class.java, + performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), + TimeUnit.MINUTES + ) + .setInputData(workerCaseForCreatingMemoryUsageMetricLogs) + .setConstraints(logReportWorkerConstraints) + .build() + override fun onCreate() { val workManager = WorkManager.getInstance(context) logUploader.enqueueWorkRequestForEvents(workManager, workRequestForUploadingEvents) logUploader.enqueueWorkRequestForExceptions(workManager, workRequestForUploadingExceptions) + logGenerator.enqueueWorkRequestForPeriodicMetrics( + workManager, + workRequestForGeneratingPeriodicMetricLogs + ) + logGenerator.enqueueWorkRequestForStorageUsage( + workManager, + workRequestForGeneratingStorageUsageMetricLogs + ) + logGenerator.enqueueWorkRequestForMemoryUsage( + workManager, + workRequestForGeneratingMemoryUsageMetricLogs + ) } /** Returns the worker constraints set for the log uploading work requests. */ - fun getLogUploadWorkerConstraints(): Constraints = logUploadWorkerConstraints + fun getLogUploadWorkerConstraints(): Constraints = logReportWorkerConstraints /** Returns the [UUID] of the work request that is enqueued for uploading event logs. */ fun getWorkRequestForEventsId(): UUID = workRequestForUploadingEvents.id diff --git a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt index 88244242d3c..2742ec783ad 100644 --- a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt @@ -7,6 +7,7 @@ import dagger.Provides import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerFactory import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorkerFactory /** Provides [Configuration] for the work manager. */ @Module @@ -16,11 +17,13 @@ class WorkManagerConfigurationModule { @Provides fun provideWorkManagerConfiguration( logUploadWorkerFactory: LogUploadWorkerFactory, - platformParameterSyncUpWorkerFactory: PlatformParameterSyncUpWorkerFactory + platformParameterSyncUpWorkerFactory: PlatformParameterSyncUpWorkerFactory, + logGenerationWorkerFactory: LogGenerationWorkerFactory ): Configuration { val delegatingWorkerFactory = DelegatingWorkerFactory() delegatingWorkerFactory.addFactory(logUploadWorkerFactory) delegatingWorkerFactory.addFactory(platformParameterSyncUpWorkerFactory) + delegatingWorkerFactory.addFactory(logGenerationWorkerFactory) return Configuration.Builder().setWorkerFactory(delegatingWorkerFactory).build() } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt new file mode 100644 index 00000000000..b7d5f75179e --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt @@ -0,0 +1,25 @@ +package org.oppia.android.util.logging + +import androidx.work.PeriodicWorkRequest +import androidx.work.WorkManager + +/** Generator for generating metric log reports related to the performance of the application. */ +interface LogGenerator { + /** + * Enqueues a [workRequest] using the [workManager] for generating metric logs of periodic + * metrics like network and cpu usage. + */ + fun enqueueWorkRequestForPeriodicMetrics(workManager: WorkManager, workRequest: PeriodicWorkRequest) + + /** + * Enqueues a [workRequest] using the [workManager] for generating metric logs for getting to + * know the storage usage of the application on the current device. + */ + fun enqueueWorkRequestForStorageUsage(workManager: WorkManager, workRequest: PeriodicWorkRequest) + + /** + * Enqueues a [workRequest] using the [workManager] for generating metric logs for getting to + * know the memory usage of the application on the current device. + */ + fun enqueueWorkRequestForMemoryUsage(workManager: WorkManager, workRequest: PeriodicWorkRequest) +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt new file mode 100644 index 00000000000..15c7a62fb93 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt @@ -0,0 +1,49 @@ +package org.oppia.android.util.logging.performancemetrics + +import androidx.work.ExistingPeriodicWorkPolicy +import androidx.work.PeriodicWorkRequest +import androidx.work.WorkManager +import org.oppia.android.util.logging.LogGenerator + +private const val OPPIA_PERIODIC_METRIC_WORK = "OPPIA_PERIODIC_METRIC_WORK" +private const val OPPIA_STORAGE_USAGE_WORK = "OPPIA_STORAGE_USAGE_WORK" +private const val OPPIA_MEMORY_USAGE_WORK = "OPPIA_MEMORY_USAGE_WORK" + +/** + * Enqueues work requests for generating metric log reports for gaining an insight regarding into + * the performance of the application. + */ +class MetricLogGenerator() : LogGenerator { + override fun enqueueWorkRequestForPeriodicMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + workManager.enqueueUniquePeriodicWork( + OPPIA_PERIODIC_METRIC_WORK, + ExistingPeriodicWorkPolicy.KEEP, + workRequest + ) + } + + override fun enqueueWorkRequestForStorageUsage( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + workManager.enqueueUniquePeriodicWork( + OPPIA_STORAGE_USAGE_WORK, + ExistingPeriodicWorkPolicy.KEEP, + workRequest + ) + } + + override fun enqueueWorkRequestForMemoryUsage( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + workManager.enqueueUniquePeriodicWork( + OPPIA_MEMORY_USAGE_WORK, + ExistingPeriodicWorkPolicy.KEEP, + workRequest + ) + } +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt new file mode 100644 index 00000000000..c2b25bdae28 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt @@ -0,0 +1,12 @@ +package org.oppia.android.util.logging.performancemetrics + +import dagger.Binds +import dagger.Module +import org.oppia.android.util.logging.LogGenerator + +/** Provides Log Generator related dependencies. */ +@Module +interface MetricLogGeneratorModule { + @Binds + fun bindMetricLogGenerator(metricLogGenerator: MetricLogGenerator): LogGenerator +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt new file mode 100644 index 00000000000..b627b372bef --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt @@ -0,0 +1,7 @@ +package org.oppia.android.util.logging.performancemetrics + +import org.oppia.android.app.model.OppiaMetricLog + +interface PerformanceMetricLogger { + fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt new file mode 100644 index 00000000000..7c50e1d70b6 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt @@ -0,0 +1,5 @@ +package org.oppia.android.util.metriccollection + +interface AppHealthMetricUtils { + fun isAppInForeground(): Boolean +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt new file mode 100644 index 00000000000..729485a2f1f --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt @@ -0,0 +1,9 @@ +package org.oppia.android.util.metriccollection + +import org.oppia.android.app.model.OppiaMetricLog + +interface AppStartupMetrics { + fun getApkSize(): Long + fun getUsedStorage(): Long + fun getDeviceStorageTier(): OppiaMetricLog.StorageTier +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt new file mode 100644 index 00000000000..d8106e5969e --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt @@ -0,0 +1,6 @@ +package org.oppia.android.util.metriccollection + +interface PeriodicMetrics { + fun getTotalTransmittedBytes(): Long + fun getTotalReceivedBytes(): Long +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt new file mode 100644 index 00000000000..f26eab5c569 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt @@ -0,0 +1,8 @@ +package org.oppia.android.util.metriccollection + +import org.oppia.android.app.model.OppiaMetricLog + +interface UiSpecificMetrics { + fun getTotalPssUsed(): Long + fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier +} \ No newline at end of file From 0d2a668b33b7dd285c83745d18ce3f292ec92970 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 04:28:59 +0530 Subject: [PATCH 016/149] name correction. --- .../PlatformParameterModule.kt | 28 +++++++++---------- .../PlatformParameterConstants.kt | 16 +++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index 27a3fad2a49..41f2abfacb0 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -13,14 +13,14 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue @@ -106,26 +106,26 @@ class PlatformParameterModule { } @Provides - @PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes - fun providePerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes( + @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL ) } @Provides - @PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes - fun providePerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes( + @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes( platformParameterSingleton: PlatformParameterSingleton ): PlatformParameterValue { return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL ) } } diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index 814981cc31d..385a5a20227 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -128,20 +128,20 @@ const val PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT * performance metrics that are to be recorded more frequently. */ @Qualifier -annotation class PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes +annotation class PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes /** * Name of the platform parameter that controls the time interval in minutes of recording * performance metrics that are to be recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = - "performance_metrics_collection_high_frequent_record_time_interval_in_minutes" +const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_high_frequency_time_interval_in_minutes" /** * Default value of the time interval in minutes of recording performance metrics that are to be * recorded more frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = +const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 15 /** @@ -149,18 +149,18 @@ const val PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENT_RECORD_TIME_INTERVAL_IN_M * performance metrics that are to be recorded less frequently. */ @Qualifier -annotation class PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes +annotation class PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes /** * Name of the platform parameter that controls the time interval in minutes of recording * performance metrics that are to be recorded less frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES = - "performance_metrics_collection_regular_record_time_interval_in_minutes" +const val PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES = + "performance_metrics_collection_low_frequency_time_interval_in_minutes" /** * Default value of the time interval in minutes of recording performance metrics that are to be * recorded less frequently. */ -const val PERFORMANCE_METRICS_COLLECTION_LESS_FREQUENT_RECORD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = +const val PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 From 52e12ebed70c62d700b2e711f7c181bbf193fc27 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 04:32:12 +0530 Subject: [PATCH 017/149] nits. --- model/src/main/proto/performance_metrics.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 3842dd80f39..598217e55aa 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -147,10 +147,10 @@ message OppiaMetricLog { // The storage tier where the amount of storage is less than or equal to 5GB. LOW_STORAGE = 1; // =<5GB - // The storage tier where the amount of storage is less than or equal to 2GB and more than 1GB. + // The storage tier where the amount of storage is less than or equal to 20GB and more than 5GB. MEDIUM_STORAGE = 2; // =<20GB && >5GB - // The storage tier where the amount of storage is greater than 2GB. + // The storage tier where the amount of storage is greater than 20GB. HIGH_STORAGE = 3; // >20GB } From dae599053b8b0255c06298e4437f871c33da809f Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 04:37:08 +0530 Subject: [PATCH 018/149] nits. --- .../oppia/android/domain/oppialogger/OppiaLogger.kt | 2 +- .../oppialogger/analytics/AppHealthMetricController.kt | 4 ++-- .../oppialogger/loggenerator/LogGenerationWorker.kt | 8 ++++---- .../loguploader/LogUploadWorkManagerInitializer.kt | 10 +++++----- .../workmanager/WorkManagerConfigurationModule.kt | 2 +- .../org/oppia/android/util/logging/LogGenerator.kt | 7 +++++-- .../logging/performancemetrics/MetricLogGenerator.kt | 2 +- .../performancemetrics/MetricLogGeneratorModule.kt | 2 +- .../performancemetrics/PerformanceMetricLogger.kt | 2 +- .../util/metriccollection/AppHealthMetricUtils.kt | 2 +- .../android/util/metriccollection/AppStartupMetrics.kt | 2 +- .../android/util/metriccollection/PeriodicMetrics.kt | 2 +- .../android/util/metriccollection/UiSpecificMetrics.kt | 2 +- 13 files changed, 25 insertions(+), 22 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 3bccbdd347f..719fee9928b 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -1,11 +1,11 @@ package org.oppia.android.domain.oppialogger import org.oppia.android.app.model.EventLog +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject -import org.oppia.android.app.model.OppiaMetricLog /** Logger that handles general-purpose logging throughout the domain & UI layers. */ class OppiaLogger @Inject constructor( diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt index c2f3626355d..a754ed852f2 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt @@ -2,7 +2,7 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.domain.oppialogger.ApplicationStartupListener -interface AppHealthMetricController: ApplicationStartupListener { +interface AppHealthMetricController : ApplicationStartupListener { override fun onCreate() {} @@ -21,4 +21,4 @@ interface AppHealthMetricController: ApplicationStartupListener { fun removeFirstLog() fun getStore() -} \ No newline at end of file +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt index e8086b435f8..6d070253304 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt @@ -5,12 +5,12 @@ import androidx.work.ListenableWorker import androidx.work.WorkerParameters import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.SettableFuture -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.async import org.oppia.android.domain.util.getStringFromData import org.oppia.android.util.threading.BackgroundDispatcher +import javax.inject.Inject /** * Worker class that generates metric log reports regarding the performance of the application @@ -20,7 +20,7 @@ class LogGenerationWorker private constructor( context: Context, params: WorkerParameters, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher -): ListenableWorker(context, params) { +) : ListenableWorker(context, params) { companion object { const val WORKER_CASE_KEY = "worker_case_key" @@ -33,7 +33,7 @@ class LogGenerationWorker private constructor( override fun startWork(): ListenableFuture { val backgroundScope = CoroutineScope(backgroundDispatcher) val result = backgroundScope.async { - when(inputData.getStringFromData(WORKER_CASE_KEY)) { + when (inputData.getStringFromData(WORKER_CASE_KEY)) { PERIODIC_METRIC_WORKER -> generatePeriodicMetricLog() STORAGE_USAGE_WORKER -> generateStorageUsageMetricLog() MEMORY_USAGE_WORKER -> generateMemoryUsageMetricLog() @@ -76,4 +76,4 @@ class LogGenerationWorker private constructor( return LogGenerationWorker(context, params, backgroundDispatcher) } } -} \ No newline at end of file +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index c01db0f36d5..cd475204384 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -7,16 +7,16 @@ import androidx.work.NetworkType import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.util.logging.LogUploader -import java.util.UUID -import java.util.concurrent.TimeUnit -import javax.inject.Inject -import javax.inject.Singleton import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker import org.oppia.android.util.logging.LogGenerator +import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterValue +import java.util.UUID +import java.util.concurrent.TimeUnit +import javax.inject.Inject +import javax.inject.Singleton /** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ @Singleton diff --git a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt index 2742ec783ad..37212df6b95 100644 --- a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt @@ -4,10 +4,10 @@ import androidx.work.Configuration import androidx.work.DelegatingWorkerFactory import dagger.Module import dagger.Provides +import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorkerFactory import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerFactory import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorkerFactory /** Provides [Configuration] for the work manager. */ @Module diff --git a/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt index b7d5f75179e..ad1e6439a9b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt @@ -9,7 +9,10 @@ interface LogGenerator { * Enqueues a [workRequest] using the [workManager] for generating metric logs of periodic * metrics like network and cpu usage. */ - fun enqueueWorkRequestForPeriodicMetrics(workManager: WorkManager, workRequest: PeriodicWorkRequest) + fun enqueueWorkRequestForPeriodicMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) /** * Enqueues a [workRequest] using the [workManager] for generating metric logs for getting to @@ -22,4 +25,4 @@ interface LogGenerator { * know the memory usage of the application on the current device. */ fun enqueueWorkRequestForMemoryUsage(workManager: WorkManager, workRequest: PeriodicWorkRequest) -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt index 15c7a62fb93..6f2a35b25b6 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt @@ -46,4 +46,4 @@ class MetricLogGenerator() : LogGenerator { workRequest ) } -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt index c2b25bdae28..0883770a6fa 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt @@ -9,4 +9,4 @@ import org.oppia.android.util.logging.LogGenerator interface MetricLogGeneratorModule { @Binds fun bindMetricLogGenerator(metricLogGenerator: MetricLogGenerator): LogGenerator -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt index b627b372bef..4a12288c4ed 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt @@ -4,4 +4,4 @@ import org.oppia.android.app.model.OppiaMetricLog interface PerformanceMetricLogger { fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt index 7c50e1d70b6..c5dad98bd36 100644 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt @@ -2,4 +2,4 @@ package org.oppia.android.util.metriccollection interface AppHealthMetricUtils { fun isAppInForeground(): Boolean -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt index 729485a2f1f..3070b449d5e 100644 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt @@ -6,4 +6,4 @@ interface AppStartupMetrics { fun getApkSize(): Long fun getUsedStorage(): Long fun getDeviceStorageTier(): OppiaMetricLog.StorageTier -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt index d8106e5969e..8e52bc63e86 100644 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt @@ -3,4 +3,4 @@ package org.oppia.android.util.metriccollection interface PeriodicMetrics { fun getTotalTransmittedBytes(): Long fun getTotalReceivedBytes(): Long -} \ No newline at end of file +} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt index f26eab5c569..84d24c2f33e 100644 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt +++ b/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt @@ -5,4 +5,4 @@ import org.oppia.android.app.model.OppiaMetricLog interface UiSpecificMetrics { fun getTotalPssUsed(): Long fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier -} \ No newline at end of file +} From f2112a2eacd59ccab78bce0aa40dfdcbf095bd0a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 05:02:07 +0530 Subject: [PATCH 019/149] storage comment --- model/src/main/proto/performance_metrics.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 598217e55aa..dfb8f260b44 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -62,7 +62,8 @@ message OppiaMetricLog { // Structure of the storage usage metric. message StorageUsage { - // Amount of storage usage by the app on user's device in bytes. + // Amount of storage usage by the app on user's device in bytes. This storage size is the cumulative + // size of app-specific files which include the application cache but not the apk size. int64 storage_usage_bytes = 1; } From 0b1181fb17c3a54f8d0564440c0fb1911dbf3ba7 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 05:08:17 +0530 Subject: [PATCH 020/149] pss comment --- model/src/main/proto/performance_metrics.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index dfb8f260b44..5f4528a784e 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -76,6 +76,10 @@ message OppiaMetricLog { // Structure of the memory usage metric. message MemoryUsage { // Amount of memory used by the application on the device in bytes. + // Here, PSS refers to Proportional Set Size which is the number of non-shared pages used by the + // app. It is majorly useful when we want to know how much memory is used by all processes since + // processes don't get counted multiple times. For more information, refer to the following link: + // https://developer.android.com/topic/performance/memory-management#calculating_memory_footprint int64 total_pss_bytes = 1; } From dbe1740f45957ff4f6922e2e7c26c4dd78a1e082 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 17:19:04 +0530 Subject: [PATCH 021/149] network usage comment. --- model/src/main/proto/performance_metrics.proto | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 5f4528a784e..bd84a14f01d 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -85,13 +85,16 @@ message OppiaMetricLog { // Structure of the network usage metric. message NetworkUsage { - // Usage data is collected in discrete bins of time called 'Buckets'. This fields denotes the - // number of bytes received by the application on the device during this bucket's time interval. + // Usage data is collected in discrete bins of time called 'Buckets'. The time interval of this + // bucket is customizable and depends on the query that we are making. This data is logged after + // the bucket's timeframe. + + // This field denotes the number of bytes received by the application on the device during + // this bucket's time interval. int64 bytes_received = 1; - // Usage data is collected in discrete bins of time called 'Buckets'. This fields denotes the - // number of bytes transmitted by the application on the device during this bucket's time - // interval. + // This field denotes the number of bytes transmitted by the application on the device during + // this bucket's time interval. int64 bytes_transmitted = 2; } From c41c2e56823be1adc89e3b9328d62dbe5c299a5e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 17:19:39 +0530 Subject: [PATCH 022/149] network usage comment - part 2. --- model/src/main/proto/performance_metrics.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index bd84a14f01d..8b7d2ba2afe 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -93,7 +93,7 @@ message OppiaMetricLog { // this bucket's time interval. int64 bytes_received = 1; - // This field denotes the number of bytes transmitted by the application on the device during + // This field denotes the number of bytes sent by the application on the device during // this bucket's time interval. int64 bytes_transmitted = 2; } From 629fe3c008b53db1bcd390d15f2d9d8755de1237 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 9 Jun 2022 17:23:52 +0530 Subject: [PATCH 023/149] metric addition in proto definitions. --- .../src/main/proto/performance_metrics.proto | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index 8b7d2ba2afe..f35c5bcf052 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -35,46 +35,46 @@ message OppiaMetricLog { message MetricLog { oneof metric_log_type { // The metric being logged is related to the apk size of the application. - ApkSize apk_size = 1; + ApkSizeMetric apk_size_metric = 1; // The metric being logged is related to the storage usage of the application. - StorageUsage storage_usage = 2; + StorageUsageMetric storage_usage_metric = 2; // The metric being logged is related to the startup latency of the application. - StartupLatency startup_latency = 3; + StartupLatencyMetric startup_latency_metric = 3; // The metric being logged is related to the memory usage of the application. - MemoryUsage memory_usage = 4; + MemoryUsageMetric memory_usage_metric = 4; // The metric being logged is related to the network usage of the application. - NetworkUsage network_usage = 5; + NetworkUsageMetric network_usage_metric = 5; // The metric being logged is related to the cpu usage of the application. - CpuUsage cpu_usage = 6; + CpuUsageMetric cpu_usage_metric = 6; } } // Structure of the apk size metric. - message ApkSize { + message ApkSizeMetric { // Size of the app's installed APK file, in bytes. int64 apk_size_bytes = 1; } // Structure of the storage usage metric. - message StorageUsage { + message StorageUsageMetric { // Amount of storage usage by the app on user's device in bytes. This storage size is the cumulative // size of app-specific files which include the application cache but not the apk size. int64 storage_usage_bytes = 1; } // Structure of the startup latency metric. - message StartupLatency { + message StartupLatencyMetric { // Number of milliseconds required to start up the application from a cold start. int64 startup_latency_millis = 1; } // Structure of the memory usage metric. - message MemoryUsage { + message MemoryUsageMetric { // Amount of memory used by the application on the device in bytes. // Here, PSS refers to Proportional Set Size which is the number of non-shared pages used by the // app. It is majorly useful when we want to know how much memory is used by all processes since @@ -84,7 +84,7 @@ message OppiaMetricLog { } // Structure of the network usage metric. - message NetworkUsage { + message NetworkUsageMetric { // Usage data is collected in discrete bins of time called 'Buckets'. The time interval of this // bucket is customizable and depends on the query that we are making. This data is logged after // the bucket's timeframe. @@ -99,9 +99,9 @@ message OppiaMetricLog { } // Structure of the cpu usage metric. - message CpuUsage { + message CpuUsageMetric { // Amount of cpu used by the application. - int64 cpu_usage = 1; + int64 cpu_usage_metric = 1; } // Supported priority of events for performance metric logging. From 172f98c41b512b37dcff539a78611f1bc8987883 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 11 Jun 2022 01:08:08 +0530 Subject: [PATCH 024/149] metricLog --> loggableMetric --- model/src/main/proto/performance_metrics.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index f35c5bcf052..b8625341359 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -26,14 +26,14 @@ message OppiaMetricLog { NetworkType network_type = 6; // The metric log of the event. - MetricLog metric_log = 7; + LoggableMetric loggable_metric = 7; // The current screen where the event is getting logged. CurrentScreen current_screen = 8; - // Structure of a metric log. - message MetricLog { - oneof metric_log_type { + // Structure of a loggable metric. + message LoggableMetric { + oneof loggable_metric_type { // The metric being logged is related to the apk size of the application. ApkSizeMetric apk_size_metric = 1; From 3f8464fff01ec17ab6ca60c238aaa919f356562d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 12 Jun 2022 09:04:31 +0530 Subject: [PATCH 025/149] proto definitions in oppiaLogger --- .../android/domain/oppialogger/OppiaLogger.kt | 91 ++++++++++++++++++- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 719fee9928b..0d4cc098ef5 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -220,14 +220,95 @@ class OppiaLogger @Inject constructor( .build() } - fun createApkSizeMetricLog( + /** + * Returns the loggable metric of the performance metric event log indicating the size of the + * apk file of the application. + */ + fun createApkSizeLoggableMetric( apkSize: Long - ): OppiaMetricLog.MetricLog { - return OppiaMetricLog.MetricLog.newBuilder() - .setApkSize( - OppiaMetricLog.ApkSize.newBuilder() + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setApkSizeMetric( + OppiaMetricLog.ApkSizeMetric.newBuilder() .setApkSizeBytes(apkSize) .build() ).build() } + + /** + * Returns the loggable metric of the performance metric event log indicating the amount of + * storage space used by the application on user's device. + */ + fun createStorageUsageLoggableMetric( + storageUsage: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setStorageUsageMetric( + OppiaMetricLog.StorageUsageMetric.newBuilder() + .setStorageUsageBytes(storageUsage) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the number of + * milliseconds required to start up the application from a cold start. + */ + fun createStartupLatencyLoggableMetric( + startupLatency: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setStartupLatencyMetric( + OppiaMetricLog.StartupLatencyMetric.newBuilder() + .setStartupLatencyMillis(startupLatency) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * memory used by the application on user's device. + */ + fun createMemoryUsageLoggableMetric( + totalPssBytes: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setMemoryUsageMetric( + OppiaMetricLog.MemoryUsageMetric.newBuilder() + .setTotalPssBytes(totalPssBytes) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * CPU used by the application on user's device. + */ + fun createCpuUsageLoggableMetric( + cpuUsage: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setCpuUsageMetric( + OppiaMetricLog.CpuUsageMetric.newBuilder() + .setCpuUsageMetric(cpuUsage) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * network used by the application on user's device. + */ + fun createNetworkUsageLoggableMetric( + totalBytesReceived: Long, + totalBytesSent: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setNetworkUsageMetric( + OppiaMetricLog.NetworkUsageMetric.newBuilder() + .setBytesTransmitted(totalBytesSent) + .setBytesReceived(totalBytesReceived) + .build() + ).build() + } } From adf9d4a9fda11a1c8a2064a0b94d70d8fb54f1fe Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 12 Jun 2022 09:06:06 +0530 Subject: [PATCH 026/149] wording update for transmission --- model/src/main/proto/performance_metrics.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index b8625341359..a2781d59508 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -95,7 +95,7 @@ message OppiaMetricLog { // This field denotes the number of bytes sent by the application on the device during // this bucket's time interval. - int64 bytes_transmitted = 2; + int64 bytes_sent = 2; } // Structure of the cpu usage metric. From 1776e6237efe0b604252916f1abd84aa5c9ffbb4 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 12 Jun 2022 09:10:14 +0530 Subject: [PATCH 027/149] dependency/api updates. --- .../org/oppia/android/domain/oppialogger/OppiaLogger.kt | 2 +- .../loguploader/LogUploadWorkManagerInitializer.kt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 0d4cc098ef5..3f5bc41e411 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -306,7 +306,7 @@ class OppiaLogger @Inject constructor( return OppiaMetricLog.LoggableMetric.newBuilder() .setNetworkUsageMetric( OppiaMetricLog.NetworkUsageMetric.newBuilder() - .setBytesTransmitted(totalBytesSent) + .setBytesSent(totalBytesSent) .setBytesReceived(totalBytesReceived) .build() ).build() diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index cd475204384..4c6973e4399 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -17,6 +17,8 @@ import java.util.UUID import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes /** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ @Singleton @@ -24,9 +26,9 @@ class LogUploadWorkManagerInitializer @Inject constructor( private val context: Context, private val logUploader: LogUploader, private val logGenerator: LogGenerator, - @PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes + @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes performanceMetricsCollectionHighFrequencyTimeInterval: PlatformParameterValue, - @PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes + @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes performanceMetricCollectionLowFrequencyTimeInterval: PlatformParameterValue ) : ApplicationStartupListener { From 1917ec255a0e42cc32c999784385f0caf757713a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 12 Jun 2022 09:12:12 +0530 Subject: [PATCH 028/149] nits. --- .../loguploader/LogUploadWorkManagerInitializer.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 4c6973e4399..3d3caf980ed 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -10,15 +10,13 @@ import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker import org.oppia.android.util.logging.LogGenerator import org.oppia.android.util.logging.LogUploader -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequentRecordTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLessFrequentRecordTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterValue import java.util.UUID import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes /** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ @Singleton From c7efd2a60555152462cdb087606f81dd0bd6f9ea Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 14 Jun 2022 04:06:58 +0530 Subject: [PATCH 029/149] metric controller and oppiaLogger --- .../app/application/ApplicationComponent.kt | 2 + .../domain/oppialogger/LogStorageModule.kt | 13 + .../android/domain/oppialogger/OppiaLogger.kt | 49 +++- .../analytics/AppHealthMetricController.kt | 244 +++++++++++++++++- 4 files changed, 296 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index f08f475b263..11d23e13438 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -53,6 +53,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogGeneratorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -103,6 +104,7 @@ import javax.inject.Singleton NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, + MetricLogGeneratorModule::class, // TODO(#59): Remove this module once we completely migrate to Bazel from Gradle as we can then // directly exclude debug files from the build and thus won't be requiring this module. NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt index bea59db840e..2c19a46b57c 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt @@ -10,6 +10,9 @@ annotation class EventLogStorageCacheSize @Qualifier annotation class ExceptionLogStorageCacheSize +@Qualifier +annotation class MetricLogStorageCacheSize + /** Provider to return any constants required during the storage of log reports. */ @Module class LogStorageModule { @@ -33,4 +36,14 @@ class LogStorageModule { @Provides @ExceptionLogStorageCacheSize fun provideExceptionLogStorageCacheSize(): Int = 25 + + /** + * Provides the maximum number of performance metrics logs that can be cached on disk. + * + * At a configured cache size of 25k records & estimating 121 bytes per record, it's expected that + * no more than 3.02MB will be required for cache disk space. + */ + @Provides + @MetricLogStorageCacheSize + fun provideMetricLogStorageCacheSize(): Int = 25_000 } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 3f5bc41e411..a7e9b793eeb 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -6,18 +6,65 @@ import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject +import org.oppia.android.domain.oppialogger.analytics.AppHealthMetricController /** Logger that handles general-purpose logging throughout the domain & UI layers. */ class OppiaLogger @Inject constructor( private val analyticsController: AnalyticsController, private val consoleLogger: ConsoleLogger, - private val oppiaClock: OppiaClock + private val oppiaClock: OppiaClock, + private val appHealthMetricController: AppHealthMetricController ) { /** Logs high-priority events. See [AnalyticsController.logImportantEvent] for more context. */ fun logImportantEvent(eventContext: EventLog.Context) { analyticsController.logImportantEvent(oppiaClock.getCurrentTimeMs(), eventContext) } + /** + * Logs high-priority performance metrics. See [AppHealthMetricController.logHighPriorityMetricEvent] + * for more context. + */ + fun logHighPriorityPerformanceMetric( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + appHealthMetricController.logHighPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + loggableMetric + ) + } + + /** + * Logs medium-priority performance metrics. See [AppHealthMetricController.logMediumPriorityMetricEvent] + * for more context. + */ + fun logMediumPriorityPerformanceMetric( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + appHealthMetricController.logMediumPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + loggableMetric + ) + } + + /** + * Logs low-priority performance metrics. See [AppHealthMetricController.logLowPriorityMetricEvent] for + * more context. + */ + fun logLowPriorityPerformanceMetric( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + appHealthMetricController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), + currentScreen, + loggableMetric + ) + } + /** Logs a verbose message with the specified tag. See [ConsoleLogger.v] for more context */ fun v(tag: String, msg: String) { consoleLogger.v(tag, msg) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt index a754ed852f2..b6fa548d40d 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt @@ -1,24 +1,246 @@ package org.oppia.android.domain.oppialogger.analytics -import org.oppia.android.domain.oppialogger.ApplicationStartupListener +import java.lang.IllegalStateException +import javax.inject.Inject +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.Priority +import org.oppia.android.app.model.OppiaMetricLogs +import org.oppia.android.data.persistence.PersistentCacheStore +import org.oppia.android.domain.oppialogger.MetricLogStorageCacheSize +import org.oppia.android.util.data.DataProvider +import org.oppia.android.util.logging.ConsoleLogger +import org.oppia.android.util.logging.ExceptionLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricLogger +import org.oppia.android.util.metriccollection.AppHealthMetricUtils +import org.oppia.android.util.metriccollection.AppStartupMetrics +import org.oppia.android.util.metriccollection.UiSpecificMetrics +import org.oppia.android.util.networking.NetworkConnectionUtil -interface AppHealthMetricController : ApplicationStartupListener { +/** + * Controller for handling performance metrics event logging. + * + * Callers should not use this class directly; instead, they should use ``OppiaLogger`` which + * provides convenience log methods. + */ +class AppHealthMetricController @Inject constructor( + private val appStartupMetrics: AppStartupMetrics, + private val appHealthMetricUtils: AppHealthMetricUtils, + private val uiSpecificMetrics: UiSpecificMetrics, + private val consoleLogger: ConsoleLogger, + private val networkConnectionUtil: NetworkConnectionUtil, + private val exceptionLogger: ExceptionLogger, + private val performanceMetricLogger: PerformanceMetricLogger, + cacheStoreFactory: PersistentCacheStore.Factory, + @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int +) { - override fun onCreate() {} + private val metricLogStore = + cacheStoreFactory.create("metric_logs", OppiaMetricLogs.getDefaultInstance()) - fun logHighPriorityEvent() + /** + * Logs a high priority performance metric occurring at [currentScreen] defined by [loggableMetric] + * corresponding to time [timestamp]. + * + * 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 + * application. These metrics are important to log and should be prioritized over metrics logged + * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. + */ + fun logHighPriorityMetricEvent( + timestamp: Long, + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + uploadOrCacheLog( + createMetricLog( + timestamp, + Priority.HIGH_PRIORITY, + currentScreen, + loggableMetric + ) + ) + } - fun logMediumPriorityEvent() + /** + * Logs a medium priority performance metric occurring at [currentScreen] defined by [loggableMetric] + * corresponding to time [timestamp]. + * + * This will schedule a background upload of the event if there's internet connectivity, otherwise + * it will cache the event for a later upload. + * + * Medium priority metrics may be removed from the event cache if device space is limited, and + * there's no connectivity for immediately sending events. These metrics will however be + * prioritised over Low priority metrics. + * + * This method should only be used for logging ui-specific metrics like memory usage of the + * application. These metrics are important to log (but not as important as high priority metrics) + * and should be prioritized over metrics logged via [logLowPriorityMetricEvent]. + */ + fun logMediumPriorityMetricEvent( + timestamp: Long, + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + uploadOrCacheLog( + createMetricLog( + timestamp, + Priority.MEDIUM_PRIORITY, + currentScreen, + loggableMetric + ) + ) + } - fun logLowPriorityEvent() + /** + * Logs a low priority performance metric occurring at [currentScreen] defined by [loggableMetric] + * corresponding to time [timestamp]. + * + * This will schedule a background upload of the event if there's internet connectivity, otherwise + * it will cache the event for a later upload. + * + * Low priority metrics may be removed from the event cache if device space is limited, and + * there's no connectivity for immediately sending events. + * + * This method should only be used for logging metrics that are to be logged at the beginning of + * the application like apk size and storage usage. + * + * Callers should use this for events that are nice to have, but okay to miss occasionally (as + * it's unexpected for events to actually be dropped since the app is configured to support a + * large number of cached events at one time). + */ + fun logLowPriorityMetricEvent( + timestamp: Long, + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + uploadOrCacheLog( + createMetricLog( + timestamp, + Priority.LOW_PRIORITY, + currentScreen, + loggableMetric + ) + ) + } - fun uploadOrCacheLog() + /** Either uploads or caches [oppiaMetricLog] depending on current internet connectivity. */ + private fun uploadOrCacheLog(oppiaMetricLog: OppiaMetricLog) { + when (networkConnectionUtil.getCurrentConnectionStatus()) { + NetworkConnectionUtil.ProdConnectionStatus.NONE -> cacheMetricLog(oppiaMetricLog) + else -> performanceMetricLogger.logPerformanceMetric(oppiaMetricLog) + } + } - fun cacheMetricLog() + /** + * Adds a metric log to the storage. + * + * At first, it checks if the size of the store isn't exceeding [metricLogStorageCacheSize]. If + * the limit is exceeded then the least recent event is removed from the [metricLogStore]. After + * this, the [oppiaMetricLog] is added to the store. + */ + private fun cacheMetricLog(oppiaMetricLog: OppiaMetricLog) { + metricLogStore.storeDataAsync(updateInMemoryCache = true) { oppiaMetricLogs -> + val storeSize = oppiaMetricLogs.oppiaMetricLogList.size + if (storeSize + 1 > metricLogStorageCacheSize) { + val eventLogRemovalIndex = getLeastRecentMetricLogIndex(oppiaMetricLogs) + if (eventLogRemovalIndex != null) { + return@storeDataAsync oppiaMetricLogs.toBuilder() + .removeOppiaMetricLog(eventLogRemovalIndex) + .addOppiaMetricLog(oppiaMetricLog) + .build() + } else { + // TODO(#1433): Refactoring for logging exceptions to both console and exception loggers. + val exception = + IllegalStateException("Least Recent Event index absent -- MetricLogStorageCacheSize is 0") + consoleLogger.e( + "AppHealthMetricController", + "Failure while caching metric log.", + exception + ) + exceptionLogger.logException(exception) + } + } + return@storeDataAsync oppiaMetricLogs.toBuilder().addOppiaMetricLog(oppiaMetricLog).build() + }.invokeOnCompletion { + it?.let { consoleLogger.e("AppHealthMetricController", "Failed to store metric log.", it) } + } + } - fun createMetricLog() + /** Returns a metric log containing relevant data for metric log reporting. */ + private fun createMetricLog( + timestamp: Long, + priority: OppiaMetricLog.Priority, + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ): OppiaMetricLog { + return OppiaMetricLog.newBuilder().apply { + this.timestampMillis = timestamp + this.priority = priority + this.currentScreen = currentScreen + this.loggableMetric = loggableMetric + this.isAppInForeground = appHealthMetricUtils.isAppInForeground() + this.storageTier = appStartupMetrics.getDeviceStorageTier() + this.memoryTier = uiSpecificMetrics.getDeviceMemoryTier() + }.build() + } - fun removeFirstLog() + /** + * Returns the index of the least recent event from the existing store on the basis of recency and + * priority. + * + * At first, it checks the index of the least recent event which has LOW priority. If that + * returns null, then it checks the index of the least recent event which has MEDIUM priority. If + * that returns null, then it checks the index of the least recent event regardless of the + * priority is returned. + */ + private fun getLeastRecentMetricLogIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = + oppiaMetricLogs.oppiaMetricLogList.withIndex() + .filter { it.value.priority == Priority.LOW_PRIORITY } + .minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentMediumPriorityEventIndex( + oppiaMetricLogs + ) - fun getStore() + /** + * Returns the index of the least recent event from the existing store on the basis of recency and + * priority. + * + * At first, it checks the index of the least recent event which has LOW priority. If that + * returns null, then it checks the index of the least recent event regardless of the + * priority is returned. + */ + private fun getLeastRecentMediumPriorityEventIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = + oppiaMetricLogs.oppiaMetricLogList.withIndex() + .filter { it.value.priority == Priority.MEDIUM_PRIORITY } + .minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentGeneralEventIndex( + oppiaMetricLogs + ) + + /** Returns the index of the least recent event regardless of their priority. */ + private fun getLeastRecentGeneralEventIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = + oppiaMetricLogs.oppiaMetricLogList.withIndex() + .minByOrNull { it.value.timestampMillis }?.index + + /** Returns a data provider for log reports that have been recorded for upload. */ + fun getMetricLogStore(): DataProvider = metricLogStore + + /** + * Returns a list of metric log reports that have been recorded for upload. + * + * As we are using the await call on the deferred output of readDataAsync, the failure case would + * be caught and it'll throw an error. + */ + suspend fun getMetricLogStoreList(): MutableList { + return metricLogStore.readDataAsync().await().oppiaMetricLogList + } + + /** Removes the first metric log report that had been recorded for upload. */ + fun removeFirstMetricLogFromStore() { + metricLogStore.storeDataAsync(updateInMemoryCache = true) { oppiaEventLogs -> + return@storeDataAsync oppiaEventLogs.toBuilder().removeOppiaMetricLog(0).build() + }.invokeOnCompletion { + it?.let { consoleLogger.e("AppHealthMetricController", "Failed to remove metric log.", it) } + } + } } From 5104036ffa76703e2f2f590ad8c8ff609278d782 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 14 Jun 2022 04:07:51 +0530 Subject: [PATCH 030/149] nits --- .../org/oppia/android/domain/oppialogger/OppiaLogger.kt | 2 +- .../oppialogger/analytics/AppHealthMetricController.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index a7e9b793eeb..5c9a11adbc3 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -3,10 +3,10 @@ package org.oppia.android.domain.oppialogger import org.oppia.android.app.model.EventLog import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.analytics.AnalyticsController +import org.oppia.android.domain.oppialogger.analytics.AppHealthMetricController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject -import org.oppia.android.domain.oppialogger.analytics.AppHealthMetricController /** Logger that handles general-purpose logging throughout the domain & UI layers. */ class OppiaLogger @Inject constructor( diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt index b6fa548d40d..4d25a8dfa3c 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt @@ -1,7 +1,5 @@ package org.oppia.android.domain.oppialogger.analytics -import java.lang.IllegalStateException -import javax.inject.Inject import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.OppiaMetricLog.Priority import org.oppia.android.app.model.OppiaMetricLogs @@ -15,6 +13,8 @@ import org.oppia.android.util.metriccollection.AppHealthMetricUtils import org.oppia.android.util.metriccollection.AppStartupMetrics import org.oppia.android.util.metriccollection.UiSpecificMetrics import org.oppia.android.util.networking.NetworkConnectionUtil +import java.lang.IllegalStateException +import javax.inject.Inject /** * Controller for handling performance metrics event logging. @@ -153,7 +153,9 @@ class AppHealthMetricController @Inject constructor( } else { // TODO(#1433): Refactoring for logging exceptions to both console and exception loggers. val exception = - IllegalStateException("Least Recent Event index absent -- MetricLogStorageCacheSize is 0") + IllegalStateException( + "Least Recent Event index absent -- MetricLogStorageCacheSize is 0" + ) consoleLogger.e( "AppHealthMetricController", "Failure while caching metric log.", From 60400a1dfd44fab966c68abba3be18d3bd37af03 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 21 Jun 2022 01:47:00 +0530 Subject: [PATCH 031/149] logger-controller pattern, single utils --- .../android/domain/oppialogger/OppiaLogger.kt | 141 +--------- .../analytics/ApplicationLifecycleObserver.kt | 9 + ...ler.kt => PerformanceMetricsController.kt} | 103 +------- .../analytics/PerformanceMetricsLogger.kt | 243 ++++++++++++++++++ .../PerformanceMetricsUtils.kt | 83 ++++++ 5 files changed, 358 insertions(+), 221 deletions(-) rename domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/{AppHealthMetricController.kt => PerformanceMetricsController.kt} (64%) create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 5c9a11adbc3..6d88b81c2fe 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -3,7 +3,7 @@ package org.oppia.android.domain.oppialogger import org.oppia.android.app.model.EventLog import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.analytics.AnalyticsController -import org.oppia.android.domain.oppialogger.analytics.AppHealthMetricController +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject @@ -13,55 +13,24 @@ class OppiaLogger @Inject constructor( private val analyticsController: AnalyticsController, private val consoleLogger: ConsoleLogger, private val oppiaClock: OppiaClock, - private val appHealthMetricController: AppHealthMetricController + private val performanceMetricsController: PerformanceMetricsController ) { /** Logs high-priority events. See [AnalyticsController.logImportantEvent] for more context. */ fun logImportantEvent(eventContext: EventLog.Context) { analyticsController.logImportantEvent(oppiaClock.getCurrentTimeMs(), eventContext) } - /** - * Logs high-priority performance metrics. See [AppHealthMetricController.logHighPriorityMetricEvent] - * for more context. - */ - fun logHighPriorityPerformanceMetric( + /** Logs performance metrics logs. See [PerformanceMetricsController.logMetricEvent] for more context. */ + fun logPerformanceMetrics( currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric + loggableMetric: OppiaMetricLog.LoggableMetric, + priority: OppiaMetricLog.Priority ) { - appHealthMetricController.logHighPriorityMetricEvent( + performanceMetricsController.logMetricEvent( oppiaClock.getCurrentTimeMs(), currentScreen, - loggableMetric - ) - } - - /** - * Logs medium-priority performance metrics. See [AppHealthMetricController.logMediumPriorityMetricEvent] - * for more context. - */ - fun logMediumPriorityPerformanceMetric( - currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric - ) { - appHealthMetricController.logMediumPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - loggableMetric - ) - } - - /** - * Logs low-priority performance metrics. See [AppHealthMetricController.logLowPriorityMetricEvent] for - * more context. - */ - fun logLowPriorityPerformanceMetric( - currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric - ) { - appHealthMetricController.logLowPriorityMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - loggableMetric + loggableMetric, + priority ) } @@ -266,96 +235,4 @@ class OppiaLogger @Inject constructor( ) .build() } - - /** - * Returns the loggable metric of the performance metric event log indicating the size of the - * apk file of the application. - */ - fun createApkSizeLoggableMetric( - apkSize: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setApkSizeMetric( - OppiaMetricLog.ApkSizeMetric.newBuilder() - .setApkSizeBytes(apkSize) - .build() - ).build() - } - - /** - * Returns the loggable metric of the performance metric event log indicating the amount of - * storage space used by the application on user's device. - */ - fun createStorageUsageLoggableMetric( - storageUsage: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setStorageUsageMetric( - OppiaMetricLog.StorageUsageMetric.newBuilder() - .setStorageUsageBytes(storageUsage) - .build() - ).build() - } - - /** - * Returns the loggable metric of the performance metric event log indicating the number of - * milliseconds required to start up the application from a cold start. - */ - fun createStartupLatencyLoggableMetric( - startupLatency: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setStartupLatencyMetric( - OppiaMetricLog.StartupLatencyMetric.newBuilder() - .setStartupLatencyMillis(startupLatency) - .build() - ).build() - } - - /** - * Returns the loggable metric of the performance metric event log indicating the the amount of - * memory used by the application on user's device. - */ - fun createMemoryUsageLoggableMetric( - totalPssBytes: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setMemoryUsageMetric( - OppiaMetricLog.MemoryUsageMetric.newBuilder() - .setTotalPssBytes(totalPssBytes) - .build() - ).build() - } - - /** - * Returns the loggable metric of the performance metric event log indicating the the amount of - * CPU used by the application on user's device. - */ - fun createCpuUsageLoggableMetric( - cpuUsage: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setCpuUsageMetric( - OppiaMetricLog.CpuUsageMetric.newBuilder() - .setCpuUsageMetric(cpuUsage) - .build() - ).build() - } - - /** - * Returns the loggable metric of the performance metric event log indicating the the amount of - * network used by the application on user's device. - */ - fun createNetworkUsageLoggableMetric( - totalBytesReceived: Long, - totalBytesSent: Long - ): OppiaMetricLog.LoggableMetric { - return OppiaMetricLog.LoggableMetric.newBuilder() - .setNetworkUsageMetric( - OppiaMetricLog.NetworkUsageMetric.newBuilder() - .setBytesSent(totalBytesSent) - .setBytesReceived(totalBytesReceived) - .build() - ).build() - } } 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 e49bf08b3c4..ac01b593896 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 @@ -32,6 +32,10 @@ class ApplicationLifecycleObserver @Inject constructor( ProcessLifecycleOwner.get().lifecycle.addObserver(this) } + // Keep the default value as false as the app is considered to be in the background until it comes + // to foreground. + private var isAppInForeground: Boolean = false + // Use a large Long value such that the time difference based on any timestamp will be negative // and thus ignored until the app goes into the background at least once. private var firstTimestamp: Long = Long.MAX_VALUE @@ -39,6 +43,7 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application comes to foreground. */ @OnLifecycleEvent(Lifecycle.Event.ON_START) fun onAppInForeground() { + isAppInForeground = true val timeDifferenceMs = oppiaClock.getCurrentTimeMs() - firstTimestamp if (timeDifferenceMs > inactivityLimitMillis) { loggingIdentifierController.updateSessionId() @@ -49,6 +54,7 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application goes to background. */ @OnLifecycleEvent(Lifecycle.Event.ON_STOP) fun onAppInBackground() { + isAppInForeground = false firstTimestamp = oppiaClock.getCurrentTimeMs() logAppLifecycleEventInBackground(learnerAnalyticsLogger::logAppInBackground) } @@ -68,4 +74,7 @@ class ApplicationLifecycleObserver @Inject constructor( } } } + + /** Returns a boolean value indicating whether the application is in foreground or not. */ + fun isAppInForeground(): Boolean = isAppInForeground } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt similarity index 64% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt index 4d25a8dfa3c..d951a7ae4e0 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AppHealthMetricController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt @@ -9,12 +9,10 @@ import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricLogger -import org.oppia.android.util.metriccollection.AppHealthMetricUtils -import org.oppia.android.util.metriccollection.AppStartupMetrics -import org.oppia.android.util.metriccollection.UiSpecificMetrics import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Controller for handling performance metrics event logging. @@ -22,15 +20,14 @@ import javax.inject.Inject * Callers should not use this class directly; instead, they should use ``OppiaLogger`` which * provides convenience log methods. */ -class AppHealthMetricController @Inject constructor( - private val appStartupMetrics: AppStartupMetrics, - private val appHealthMetricUtils: AppHealthMetricUtils, - private val uiSpecificMetrics: UiSpecificMetrics, +class PerformanceMetricsController @Inject constructor( + private val performanceMetricsUtils: PerformanceMetricsUtils, private val consoleLogger: ConsoleLogger, private val networkConnectionUtil: NetworkConnectionUtil, private val exceptionLogger: ExceptionLogger, private val performanceMetricLogger: PerformanceMetricLogger, cacheStoreFactory: PersistentCacheStore.Factory, + private val applicationLifecycleObserver: ApplicationLifecycleObserver, @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int ) { @@ -38,91 +35,19 @@ class AppHealthMetricController @Inject constructor( cacheStoreFactory.create("metric_logs", OppiaMetricLogs.getDefaultInstance()) /** - * Logs a high priority performance metric occurring at [currentScreen] defined by [loggableMetric] - * corresponding to time [timestamp]. + * Logs a performance metric occurring at [currentScreen] defined by [loggableMetric] + * corresponding to a time [timestamp]. * * 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 - * application. These metrics are important to log and should be prioritized over metrics logged - * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. - */ - fun logHighPriorityMetricEvent( - timestamp: Long, - currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric - ) { - uploadOrCacheLog( - createMetricLog( - timestamp, - Priority.HIGH_PRIORITY, - currentScreen, - loggableMetric - ) - ) - } - - /** - * Logs a medium priority performance metric occurring at [currentScreen] defined by [loggableMetric] - * corresponding to time [timestamp]. - * - * This will schedule a background upload of the event if there's internet connectivity, otherwise - * it will cache the event for a later upload. - * - * Medium priority metrics may be removed from the event cache if device space is limited, and - * there's no connectivity for immediately sending events. These metrics will however be - * prioritised over Low priority metrics. - * - * This method should only be used for logging ui-specific metrics like memory usage of the - * application. These metrics are important to log (but not as important as high priority metrics) - * and should be prioritized over metrics logged via [logLowPriorityMetricEvent]. - */ - fun logMediumPriorityMetricEvent( - timestamp: Long, - currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric - ) { - uploadOrCacheLog( - createMetricLog( - timestamp, - Priority.MEDIUM_PRIORITY, - currentScreen, - loggableMetric - ) - ) - } - - /** - * Logs a low priority performance metric occurring at [currentScreen] defined by [loggableMetric] - * corresponding to time [timestamp]. - * - * This will schedule a background upload of the event if there's internet connectivity, otherwise - * it will cache the event for a later upload. - * - * Low priority metrics may be removed from the event cache if device space is limited, and - * there's no connectivity for immediately sending events. - * - * This method should only be used for logging metrics that are to be logged at the beginning of - * the application like apk size and storage usage. - * - * Callers should use this for events that are nice to have, but okay to miss occasionally (as - * it's unexpected for events to actually be dropped since the app is configured to support a - * large number of cached events at one time). */ - fun logLowPriorityMetricEvent( + fun logMetricEvent( timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric + loggableMetric: OppiaMetricLog.LoggableMetric, + priority: Priority ) { - uploadOrCacheLog( - createMetricLog( - timestamp, - Priority.LOW_PRIORITY, - currentScreen, - loggableMetric - ) - ) + uploadOrCacheLog(createMetricLog(timestamp, priority, currentScreen, loggableMetric)) } /** Either uploads or caches [oppiaMetricLog] depending on current internet connectivity. */ @@ -173,7 +98,7 @@ class AppHealthMetricController @Inject constructor( /** Returns a metric log containing relevant data for metric log reporting. */ private fun createMetricLog( timestamp: Long, - priority: OppiaMetricLog.Priority, + priority: Priority, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric ): OppiaMetricLog { @@ -182,9 +107,9 @@ class AppHealthMetricController @Inject constructor( this.priority = priority this.currentScreen = currentScreen this.loggableMetric = loggableMetric - this.isAppInForeground = appHealthMetricUtils.isAppInForeground() - this.storageTier = appStartupMetrics.getDeviceStorageTier() - this.memoryTier = uiSpecificMetrics.getDeviceMemoryTier() + this.isAppInForeground = applicationLifecycleObserver.isAppInForeground() + this.storageTier = performanceMetricsUtils.getDeviceStorageTier() + this.memoryTier = performanceMetricsUtils.getDeviceMemoryTier() }.build() } 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 new file mode 100644 index 00000000000..cc7d49615ad --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLogger.kt @@ -0,0 +1,243 @@ +package org.oppia.android.domain.oppialogger.analytics + +import javax.inject.Inject +import javax.inject.Singleton +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.domain.oppialogger.ApplicationStartupListener +import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.system.OppiaClock + +@Singleton +class PerformanceMetricsLogger @Inject constructor( + private val oppiaLogger: OppiaLogger, + private val performanceMetricsUtils: PerformanceMetricsUtils, + private val oppiaClock: OppiaClock +): ApplicationStartupListener { + + /** + * Use 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 firstTimestamp: Long = Long.MAX_VALUE + + override fun onCreate() { + firstTimestamp = oppiaClock.getCurrentTimeMs() + } + + fun logApkSize() { + oppiaLogger.logLowPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.HOME_SCREEN, + createApkSizeLoggableMetric(performanceMetricsUtils.getApkSize()) + ) + } + + fun logStorageUsage() { + oppiaLogger.logLowPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.HOME_SCREEN, + createStorageUsageLoggableMetric(performanceMetricsUtils.getUsedStorage()) + ) + } + + fun logStartupLatency() { + val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp + if(startupLatency >= 0) { + oppiaLogger.logLowPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.HOME_SCREEN, + createStartupLatencyLoggableMetric(startupLatency) + ) + } + } + + fun logMemoryUsage() { + oppiaLogger.logMediumPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + createMemoryUsageLoggableMetric(performanceMetricsUtils.getTotalPssUsed()) + ) + } + + fun logNetworkUsage() { + oppiaLogger.logHighPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + createNetworkUsageLoggableMetric( + performanceMetricsUtils.getTotalReceivedBytes(), + performanceMetricsUtils.getTotalSentBytes() + ) + ) + } + + fun logCpuUsage(cpuUsage: Long) { + oppiaLogger.logHighPriorityMetricEvent( + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + createCpuUsageLoggableMetric(cpuUsage) + ) + } + + internal companion object { + /** + * Logs a high priority performance metric occurring at [currentScreen] defined by [loggableMetric]. + * + * 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 + * application. These metrics are important to log and should be prioritized over metrics logged + * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. + */ + internal fun OppiaLogger.logHighPriorityMetricEvent( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + logPerformanceMetrics( + currentScreen, + loggableMetric, + OppiaMetricLog.Priority.HIGH_PRIORITY + ) + } + + /** + * Logs a medium priority performance metric occurring at [currentScreen] defined by [loggableMetric]. + * + * This will schedule a background upload of the event if there's internet connectivity, otherwise + * it will cache the event for a later upload. + * + * Medium priority metrics may be removed from the event cache if device space is limited, and + * there's no connectivity for immediately sending events. These metrics will however be + * prioritised over Low priority metrics. + * + * This method should only be used for logging ui-specific metrics like memory usage of the + * application. These metrics are important to log (but not as important as high priority metrics) + * and should be prioritized over metrics logged via [logLowPriorityMetricEvent]. + */ + internal fun OppiaLogger.logMediumPriorityMetricEvent( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + logPerformanceMetrics( + currentScreen, + loggableMetric, + OppiaMetricLog.Priority.MEDIUM_PRIORITY + ) + } + + /** + * Logs a low priority performance metric occurring at [currentScreen] defined by [loggableMetric] + * corresponding to time [timestamp]. + * + * This will schedule a background upload of the event if there's internet connectivity, otherwise + * it will cache the event for a later upload. + * + * Low priority metrics may be removed from the event cache if device space is limited, and + * there's no connectivity for immediately sending events. + * + * This method should only be used for logging metrics that are to be logged at the beginning of + * the application like apk size and storage usage. + * + * Callers should use this for events that are nice to have, but okay to miss occasionally (as + * it's unexpected for events to actually be dropped since the app is configured to support a + * large number of cached events at one time). + */ + internal fun OppiaLogger.logLowPriorityMetricEvent( + currentScreen: OppiaMetricLog.CurrentScreen, + loggableMetric: OppiaMetricLog.LoggableMetric + ) { + logPerformanceMetrics( + currentScreen, + loggableMetric, + OppiaMetricLog.Priority.LOW_PRIORITY + ) + } + } + + /** + * Returns the loggable metric of the performance metric event log indicating the size of the + * apk file of the application. + */ + private fun createApkSizeLoggableMetric( + apkSize: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setApkSizeMetric( + OppiaMetricLog.ApkSizeMetric.newBuilder() + .setApkSizeBytes(apkSize) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the amount of + * storage space used by the application on user's device. + */ + private fun createStorageUsageLoggableMetric( + storageUsage: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setStorageUsageMetric( + OppiaMetricLog.StorageUsageMetric.newBuilder() + .setStorageUsageBytes(storageUsage) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the number of + * milliseconds required to start up the application from a cold start. + */ + private fun createStartupLatencyLoggableMetric( + startupLatency: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setStartupLatencyMetric( + OppiaMetricLog.StartupLatencyMetric.newBuilder() + .setStartupLatencyMillis(startupLatency) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * memory used by the application on user's device. + */ + private fun createMemoryUsageLoggableMetric( + totalPssBytes: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setMemoryUsageMetric( + OppiaMetricLog.MemoryUsageMetric.newBuilder() + .setTotalPssBytes(totalPssBytes) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * CPU used by the application on user's device. + */ + private fun createCpuUsageLoggableMetric( + cpuUsage: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setCpuUsageMetric( + OppiaMetricLog.CpuUsageMetric.newBuilder() + .setCpuUsageMetric(cpuUsage) + .build() + ).build() + } + + /** + * Returns the loggable metric of the performance metric event log indicating the the amount of + * network used by the application on user's device. + */ + private fun createNetworkUsageLoggableMetric( + totalBytesReceived: Long, + totalBytesSent: Long + ): OppiaMetricLog.LoggableMetric { + return OppiaMetricLog.LoggableMetric.newBuilder() + .setNetworkUsageMetric( + OppiaMetricLog.NetworkUsageMetric.newBuilder() + .setBytesSent(totalBytesSent) + .setBytesReceived(totalBytesReceived) + .build() + ).build() + } +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt new file mode 100644 index 00000000000..aa7d4f97471 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -0,0 +1,83 @@ +package org.oppia.android.util.logging.performancemetrics + +import android.app.ActivityManager +import android.app.Application +import android.content.Context +import android.net.TrafficStats +import android.os.Environment +import java.io.File +import javax.inject.Inject +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.ConsoleLogger + +class PerformanceMetricsUtils @Inject constructor( + private val context: Application, + private val consoleLogger: ConsoleLogger +) { + + fun getApkSize(): Long { + var apkSize: Long = 0 + try { + val apkPath = + context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir + val apkFile = File(apkPath) + apkSize = ((apkFile.length() / 1024).toString()).toLong() + } catch (e: Exception) { + consoleLogger.e( + "PerformanceMetricsUtils", + "APK size could not be calculated." + ) + } + return apkSize + } + + fun getUsedStorage(): Long { + var storageUsage: Long = 0 + try { + val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace + val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + storageUsage = permanentStorageUsage + cacheStorageUsage + } catch (e: Exception) { + consoleLogger.e( + "PerformanceMetricsUtils", + "Storage usage could not be calculated." + ) + } + return storageUsage + } + + fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = + when (Environment.getDataDirectory().totalSpace / (1024 * 1024 * 1024)) { + in 0..5 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 5..20 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + else -> OppiaMetricLog.StorageTier.HIGH_STORAGE + } + + fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + + fun getTotalReceivedBytes(): Long = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + + fun getTotalPssUsed(): Long { + val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + var totalPssUsed: Long = 0 + if(activityManager.runningAppProcesses != null) { + val pid = ActivityManager.RunningAppProcessInfo().pid + val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) + for (element in processMemoryInfo) { + totalPssUsed += element.totalPss + } + } + return totalPssUsed + } + + fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { + val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val memoryInfo = ActivityManager.MemoryInfo() + activityManager.getMemoryInfo(memoryInfo) + return when (memoryInfo.totalMem / (1024 * 1024 * 1024)) { + in 0..1 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + in 1..2 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER + } + } +} From 74fcbf55a3b9bab98b572709c5fffc2790f905f0 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 21 Jun 2022 01:48:35 +0530 Subject: [PATCH 032/149] nits --- .../oppialogger/analytics/PerformanceMetricsController.kt | 2 +- .../oppialogger/analytics/PerformanceMetricsLogger.kt | 8 ++++---- .../logging/performancemetrics/PerformanceMetricsUtils.kt | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) 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 d951a7ae4e0..3a3e9214d3c 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 @@ -9,10 +9,10 @@ import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Controller for handling performance metrics event logging. 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 cc7d49615ad..f2bb4226888 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 @@ -1,19 +1,19 @@ package org.oppia.android.domain.oppialogger.analytics -import javax.inject.Inject -import javax.inject.Singleton import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.system.OppiaClock +import javax.inject.Inject +import javax.inject.Singleton @Singleton class PerformanceMetricsLogger @Inject constructor( private val oppiaLogger: OppiaLogger, private val performanceMetricsUtils: PerformanceMetricsUtils, private val oppiaClock: OppiaClock -): ApplicationStartupListener { +) : ApplicationStartupListener { /** * Use a large Long value such that the time difference based on any timestamp will be negative @@ -41,7 +41,7 @@ class PerformanceMetricsLogger @Inject constructor( fun logStartupLatency() { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp - if(startupLatency >= 0) { + if (startupLatency >= 0) { oppiaLogger.logLowPriorityMetricEvent( OppiaMetricLog.CurrentScreen.HOME_SCREEN, createStartupLatencyLoggableMetric(startupLatency) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index aa7d4f97471..603cec17417 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -5,10 +5,10 @@ import android.app.Application import android.content.Context import android.net.TrafficStats import android.os.Environment -import java.io.File -import javax.inject.Inject import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.ConsoleLogger +import java.io.File +import javax.inject.Inject class PerformanceMetricsUtils @Inject constructor( private val context: Application, @@ -60,7 +60,7 @@ class PerformanceMetricsUtils @Inject constructor( fun getTotalPssUsed(): Long { val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager var totalPssUsed: Long = 0 - if(activityManager.runningAppProcesses != null) { + if (activityManager.runningAppProcesses != null) { val pid = ActivityManager.RunningAppProcessInfo().pid val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) for (element in processMemoryInfo) { From db30498f698c5dc0495202ebbdd2d8ed4c26f56a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 21 Jun 2022 17:58:08 +0530 Subject: [PATCH 033/149] comments --- .../src/main/proto/performance_metrics.proto | 12 +++---- .../PerformanceMetricsUtils.kt | 31 ++++++++++++++----- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index a2781d59508..1b98ebf0d0b 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -85,16 +85,14 @@ message OppiaMetricLog { // Structure of the network usage metric. message NetworkUsageMetric { - // Usage data is collected in discrete bins of time called 'Buckets'. The time interval of this - // bucket is customizable and depends on the query that we are making. This data is logged after - // the bucket's timeframe. + // Both metrics count the packets across all network interfaces, and always increases + // monotonically since device reboot. Statistics are measured at the network layer, so they + // include both TCP and UDP usage. - // This field denotes the number of bytes received by the application on the device during - // this bucket's time interval. + // This field denotes the number of bytes received by the application since device reboot. int64 bytes_received = 1; - // This field denotes the number of bytes sent by the application on the device during - // this bucket's time interval. + // This field denotes the number of bytes sent by the application since device reboot. int64 bytes_sent = 2; } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 603cec17417..1f14a38683b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -15,6 +15,7 @@ class PerformanceMetricsUtils @Inject constructor( private val consoleLogger: ConsoleLogger ) { + /** Returns the size of the app's installed APK file, in bytes. */ fun getApkSize(): Long { var apkSize: Long = 0 try { @@ -31,6 +32,11 @@ class PerformanceMetricsUtils @Inject constructor( return apkSize } + /** + * Returns the amount of storage usage by the app on user's device in bytes. + * This storage size is the cumulative size of app-specific files which include the application + * cache but not the apk size. + */ fun getUsedStorage(): Long { var storageUsage: Long = 0 try { @@ -46,17 +52,13 @@ class PerformanceMetricsUtils @Inject constructor( return storageUsage } - fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = - when (Environment.getDataDirectory().totalSpace / (1024 * 1024 * 1024)) { - in 0..5 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 5..20 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE - else -> OppiaMetricLog.StorageTier.HIGH_STORAGE - } - + /** Returns the number of bytes sent by the application over a network since device reboot. */ fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + /** Returns the number of bytes received by the application over a network since device reboot. */ fun getTotalReceivedBytes(): Long = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + /** Returns the amount of memory used by the application on the device in bytes. */ fun getTotalPssUsed(): Long { val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager var totalPssUsed: Long = 0 @@ -70,6 +72,21 @@ class PerformanceMetricsUtils @Inject constructor( return totalPssUsed } + /** + * Returns the [OppiaMetricLog.StorageTier] of the device by analysing the total storage + * capacity of the device. + */ + fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = + when (Environment.getDataDirectory().totalSpace / (1024 * 1024 * 1024)) { + in 0..5 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 5..20 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + else -> OppiaMetricLog.StorageTier.HIGH_STORAGE + } + + /** + * Returns the [OppiaMetricLog.MemoryTier] of the device by analysing the total memory + * capacity of the device. + */ fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val memoryInfo = ActivityManager.MemoryInfo() From 2c454e76dd6f3323091022cd137f14526ced12f5 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 01:36:50 +0530 Subject: [PATCH 034/149] log uploading support --- .../analytics/PerformanceMetricsController.kt | 6 +- .../LogUploadWorkManagerInitializer.kt | 17 ++ .../loguploader/LogUploadWorker.kt | 26 +++ .../util/logging/EventBundleCreator.kt | 186 ++++++++++++++++++ .../oppia/android/util/logging/LogUploader.kt | 6 + .../logging/firebase/FirebaseEventLogger.kt | 25 ++- .../logging/firebase/FirebaseLogUploader.kt | 12 ++ .../logging/firebase/LogReportingModule.kt | 8 + ...er.kt => PerformanceMetricsEventLogger.kt} | 2 +- 9 files changed, 283 insertions(+), 5 deletions(-) rename utility/src/main/java/org/oppia/android/util/logging/performancemetrics/{PerformanceMetricLogger.kt => PerformanceMetricsEventLogger.kt} (80%) 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 3a3e9214d3c..c7bc3870121 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 @@ -8,7 +8,7 @@ import org.oppia.android.domain.oppialogger.MetricLogStorageCacheSize import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException @@ -25,7 +25,7 @@ class PerformanceMetricsController @Inject constructor( private val consoleLogger: ConsoleLogger, private val networkConnectionUtil: NetworkConnectionUtil, private val exceptionLogger: ExceptionLogger, - private val performanceMetricLogger: PerformanceMetricLogger, + private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, cacheStoreFactory: PersistentCacheStore.Factory, private val applicationLifecycleObserver: ApplicationLifecycleObserver, @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int @@ -54,7 +54,7 @@ class PerformanceMetricsController @Inject constructor( private fun uploadOrCacheLog(oppiaMetricLog: OppiaMetricLog) { when (networkConnectionUtil.getCurrentConnectionStatus()) { NetworkConnectionUtil.ProdConnectionStatus.NONE -> cacheMetricLog(oppiaMetricLog) - else -> performanceMetricLogger.logPerformanceMetric(oppiaMetricLog) + else -> performanceMetricsEventLogger.logPerformanceMetric(oppiaMetricLog) } } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 3d3caf980ed..da867266d13 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -49,6 +49,13 @@ class LogUploadWorkManagerInitializer @Inject constructor( ) .build() + private val workerCaseForUploadingPerformanceMetrics: Data = Data.Builder() + .putString( + LogUploadWorker.WORKER_CASE_KEY, + LogUploadWorker.PERFORMANCE_METRICS_WORKER + ) + .build() + private val workerCaseForCreatingPeriodicMetricLogs: Data = Data.Builder() .putString( LogGenerationWorker.WORKER_CASE_KEY, @@ -82,6 +89,12 @@ class LogUploadWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() + private val workRequestForUploadingPerformanceMetrics: PeriodicWorkRequest = PeriodicWorkRequest + .Builder(LogUploadWorker::class.java, 6, TimeUnit.HOURS) + .setInputData(workerCaseForUploadingPerformanceMetrics) + .setConstraints(logReportWorkerConstraints) + .build() + private val workRequestForGeneratingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( LogGenerationWorker::class.java, @@ -118,6 +131,10 @@ class LogUploadWorkManagerInitializer @Inject constructor( val workManager = WorkManager.getInstance(context) logUploader.enqueueWorkRequestForEvents(workManager, workRequestForUploadingEvents) logUploader.enqueueWorkRequestForExceptions(workManager, workRequestForUploadingExceptions) + logUploader.enqueueWorkRequestForPerformanceMetrics( + workManager, + workRequestForUploadingPerformanceMetrics + ) logGenerator.enqueueWorkRequestForPeriodicMetrics( workManager, workRequestForGeneratingPeriodicMetricLogs diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt index 44b59243406..4ff0625596a 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt @@ -10,6 +10,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import org.oppia.android.domain.oppialogger.analytics.AnalyticsController +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.domain.oppialogger.exceptions.ExceptionsController import org.oppia.android.domain.oppialogger.exceptions.toException import org.oppia.android.domain.util.getStringFromData @@ -17,6 +18,7 @@ import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.SyncStatusManager +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.threading.BackgroundDispatcher import javax.inject.Inject @@ -26,8 +28,10 @@ class LogUploadWorker private constructor( params: WorkerParameters, private val analyticsController: AnalyticsController, private val exceptionsController: ExceptionsController, + private val performanceMetricsController: PerformanceMetricsController, private val exceptionLogger: ExceptionLogger, private val eventLogger: EventLogger, + private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, private val consoleLogger: ConsoleLogger, private val syncStatusManager: SyncStatusManager, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher @@ -38,6 +42,7 @@ class LogUploadWorker private constructor( const val TAG = "LogUploadWorker.tag" const val EVENT_WORKER = "event_worker" const val EXCEPTION_WORKER = "exception_worker" + const val PERFORMANCE_METRICS_WORKER = "performance_metrics_worker" } @ExperimentalCoroutinesApi @@ -47,6 +52,7 @@ class LogUploadWorker private constructor( when (inputData.getStringFromData(WORKER_CASE_KEY)) { EVENT_WORKER -> uploadEvents() EXCEPTION_WORKER -> uploadExceptions() + PERFORMANCE_METRICS_WORKER -> uploadPerformanceMetrics() else -> Result.failure() } } @@ -97,12 +103,30 @@ class LogUploadWorker private constructor( } } + private suspend fun uploadPerformanceMetrics(): Result { + return try { + val performanceMetricsLogs = performanceMetricsController.getMetricLogStoreList() + performanceMetricsLogs.let { + for (performanceMetricsLog in it) { + performanceMetricsEventLogger.logPerformanceMetric(performanceMetricsLog) + performanceMetricsController.removeFirstMetricLogFromStore() + } + } + Result.success() + } catch (e: Exception) { + consoleLogger.e(TAG, e.toString(), e) + Result.failure() + } + } + /** Creates an instance of [LogUploadWorker] by properly injecting dependencies. */ class Factory @Inject constructor( private val analyticsController: AnalyticsController, private val exceptionsController: ExceptionsController, + private val performanceMetricsController: PerformanceMetricsController, private val exceptionLogger: ExceptionLogger, private val eventLogger: EventLogger, + private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, private val consoleLogger: ConsoleLogger, private val syncStatusManager: SyncStatusManager, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher @@ -114,8 +138,10 @@ class LogUploadWorker private constructor( params, analyticsController, exceptionsController, + performanceMetricsController, exceptionLogger, eventLogger, + performanceMetricsEventLogger, consoleLogger, syncStatusManager, backgroundDispatcher 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 a35bb6caf4e..e2a72c3a311 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 @@ -30,6 +30,14 @@ import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SOLUTION import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_CARD_CONTEXT import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_OVER_EXPLORATION_CONTEXT import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SUBMIT_ANSWER_CONTEXT +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.LOGGABLEMETRICTYPE_NOT_SET +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_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.util.logging.EventBundleCreator.EventActivityContext.CardContext import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.ConceptCardContext import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.EmptyContext @@ -84,6 +92,51 @@ class EventBundleCreator @Inject constructor( }?.activityName ?: "unknown_activity_context" } + fun fillPerformanceMetricsEventBundle(oppiaMetricLog: OppiaMetricLog, bundle: Bundle): String { + bundle.putLong("timestamp", oppiaMetricLog.timestampMillis) + bundle.putString("priority", oppiaMetricLog.priority.toAnalyticsName()) + bundle.putBoolean("is_app_in_foreground", oppiaMetricLog.isAppInForeground) + bundle.putString("memory_tier", oppiaMetricLog.memoryTier.toAnalyticsName()) + bundle.putString("storage_tier", oppiaMetricLog.storageTier.toAnalyticsName()) + bundle.putString("network_type", oppiaMetricLog.networkType.toAnalyticsName()) + bundle.putString("current_screen", oppiaMetricLog.currentScreen.toAnalyticsName()) + return oppiaMetricLog.loggableMetric.convertToLoggableMetricType()?.also { loggableMetric -> + // No allowance for user IDs to be logged since learner study feature is disabled for + // performance metrics logging as of now. + loggableMetric.storeValue(PropertyStore(bundle, allowUserIds = false)) + }?.metricName ?: "unknown_loggable_metric" + } + + private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): PerformanceMetricsLoggableMetricType<*>? { + return when (loggableMetricTypeCase) { + APK_SIZE_METRIC -> PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric( + "apk_size_metric", + apkSizeMetric + ) + STORAGE_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.StorageUsageLoggableMetric( + "storage_usage_metric", + storageUsageMetric + ) + STARTUP_LATENCY_METRIC -> PerformanceMetricsLoggableMetricType.StartupLatencyLoggableMetric( + "startup_latency_metric", + startupLatencyMetric + ) + MEMORY_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.MemoryUsageLoggableMetric( + "memory_usage_metric", + memoryUsageMetric + ) + NETWORK_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.NetworkUsageLoggableMetric( + "network_usage_metric", + networkUsageMetric + ) + CPU_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.CpuUsageLoggableMetric( + "cpu_usage_metric", + cpuUsageMetric + ) + LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + } + } + private fun EventLog.Context.convertToActivityContext(): EventActivityContext<*>? { return when (activityContextCase) { OPEN_EXPLORATION_ACTIVITY -> @@ -193,6 +246,100 @@ class EventBundleCreator @Inject constructor( namespace.split('_').map(String::first).joinToString(separator = "") } + private sealed class PerformanceMetricsLoggableMetricType( + val metricName: String, + private val value: T + ) { + /** + * Stores the value of this context (i.e. its constituent properties which may correspond to + * other [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase]s). + */ + fun storeValue(store: PropertyStore) = value.storeValue(store) + + /** Method that should be overridden by base classes to satisfy the contract of [storeValue]. */ + protected abstract fun T.storeValue(store: PropertyStore) + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.ApkSizeMetric]. + */ + class ApkSizeLoggableMetric( + metricName: String, + value: OppiaMetricLog.ApkSizeMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.ApkSizeMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("apk_size_bytes", apkSizeBytes) + } + } + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.StorageUsageMetric]. + */ + class StorageUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.StorageUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.StorageUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("storage_usage_bytes", storageUsageBytes) + } + } + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.StartupLatencyMetric]. + */ + class StartupLatencyLoggableMetric( + metricName: String, + value: OppiaMetricLog.StartupLatencyMetric + ) : + PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.StartupLatencyMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("startup_latency_millis", startupLatencyMillis) + } + } + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.MemoryUsageMetric]. + */ + class MemoryUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.MemoryUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.MemoryUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("total_pss_bytes", totalPssBytes) + } + } + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.NetworkUsageMetric]. + */ + class NetworkUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.NetworkUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.NetworkUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("bytes_received", bytesReceived) + store.putNonSensitiveValue("bytes_sent", bytesSent) + } + } + + /** + * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to + * [OppiaMetricLog.CpuUsageMetric]. + */ + class CpuUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.CpuUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.CpuUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("cpu_usage", cpuUsageMetric) + } + } + } + /** * Represents an [EventLog] activity context (denoted by * [EventLog.Context.getActivityContextCase]). @@ -375,4 +522,43 @@ class EventBundleCreator @Inject constructor( EventLog.Priority.OPTIONAL -> "optional" EventLog.Priority.UNRECOGNIZED -> "unknown_priority" } + + private fun OppiaMetricLog.Priority.toAnalyticsName() = when (this) { + OppiaMetricLog.Priority.PRIORITY_UNSPECIFIED -> "unspecified_priority" + OppiaMetricLog.Priority.LOW_PRIORITY -> "low_priority" + OppiaMetricLog.Priority.MEDIUM_PRIORITY -> "medium_priority" + OppiaMetricLog.Priority.HIGH_PRIORITY -> "high_priority" + OppiaMetricLog.Priority.UNRECOGNIZED -> "unknown_priority" + } + + private fun OppiaMetricLog.MemoryTier.toAnalyticsName() = when (this) { + OppiaMetricLog.MemoryTier.MEMORY_TIER_UNSPECIFIED -> "unspecified_memory_tier" + OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER -> "low_memory" + OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER -> "medium_memory" + OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER -> "high_memory" + OppiaMetricLog.MemoryTier.UNRECOGNIZED -> "unknown_memory_tier" + } + + private fun OppiaMetricLog.StorageTier.toAnalyticsName() = when (this) { + OppiaMetricLog.StorageTier.STORAGE_TIER_UNSPECIFIED -> "unspecified_storage_tier" + OppiaMetricLog.StorageTier.LOW_STORAGE -> "low_storage" + OppiaMetricLog.StorageTier.MEDIUM_STORAGE -> "medium_storage" + OppiaMetricLog.StorageTier.HIGH_STORAGE -> "high_storage" + OppiaMetricLog.StorageTier.UNRECOGNIZED -> "unknown_storage_tier" + } + + private fun OppiaMetricLog.NetworkType.toAnalyticsName() = when (this) { + OppiaMetricLog.NetworkType.NETWORK_UNSPECIFIED -> "unspecified_network_type" + OppiaMetricLog.NetworkType.WIFI -> "wifi" + OppiaMetricLog.NetworkType.CELLULAR -> "cellular" + OppiaMetricLog.NetworkType.NONE -> "none" + OppiaMetricLog.NetworkType.UNRECOGNIZED -> "unknown_network_type" + } + + private fun OppiaMetricLog.CurrentScreen.toAnalyticsName() = when (this) { + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED -> "unspecified_current_screen" + OppiaMetricLog.CurrentScreen.HOME_SCREEN -> "home_screen" + OppiaMetricLog.CurrentScreen.UNRECOGNIZED -> "unknown_screen_name" + // TODO(#4340): Add support for all screens which are going to be used for metric logging. + } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/LogUploader.kt b/utility/src/main/java/org/oppia/android/util/logging/LogUploader.kt index fdfa943b5ad..9104e66a24f 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/LogUploader.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/LogUploader.kt @@ -11,4 +11,10 @@ interface LogUploader { /** Enqueues a [workRequest] using the [workManager] for uploading exception logs that are stored in the cache store. */ fun enqueueWorkRequestForExceptions(workManager: WorkManager, workRequest: PeriodicWorkRequest) + + /** Enqueues a [workRequest] using the [workManager] for uploading performance metrics logs that are stored in the cache store. */ + fun enqueueWorkRequestForPerformanceMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) } diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index a4f61516e54..e2bbfb37cec 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -5,8 +5,10 @@ import android.content.Context import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics import org.oppia.android.app.model.EventLog +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.EventBundleCreator import org.oppia.android.util.logging.EventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.networking.NetworkConnectionUtil import java.util.Locale import javax.inject.Inject @@ -19,7 +21,7 @@ class FirebaseEventLogger private constructor( private val firebaseAnalytics: FirebaseAnalytics, private val networkConnectionUtil: NetworkConnectionUtil, private val eventBundleCreator: EventBundleCreator -) : EventLogger { +) : EventLogger, PerformanceMetricsEventLogger { /** * Logs an event to Firebase Analytics with [NETWORK_USER_PROPERTY] and [COUNTRY_USER_PROPERTY]. */ @@ -32,6 +34,24 @@ class FirebaseEventLogger private constructor( firebaseAnalytics.setUserProperty(NETWORK_USER_PROPERTY, getNetworkStatus()) } + /** + * Logs a performance metric to Firebase Analytics with [NETWORK_USER_PROPERTY] and [COUNTRY_USER_PROPERTY]. + */ + override fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) { + Bundle().let { + firebaseAnalytics.logEvent( + eventBundleCreator.fillPerformanceMetricsEventBundle( + oppiaMetricLog, + it + ), + it + ) + } + // TODO(#3792): Remove this usage of Locale. + firebaseAnalytics.setUserProperty(COUNTRY_USER_PROPERTY, Locale.getDefault().displayCountry) + firebaseAnalytics.setUserProperty(NETWORK_USER_PROPERTY, getNetworkStatus()) + } + private fun getNetworkStatus(): String { return when (networkConnectionUtil.getCurrentConnectionStatus()) { NetworkConnectionUtil.ProdConnectionStatus.LOCAL -> @@ -60,5 +80,8 @@ class FirebaseEventLogger private constructor( */ fun create(): EventLogger = FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) + + fun createPerformanceMetricEventLogger(): PerformanceMetricsEventLogger = + FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseLogUploader.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseLogUploader.kt index fbe0b7c4f57..067c7c4c815 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseLogUploader.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseLogUploader.kt @@ -8,6 +8,7 @@ import javax.inject.Inject private const val OPPIA_EVENT_WORK = "OPPIA_EVENT_WORK_REQUEST" private const val OPPIA_EXCEPTION_WORK = "OPPIA_EXCEPTION_WORK_REQUEST" +private const val OPPIA_PERFORMANCE_METRICS_WORK = "OPPIA_PERFORMANCE_METRICS_WORK" /** Enqueues work requests for uploading stored event/exception logs to the remote service. */ class FirebaseLogUploader @Inject constructor() : @@ -34,4 +35,15 @@ class FirebaseLogUploader @Inject constructor() : workRequest ) } + + override fun enqueueWorkRequestForPerformanceMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + workManager.enqueueUniquePeriodicWork( + OPPIA_PERFORMANCE_METRICS_WORK, + ExistingPeriodicWorkPolicy.KEEP, + workRequest + ) + } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt index 21d8fd20345..aaa8bd329c4 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt @@ -5,6 +5,7 @@ import dagger.Module import dagger.Provides import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import javax.inject.Singleton /** Provides Firebase-specific logging implementations. */ @@ -18,4 +19,11 @@ class LogReportingModule { @Provides @Singleton fun provideEventLogger(factory: FirebaseEventLogger.Factory): EventLogger = factory.create() + + @Provides + @Singleton + fun providePerformanceMetricsEventLogger( + factory: FirebaseEventLogger.Factory + ): PerformanceMetricsEventLogger = + factory.createPerformanceMetricEventLogger() } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt similarity index 80% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt rename to utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt index 4a12288c4ed..756ebda9198 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt @@ -2,6 +2,6 @@ package org.oppia.android.util.logging.performancemetrics import org.oppia.android.app.model.OppiaMetricLog -interface PerformanceMetricLogger { +interface PerformanceMetricsEventLogger { fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) } From 8f920369234ad0ae292567462b25a22b06e2df75 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 01:37:33 +0530 Subject: [PATCH 035/149] nits --- .../java/org/oppia/android/util/logging/EventBundleCreator.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 e2a72c3a311..e348185a034 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 @@ -107,7 +107,8 @@ class EventBundleCreator @Inject constructor( }?.metricName ?: "unknown_loggable_metric" } - private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): PerformanceMetricsLoggableMetricType<*>? { + private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType( + ): PerformanceMetricsLoggableMetricType<*>? { return when (loggableMetricTypeCase) { APK_SIZE_METRIC -> PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric( "apk_size_metric", From 52b416c5e0b5d1c1cf7531adbe036fc73a384d71 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 01:39:56 +0530 Subject: [PATCH 036/149] nits --- .../util/logging/EventBundleCreator.kt | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) 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 e348185a034..7fc5eb10cb1 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 @@ -107,36 +107,36 @@ class EventBundleCreator @Inject constructor( }?.metricName ?: "unknown_loggable_metric" } - private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType( - ): PerformanceMetricsLoggableMetricType<*>? { - return when (loggableMetricTypeCase) { - APK_SIZE_METRIC -> PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric( - "apk_size_metric", - apkSizeMetric - ) - STORAGE_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.StorageUsageLoggableMetric( - "storage_usage_metric", - storageUsageMetric - ) - STARTUP_LATENCY_METRIC -> PerformanceMetricsLoggableMetricType.StartupLatencyLoggableMetric( - "startup_latency_metric", - startupLatencyMetric - ) - MEMORY_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.MemoryUsageLoggableMetric( - "memory_usage_metric", - memoryUsageMetric - ) - NETWORK_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.NetworkUsageLoggableMetric( - "network_usage_metric", - networkUsageMetric - ) - CPU_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.CpuUsageLoggableMetric( - "cpu_usage_metric", - cpuUsageMetric - ) - LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): + PerformanceMetricsLoggableMetricType<*>? { + return when (loggableMetricTypeCase) { + APK_SIZE_METRIC -> PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric( + "apk_size_metric", + apkSizeMetric + ) + STORAGE_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.StorageUsageLoggableMetric( + "storage_usage_metric", + storageUsageMetric + ) + STARTUP_LATENCY_METRIC -> PerformanceMetricsLoggableMetricType.StartupLatencyLoggableMetric( + "startup_latency_metric", + startupLatencyMetric + ) + MEMORY_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.MemoryUsageLoggableMetric( + "memory_usage_metric", + memoryUsageMetric + ) + NETWORK_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.NetworkUsageLoggableMetric( + "network_usage_metric", + networkUsageMetric + ) + CPU_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.CpuUsageLoggableMetric( + "cpu_usage_metric", + cpuUsageMetric + ) + LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + } } - } private fun EventLog.Context.convertToActivityContext(): EventActivityContext<*>? { return when (activityContextCase) { From 0062ce35c2c8c7052b88c75c66b237786a7e1685 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 03:22:47 +0530 Subject: [PATCH 037/149] performance metric event logger nits. --- .../analytics/PerformanceMetricsController.kt | 6 +++--- .../PerformanceMetricEventLogger.kt | 13 +++++++++++++ .../performancemetrics/PerformanceMetricLogger.kt | 7 ------- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt delete mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt 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 3a3e9214d3c..f9e4b5baa3f 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 @@ -8,7 +8,7 @@ import org.oppia.android.domain.oppialogger.MetricLogStorageCacheSize import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricEventLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException @@ -25,7 +25,7 @@ class PerformanceMetricsController @Inject constructor( private val consoleLogger: ConsoleLogger, private val networkConnectionUtil: NetworkConnectionUtil, private val exceptionLogger: ExceptionLogger, - private val performanceMetricLogger: PerformanceMetricLogger, + private val performanceMetricEventLogger: PerformanceMetricEventLogger, cacheStoreFactory: PersistentCacheStore.Factory, private val applicationLifecycleObserver: ApplicationLifecycleObserver, @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int @@ -54,7 +54,7 @@ class PerformanceMetricsController @Inject constructor( private fun uploadOrCacheLog(oppiaMetricLog: OppiaMetricLog) { when (networkConnectionUtil.getCurrentConnectionStatus()) { NetworkConnectionUtil.ProdConnectionStatus.NONE -> cacheMetricLog(oppiaMetricLog) - else -> performanceMetricLogger.logPerformanceMetric(oppiaMetricLog) + else -> performanceMetricEventLogger.logPerformanceMetric(oppiaMetricLog) } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt new file mode 100644 index 00000000000..7f0049a1c60 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt @@ -0,0 +1,13 @@ +package org.oppia.android.util.logging.performancemetrics + +import org.oppia.android.app.model.OppiaMetricLog + +/** Logger for uploading performance metrics event logs to remote services. */ +interface PerformanceMetricEventLogger { + /** + * Logs a performance metric to remote services. + * + * @param oppiaMetricLog refers to the log object which contains all the relevant data to be reported. + */ + fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt deleted file mode 100644 index 4a12288c4ed..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricLogger.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.oppia.android.util.logging.performancemetrics - -import org.oppia.android.app.model.OppiaMetricLog - -interface PerformanceMetricLogger { - fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) -} From 4fb75a0e06f78e84cfecc1c7e440c925a70014ac Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 03:26:15 +0530 Subject: [PATCH 038/149] nits. --- .../oppialogger/analytics/PerformanceMetricsController.kt | 6 +++--- ...etricEventLogger.kt => PerformanceMetricsEventLogger.kt} | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename utility/src/main/java/org/oppia/android/util/logging/performancemetrics/{PerformanceMetricEventLogger.kt => PerformanceMetricsEventLogger.kt} (90%) 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 f9e4b5baa3f..c7bc3870121 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 @@ -8,7 +8,7 @@ import org.oppia.android.domain.oppialogger.MetricLogStorageCacheSize import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricEventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException @@ -25,7 +25,7 @@ class PerformanceMetricsController @Inject constructor( private val consoleLogger: ConsoleLogger, private val networkConnectionUtil: NetworkConnectionUtil, private val exceptionLogger: ExceptionLogger, - private val performanceMetricEventLogger: PerformanceMetricEventLogger, + private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, cacheStoreFactory: PersistentCacheStore.Factory, private val applicationLifecycleObserver: ApplicationLifecycleObserver, @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int @@ -54,7 +54,7 @@ class PerformanceMetricsController @Inject constructor( private fun uploadOrCacheLog(oppiaMetricLog: OppiaMetricLog) { when (networkConnectionUtil.getCurrentConnectionStatus()) { NetworkConnectionUtil.ProdConnectionStatus.NONE -> cacheMetricLog(oppiaMetricLog) - else -> performanceMetricEventLogger.logPerformanceMetric(oppiaMetricLog) + else -> performanceMetricsEventLogger.logPerformanceMetric(oppiaMetricLog) } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt similarity index 90% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt rename to utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt index 7f0049a1c60..a224aa08b70 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt @@ -3,7 +3,7 @@ package org.oppia.android.util.logging.performancemetrics import org.oppia.android.app.model.OppiaMetricLog /** Logger for uploading performance metrics event logs to remote services. */ -interface PerformanceMetricEventLogger { +interface PerformanceMetricsEventLogger { /** * Logs a performance metric to remote services. * From bcab311c0c60634b102863a253599b22705e3a48 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 03:30:34 +0530 Subject: [PATCH 039/149] logger reinstated. --- .../PerformanceMetricsEventLogger.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt new file mode 100644 index 00000000000..a224aa08b70 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt @@ -0,0 +1,13 @@ +package org.oppia.android.util.logging.performancemetrics + +import org.oppia.android.app.model.OppiaMetricLog + +/** Logger for uploading performance metrics event logs to remote services. */ +interface PerformanceMetricsEventLogger { + /** + * Logs a performance metric to remote services. + * + * @param oppiaMetricLog refers to the log object which contains all the relevant data to be reported. + */ + fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) +} From 8cecb6d77226b19485ebb361f88463f9e25670c8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 04:40:53 +0530 Subject: [PATCH 040/149] nits --- .../util/logging/EventBundleCreator.kt | 67 ++++++++----------- 1 file changed, 27 insertions(+), 40 deletions(-) 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 7fc5eb10cb1..a5611ffb731 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 @@ -31,6 +31,7 @@ import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_CA import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_OVER_EXPLORATION_CONTEXT import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SUBMIT_ANSWER_CONTEXT import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.LOGGABLEMETRICTYPE_NOT_SET @@ -51,6 +52,12 @@ import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.Se import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.StoryContext import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.SubmitAnswerContext import org.oppia.android.util.logging.EventBundleCreator.EventActivityContext.TopicContext +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.CpuUsageLoggableMetric +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.MemoryUsageLoggableMetric +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.NetworkUsageLoggableMetric +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.StartupLatencyLoggableMetric +import org.oppia.android.util.logging.EventBundleCreator.PerformanceMetricsLoggableMetricType.StorageUsageLoggableMetric import org.oppia.android.util.platformparameter.LearnerStudyAnalytics import org.oppia.android.util.platformparameter.PlatformParameterValue import javax.inject.Inject @@ -65,6 +72,12 @@ import org.oppia.android.app.model.EventLog.RevisionCardContext as RevisionCardE import org.oppia.android.app.model.EventLog.StoryContext as StoryEventContext import org.oppia.android.app.model.EventLog.SubmitAnswerContext as SubmitAnswerEventContext import org.oppia.android.app.model.EventLog.TopicContext as TopicEventContext +import org.oppia.android.app.model.OppiaMetricLog.ApkSizeMetric as ApkSizePerformanceLoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.CpuUsageMetric as CpuUsagePerformanceLoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.MemoryUsageMetric as MemoryUsagePerformanceLoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.NetworkUsageMetric as NetworkUsagePerformanceLoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.StartupLatencyMetric as StartupLatencyPerformanceLoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.StorageUsageMetric as StorageUsagePerformanceLoggableMetric // See https://firebase.google.com/docs/reference/cpp/group/parameter-names for context. private const val MAX_CHARACTERS_IN_PARAMETER_NAME = 40 @@ -110,30 +123,21 @@ class EventBundleCreator @Inject constructor( private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): PerformanceMetricsLoggableMetricType<*>? { return when (loggableMetricTypeCase) { - APK_SIZE_METRIC -> PerformanceMetricsLoggableMetricType.ApkSizeLoggableMetric( - "apk_size_metric", - apkSizeMetric - ) - STORAGE_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.StorageUsageLoggableMetric( + APK_SIZE_METRIC -> ApkSizeLoggableMetric("apk_size_metric", apkSizeMetric) + STORAGE_USAGE_METRIC -> StorageUsageLoggableMetric( "storage_usage_metric", storageUsageMetric ) - STARTUP_LATENCY_METRIC -> PerformanceMetricsLoggableMetricType.StartupLatencyLoggableMetric( + STARTUP_LATENCY_METRIC -> StartupLatencyLoggableMetric( "startup_latency_metric", startupLatencyMetric ) - MEMORY_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.MemoryUsageLoggableMetric( - "memory_usage_metric", - memoryUsageMetric - ) - NETWORK_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.NetworkUsageLoggableMetric( + MEMORY_USAGE_METRIC -> MemoryUsageLoggableMetric("memory_usage_metric", memoryUsageMetric) + NETWORK_USAGE_METRIC -> NetworkUsageLoggableMetric( "network_usage_metric", networkUsageMetric ) - CPU_USAGE_METRIC -> PerformanceMetricsLoggableMetricType.CpuUsageLoggableMetric( - "cpu_usage_metric", - cpuUsageMetric - ) + CPU_USAGE_METRIC -> CpuUsageLoggableMetric("cpu_usage_metric", cpuUsageMetric) LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. } } @@ -247,23 +251,21 @@ class EventBundleCreator @Inject constructor( namespace.split('_').map(String::first).joinToString(separator = "") } + /*** Represents an [OppiaMetricLog] loggable metric (denoted by [LoggableMetricTypeCase]).*/ private sealed class PerformanceMetricsLoggableMetricType( val metricName: String, private val value: T ) { /** * Stores the value of this context (i.e. its constituent properties which may correspond to - * other [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase]s). + * other [LoggableMetricTypeCase]s). */ fun storeValue(store: PropertyStore) = value.storeValue(store) /** Method that should be overridden by base classes to satisfy the contract of [storeValue]. */ protected abstract fun T.storeValue(store: PropertyStore) - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.ApkSizeMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [ApkSizePerformanceLoggableMetric]. */ class ApkSizeLoggableMetric( metricName: String, value: OppiaMetricLog.ApkSizeMetric @@ -273,10 +275,7 @@ class EventBundleCreator @Inject constructor( } } - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.StorageUsageMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [StorageUsagePerformanceLoggableMetric]. */ class StorageUsageLoggableMetric( metricName: String, value: OppiaMetricLog.StorageUsageMetric @@ -286,10 +285,7 @@ class EventBundleCreator @Inject constructor( } } - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.StartupLatencyMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [StartupLatencyPerformanceLoggableMetric]. */ class StartupLatencyLoggableMetric( metricName: String, value: OppiaMetricLog.StartupLatencyMetric @@ -300,10 +296,7 @@ class EventBundleCreator @Inject constructor( } } - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.MemoryUsageMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [MemoryUsagePerformanceLoggableMetric]. */ class MemoryUsageLoggableMetric( metricName: String, value: OppiaMetricLog.MemoryUsageMetric @@ -313,10 +306,7 @@ class EventBundleCreator @Inject constructor( } } - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.NetworkUsageMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [NetworkUsagePerformanceLoggableMetric]. */ class NetworkUsageLoggableMetric( metricName: String, value: OppiaMetricLog.NetworkUsageMetric @@ -327,10 +317,7 @@ class EventBundleCreator @Inject constructor( } } - /** - * The [OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase] corresponding to - * [OppiaMetricLog.CpuUsageMetric]. - */ + /** The [LoggableMetricTypeCase] corresponding to [CpuUsagePerformanceLoggableMetric]. */ class CpuUsageLoggableMetric( metricName: String, value: OppiaMetricLog.CpuUsageMetric From 35464e73f13156c1f18c33da429db76568dcec9c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 04:46:46 +0530 Subject: [PATCH 041/149] deleting unused interfaces. --- .../util/metriccollection/AppHealthMetricUtils.kt | 5 ----- .../android/util/metriccollection/AppStartupMetrics.kt | 9 --------- .../android/util/metriccollection/PeriodicMetrics.kt | 6 ------ .../android/util/metriccollection/UiSpecificMetrics.kt | 8 -------- 4 files changed, 28 deletions(-) delete mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt delete mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt delete mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt delete mode 100644 utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt deleted file mode 100644 index c5dad98bd36..00000000000 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/AppHealthMetricUtils.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.oppia.android.util.metriccollection - -interface AppHealthMetricUtils { - fun isAppInForeground(): Boolean -} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt deleted file mode 100644 index 3070b449d5e..00000000000 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/AppStartupMetrics.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.oppia.android.util.metriccollection - -import org.oppia.android.app.model.OppiaMetricLog - -interface AppStartupMetrics { - fun getApkSize(): Long - fun getUsedStorage(): Long - fun getDeviceStorageTier(): OppiaMetricLog.StorageTier -} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt deleted file mode 100644 index 8e52bc63e86..00000000000 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/PeriodicMetrics.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.oppia.android.util.metriccollection - -interface PeriodicMetrics { - fun getTotalTransmittedBytes(): Long - fun getTotalReceivedBytes(): Long -} diff --git a/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt b/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt deleted file mode 100644 index 84d24c2f33e..00000000000 --- a/utility/src/main/java/org/oppia/android/util/metriccollection/UiSpecificMetrics.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.oppia.android.util.metriccollection - -import org.oppia.android.app.model.OppiaMetricLog - -interface UiSpecificMetrics { - fun getTotalPssUsed(): Long - fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier -} From f4a039b1c25b7acaff60c09e63a6c1c3b77f9c6b Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 04:59:42 +0530 Subject: [PATCH 042/149] log generator to metric log scheduler --- .../app/application/ApplicationComponent.kt | 4 ++-- .../loguploader/LogUploadWorkManagerInitializer.kt | 10 +++++----- .../{LogGenerator.kt => MetricLogScheduler.kt} | 4 ++-- .../performancemetrics/MetricLogGeneratorModule.kt | 12 ------------ .../performancemetrics/MetricLogSchedulerModule.kt | 14 ++++++++++++++ ...erator.kt => PerformanceMetricsLogScheduler.kt} | 4 ++-- 6 files changed, 25 insertions(+), 23 deletions(-) rename utility/src/main/java/org/oppia/android/util/logging/{LogGenerator.kt => MetricLogScheduler.kt} (91%) delete mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt rename utility/src/main/java/org/oppia/android/util/logging/performancemetrics/{MetricLogGenerator.kt => PerformanceMetricsLogScheduler.kt} (91%) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index 11d23e13438..25aece298ef 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -53,7 +53,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogGeneratorModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +104,7 @@ import javax.inject.Singleton NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - MetricLogGeneratorModule::class, + MetricLogSchedulerModule::class, // TODO(#59): Remove this module once we completely migrate to Bazel from Gradle as we can then // directly exclude debug files from the build and thus won't be requiring this module. NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 3d3caf980ed..8f14d52e09a 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -8,7 +8,7 @@ import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker -import org.oppia.android.util.logging.LogGenerator +import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes @@ -23,7 +23,7 @@ import javax.inject.Singleton class LogUploadWorkManagerInitializer @Inject constructor( private val context: Context, private val logUploader: LogUploader, - private val logGenerator: LogGenerator, + private val metricLogScheduler: MetricLogScheduler, @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes performanceMetricsCollectionHighFrequencyTimeInterval: PlatformParameterValue, @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes @@ -118,15 +118,15 @@ class LogUploadWorkManagerInitializer @Inject constructor( val workManager = WorkManager.getInstance(context) logUploader.enqueueWorkRequestForEvents(workManager, workRequestForUploadingEvents) logUploader.enqueueWorkRequestForExceptions(workManager, workRequestForUploadingExceptions) - logGenerator.enqueueWorkRequestForPeriodicMetrics( + metricLogScheduler.enqueueWorkRequestForPeriodicMetrics( workManager, workRequestForGeneratingPeriodicMetricLogs ) - logGenerator.enqueueWorkRequestForStorageUsage( + metricLogScheduler.enqueueWorkRequestForStorageUsage( workManager, workRequestForGeneratingStorageUsageMetricLogs ) - logGenerator.enqueueWorkRequestForMemoryUsage( + metricLogScheduler.enqueueWorkRequestForMemoryUsage( workManager, workRequestForGeneratingMemoryUsageMetricLogs ) diff --git a/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt similarity index 91% rename from utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt rename to utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt index ad1e6439a9b..dca50b0be08 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/LogGenerator.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt @@ -3,8 +3,8 @@ package org.oppia.android.util.logging import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager -/** Generator for generating metric log reports related to the performance of the application. */ -interface LogGenerator { +/** Scheduler for scheduling metric log reports related to the performance of the application. */ +interface MetricLogScheduler { /** * Enqueues a [workRequest] using the [workManager] for generating metric logs of periodic * metrics like network and cpu usage. diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt deleted file mode 100644 index 0883770a6fa..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGeneratorModule.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.oppia.android.util.logging.performancemetrics - -import dagger.Binds -import dagger.Module -import org.oppia.android.util.logging.LogGenerator - -/** Provides Log Generator related dependencies. */ -@Module -interface MetricLogGeneratorModule { - @Binds - fun bindMetricLogGenerator(metricLogGenerator: MetricLogGenerator): LogGenerator -} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt new file mode 100644 index 00000000000..b570833641b --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt @@ -0,0 +1,14 @@ +package org.oppia.android.util.logging.performancemetrics + +import dagger.Binds +import dagger.Module +import org.oppia.android.util.logging.MetricLogScheduler + +/** Provides Log Generator related dependencies. */ +@Module +interface MetricLogSchedulerModule { + @Binds + fun bindMetricLogScheduler( + performanceMetricLogScheduler: PerformanceMetricsLogScheduler + ): MetricLogScheduler +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt similarity index 91% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt rename to utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt index 6f2a35b25b6..d3b6ef7d93b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogGenerator.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt @@ -3,7 +3,7 @@ package org.oppia.android.util.logging.performancemetrics import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager -import org.oppia.android.util.logging.LogGenerator +import org.oppia.android.util.logging.MetricLogScheduler private const val OPPIA_PERIODIC_METRIC_WORK = "OPPIA_PERIODIC_METRIC_WORK" private const val OPPIA_STORAGE_USAGE_WORK = "OPPIA_STORAGE_USAGE_WORK" @@ -13,7 +13,7 @@ private const val OPPIA_MEMORY_USAGE_WORK = "OPPIA_MEMORY_USAGE_WORK" * Enqueues work requests for generating metric log reports for gaining an insight regarding into * the performance of the application. */ -class MetricLogGenerator() : LogGenerator { +class PerformanceMetricsLogScheduler() : MetricLogScheduler { override fun enqueueWorkRequestForPeriodicMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest From e57abfe82c2d9ec5fc034919aa6be161e0e85ad5 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 05:00:39 +0530 Subject: [PATCH 043/149] nits --- .../oppialogger/loguploader/LogUploadWorkManagerInitializer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 8f14d52e09a..4f620001efd 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -8,8 +8,8 @@ import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager import org.oppia.android.domain.oppialogger.ApplicationStartupListener import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker -import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.logging.LogUploader +import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterValue From d51585a26389962823bbc6c77d0a500b45a11198 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 16:27:41 +0530 Subject: [PATCH 044/149] nits -- kdoc, code placing, readability --- .../loguploader/LogUploadWorker.kt | 9 +- .../util/logging/EventBundleCreator.kt | 207 +++++++++--------- .../logging/firebase/FirebaseEventLogger.kt | 11 +- 3 files changed, 120 insertions(+), 107 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt index 4ff0625596a..ad7ffe8e878 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt @@ -103,14 +103,13 @@ class LogUploadWorker private constructor( } } + /** Extracts performance metric logs from the cache store and logs them to the remote service. */ private suspend fun uploadPerformanceMetrics(): Result { return try { val performanceMetricsLogs = performanceMetricsController.getMetricLogStoreList() - performanceMetricsLogs.let { - for (performanceMetricsLog in it) { - performanceMetricsEventLogger.logPerformanceMetric(performanceMetricsLog) - performanceMetricsController.removeFirstMetricLogFromStore() - } + performanceMetricsLogs.forEach { performanceMetricsLog -> + performanceMetricsEventLogger.logPerformanceMetric(performanceMetricsLog) + performanceMetricsController.removeFirstMetricLogFromStore() } Result.success() } catch (e: Exception) { 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 a5611ffb731..1d72f6f3f70 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 @@ -105,6 +105,11 @@ class EventBundleCreator @Inject constructor( }?.activityName ?: "unknown_activity_context" } + /** + * Fills the specified [bundle] with a logging-ready representation of [oppiaMetricLog] and + * returns a string representation of the high-level type of event logged (per + * [OppiaMetricLog.LoggableMetric.getLoggableMetricTypeCase]). + */ fun fillPerformanceMetricsEventBundle(oppiaMetricLog: OppiaMetricLog, bundle: Bundle): String { bundle.putLong("timestamp", oppiaMetricLog.timestampMillis) bundle.putString("priority", oppiaMetricLog.priority.toAnalyticsName()) @@ -114,34 +119,11 @@ class EventBundleCreator @Inject constructor( bundle.putString("network_type", oppiaMetricLog.networkType.toAnalyticsName()) bundle.putString("current_screen", oppiaMetricLog.currentScreen.toAnalyticsName()) return oppiaMetricLog.loggableMetric.convertToLoggableMetricType()?.also { loggableMetric -> - // No allowance for user IDs to be logged since learner study feature is disabled for - // performance metrics logging as of now. + // No performance metrics need to be tied to user IDs. loggableMetric.storeValue(PropertyStore(bundle, allowUserIds = false)) }?.metricName ?: "unknown_loggable_metric" } - private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): - PerformanceMetricsLoggableMetricType<*>? { - return when (loggableMetricTypeCase) { - APK_SIZE_METRIC -> ApkSizeLoggableMetric("apk_size_metric", apkSizeMetric) - STORAGE_USAGE_METRIC -> StorageUsageLoggableMetric( - "storage_usage_metric", - storageUsageMetric - ) - STARTUP_LATENCY_METRIC -> StartupLatencyLoggableMetric( - "startup_latency_metric", - startupLatencyMetric - ) - MEMORY_USAGE_METRIC -> MemoryUsageLoggableMetric("memory_usage_metric", memoryUsageMetric) - NETWORK_USAGE_METRIC -> NetworkUsageLoggableMetric( - "network_usage_metric", - networkUsageMetric - ) - CPU_USAGE_METRIC -> CpuUsageLoggableMetric("cpu_usage_metric", cpuUsageMetric) - LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. - } - } - private fun EventLog.Context.convertToActivityContext(): EventActivityContext<*>? { return when (activityContextCase) { OPEN_EXPLORATION_ACTIVITY -> @@ -187,6 +169,28 @@ class EventBundleCreator @Inject constructor( } } + private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): + PerformanceMetricsLoggableMetricType<*>? { + return when (loggableMetricTypeCase) { + APK_SIZE_METRIC -> ApkSizeLoggableMetric("apk_size_metric", apkSizeMetric) + STORAGE_USAGE_METRIC -> StorageUsageLoggableMetric( + "storage_usage_metric", + storageUsageMetric + ) + STARTUP_LATENCY_METRIC -> StartupLatencyLoggableMetric( + "startup_latency_metric", + startupLatencyMetric + ) + MEMORY_USAGE_METRIC -> MemoryUsageLoggableMetric("memory_usage_metric", memoryUsageMetric) + NETWORK_USAGE_METRIC -> NetworkUsageLoggableMetric( + "network_usage_metric", + networkUsageMetric + ) + CPU_USAGE_METRIC -> CpuUsageLoggableMetric("cpu_usage_metric", cpuUsageMetric) + LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + } + } + /** * Utility for storing properties within a [Bundle] (indicated by [bundle]), omitting those which * contain sensitive information (if they should be per [allowUserIds]. @@ -251,83 +255,6 @@ class EventBundleCreator @Inject constructor( namespace.split('_').map(String::first).joinToString(separator = "") } - /*** Represents an [OppiaMetricLog] loggable metric (denoted by [LoggableMetricTypeCase]).*/ - private sealed class PerformanceMetricsLoggableMetricType( - val metricName: String, - private val value: T - ) { - /** - * Stores the value of this context (i.e. its constituent properties which may correspond to - * other [LoggableMetricTypeCase]s). - */ - fun storeValue(store: PropertyStore) = value.storeValue(store) - - /** Method that should be overridden by base classes to satisfy the contract of [storeValue]. */ - protected abstract fun T.storeValue(store: PropertyStore) - - /** The [LoggableMetricTypeCase] corresponding to [ApkSizePerformanceLoggableMetric]. */ - class ApkSizeLoggableMetric( - metricName: String, - value: OppiaMetricLog.ApkSizeMetric - ) : PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.ApkSizeMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("apk_size_bytes", apkSizeBytes) - } - } - - /** The [LoggableMetricTypeCase] corresponding to [StorageUsagePerformanceLoggableMetric]. */ - class StorageUsageLoggableMetric( - metricName: String, - value: OppiaMetricLog.StorageUsageMetric - ) : PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.StorageUsageMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("storage_usage_bytes", storageUsageBytes) - } - } - - /** The [LoggableMetricTypeCase] corresponding to [StartupLatencyPerformanceLoggableMetric]. */ - class StartupLatencyLoggableMetric( - metricName: String, - value: OppiaMetricLog.StartupLatencyMetric - ) : - PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.StartupLatencyMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("startup_latency_millis", startupLatencyMillis) - } - } - - /** The [LoggableMetricTypeCase] corresponding to [MemoryUsagePerformanceLoggableMetric]. */ - class MemoryUsageLoggableMetric( - metricName: String, - value: OppiaMetricLog.MemoryUsageMetric - ) : PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.MemoryUsageMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("total_pss_bytes", totalPssBytes) - } - } - - /** The [LoggableMetricTypeCase] corresponding to [NetworkUsagePerformanceLoggableMetric]. */ - class NetworkUsageLoggableMetric( - metricName: String, - value: OppiaMetricLog.NetworkUsageMetric - ) : PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.NetworkUsageMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("bytes_received", bytesReceived) - store.putNonSensitiveValue("bytes_sent", bytesSent) - } - } - - /** The [LoggableMetricTypeCase] corresponding to [CpuUsagePerformanceLoggableMetric]. */ - class CpuUsageLoggableMetric( - metricName: String, - value: OppiaMetricLog.CpuUsageMetric - ) : PerformanceMetricsLoggableMetricType(metricName, value) { - override fun OppiaMetricLog.CpuUsageMetric.storeValue(store: PropertyStore) { - store.putNonSensitiveValue("cpu_usage", cpuUsageMetric) - } - } - } - /** * Represents an [EventLog] activity context (denoted by * [EventLog.Context.getActivityContextCase]). @@ -504,6 +431,84 @@ class EventBundleCreator @Inject constructor( } } + + /*** Represents an [OppiaMetricLog] loggable metric (denoted by [LoggableMetricTypeCase]).*/ + private sealed class PerformanceMetricsLoggableMetricType( + val metricName: String, + private val value: T + ) { + /** + * Stores the value of this context (i.e. its constituent properties which may correspond to + * other [LoggableMetricTypeCase]s). + */ + fun storeValue(store: PropertyStore) = value.storeValue(store) + + /** Method that should be overridden by base classes to satisfy the contract of [storeValue]. */ + protected abstract fun T.storeValue(store: PropertyStore) + + /** The [LoggableMetricTypeCase] corresponding to [ApkSizePerformanceLoggableMetric]. */ + class ApkSizeLoggableMetric( + metricName: String, + value: OppiaMetricLog.ApkSizeMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.ApkSizeMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("apk_size_bytes", apkSizeBytes) + } + } + + /** The [LoggableMetricTypeCase] corresponding to [StorageUsagePerformanceLoggableMetric]. */ + class StorageUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.StorageUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.StorageUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("storage_usage_bytes", storageUsageBytes) + } + } + + /** The [LoggableMetricTypeCase] corresponding to [StartupLatencyPerformanceLoggableMetric]. */ + class StartupLatencyLoggableMetric( + metricName: String, + value: OppiaMetricLog.StartupLatencyMetric + ) : + PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.StartupLatencyMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("startup_latency_millis", startupLatencyMillis) + } + } + + /** The [LoggableMetricTypeCase] corresponding to [MemoryUsagePerformanceLoggableMetric]. */ + class MemoryUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.MemoryUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.MemoryUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("total_pss_bytes", totalPssBytes) + } + } + + /** The [LoggableMetricTypeCase] corresponding to [NetworkUsagePerformanceLoggableMetric]. */ + class NetworkUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.NetworkUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.NetworkUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("bytes_received", bytesReceived) + store.putNonSensitiveValue("bytes_sent", bytesSent) + } + } + + /** The [LoggableMetricTypeCase] corresponding to [CpuUsagePerformanceLoggableMetric]. */ + class CpuUsageLoggableMetric( + metricName: String, + value: OppiaMetricLog.CpuUsageMetric + ) : PerformanceMetricsLoggableMetricType(metricName, value) { + override fun OppiaMetricLog.CpuUsageMetric.storeValue(store: PropertyStore) { + store.putNonSensitiveValue("cpu_usage", cpuUsageMetric) + } + } + } + private fun EventLog.Priority.toAnalyticsName() = when (this) { EventLog.Priority.PRIORITY_UNSPECIFIED -> "unspecified_priority" EventLog.Priority.ESSENTIAL -> "essential" diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index e2bbfb37cec..e1025eb03ec 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -77,10 +77,19 @@ class FirebaseEventLogger private constructor( * Returns a new [FirebaseEventLogger] for the current application context. * * Generally, only one of these needs to be created per application. + * + * This [FirebaseEventLogger] implements the [EventLogger] for facilitating analytics log + * reporting. */ - fun create(): EventLogger = + fun create(): EventLogger= FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) + /** + * Returns a new [FirebaseEventLogger] for the current application context. + * + * This [FirebaseEventLogger] implements the [PerformanceMetricsEventLogger] for facilitating + * performance metrics log reporting. + */ fun createPerformanceMetricEventLogger(): PerformanceMetricsEventLogger = FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) } From 2ede4142b88b2a7e9740bc2767cef3b28927e520 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 16:29:33 +0530 Subject: [PATCH 045/149] nits -- kdoc, code placing, readability --- .../util/logging/EventBundleCreator.kt | 37 +++++++++---------- .../logging/firebase/FirebaseEventLogger.kt | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-) 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 1d72f6f3f70..6b686e7f6f2 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 @@ -171,25 +171,25 @@ class EventBundleCreator @Inject constructor( private fun OppiaMetricLog.LoggableMetric.convertToLoggableMetricType(): PerformanceMetricsLoggableMetricType<*>? { - return when (loggableMetricTypeCase) { - APK_SIZE_METRIC -> ApkSizeLoggableMetric("apk_size_metric", apkSizeMetric) - STORAGE_USAGE_METRIC -> StorageUsageLoggableMetric( - "storage_usage_metric", - storageUsageMetric - ) - STARTUP_LATENCY_METRIC -> StartupLatencyLoggableMetric( - "startup_latency_metric", - startupLatencyMetric - ) - MEMORY_USAGE_METRIC -> MemoryUsageLoggableMetric("memory_usage_metric", memoryUsageMetric) - NETWORK_USAGE_METRIC -> NetworkUsageLoggableMetric( - "network_usage_metric", - networkUsageMetric - ) - CPU_USAGE_METRIC -> CpuUsageLoggableMetric("cpu_usage_metric", cpuUsageMetric) - LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + return when (loggableMetricTypeCase) { + APK_SIZE_METRIC -> ApkSizeLoggableMetric("apk_size_metric", apkSizeMetric) + STORAGE_USAGE_METRIC -> StorageUsageLoggableMetric( + "storage_usage_metric", + storageUsageMetric + ) + STARTUP_LATENCY_METRIC -> StartupLatencyLoggableMetric( + "startup_latency_metric", + startupLatencyMetric + ) + MEMORY_USAGE_METRIC -> MemoryUsageLoggableMetric("memory_usage_metric", memoryUsageMetric) + NETWORK_USAGE_METRIC -> NetworkUsageLoggableMetric( + "network_usage_metric", + networkUsageMetric + ) + CPU_USAGE_METRIC -> CpuUsageLoggableMetric("cpu_usage_metric", cpuUsageMetric) + LOGGABLEMETRICTYPE_NOT_SET, null -> null // No context to create here. + } } - } /** * Utility for storing properties within a [Bundle] (indicated by [bundle]), omitting those which @@ -431,7 +431,6 @@ class EventBundleCreator @Inject constructor( } } - /*** Represents an [OppiaMetricLog] loggable metric (denoted by [LoggableMetricTypeCase]).*/ private sealed class PerformanceMetricsLoggableMetricType( val metricName: String, diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index e1025eb03ec..eb285ed8864 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -81,7 +81,7 @@ class FirebaseEventLogger private constructor( * This [FirebaseEventLogger] implements the [EventLogger] for facilitating analytics log * reporting. */ - fun create(): EventLogger= + fun create(): EventLogger = FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) /** From b92f8e0bcc4ab7bf6c0d11ae48dad9e74509e286 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 16:53:51 +0530 Subject: [PATCH 046/149] worker functions to schedule logging, renaming --- ...Worker.kt => MetricLogSchedulingWorker.kt} | 58 ++++++++++++++----- ...kt => MetricLogSchedulingWorkerFactory.kt} | 8 +-- .../LogUploadWorkManagerInitializer.kt | 20 +++---- .../WorkManagerConfigurationModule.kt | 6 +- 4 files changed, 60 insertions(+), 32 deletions(-) rename domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/{LogGenerationWorker.kt => MetricLogSchedulingWorker.kt} (53%) rename domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/{LogGenerationWorkerFactory.kt => MetricLogSchedulingWorkerFactory.kt} (62%) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt similarity index 53% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt index 6d070253304..90f3f2a3f70 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt @@ -11,14 +11,18 @@ import kotlinx.coroutines.async import org.oppia.android.domain.util.getStringFromData import org.oppia.android.util.threading.BackgroundDispatcher import javax.inject.Inject +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLogger +import org.oppia.android.util.logging.ConsoleLogger /** * Worker class that generates metric log reports regarding the performance of the application * and then stores it in in device cache. */ -class LogGenerationWorker private constructor( +class MetricLogSchedulingWorker private constructor( context: Context, params: WorkerParameters, + private val consoleLogger: ConsoleLogger, + private val performanceMetricsLogger: PerformanceMetricsLogger, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) : ListenableWorker(context, params) { @@ -34,9 +38,9 @@ class LogGenerationWorker private constructor( val backgroundScope = CoroutineScope(backgroundDispatcher) val result = backgroundScope.async { when (inputData.getStringFromData(WORKER_CASE_KEY)) { - PERIODIC_METRIC_WORKER -> generatePeriodicMetricLog() - STORAGE_USAGE_WORKER -> generateStorageUsageMetricLog() - MEMORY_USAGE_WORKER -> generateMemoryUsageMetricLog() + PERIODIC_METRIC_WORKER -> schedulePeriodicMetricLogging() + STORAGE_USAGE_WORKER -> scheduleStorageUsageMetricLogging() + MEMORY_USAGE_WORKER -> scheduleMemoryUsageMetricLogging() else -> Result.failure() } } @@ -53,27 +57,51 @@ class LogGenerationWorker private constructor( return future } - private fun generatePeriodicMetricLog(): Result { - // TODO(#4334): Add functionality to generate metric log reports for periodic events. - return Result.failure() + private fun schedulePeriodicMetricLogging(): Result { + return try { + performanceMetricsLogger.logNetworkUsage() + // TODO(#4334): Add functionality to log cpu usage performance metric. + Result.success() + } catch (e: Exception) { + consoleLogger.e(TAG, e.toString(), e) + return Result.failure() + } } - private fun generateStorageUsageMetricLog(): Result { - // TODO(#4334): Add functionality to generate metric log reports for storage usage. - return Result.failure() + private fun scheduleStorageUsageMetricLogging(): Result { + return try { + performanceMetricsLogger.logStorageUsage() + Result.success() + } catch (e: Exception) { + consoleLogger.e(TAG, e.toString(), e) + return Result.failure() + } } - private fun generateMemoryUsageMetricLog(): Result { - // TODO(#4334): Add functionality to generate metric log reports for memory usage. - return Result.failure() + private fun scheduleMemoryUsageMetricLogging(): Result { + return try { + performanceMetricsLogger.logMemoryUsage() + Result.success() + } catch (e: Exception) { + consoleLogger.e(TAG, e.toString(), e) + return Result.failure() + } } - /** Creates an instance of [LogGenerationWorker] by properly injecting dependencies. */ + /** Creates an instance of [MetricLogSchedulingWorker] by properly injecting dependencies. */ class Factory @Inject constructor( + private val consoleLogger: ConsoleLogger, + private val performanceMetricsLogger: PerformanceMetricsLogger, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) { fun create(context: Context, params: WorkerParameters): ListenableWorker { - return LogGenerationWorker(context, params, backgroundDispatcher) + return MetricLogSchedulingWorker( + context, + params, + consoleLogger, + performanceMetricsLogger, + backgroundDispatcher + ) } } } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt similarity index 62% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt index 50a8c89e35a..82d658c243e 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/LogGenerationWorkerFactory.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt @@ -6,12 +6,12 @@ import androidx.work.WorkerFactory import androidx.work.WorkerParameters import javax.inject.Inject -/** Custom [WorkerFactory] for the [LogGenerationWorker]. */ -class LogGenerationWorkerFactory @Inject constructor( - private val workerFactory: LogGenerationWorker.Factory +/** Custom [WorkerFactory] for the [MetricLogSchedulingWorker]. */ +class MetricLogSchedulingWorkerFactory @Inject constructor( + private val workerFactory: MetricLogSchedulingWorker.Factory ) : WorkerFactory() { - /** Returns a new [LogGenerationWorker] for the given context and parameters. */ + /** Returns a new [MetricLogSchedulingWorker] for the given context and parameters. */ override fun createWorker( appContext: Context, workerClassName: String, diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 4f620001efd..8061d3f533d 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -7,7 +7,7 @@ import androidx.work.NetworkType import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorker +import org.oppia.android.domain.oppialogger.loggenerator.MetricLogSchedulingWorker import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes @@ -51,22 +51,22 @@ class LogUploadWorkManagerInitializer @Inject constructor( private val workerCaseForCreatingPeriodicMetricLogs: Data = Data.Builder() .putString( - LogGenerationWorker.WORKER_CASE_KEY, - LogGenerationWorker.PERIODIC_METRIC_WORKER + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER ) .build() private val workerCaseForCreatingStorageUsageMetricLogs: Data = Data.Builder() .putString( - LogGenerationWorker.WORKER_CASE_KEY, - LogGenerationWorker.STORAGE_USAGE_WORKER + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER ) .build() private val workerCaseForCreatingMemoryUsageMetricLogs: Data = Data.Builder() .putString( - LogGenerationWorker.WORKER_CASE_KEY, - LogGenerationWorker.MEMORY_USAGE_WORKER + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.MEMORY_USAGE_WORKER ) .build() @@ -84,7 +84,7 @@ class LogUploadWorkManagerInitializer @Inject constructor( private val workRequestForGeneratingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( - LogGenerationWorker::class.java, + MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) @@ -95,7 +95,7 @@ class LogUploadWorkManagerInitializer @Inject constructor( private val workRequestForGeneratingStorageUsageMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( - LogGenerationWorker::class.java, + MetricLogSchedulingWorker::class.java, performanceMetricCollectionLowFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) @@ -106,7 +106,7 @@ class LogUploadWorkManagerInitializer @Inject constructor( private val workRequestForGeneratingMemoryUsageMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( - LogGenerationWorker::class.java, + MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) diff --git a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt index 37212df6b95..7234a873a2c 100644 --- a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt @@ -4,7 +4,7 @@ import androidx.work.Configuration import androidx.work.DelegatingWorkerFactory import dagger.Module import dagger.Provides -import org.oppia.android.domain.oppialogger.loggenerator.LogGenerationWorkerFactory +import org.oppia.android.domain.oppialogger.loggenerator.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerFactory import javax.inject.Singleton @@ -18,12 +18,12 @@ class WorkManagerConfigurationModule { fun provideWorkManagerConfiguration( logUploadWorkerFactory: LogUploadWorkerFactory, platformParameterSyncUpWorkerFactory: PlatformParameterSyncUpWorkerFactory, - logGenerationWorkerFactory: LogGenerationWorkerFactory + metricLogSchedulingWorkerFactory: MetricLogSchedulingWorkerFactory ): Configuration { val delegatingWorkerFactory = DelegatingWorkerFactory() delegatingWorkerFactory.addFactory(logUploadWorkerFactory) delegatingWorkerFactory.addFactory(platformParameterSyncUpWorkerFactory) - delegatingWorkerFactory.addFactory(logGenerationWorkerFactory) + delegatingWorkerFactory.addFactory(metricLogSchedulingWorkerFactory) return Configuration.Builder().setWorkerFactory(delegatingWorkerFactory).build() } } From 7d399734fcdbbb6920c4a52ba084e96687962a90 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 22 Jun 2022 19:35:02 +0530 Subject: [PATCH 047/149] nits. --- .../oppialogger/loggenerator/MetricLogSchedulingWorker.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt index 90f3f2a3f70..dae7afa8e55 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt @@ -8,11 +8,11 @@ import com.google.common.util.concurrent.SettableFuture import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.async +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLogger import org.oppia.android.domain.util.getStringFromData +import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.threading.BackgroundDispatcher import javax.inject.Inject -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLogger -import org.oppia.android.util.logging.ConsoleLogger /** * Worker class that generates metric log reports regarding the performance of the application From 8f26c7d640a4a1a4fbe0e8b18cb7894b88c69d1d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 23 Jun 2022 23:33:01 +0530 Subject: [PATCH 048/149] clearing up build errors. --- .../analytics/ApplicationLifecycleObserver.kt | 9 ------- .../analytics/PerformanceMetricsController.kt | 3 +-- .../firebase/DebugLogReportingModule.kt | 8 +++++++ .../logging/firebase/FirebaseEventLogger.kt | 23 +++++++++++++++++- .../logging/firebase/LogReportingModule.kt | 8 +++++++ .../PerformanceMetricsLogScheduler.kt | 3 ++- .../PerformanceMetricsUtils.kt | 24 ++++++++++++++++++- 7 files changed, 64 insertions(+), 14 deletions(-) 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 ac01b593896..e49bf08b3c4 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 @@ -32,10 +32,6 @@ class ApplicationLifecycleObserver @Inject constructor( ProcessLifecycleOwner.get().lifecycle.addObserver(this) } - // Keep the default value as false as the app is considered to be in the background until it comes - // to foreground. - private var isAppInForeground: Boolean = false - // Use a large Long value such that the time difference based on any timestamp will be negative // and thus ignored until the app goes into the background at least once. private var firstTimestamp: Long = Long.MAX_VALUE @@ -43,7 +39,6 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application comes to foreground. */ @OnLifecycleEvent(Lifecycle.Event.ON_START) fun onAppInForeground() { - isAppInForeground = true val timeDifferenceMs = oppiaClock.getCurrentTimeMs() - firstTimestamp if (timeDifferenceMs > inactivityLimitMillis) { loggingIdentifierController.updateSessionId() @@ -54,7 +49,6 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application goes to background. */ @OnLifecycleEvent(Lifecycle.Event.ON_STOP) fun onAppInBackground() { - isAppInForeground = false firstTimestamp = oppiaClock.getCurrentTimeMs() logAppLifecycleEventInBackground(learnerAnalyticsLogger::logAppInBackground) } @@ -74,7 +68,4 @@ class ApplicationLifecycleObserver @Inject constructor( } } } - - /** Returns a boolean value indicating whether the application is in foreground or not. */ - fun isAppInForeground(): Boolean = isAppInForeground } 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 c7bc3870121..a8f92092a34 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 @@ -27,7 +27,6 @@ class PerformanceMetricsController @Inject constructor( private val exceptionLogger: ExceptionLogger, private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, cacheStoreFactory: PersistentCacheStore.Factory, - private val applicationLifecycleObserver: ApplicationLifecycleObserver, @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int ) { @@ -107,7 +106,7 @@ class PerformanceMetricsController @Inject constructor( this.priority = priority this.currentScreen = currentScreen this.loggableMetric = loggableMetric - this.isAppInForeground = applicationLifecycleObserver.isAppInForeground() + this.isAppInForeground = performanceMetricsUtils.isAppInForeground() this.storageTier = performanceMetricsUtils.getDeviceStorageTier() this.memoryTier = performanceMetricsUtils.getDeviceMemoryTier() }.build() diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt index 0b628a3190e..d03e7dd26b4 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt @@ -6,6 +6,7 @@ import dagger.Provides import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** Provides debug log reporting dependencies. */ @Module @@ -18,4 +19,11 @@ class DebugLogReportingModule { @Provides @Singleton fun provideDebugEventLogger(debugEventLogger: DebugEventLogger): EventLogger = debugEventLogger + + @Provides + @Singleton + fun providePerformanceMetricsEventLogger( + factory: FirebaseEventLogger.Factory + ): PerformanceMetricsEventLogger = + factory.createPerformanceMetricEventLogger() } diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index a4f61516e54..841bead734c 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -10,6 +10,8 @@ import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.networking.NetworkConnectionUtil import java.util.Locale import javax.inject.Inject +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger private const val NETWORK_USER_PROPERTY = "NETWORK" private const val COUNTRY_USER_PROPERTY = "COUNTRY" @@ -19,7 +21,7 @@ class FirebaseEventLogger private constructor( private val firebaseAnalytics: FirebaseAnalytics, private val networkConnectionUtil: NetworkConnectionUtil, private val eventBundleCreator: EventBundleCreator -) : EventLogger { +) : EventLogger, PerformanceMetricsEventLogger { /** * Logs an event to Firebase Analytics with [NETWORK_USER_PROPERTY] and [COUNTRY_USER_PROPERTY]. */ @@ -32,6 +34,13 @@ class FirebaseEventLogger private constructor( firebaseAnalytics.setUserProperty(NETWORK_USER_PROPERTY, getNetworkStatus()) } + /** + * Logs a performance metric to Firebase Analytics with [NETWORK_USER_PROPERTY] and [COUNTRY_USER_PROPERTY]. + */ + override fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) { + // TODO(#4325): Add implementation to upload performance metrics logs to firebase. + } + private fun getNetworkStatus(): String { return when (networkConnectionUtil.getCurrentConnectionStatus()) { NetworkConnectionUtil.ProdConnectionStatus.LOCAL -> @@ -57,8 +66,20 @@ class FirebaseEventLogger private constructor( * Returns a new [FirebaseEventLogger] for the current application context. * * Generally, only one of these needs to be created per application. + * + * This [FirebaseEventLogger] implements the [EventLogger] for facilitating analytics log + * reporting. */ fun create(): EventLogger = FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) + + /** + * Returns a new [FirebaseEventLogger] for the current application context. + * + * This [FirebaseEventLogger] implements the [PerformanceMetricsEventLogger] for facilitating + * performance metrics log reporting. + */ + fun createPerformanceMetricEventLogger(): PerformanceMetricsEventLogger = + FirebaseEventLogger(firebaseAnalytics, networkConnectionUtil, eventBundleCreator) } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt index 21d8fd20345..1d856aa69d8 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt @@ -6,6 +6,7 @@ import dagger.Provides import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** Provides Firebase-specific logging implementations. */ @Module @@ -18,4 +19,11 @@ class LogReportingModule { @Provides @Singleton fun provideEventLogger(factory: FirebaseEventLogger.Factory): EventLogger = factory.create() + + @Provides + @Singleton + fun providePerformanceMetricsEventLogger( + factory: FirebaseEventLogger.Factory + ): PerformanceMetricsEventLogger = + factory.createPerformanceMetricEventLogger() } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt index d3b6ef7d93b..20da3f68afc 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt @@ -3,6 +3,7 @@ package org.oppia.android.util.logging.performancemetrics import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager +import javax.inject.Inject import org.oppia.android.util.logging.MetricLogScheduler private const val OPPIA_PERIODIC_METRIC_WORK = "OPPIA_PERIODIC_METRIC_WORK" @@ -13,7 +14,7 @@ private const val OPPIA_MEMORY_USAGE_WORK = "OPPIA_MEMORY_USAGE_WORK" * Enqueues work requests for generating metric log reports for gaining an insight regarding into * the performance of the application. */ -class PerformanceMetricsLogScheduler() : MetricLogScheduler { +class PerformanceMetricsLogScheduler @Inject constructor() : MetricLogScheduler { override fun enqueueWorkRequestForPeriodicMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 1f14a38683b..d98e207c560 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -5,6 +5,9 @@ import android.app.Application import android.content.Context import android.net.TrafficStats import android.os.Environment +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleObserver +import androidx.lifecycle.OnLifecycleEvent import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.ConsoleLogger import java.io.File @@ -13,7 +16,11 @@ import javax.inject.Inject class PerformanceMetricsUtils @Inject constructor( private val context: Application, private val consoleLogger: ConsoleLogger -) { +): LifecycleObserver { + + // Keep the default value as false as the app is considered to be in the background until it comes + // to foreground. + private var isAppInForeground: Boolean = false /** Returns the size of the app's installed APK file, in bytes. */ fun getApkSize(): Long { @@ -97,4 +104,19 @@ class PerformanceMetricsUtils @Inject constructor( else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER } } + + /** Occurs when application comes to foreground. */ + @OnLifecycleEvent(Lifecycle.Event.ON_START) + fun onAppInForeground() { + isAppInForeground = true + } + + /** Occurs when application goes to background. */ + @OnLifecycleEvent(Lifecycle.Event.ON_STOP) + fun onAppInBackground() { + isAppInForeground = false + } + + /** Returns a boolean value indicating whether the application is in foreground or not. */ + fun isAppInForeground(): Boolean = isAppInForeground } From 5de3f2df75dcf482876c60e95b55d2008268a876 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 23 Jun 2022 23:34:32 +0530 Subject: [PATCH 049/149] nits. --- .../android/util/logging/firebase/DebugLogReportingModule.kt | 2 +- .../android/util/logging/firebase/FirebaseEventLogger.kt | 4 ++-- .../oppia/android/util/logging/firebase/LogReportingModule.kt | 2 +- .../performancemetrics/PerformanceMetricsLogScheduler.kt | 2 +- .../logging/performancemetrics/PerformanceMetricsUtils.kt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt index d03e7dd26b4..d31b656aba3 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/DebugLogReportingModule.kt @@ -5,8 +5,8 @@ import dagger.Module import dagger.Provides import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger -import javax.inject.Singleton import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import javax.inject.Singleton /** Provides debug log reporting dependencies. */ @Module diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index 841bead734c..50bf90c3da8 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -5,13 +5,13 @@ import android.content.Context import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics import org.oppia.android.app.model.EventLog +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.EventBundleCreator import org.oppia.android.util.logging.EventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.networking.NetworkConnectionUtil import java.util.Locale import javax.inject.Inject -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger private const val NETWORK_USER_PROPERTY = "NETWORK" private const val COUNTRY_USER_PROPERTY = "COUNTRY" diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt index 1d856aa69d8..aaa8bd329c4 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/LogReportingModule.kt @@ -5,8 +5,8 @@ import dagger.Module import dagger.Provides import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger -import javax.inject.Singleton import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import javax.inject.Singleton /** Provides Firebase-specific logging implementations. */ @Module diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt index 20da3f68afc..065a1e706e6 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt @@ -3,8 +3,8 @@ package org.oppia.android.util.logging.performancemetrics import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager -import javax.inject.Inject import org.oppia.android.util.logging.MetricLogScheduler +import javax.inject.Inject private const val OPPIA_PERIODIC_METRIC_WORK = "OPPIA_PERIODIC_METRIC_WORK" private const val OPPIA_STORAGE_USAGE_WORK = "OPPIA_STORAGE_USAGE_WORK" diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index d98e207c560..386d160347e 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -16,7 +16,7 @@ import javax.inject.Inject class PerformanceMetricsUtils @Inject constructor( private val context: Application, private val consoleLogger: ConsoleLogger -): LifecycleObserver { +) : LifecycleObserver { // Keep the default value as false as the app is considered to be in the background until it comes // to foreground. From 52dd3115daea4462dc847660425223801bed8561 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 24 Jun 2022 17:22:26 +0530 Subject: [PATCH 050/149] fixing build errors. --- .../oppialogger/loguploader/FakeLogUploader.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt index b2a02324827..48783b794d5 100644 --- a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt @@ -12,6 +12,7 @@ import javax.inject.Singleton class FakeLogUploader @Inject constructor() : LogUploader { private val eventRequestIdList = mutableListOf() private val exceptionRequestIdList = mutableListOf() + private val performanceMetricsRequestIdList = mutableListOf() override fun enqueueWorkRequestForEvents( workManager: WorkManager, @@ -27,9 +28,19 @@ class FakeLogUploader @Inject constructor() : LogUploader { exceptionRequestIdList.add(workRequest.id) } + override fun enqueueWorkRequestForPerformanceMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + performanceMetricsRequestIdList.add(workRequest.id) + } + /** Returns the most recent work request id that's stored in the [eventRequestIdList]. */ fun getMostRecentEventRequestId() = eventRequestIdList.last() /** Returns the most recent work request id that's stored in the [exceptionRequestIdList]. */ fun getMostRecentExceptionRequestId() = exceptionRequestIdList.last() + + /** Returns the most recent work request id that's stored in the [performanceMetricsRequestIdList]. */ + fun getMostRecentPerformanceMetricsRequestId() = performanceMetricsRequestIdList.last() } From 8835c5bf957c1909b339a982183d554b8d6bef32 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 24 Jun 2022 18:52:02 +0530 Subject: [PATCH 051/149] removal of dependency from oppiaLogger and basing the entire implementation on Logger-Controller --- .../android/domain/oppialogger/OppiaLogger.kt | 17 +------- .../analytics/PerformanceMetricsController.kt | 2 +- .../analytics/PerformanceMetricsLogger.kt | 39 ++++++++++++------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 6d88b81c2fe..8e43668c23c 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -12,28 +12,13 @@ import javax.inject.Inject class OppiaLogger @Inject constructor( private val analyticsController: AnalyticsController, private val consoleLogger: ConsoleLogger, - private val oppiaClock: OppiaClock, - private val performanceMetricsController: PerformanceMetricsController + private val oppiaClock: OppiaClock ) { /** Logs high-priority events. See [AnalyticsController.logImportantEvent] for more context. */ fun logImportantEvent(eventContext: EventLog.Context) { analyticsController.logImportantEvent(oppiaClock.getCurrentTimeMs(), eventContext) } - /** Logs performance metrics logs. See [PerformanceMetricsController.logMetricEvent] for more context. */ - fun logPerformanceMetrics( - currentScreen: OppiaMetricLog.CurrentScreen, - loggableMetric: OppiaMetricLog.LoggableMetric, - priority: OppiaMetricLog.Priority - ) { - performanceMetricsController.logMetricEvent( - oppiaClock.getCurrentTimeMs(), - currentScreen, - loggableMetric, - priority - ) - } - /** Logs a verbose message with the specified tag. See [ConsoleLogger.v] for more context */ fun v(tag: String, msg: String) { consoleLogger.v(tag, msg) 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 a8f92092a34..2b252c8c5d6 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 @@ -40,7 +40,7 @@ class PerformanceMetricsController @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. */ - fun logMetricEvent( + fun logPerformanceMetricsEvent( timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric, 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 f2bb4226888..4683ed468ae 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 @@ -2,7 +2,6 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.system.OppiaClock import javax.inject.Inject @@ -10,7 +9,7 @@ import javax.inject.Singleton @Singleton class PerformanceMetricsLogger @Inject constructor( - private val oppiaLogger: OppiaLogger, + private val performanceMetricsController: PerformanceMetricsController, private val performanceMetricsUtils: PerformanceMetricsUtils, private val oppiaClock: OppiaClock ) : ApplicationStartupListener { @@ -26,14 +25,16 @@ class PerformanceMetricsLogger @Inject constructor( } fun logApkSize() { - oppiaLogger.logLowPriorityMetricEvent( + performanceMetricsController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.HOME_SCREEN, createApkSizeLoggableMetric(performanceMetricsUtils.getApkSize()) ) } fun logStorageUsage() { - oppiaLogger.logLowPriorityMetricEvent( + performanceMetricsController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.HOME_SCREEN, createStorageUsageLoggableMetric(performanceMetricsUtils.getUsedStorage()) ) @@ -42,7 +43,8 @@ class PerformanceMetricsLogger @Inject constructor( fun logStartupLatency() { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp if (startupLatency >= 0) { - oppiaLogger.logLowPriorityMetricEvent( + performanceMetricsController.logLowPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.HOME_SCREEN, createStartupLatencyLoggableMetric(startupLatency) ) @@ -50,14 +52,16 @@ class PerformanceMetricsLogger @Inject constructor( } fun logMemoryUsage() { - oppiaLogger.logMediumPriorityMetricEvent( + performanceMetricsController.logMediumPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, createMemoryUsageLoggableMetric(performanceMetricsUtils.getTotalPssUsed()) ) } fun logNetworkUsage() { - oppiaLogger.logHighPriorityMetricEvent( + performanceMetricsController.logHighPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, createNetworkUsageLoggableMetric( performanceMetricsUtils.getTotalReceivedBytes(), @@ -67,7 +71,8 @@ class PerformanceMetricsLogger @Inject constructor( } fun logCpuUsage(cpuUsage: Long) { - oppiaLogger.logHighPriorityMetricEvent( + performanceMetricsController.logHighPriorityMetricEvent( + oppiaClock.getCurrentTimeMs(), OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, createCpuUsageLoggableMetric(cpuUsage) ) @@ -84,11 +89,13 @@ class PerformanceMetricsLogger @Inject constructor( * application. These metrics are important to log and should be prioritized over metrics logged * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. */ - internal fun OppiaLogger.logHighPriorityMetricEvent( + internal fun PerformanceMetricsController.logHighPriorityMetricEvent( + timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric ) { - logPerformanceMetrics( + logPerformanceMetricsEvent( + timestamp, currentScreen, loggableMetric, OppiaMetricLog.Priority.HIGH_PRIORITY @@ -109,11 +116,13 @@ class PerformanceMetricsLogger @Inject constructor( * application. These metrics are important to log (but not as important as high priority metrics) * and should be prioritized over metrics logged via [logLowPriorityMetricEvent]. */ - internal fun OppiaLogger.logMediumPriorityMetricEvent( + internal fun PerformanceMetricsController.logMediumPriorityMetricEvent( + timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric ) { - logPerformanceMetrics( + logPerformanceMetricsEvent( + timestamp, currentScreen, loggableMetric, OppiaMetricLog.Priority.MEDIUM_PRIORITY @@ -137,11 +146,13 @@ class PerformanceMetricsLogger @Inject constructor( * it's unexpected for events to actually be dropped since the app is configured to support a * large number of cached events at one time). */ - internal fun OppiaLogger.logLowPriorityMetricEvent( + internal fun PerformanceMetricsController.logLowPriorityMetricEvent( + timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric ) { - logPerformanceMetrics( + logPerformanceMetricsEvent( + timestamp, currentScreen, loggableMetric, OppiaMetricLog.Priority.LOW_PRIORITY From 4835fac6763d7792e5169d4a73e6f333578dca4c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 25 Jun 2022 19:30:01 +0530 Subject: [PATCH 052/149] performanceMetricController tests + fakeLogger --- .../domain/oppialogger/LogStorageModule.kt | 4 +- .../android/domain/oppialogger/OppiaLogger.kt | 2 - .../analytics/PerformanceMetricsController.kt | 10 +- .../PerformanceMetricsControllerTest.kt | 495 ++++++++++++++++++ .../LogUploadWorkManagerInitializerTest.kt | 3 +- .../FakePerformanceMetricsEventLogger.kt | 41 ++ .../android/testing/TestLogReportingModule.kt | 6 + .../PerformanceMetricsUtils.kt | 6 +- 8 files changed, 555 insertions(+), 12 deletions(-) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt create mode 100644 testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt index 2c19a46b57c..73fe03a7a3d 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/LogStorageModule.kt @@ -11,7 +11,7 @@ annotation class EventLogStorageCacheSize annotation class ExceptionLogStorageCacheSize @Qualifier -annotation class MetricLogStorageCacheSize +annotation class PerformanceMetricsLogStorageCacheSize /** Provider to return any constants required during the storage of log reports. */ @Module @@ -44,6 +44,6 @@ class LogStorageModule { * no more than 3.02MB will be required for cache disk space. */ @Provides - @MetricLogStorageCacheSize + @PerformanceMetricsLogStorageCacheSize fun provideMetricLogStorageCacheSize(): Int = 25_000 } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt index 8e43668c23c..12ff9e6a5c2 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt @@ -1,9 +1,7 @@ package org.oppia.android.domain.oppialogger import org.oppia.android.app.model.EventLog -import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.analytics.AnalyticsController -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.system.OppiaClock import javax.inject.Inject 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 2b252c8c5d6..969f35263f5 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 @@ -4,7 +4,7 @@ import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.OppiaMetricLog.Priority import org.oppia.android.app.model.OppiaMetricLogs import org.oppia.android.data.persistence.PersistentCacheStore -import org.oppia.android.domain.oppialogger.MetricLogStorageCacheSize +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger @@ -27,7 +27,7 @@ class PerformanceMetricsController @Inject constructor( private val exceptionLogger: ExceptionLogger, private val performanceMetricsEventLogger: PerformanceMetricsEventLogger, cacheStoreFactory: PersistentCacheStore.Factory, - @MetricLogStorageCacheSize private val metricLogStorageCacheSize: Int + @PerformanceMetricsLogStorageCacheSize private val metricLogStorageCacheSize: Int ) { private val metricLogStore = @@ -81,7 +81,7 @@ class PerformanceMetricsController @Inject constructor( "Least Recent Event index absent -- MetricLogStorageCacheSize is 0" ) consoleLogger.e( - "AppHealthMetricController", + "PerformanceMetricsController", "Failure while caching metric log.", exception ) @@ -90,7 +90,7 @@ class PerformanceMetricsController @Inject constructor( } return@storeDataAsync oppiaMetricLogs.toBuilder().addOppiaMetricLog(oppiaMetricLog).build() }.invokeOnCompletion { - it?.let { consoleLogger.e("AppHealthMetricController", "Failed to store metric log.", it) } + it?.let { consoleLogger.e("PerformanceMetricsController", "Failed to store metric log.", it) } } } @@ -166,7 +166,7 @@ class PerformanceMetricsController @Inject constructor( metricLogStore.storeDataAsync(updateInMemoryCache = true) { oppiaEventLogs -> return@storeDataAsync oppiaEventLogs.toBuilder().removeOppiaMetricLog(0).build() }.invokeOnCompletion { - it?.let { consoleLogger.e("AppHealthMetricController", "Failed to remove metric log.", it) } + it?.let { consoleLogger.e("PerformanceMetricsController", "Failed to remove metric log.", it) } } } } 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 new file mode 100644 index 00000000000..dea495305a2 --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsControllerTest.kt @@ -0,0 +1,495 @@ +package org.oppia.android.domain.oppialogger.analytics + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.runner.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_USAGE_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.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.domain.oppialogger.EventLogStorageCacheSize +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.platformparameter.PlatformParameterModule +import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule +import org.oppia.android.testing.FakePerformanceMetricsEventLogger +import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.data.DataProviderTestMonitor +import org.oppia.android.testing.logging.SyncStatusTestModule +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.DataProviders +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.MetricLogSchedulerModule +import org.oppia.android.util.networking.NetworkConnectionDebugUtil +import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +private const val TEST_TIMESTAMP = Long.MAX_VALUE +private const val TEST_CPU_USAGE = Long.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 +private const val TEST_NETWORK_USAGE = Long.MAX_VALUE +private const val TEST_MEMORY_USAGE = Long.MAX_VALUE + +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsControllerTest.TestApplication::class) +class PerformanceMetricsControllerTest { + + @Inject + lateinit var performanceMetricsController: PerformanceMetricsController + + @Inject + lateinit var oppiaLogger: OppiaLogger + + @Inject + lateinit var performanceMetricsLogger: PerformanceMetricsLogger + + @Inject + lateinit var networkConnectionUtil: NetworkConnectionDebugUtil + + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + + @Inject + lateinit var dataProviders: DataProviders + + @Inject + lateinit var monitorFactory: DataProviderTestMonitor.Factory + + @Inject + lateinit var fakeOppiaClock: FakeOppiaClock + + private val apkSizeTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setApkSizeMetric( + OppiaMetricLog.ApkSizeMetric.newBuilder() + .setApkSizeBytes(TEST_APK_SIZE) + .build() + ).build() + + private val storageUsageTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setStorageUsageMetric( + OppiaMetricLog.StorageUsageMetric.newBuilder() + .setStorageUsageBytes(TEST_STORAGE_USAGE) + .build() + ).build() + + private val startupLatencyTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setStartupLatencyMetric( + OppiaMetricLog.StartupLatencyMetric.newBuilder() + .setStartupLatencyMillis(TEST_STARTUP_LATENCY) + .build() + ).build() + + private val cpuUsageTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setCpuUsageMetric( + OppiaMetricLog.CpuUsageMetric.newBuilder() + .setCpuUsageMetric(TEST_CPU_USAGE) + .build() + ).build() + + private val networkUsageTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setNetworkUsageMetric( + OppiaMetricLog.NetworkUsageMetric.newBuilder() + .setBytesReceived(TEST_NETWORK_USAGE) + .setBytesSent(TEST_NETWORK_USAGE) + .build() + ).build() + + private val memoryUsageTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setMemoryUsageMetric( + OppiaMetricLog.MemoryUsageMetric.newBuilder() + .setTotalPssBytes(TEST_MEMORY_USAGE) + .build() + ).build() + + @Before + fun setUp() { + setUpTestApplicationComponent() + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) + } + + @Test + fun testController_logPerformanceMetric_withApkSizeLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + APK_SIZE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withStorageUsageLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + storageUsageTestLoggableMetric, + LOW_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + STORAGE_USAGE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withStartupLatencyLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + startupLatencyTestLoggableMetric, + LOW_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + STARTUP_LATENCY_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withMemoryUsageLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + memoryUsageTestLoggableMetric, + MEDIUM_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(MEDIUM_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + MEMORY_USAGE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withNetworkUsageLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + networkUsageTestLoggableMetric, + HIGH_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(HIGH_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + NETWORK_USAGE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withCpuUsageLoggableMetric_checkLogsMetric() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + cpuUsageTestLoggableMetric, + HIGH_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(HIGH_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + CPU_USAGE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withNoNetwork_checkLogsEventToStore() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val eventLogsProvider = performanceMetricsController.getMetricLogStore() + + val performanceMetricsLog = + monitorFactory.waitForNextSuccessfulResult(eventLogsProvider).getOppiaMetricLog(0) + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + APK_SIZE_METRIC + ) + } + + @Test + fun testController_logPerformanceMetric_withNoNetwork_exceedLimit_checkEventLogStoreSize() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + logMultiplePerformanceMetrics() + + val eventLogsProvider = performanceMetricsController.getMetricLogStore() + + val performanceMetricLogs = monitorFactory.waitForNextSuccessfulResult(eventLogsProvider) + assertThat(performanceMetricLogs.oppiaMetricLogList).hasSize(2) + } + + @Test + fun testController_logMultiplePerformanceMetrics_withNoNetwork_checkOrderInCache() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + cpuUsageTestLoggableMetric, + HIGH_PRIORITY + ) + + val metricLogsProvider = performanceMetricsController.getMetricLogStore() + + val metricLogs = monitorFactory.waitForNextSuccessfulResult(metricLogsProvider) + val firstEventLog = metricLogs.getOppiaMetricLog(0) + val secondEventLog = metricLogs.getOppiaMetricLog(1) + + assertThat(firstEventLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(secondEventLog.priority).isEqualTo(HIGH_PRIORITY) + } + + @Test + fun testController_logPerformanceMetric_switchToNoNetwork_logPerformanceMetric_checkManagement() { + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + cpuUsageTestLoggableMetric, + HIGH_PRIORITY + ) + networkConnectionUtil.setCurrentConnectionStatus(NONE) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val metricLogsProvider = performanceMetricsController.getMetricLogStore() + + val uploadedMetricLog = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + val cachedMetricLog = + monitorFactory.waitForNextSuccessfulResult(metricLogsProvider).getOppiaMetricLog(0) + + assertThat(uploadedMetricLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(uploadedMetricLog.priority).isEqualTo(HIGH_PRIORITY) + assertThat(uploadedMetricLog.loggableMetric.loggableMetricTypeCase).isEqualTo(CPU_USAGE_METRIC) + + assertThat(cachedMetricLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(cachedMetricLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(cachedMetricLog.loggableMetric.loggableMetricTypeCase).isEqualTo(APK_SIZE_METRIC) + } + + @Test + fun testController_logPerformanceMetrics_exceedLimit_withNoNetwork_checkCorrectEventIsEvicted() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + logMultiplePerformanceMetrics() + + val metricLogsProvider = performanceMetricsController.getMetricLogStore() + + val metricLogs = monitorFactory.waitForNextSuccessfulResult(metricLogsProvider) + val firstMetricLog = metricLogs.getOppiaMetricLog(0) + val secondMetricLog = metricLogs.getOppiaMetricLog(1) + assertThat(metricLogs.oppiaMetricLogList).hasSize(2) + // In this case, 1 LOW, 1 HIGH and 2 MEDIUM priority metric logs were logged. So while pruning, + // only records with HIGH and MEDIUM priority should be retained. + assertThat(firstMetricLog.priority).isEqualTo(HIGH_PRIORITY) + assertThat(secondMetricLog.priority).isEqualTo(HIGH_PRIORITY) + // If we analyse the implementation of logMultiplePerformanceMetrics(), we can see that record + // pruning will begin from the logging of the third record. At first, the first event log will + // be removed as it has LOW priority and the event logged at the third place will become the + // event record at the second place in the store. When the forth event gets logged then the + // pruning will again happen on the basis of priority as MEDIUM priority event will be evicted. + // Now, when the fifth event gets logged then pruning happen based on purely based on timestamp + // of the event as both event logs have HIGH priority. As the second event's timestamp was + // lesser than that of the fourth event, it will be pruned from the store and the fifth event + // will become the second event in the store. + assertThat(firstMetricLog.timestampMillis).isEqualTo(1556093110000) + assertThat(secondMetricLog.timestampMillis).isEqualTo(1556094110000) + } + + private fun logMultiplePerformanceMetrics() { + performanceMetricsController.logPerformanceMetricsEvent( + 1556094120000, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + performanceMetricsController.logPerformanceMetricsEvent( + 1556090110000, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + HIGH_PRIORITY + ) + + performanceMetricsController.logPerformanceMetricsEvent( + 1556092100000, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + MEDIUM_PRIORITY + ) + + performanceMetricsController.logPerformanceMetricsEvent( + 1556093110000, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + HIGH_PRIORITY + ) + + performanceMetricsController.logPerformanceMetricsEvent( + 1556094110000, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + HIGH_PRIORITY + ) + } + + 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 + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 2 + + @Provides + @EventLogStorageCacheSize + fun provideEventLogStorageCacheSize(): 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, + PlatformParameterModule::class, PlatformParameterSingletonModule::class, + LoggingIdentifierModule::class, SyncStatusTestModule::class, MetricLogSchedulerModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(performanceMetricsControllerTest: PerformanceMetricsControllerTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsControllerTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(performanceMetricsControllerTest: PerformanceMetricsControllerTest) { + component.inject(performanceMetricsControllerTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt index 141d90098b9..5262ee23570 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt @@ -42,6 +42,7 @@ import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config @@ -199,7 +200,7 @@ class LogUploadWorkManagerInitializerTest { 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, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent { diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt new file mode 100644 index 00000000000..de83cc49b4f --- /dev/null +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt @@ -0,0 +1,41 @@ +package org.oppia.android.testing + +import java.util.concurrent.CopyOnWriteArrayList +import javax.inject.Inject +import javax.inject.Singleton +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger + +/** A test specific fake for the event logger. */ +@Singleton +class FakePerformanceMetricsEventLogger @Inject constructor() : PerformanceMetricsEventLogger { + private val performanceMetricsEventList = CopyOnWriteArrayList() + + override fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) { + performanceMetricsEventList.add(oppiaMetricLog) + } + + /** Returns the oldest event that's been logged. */ + fun getOldestPerformanceMetricsEvent(): OppiaMetricLog = performanceMetricsEventList.first() + + /** Returns the most recently logged event. */ + fun getMostRecentPerformanceMetricsEvent(): OppiaMetricLog = + getMostRecentPerformanceMetricsEvents(count = 1).first() + + /** Returns the most recent [count] logged events. */ + fun getMostRecentPerformanceMetricsEvents(count: Int): List = + performanceMetricsEventList.takeLast(count) + + /** Clears all the events that are currently logged. */ + fun clearAllPerformanceMetricsEvents() = performanceMetricsEventList.clear() + + /** Checks if a certain event has been logged or not. */ + fun hasPerformanceMetricsEventLogged(oppiaMetricLog: OppiaMetricLog): Boolean = + performanceMetricsEventList.contains(oppiaMetricLog) + + /** Returns true if there are no events logged. */ + fun noPerformanceMetricsEventsPresent(): Boolean = performanceMetricsEventList.isEmpty() + + /** Returns the number of events logged to date (and not cleared by [clearAllPerformanceMetricsEvents]). */ + fun getPerformanceMetricsEventListCount(): Int = performanceMetricsEventList.size +} diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index 627577511ac..de94a09c4c1 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -4,6 +4,7 @@ import dagger.Binds import dagger.Module import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** Provides fake log reporting dependencies. */ @Module @@ -14,4 +15,9 @@ interface TestLogReportingModule { @Binds fun bindFakeEventLogger(fakeEventLogger: FakeEventLogger): EventLogger + + @Binds + fun bindFakePerformanceMetricsEventLogger( + fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 386d160347e..874ca709f4a 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -72,8 +72,10 @@ class PerformanceMetricsUtils @Inject constructor( if (activityManager.runningAppProcesses != null) { val pid = ActivityManager.RunningAppProcessInfo().pid val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) - for (element in processMemoryInfo) { - totalPssUsed += element.totalPss + if (processMemoryInfo != null) { + for (element in processMemoryInfo) { + totalPssUsed += element.totalPss + } } } return totalPssUsed From 6b4b44f3af7a3c747cdb800ce00046cca532e423 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 25 Jun 2022 22:23:00 +0530 Subject: [PATCH 053/149] fakeLogger tests --- .../PerformanceMetricsControllerTest.kt | 1 + .../FakePerformanceMetricsEventLoggerTest.kt | 324 ++++++++++++++++++ 2 files changed, 325 insertions(+) create mode 100644 testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt 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 dea495305a2..ba62b32b977 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 @@ -62,6 +62,7 @@ private const val TEST_STARTUP_LATENCY = Long.MAX_VALUE private const val TEST_NETWORK_USAGE = Long.MAX_VALUE private const val TEST_MEMORY_USAGE = Long.MAX_VALUE +/** Tests for [PerformanceMetricsControllerTest]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt new file mode 100644 index 00000000000..b74c1e3acae --- /dev/null +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt @@ -0,0 +1,324 @@ +package org.oppia.android.testing + +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.domain.oppialogger.LogStorageModule +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestDispatcherModule +import org.oppia.android.testing.time.FakeOppiaClockModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.Priority.MEDIUM_PRIORITY +import org.oppia.android.app.model.OppiaMetricLog.Priority.HIGH_PRIORITY +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger + +/** Tests for [FakePerformanceMetricsEventLoggerTest]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(manifest = Config.NONE) +class FakePerformanceMetricsEventLoggerTest { + + @Inject lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + @Inject lateinit var performanceMetricsEventLogger: PerformanceMetricsEventLogger + + private val metricLog1 = OppiaMetricLog.newBuilder().setPriority(HIGH_PRIORITY).build() + private val metricLog2 = OppiaMetricLog.newBuilder().setPriority(MEDIUM_PRIORITY).build() + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testFakeMetricsEventLogger_logPerformanceMetric_returnsMetricEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event).isEqualTo(metricLog1) + assertThat(event.priority).isEqualTo(HIGH_PRIORITY) + } + + @Test + fun testFakeMetricsEventLogger_logMetricEventTwice_returnsLatestEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event).isEqualTo(metricLog2) + assertThat(event.priority).isEqualTo(MEDIUM_PRIORITY) + } + + @Test + fun testFakeMetricsEventLogger_logEvent_clearAllEvents_logEventAgain_returnsLatestEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + val event = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(event).isEqualTo(metricLog2) + assertThat(event.priority).isEqualTo(MEDIUM_PRIORITY) + } + + @Test + fun testFakeMetricsEventLogger_logNothing_getMostRecent_returnsFailure() { + assertThrows(NoSuchElementException::class) { + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + } + } + + @Test + fun testFakeMetricsEventLogger_logEvent_clearAllEvents_getMostRecent_returnsFailure() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + val eventException = assertThrows(NoSuchElementException::class) { + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + } + + assertThat(eventException).isInstanceOf(NoSuchElementException::class.java) + } + + @Test + fun testFakeMetricsEventLogger_clearAllEvents_returnsEmptyList() { + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + val isListEmpty = fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent() + + assertThat(isListEmpty).isTrue() + } + + @Test + fun testFakeMetricsEventLogger_logEvent_clearAllEvents_returnsEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + val isListEmpty = fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent() + + assertThat(isListEmpty).isTrue() + } + + @Test + fun testFakeMetricsEventLogger_logMultipleEvents_clearAllEvents_returnsEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + val isListEmpty = fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent() + + assertThat(isListEmpty).isTrue() + } + + @Test + fun testFakeMetricsEventLogger_logEvent_returnsNonEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + val isListEmpty = fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent() + + assertThat(isListEmpty).isFalse() + } + + @Test + fun testFakeMetricsEventLogger_logMultipleEvents_returnsNonEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + + val eventLogStatus1 = fakePerformanceMetricsEventLogger.hasPerformanceMetricsEventLogged( + metricLog1 + ) + val eventLogStatus2 = fakePerformanceMetricsEventLogger.hasPerformanceMetricsEventLogged( + metricLog2 + ) + val eventListStatus = fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent() + + assertThat(eventListStatus).isFalse() + assertThat(eventLogStatus1).isTrue() + assertThat(eventLogStatus2).isTrue() + } + + @Test + fun testGetOldestEvent_noEventsLogged_throwsException() { + assertThrows(NoSuchElementException::class) { + fakePerformanceMetricsEventLogger.getOldestPerformanceMetricsEvent() + } + } + + @Test + fun testGetOldestEvent_oneEventLogged_returnsLoggedEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val oldestEvent = fakePerformanceMetricsEventLogger.getOldestPerformanceMetricsEvent() + + assertThat(oldestEvent).isEqualTo(metricLog1) + } + + @Test + fun testGetOldestEvent_twoEventsLogged_returnsFirstEventLogged() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val oldestEvent = fakePerformanceMetricsEventLogger.getOldestPerformanceMetricsEvent() + + assertThat(oldestEvent).isEqualTo(metricLog2) + } + + @Test + fun testGetOldestEvent_twoEventsLogged_clearEvents_throwsException() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + assertThrows(NoSuchElementException::class) { + fakePerformanceMetricsEventLogger.getOldestPerformanceMetricsEvent() + } + } + + @Test + fun testGetOldestEvent_eventLogged_cleared_newEventLogged_returnsLatestEventLog() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val oldestEvent = fakePerformanceMetricsEventLogger.getOldestPerformanceMetricsEvent() + + assertThat(oldestEvent).isEqualTo(metricLog1) + } + + @Test + fun testGetMostRecentEvents_twoEvents_noEventsLogged_returnsEmptyList() { + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 2 + ) + + assertThat(mostRecentEvents).isEmpty() + } + + @Test + fun testGetMostRecentEvents_twoEvents_oneEventLogged_returnsOneItemList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 2 + ) + + assertThat(mostRecentEvents).containsExactly(metricLog1) + } + + @Test + fun testGetMostRecentEvents_twoEvents_twoEventsLogged_returnsEventsInOrder() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 2 + ) + + assertThat(mostRecentEvents).containsExactly(metricLog2, metricLog1).inOrder() + } + + @Test + fun testGetMostRecentEvents_oneEvent_twoEventsLogged_returnsSingleLatestEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 1 + ) + + assertThat(mostRecentEvents).containsExactly(metricLog1) + } + + @Test + fun testGetMostRecentEvents_zeroEvents_twoEventsLogged_returnsEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 0 + ) + + assertThat(mostRecentEvents).isEmpty() + } + + @Test + fun testGetMostRecentEvents_negativeEvents_twoEventsLogged_throwsException() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + + assertThrows(IllegalArgumentException::class) { + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents(count = -1) + } + } + + @Test + fun testGetMostRecentEvents_twoEventsLogged_eventsCleared_returnsEmptyList() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 2 + ) + + assertThat(mostRecentEvents).isEmpty() + } + + @Test + fun testGetMostRecentEvents_eventLogged_cleared_newEventLogged_returnsNewestEvent() { + performanceMetricsEventLogger.logPerformanceMetric(metricLog1) + fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() + performanceMetricsEventLogger.logPerformanceMetric(metricLog2) + + val mostRecentEvents = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvents( + count = 2 + ) + + assertThat(mostRecentEvents).containsExactly(metricLog2) + } + + private fun setUpTestApplicationComponent() { + DaggerFakePerformanceMetricsEventLoggerTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .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(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class, TestLogReportingModule::class, RobolectricModule::class, + TestDispatcherModule::class, LogStorageModule::class, FakeOppiaClockModule::class + ] + ) + interface TestApplicationComponent { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(fakePerformanceMetricsEventLoggerTest: FakePerformanceMetricsEventLoggerTest) + } +} From d70297d03625314c7f8d32af25296c259b78b4e7 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 25 Jun 2022 22:25:03 +0530 Subject: [PATCH 054/149] nits --- .../oppialogger/analytics/PerformanceMetricsController.kt | 8 +++++++- .../analytics/PerformanceMetricsControllerTest.kt | 6 +++--- .../android/testing/FakePerformanceMetricsEventLogger.kt | 4 ++-- .../testing/FakePerformanceMetricsEventLoggerTest.kt | 8 ++++---- 4 files changed, 16 insertions(+), 10 deletions(-) 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 969f35263f5..5ff35a789be 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 @@ -166,7 +166,13 @@ class PerformanceMetricsController @Inject constructor( metricLogStore.storeDataAsync(updateInMemoryCache = true) { oppiaEventLogs -> return@storeDataAsync oppiaEventLogs.toBuilder().removeOppiaMetricLog(0).build() }.invokeOnCompletion { - it?.let { consoleLogger.e("PerformanceMetricsController", "Failed to remove metric log.", it) } + it?.let { + consoleLogger.e( + "PerformanceMetricsController", + "Failed to remove metric log.", + it + ) + } } } } 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 ba62b32b977..f2ccbaa92c4 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 @@ -9,8 +9,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -18,8 +16,8 @@ import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC -import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_USAGE_METRIC import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_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.OppiaMetricLog.Priority.HIGH_PRIORITY @@ -53,6 +51,8 @@ import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionSta import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +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 diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt index de83cc49b4f..310c9c7a4df 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt @@ -1,10 +1,10 @@ package org.oppia.android.testing +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import java.util.concurrent.CopyOnWriteArrayList import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** A test specific fake for the event logger. */ @Singleton diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt index b74c1e3acae..c0f2294ffa4 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt @@ -12,18 +12,18 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.Priority.HIGH_PRIORITY +import org.oppia.android.app.model.OppiaMetricLog.Priority.MEDIUM_PRIORITY import org.oppia.android.domain.oppialogger.LogStorageModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.testing.time.FakeOppiaClockModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.app.model.OppiaMetricLog.Priority.MEDIUM_PRIORITY -import org.oppia.android.app.model.OppiaMetricLog.Priority.HIGH_PRIORITY -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** Tests for [FakePerformanceMetricsEventLoggerTest]. */ // FunctionName: test names are conventionally named with underscores. From fad8f6b4f5bb0080b6f00607e8989e4d4b86a5e8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 02:50:05 +0530 Subject: [PATCH 055/149] tests for the new logger. --- .../analytics/PerformanceMetricsLoggerTest.kt | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt 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 new file mode 100644 index 00000000000..6b03b509f7d --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerTest.kt @@ -0,0 +1,278 @@ +package org.oppia.android.domain.oppialogger.analytics + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.runner.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.HOME_SCREEN +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.CPU_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_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.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.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.FakePerformanceMetricsEventLogger +import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.logging.SyncStatusTestModule +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 +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.MetricLogSchedulerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +private const val TEST_TIMESTAMP = Long.MAX_VALUE +private const val TEST_CPU_USAGE = Long.MAX_VALUE + +/** Tests for [PerformanceMetricsLoggerTest]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsLoggerTest.TestApplication::class) +class PerformanceMetricsLoggerTest { + + @Inject + lateinit var performanceMetricsLogger: PerformanceMetricsLogger + + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + + @Inject + lateinit var fakeOppiaClock: FakeOppiaClock + + @Inject + lateinit var performanceMetricsUtils: PerformanceMetricsUtils + + @Before + fun setUp() { + setUpTestApplicationComponent() + fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) + fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) + } + + @Test + fun testLogger_logApkSizePerformanceMetric_verifyLogsMetricCorrectly() { + val apkSize = performanceMetricsUtils.getApkSize() + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logApkSize() + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(LOW_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(HOME_SCREEN) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(APK_SIZE_METRIC) + assertThat(loggedEvent.loggableMetric.apkSizeMetric.apkSizeBytes).isEqualTo(apkSize) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + } + + @Test + fun testLogger_logStorageUsagePerformanceMetric_verifyLogsMetricCorrectly() { + val storageUsage = performanceMetricsUtils.getUsedStorage() + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logStorageUsage() + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(LOW_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(HOME_SCREEN) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(STORAGE_USAGE_METRIC) + assertThat(loggedEvent.loggableMetric.storageUsageMetric.storageUsageBytes).isEqualTo( + storageUsage + ) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + } + + @Test + fun testLogger_logMemoryUsagePerformanceMetric_verifyLogsMetricCorrectly() { + val memoryUsage = performanceMetricsUtils.getTotalPssUsed() + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logMemoryUsage() + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(MEDIUM_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(MEMORY_USAGE_METRIC) + assertThat(loggedEvent.loggableMetric.memoryUsageMetric.totalPssBytes).isEqualTo(memoryUsage) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + } + + @Test + fun testLogger_logStartupLatencyPerformanceMetric_verifyLogsMetricCorrectly() { + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logStartupLatency() + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(LOW_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(HOME_SCREEN) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(STARTUP_LATENCY_METRIC) + // Startup latency millis will be equal to 0 since the initial timestamp is equal to + // Long.MAX_VALUE and using FakeOppiaClock we've set the recording timestamp to also be + // Long.MAX_VALUE. The difference between the two equals 0 and hence the startup latency millis. + assertThat(loggedEvent.loggableMetric.startupLatencyMetric.startupLatencyMillis).isEqualTo(0) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + } + + @Test + fun testLogger_logCpuUsagePerformanceMetric_verifyLogsMetricCorrectly() { + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE) + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(HIGH_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(CPU_USAGE_METRIC) + assertThat(loggedEvent.loggableMetric.cpuUsageMetric.cpuUsageMetric).isEqualTo(TEST_CPU_USAGE) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + } + + @Test + fun testLogger_logNetworkUsagePerformanceMetric_verifyLogsMetricCorrectly() { + val bytesSent = performanceMetricsUtils.getTotalSentBytes() + val bytesReceived = performanceMetricsUtils.getTotalReceivedBytes() + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val isAppInForeground = performanceMetricsUtils.isAppInForeground() + performanceMetricsLogger.logNetworkUsage() + + val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedEvent.priority).isEqualTo(HIGH_PRIORITY) + assertThat(loggedEvent.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(loggedEvent.loggableMetric.loggableMetricTypeCase).isEqualTo(NETWORK_USAGE_METRIC) + assertThat(loggedEvent.loggableMetric.networkUsageMetric.bytesSent).isEqualTo(bytesSent) + assertThat(loggedEvent.loggableMetric.networkUsageMetric.bytesReceived).isEqualTo(bytesReceived) + assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) + assertThat(loggedEvent.storageTier).isEqualTo(storageTier) + assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) + + } + + 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 + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 2 + + @Provides + @EventLogStorageCacheSize + fun provideEventLogStorageCacheSize(): 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, + PlatformParameterModule::class, PlatformParameterSingletonModule::class, + LoggingIdentifierModule::class, SyncStatusTestModule::class, MetricLogSchedulerModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(performanceMetricsLoggerTest: PerformanceMetricsLoggerTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsLoggerTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(performanceMetricsLoggerTest: PerformanceMetricsLoggerTest) { + component.inject(performanceMetricsLoggerTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} \ No newline at end of file From 6c34ffdb5069aaf3e6b217e7c26893df76baae6e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 03:54:38 +0530 Subject: [PATCH 056/149] tests for the worker + renaming of package to logScheduler --- .../MetricLogSchedulingWorker.kt | 2 +- .../MetricLogSchedulingWorkerFactory.kt | 2 +- .../LogUploadWorkManagerInitializer.kt | 2 +- .../WorkManagerConfigurationModule.kt | 2 +- .../MetricLogSchedulingWorkerTest.kt | 323 ++++++++++++++++++ 5 files changed, 327 insertions(+), 4 deletions(-) rename domain/src/main/java/org/oppia/android/domain/oppialogger/{loggenerator => logscheduler}/MetricLogSchedulingWorker.kt (98%) rename domain/src/main/java/org/oppia/android/domain/oppialogger/{loggenerator => logscheduler}/MetricLogSchedulingWorkerFactory.kt (92%) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt similarity index 98% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt index dae7afa8e55..cca134716cc 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt @@ -1,4 +1,4 @@ -package org.oppia.android.domain.oppialogger.loggenerator +package org.oppia.android.domain.oppialogger.logscheduler import android.content.Context import androidx.work.ListenableWorker diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt similarity index 92% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt index 82d658c243e..c8dae69942e 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loggenerator/MetricLogSchedulingWorkerFactory.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt @@ -1,4 +1,4 @@ -package org.oppia.android.domain.oppialogger.loggenerator +package org.oppia.android.domain.oppialogger.logscheduler import android.content.Context import androidx.work.ListenableWorker diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 8061d3f533d..498f79ba302 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -7,7 +7,7 @@ import androidx.work.NetworkType import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.domain.oppialogger.loggenerator.MetricLogSchedulingWorker +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes diff --git a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt index 7234a873a2c..11fa8e5f82f 100644 --- a/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/workmanager/WorkManagerConfigurationModule.kt @@ -4,7 +4,7 @@ import androidx.work.Configuration import androidx.work.DelegatingWorkerFactory import dagger.Module import dagger.Provides -import org.oppia.android.domain.oppialogger.loggenerator.MetricLogSchedulingWorkerFactory +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerFactory import javax.inject.Singleton 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 new file mode 100644 index 00000000000..6188adf75ee --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt @@ -0,0 +1,323 @@ +package org.oppia.android.domain.oppialogger.logscheduler + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import androidx.work.Configuration +import androidx.work.Data +import androidx.work.OneTimeWorkRequest +import androidx.work.OneTimeWorkRequestBuilder +import androidx.work.WorkInfo +import androidx.work.WorkManager +import androidx.work.testing.SynchronousExecutor +import androidx.work.testing.WorkManagerTestInitHelper +import com.google.common.truth.Truth +import dagger.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import javax.inject.Inject +import javax.inject.Qualifier +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mockito +import org.oppia.android.app.model.OppiaMetricLog +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.OppiaLogger +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController +import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker +import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +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.mockito.anyOrNull +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.FakeOppiaClockModule +import org.oppia.android.util.caching.AssetModule +import org.oppia.android.util.data.DataProviders +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.LogUploader +import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.networking.NetworkConnectionDebugUtil +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +/** Tests for [MetricLogSchedulingWorker]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = MetricLogSchedulingWorkerTest.TestApplication::class) +class MetricLogSchedulingWorkerTest { + @Inject + lateinit var networkConnectionUtil: NetworkConnectionDebugUtil + + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + + @Inject + lateinit var oppiaLogger: OppiaLogger + + @Inject + lateinit var performanceMetricsController: PerformanceMetricsController + + @Inject + lateinit var metricLogSchedulingWorkerFactory: MetricLogSchedulingWorkerFactory + + @Inject + lateinit var dataProviders: DataProviders + + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + + @field:[Inject MockPerformanceMetricsEventLogger] + lateinit var mockPerformanceMetricsEventLogger: PerformanceMetricsEventLogger + + private lateinit var context: Context + + @Before + fun setUp() { + setUpTestApplicationComponent() + context = InstrumentationRegistry.getInstrumentation().targetContext + val config = Configuration.Builder() + .setExecutor(SynchronousExecutor()) + .setWorkerFactory(metricLogSchedulingWorkerFactory) + .build() + WorkManagerTestInitHelper.initializeTestWorkManager(context, config) + } + + @Test + fun testWorker_enqueueRequest_verifyStorageUsagePerformanceMetricLogging() { + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + Truth.assertThat( + fakePerformanceMetricsEventLogger + .getMostRecentPerformanceMetricsEvent() + .loggableMetric + .loggableMetricTypeCase + ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STORAGE_USAGE_METRIC) + } + + @Test + fun testWorker_enqueueRequest_verifyPeriodicPerformanceMetricsLogging() { + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + Truth.assertThat( + fakePerformanceMetricsEventLogger + .getMostRecentPerformanceMetricsEvent() + .loggableMetric + .loggableMetricTypeCase + ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_USAGE_METRIC) + } + + @Test + fun testWorker_enqueueRequest_verifyMemoryUsagePerformanceMetricsLogging() { + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.MEMORY_USAGE_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + Truth.assertThat( + fakePerformanceMetricsEventLogger + .getMostRecentPerformanceMetricsEvent() + .loggableMetric + .loggableMetricTypeCase + ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC) + } + + @Test + fun testWorker_enqueueRequest_writeFails_verifyFailure() { + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + setUpPerformanceMetricsEventLoggerToFail() + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) + Truth.assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + } + + private fun setUpTestApplicationComponent() { + DaggerMetricLogSchedulingWorkerTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .inject(this) + } + + private fun setUpPerformanceMetricsEventLoggerToFail() { + // Simulate the log attempt itself failing during the job. Note that the reset is necessary here + // to remove the default stubbing for the mock so that it can properly trigger a failure. + Mockito.reset(mockPerformanceMetricsEventLogger) + Mockito.`when`(mockPerformanceMetricsEventLogger.logPerformanceMetric(anyOrNull())) + .thenThrow(IllegalStateException("Failure.")) + } + + @Qualifier + annotation class MockPerformanceMetricsEventLogger + + // TODO(#89): Move this to a common test application component. + @Module + class TestModule { + @Provides + fun provideContext(application: Application): Context = application + + @Provides + @Singleton + @MockPerformanceMetricsEventLogger + fun bindMockPerformanceMetricsEventLogger( + fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger { + return Mockito.mock(PerformanceMetricsEventLogger::class.java).also { + Mockito.`when`(it.logPerformanceMetric(anyOrNull())).then { answer -> + fakePerformanceMetricsEventLogger.logPerformanceMetric( + answer.getArgument(/* index= */ 0, /* clazz= */ + OppiaMetricLog::class.java + ) + ) + return@then null + } + } + } + + @Provides + fun bindFakeEventLogger(fakeEventLogger: FakeEventLogger): EventLogger = fakeEventLogger + + @Provides + fun bindFakeExceptionLogger(fakeLogger: FakeExceptionLogger): ExceptionLogger = fakeLogger + + @Provides + fun bindFakePerformanceMetricsEventLogger( + @MockPerformanceMetricsEventLogger delegate: PerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger = delegate + } + + @Module + class TestLogStorageModule { + + @Provides + @EventLogStorageCacheSize + fun provideEventLogStorageCacheSize(): Int = 2 + + @Provides + @ExceptionLogStorageCacheSize + fun provideExceptionLogStorageSize(): Int = 2 + + @Provides + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 2 + } + + @Module + interface TestFirebaseLogUploaderModule { + + @Binds + fun bindsFakeLogUploader(fakeLogUploader: FakeLogUploader): LogUploader + } + + // TODO(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class, RobolectricModule::class, TestLogStorageModule::class, + TestDispatcherModule::class, LogUploadWorkerModule::class, + TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, + NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, + AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, + LoggingIdentifierModule::class, SyncStatusTestModule::class, ApplicationLifecycleModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(metricLogSchedulingWorkerTest: MetricLogSchedulingWorkerTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerMetricLogSchedulingWorkerTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(metricLogSchedulingWorkerTest: MetricLogSchedulingWorkerTest) { + component.inject(metricLogSchedulingWorkerTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From a70da9695c1ea647390aca522e16216a46df554a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 04:57:55 +0530 Subject: [PATCH 057/149] tests for work manager initializer --- .../LogUploadWorkManagerInitializer.kt | 66 +++++++++++--- .../logscheduler/FakeLogScheduler.kt | 58 ++++++++++++ .../LogUploadWorkManagerInitializerTest.kt | 91 ++++++++++++++++++- 3 files changed, 201 insertions(+), 14 deletions(-) create mode 100644 domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 498f79ba302..ec9041df00a 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -49,21 +49,21 @@ class LogUploadWorkManagerInitializer @Inject constructor( ) .build() - private val workerCaseForCreatingPeriodicMetricLogs: Data = Data.Builder() + private val workerCaseForSchedulingPeriodicMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER ) .build() - private val workerCaseForCreatingStorageUsageMetricLogs: Data = Data.Builder() + private val workerCaseForSchedulingStorageUsageMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, MetricLogSchedulingWorker.STORAGE_USAGE_WORKER ) .build() - private val workerCaseForCreatingMemoryUsageMetricLogs: Data = Data.Builder() + private val workerCaseForSchedulingMemoryUsageMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, MetricLogSchedulingWorker.MEMORY_USAGE_WORKER @@ -82,35 +82,35 @@ class LogUploadWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForGeneratingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest + private val workRequestForSchedulingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForCreatingPeriodicMetricLogs) + .setInputData(workerCaseForSchedulingPeriodicMetricLogs) .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForGeneratingStorageUsageMetricLogs: PeriodicWorkRequest = + private val workRequestForSchedulingStorageUsageMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, performanceMetricCollectionLowFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForCreatingStorageUsageMetricLogs) + .setInputData(workerCaseForSchedulingStorageUsageMetricLogs) .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForGeneratingMemoryUsageMetricLogs: PeriodicWorkRequest = + private val workRequestForSchedulingMemoryUsageMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForCreatingMemoryUsageMetricLogs) + .setInputData(workerCaseForSchedulingMemoryUsageMetricLogs) .setConstraints(logReportWorkerConstraints) .build() @@ -120,15 +120,15 @@ class LogUploadWorkManagerInitializer @Inject constructor( logUploader.enqueueWorkRequestForExceptions(workManager, workRequestForUploadingExceptions) metricLogScheduler.enqueueWorkRequestForPeriodicMetrics( workManager, - workRequestForGeneratingPeriodicMetricLogs + workRequestForSchedulingPeriodicMetricLogs ) metricLogScheduler.enqueueWorkRequestForStorageUsage( workManager, - workRequestForGeneratingStorageUsageMetricLogs + workRequestForSchedulingStorageUsageMetricLogs ) metricLogScheduler.enqueueWorkRequestForMemoryUsage( workManager, - workRequestForGeneratingMemoryUsageMetricLogs + workRequestForSchedulingMemoryUsageMetricLogs ) } @@ -141,9 +141,51 @@ class LogUploadWorkManagerInitializer @Inject constructor( /** Returns the [UUID] of the work request that is enqueued for uploading exception logs. */ fun getWorkRequestForExceptionsId(): UUID = workRequestForUploadingExceptions.id + /** + * Returns the [UUID] of the work request that is enqueued for scheduling memory usage + * performance metrics collection. + */ + fun getWorkRequestForSchedulingMemoryUsageMetricLogsId(): UUID = + workRequestForSchedulingMemoryUsageMetricLogs.id + + /** + * Returns the [UUID] of the work request that is enqueued for scheduling storage usage + * performance metrics collection. + */ + fun getWorkRequestForSchedulingStorageUsageMetricLogsId(): UUID = + workRequestForSchedulingStorageUsageMetricLogs.id + + /** + * Returns the [UUID] of the work request that is enqueued for scheduling periodic performance + * metrics collection. + */ + fun getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId(): UUID = + workRequestForSchedulingPeriodicMetricLogs.id + /** Returns the [Data] that goes into the work request that is enqueued for uploading event logs. */ fun getWorkRequestDataForEvents(): Data = workerCaseForUploadingEvents /** Returns the [Data] that goes into the work request that is enqueued for uploading exception logs. */ fun getWorkRequestDataForExceptions(): Data = workerCaseForUploadingExceptions + + /** + * Returns the [Data] that goes into the work request that is enqueued for scheduling storage + * usage performance metrics collection. + */ + fun getWorkRequestDataForSchedulingStorageUsageMetricLogs(): Data = + workerCaseForSchedulingStorageUsageMetricLogs + + /** + * Returns the [Data] that goes into the work request that is enqueued for scheduling memory + * usage performance metrics collection. + */ + fun getWorkRequestDataForSchedulingMemoryUsageMetricLogs(): Data = + workerCaseForSchedulingMemoryUsageMetricLogs + + /** + * Returns the [Data] that goes into the work request that is enqueued for scheduling periodic + * performance metrics collection. + */ + fun getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs(): Data = + workerCaseForSchedulingPeriodicMetricLogs } diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt new file mode 100644 index 00000000000..f12a5378c38 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt @@ -0,0 +1,58 @@ +package org.oppia.android.domain.testing.oppialogger.logscheduler + +import androidx.work.PeriodicWorkRequest +import androidx.work.WorkManager +import java.util.UUID +import javax.inject.Inject +import javax.inject.Singleton +import org.oppia.android.util.logging.MetricLogScheduler + +/** A test specific fake for the log uploader. */ +@Singleton +class FakeLogScheduler @Inject constructor() : MetricLogScheduler { + private val schedulingStorageUsageMetricLoggingRequestIdList = mutableListOf() + private val schedulingMemoryUsageMetricLoggingRequestIdList = mutableListOf() + private val schedulingPeriodicPerformanceMetricLoggingRequestIdList = mutableListOf() + + override fun enqueueWorkRequestForPeriodicMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + schedulingPeriodicPerformanceMetricLoggingRequestIdList.add(workRequest.id) + } + + override fun enqueueWorkRequestForStorageUsage( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + schedulingStorageUsageMetricLoggingRequestIdList.add(workRequest.id) + } + + override fun enqueueWorkRequestForMemoryUsage( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) { + schedulingMemoryUsageMetricLoggingRequestIdList.add(workRequest.id) + } + + /** + * Returns the most recent work request id that's stored in the + * [schedulingStorageUsageMetricLoggingRequestIdList]. + */ + fun getMostRecentStorageUsageMetricLoggingRequestId() = + schedulingStorageUsageMetricLoggingRequestIdList.last() + + /** + * Returns the most recent work request id that's stored in the + * [schedulingMemoryUsageMetricLoggingRequestIdList]. + */ + fun getMostRecentMemoryUsageMetricLoggingRequestId() = + schedulingMemoryUsageMetricLoggingRequestIdList.last() + + /** + * Returns the most recent work request id that's stored in the + * [schedulingPeriodicPerformanceMetricLoggingRequestIdList]. + */ + fun getMostRecentPeriodicPerformanceMetricLoggingRequestId() = + schedulingPeriodicPerformanceMetricLoggingRequestIdList.last() +} diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt index 5262ee23570..71bf41e91ec 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt @@ -8,6 +8,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.work.Configuration import androidx.work.Constraints import androidx.work.Data +import androidx.work.DelegatingWorkerFactory import androidx.work.NetworkType import androidx.work.testing.SynchronousExecutor import androidx.work.testing.WorkManagerTestInitHelper @@ -49,6 +50,11 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory +import org.oppia.android.domain.testing.oppialogger.logscheduler.FakeLogScheduler +import org.oppia.android.util.logging.MetricLogScheduler @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -58,6 +64,9 @@ class LogUploadWorkManagerInitializerTest { @Inject lateinit var logUploadWorkerFactory: LogUploadWorkerFactory + @Inject + lateinit var metricLogSchedulingWorkerFactory: MetricLogSchedulingWorkerFactory + @Inject lateinit var logUploadWorkManagerInitializer: LogUploadWorkManagerInitializer @@ -82,6 +91,9 @@ class LogUploadWorkManagerInitializerTest { @Inject lateinit var fakeLogUploader: FakeLogUploader + @Inject + lateinit var fakeLogScheduler: FakeLogScheduler + @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers @@ -91,9 +103,14 @@ class LogUploadWorkManagerInitializerTest { fun setUp() { setUpTestApplicationComponent() context = InstrumentationRegistry.getInstrumentation().targetContext + + val delegatingWorkerFactory = DelegatingWorkerFactory() + delegatingWorkerFactory.addFactory(logUploadWorkerFactory) + delegatingWorkerFactory.addFactory(metricLogSchedulingWorkerFactory) + val config = Configuration.Builder() .setExecutor(SynchronousExecutor()) - .setWorkerFactory(logUploadWorkerFactory) + .setWorkerFactory(delegatingWorkerFactory) .build() WorkManagerTestInitHelper.initializeTestWorkManager(context, config) } @@ -106,11 +123,26 @@ class LogUploadWorkManagerInitializerTest { val enqueuedEventWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForEventsId() val enqueuedExceptionWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForExceptionsId() + val enqueuedSchedulingStorageUsageMetricWorkRequestId = + logUploadWorkManagerInitializer.getWorkRequestForSchedulingStorageUsageMetricLogsId() + val enqueuedSchedulingMemoryUsageMetricWorkRequestId = + logUploadWorkManagerInitializer.getWorkRequestForSchedulingMemoryUsageMetricLogsId() + val enqueuedSchedulingPeriodicPerformanceMetricWorkRequestId = + logUploadWorkManagerInitializer.getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId() assertThat(fakeLogUploader.getMostRecentEventRequestId()).isEqualTo(enqueuedEventWorkRequestId) assertThat(fakeLogUploader.getMostRecentExceptionRequestId()).isEqualTo( enqueuedExceptionWorkRequestId ) + assertThat(fakeLogScheduler.getMostRecentStorageUsageMetricLoggingRequestId()).isEqualTo( + enqueuedSchedulingStorageUsageMetricWorkRequestId + ) + assertThat(fakeLogScheduler.getMostRecentMemoryUsageMetricLoggingRequestId()).isEqualTo( + enqueuedSchedulingMemoryUsageMetricWorkRequestId + ) + assertThat(fakeLogScheduler.getMostRecentPeriodicPerformanceMetricLoggingRequestId()).isEqualTo( + enqueuedSchedulingPeriodicPerformanceMetricWorkRequestId + ) } @Test @@ -154,6 +186,54 @@ class LogUploadWorkManagerInitializerTest { ) } + @Test + fun testWorkRequest_verifyWorkRequestData_forSchedulingStorageUsageMetricLogs() { + val workerCaseForSchedulingStorageUsageMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER + ) + .build() + + assertThat( + logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingStorageUsageMetricLogs() + ).isEqualTo( + workerCaseForSchedulingStorageUsageMetricLogs + ) + } + + @Test + fun testWorkRequest_verifyWorkRequestData_forSchedulingPeriodicPerformanceMetricLogs() { + val workerCaseForSchedulingPeriodicPerformanceMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER + ) + .build() + + assertThat( + logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs() + ).isEqualTo( + workerCaseForSchedulingPeriodicPerformanceMetricLogs + ) + } + + @Test + fun testWorkRequest_verifyWorkRequestData_forSchedulingMemoryUsageMetricLogs() { + val workerCaseForSchedulingMemoryUsageMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.MEMORY_USAGE_WORKER + ) + .build() + + assertThat( + logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingMemoryUsageMetricLogs() + ).isEqualTo( + workerCaseForSchedulingMemoryUsageMetricLogs + ) + } + private fun setUpTestApplicationComponent() { DaggerLogUploadWorkManagerInitializerTest_TestApplicationComponent.builder() .setApplication(ApplicationProvider.getApplicationContext()) @@ -181,6 +261,10 @@ class LogUploadWorkManagerInitializerTest { @Provides @ExceptionLogStorageCacheSize fun provideExceptionLogStorageSize(): Int = 2 + + @Provides + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 2 } @Module @@ -188,6 +272,9 @@ class LogUploadWorkManagerInitializerTest { @Binds fun bindsFakeLogUploader(fakeLogUploader: FakeLogUploader): LogUploader + + @Binds + fun bindsFakeLogScheduler(fakeLogScheduler: FakeLogScheduler): MetricLogScheduler } // TODO(#89): Move this to a common test application component. @@ -200,7 +287,7 @@ class LogUploadWorkManagerInitializerTest { FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, LoggerModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, - SyncStatusModule::class, ApplicationLifecycleModule::class, MetricLogSchedulerModule::class + SyncStatusModule::class, ApplicationLifecycleModule::class ] ) interface TestApplicationComponent { From c3a6b96c23d371a7a2639fd698564ec6d13d264a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 16:03:54 +0530 Subject: [PATCH 058/149] initial base setup for utils test --- .../PerformanceMetricsUtilsTest.kt | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt new file mode 100644 index 00000000000..d11948653b9 --- /dev/null +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -0,0 +1,174 @@ +package org.oppia.android.util.logging.performancemetrics + +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 +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mock +import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestDispatcherModule +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.SyncStatusManagerImpl +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 + +/** Tests for [SyncStatusManagerImpl]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsUtilsTest.TestApplication::class) +class PerformanceMetricsUtilsTest { + + @Inject + lateinit var performanceMetricsUtils: PerformanceMetricsUtils + + @Mock + lateinit var context: Context + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testPerformanceMetricsUtils_putAppInForeground_verifyIsAppInForegroundReturnsCorrectValue() { + performanceMetricsUtils.onAppInForeground() + + Truth.assertThat(performanceMetricsUtils.isAppInForeground()).isTrue() + } + + @Test + fun testPerformanceMetricsUtils_putAppInBackground_verifyIsAppInForegroundReturnsCorrectValue() { + performanceMetricsUtils.onAppInBackground() + + Truth.assertThat(performanceMetricsUtils.isAppInForeground()).isFalse() + } + + 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 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, + TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, + NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, + TestPlatformParameterModule::class, SyncStatusModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(performanceMetricsUtilsTest: PerformanceMetricsUtilsTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsUtilsTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(performanceMetricsUtilsTest: PerformanceMetricsUtilsTest) { + component.inject(performanceMetricsUtilsTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From 456e2f0bbf17bfb731c37e7475ae9a124f3a0a30 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 16:04:53 +0530 Subject: [PATCH 059/149] nits --- .../oppialogger/logscheduler/FakeLogScheduler.kt | 2 +- .../analytics/PerformanceMetricsLoggerTest.kt | 7 +++---- .../logscheduler/MetricLogSchedulingWorkerTest.kt | 9 +++++---- .../LogUploadWorkManagerInitializerTest.kt | 11 +++++------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt index f12a5378c38..9ccfee3eedd 100644 --- a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt @@ -2,10 +2,10 @@ package org.oppia.android.domain.testing.oppialogger.logscheduler import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager +import org.oppia.android.util.logging.MetricLogScheduler import java.util.UUID import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.MetricLogScheduler /** A test specific fake for the log uploader. */ @Singleton 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 6b03b509f7d..4bfef9bf990 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 @@ -9,8 +9,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -49,6 +47,8 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +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 @@ -197,7 +197,6 @@ class PerformanceMetricsLoggerTest { assertThat(loggedEvent.memoryTier).isEqualTo(memoryTier) assertThat(loggedEvent.storageTier).isEqualTo(storageTier) assertThat(loggedEvent.isAppInForeground).isEqualTo(isAppInForeground) - } private fun setUpTestApplicationComponent() { @@ -275,4 +274,4 @@ class PerformanceMetricsLoggerTest { override fun getDataProvidersInjector(): DataProvidersInjector = component } -} \ No newline at end of file +} 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 6188adf75ee..ebfa05f7b9f 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 @@ -19,9 +19,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Qualifier -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -62,6 +59,9 @@ import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Qualifier +import javax.inject.Singleton /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. @@ -240,7 +240,8 @@ class MetricLogSchedulingWorkerTest { return Mockito.mock(PerformanceMetricsEventLogger::class.java).also { Mockito.`when`(it.logPerformanceMetric(anyOrNull())).then { answer -> fakePerformanceMetricsEventLogger.logPerformanceMetric( - answer.getArgument(/* index= */ 0, /* clazz= */ + answer.getArgument( + /* index= */ 0, /* clazz= */ OppiaMetricLog::class.java ) ) diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt index 71bf41e91ec..4e0daef7a27 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt @@ -25,10 +25,14 @@ 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.OppiaLogger +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule import org.oppia.android.domain.oppialogger.exceptions.ExceptionsController +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule +import org.oppia.android.domain.testing.oppialogger.logscheduler.FakeLogScheduler import org.oppia.android.domain.testing.oppialogger.loguploader.FakeLogUploader import org.oppia.android.testing.FakeEventLogger import org.oppia.android.testing.FakeExceptionLogger @@ -42,19 +46,14 @@ import org.oppia.android.util.data.DataProviders import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.MetricLogScheduler import org.oppia.android.util.logging.SyncStatusModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory -import org.oppia.android.domain.testing.oppialogger.logscheduler.FakeLogScheduler -import org.oppia.android.util.logging.MetricLogScheduler @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) From cfddbd0c2b939d3a6184ccfab1e3bc33bd79098c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 16:05:37 +0530 Subject: [PATCH 060/149] nits --- .../logging/performancemetrics/PerformanceMetricsUtilsTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index d11948653b9..cd744a9c5c5 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -9,8 +9,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -39,6 +37,8 @@ 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 /** Tests for [SyncStatusManagerImpl]. */ // FunctionName: test names are conventionally named with underscores. From a0154a1cf3f110c23f8b8c1bd01afe02b33ad4dc Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 16:27:35 +0530 Subject: [PATCH 061/149] nit --- .../oppialogger/loguploader/LogUploadWorkManagerInitializer.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index b31ffdf5f42..7d6502db7dd 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -95,7 +95,6 @@ class LogUploadWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForSchedulingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, From 2a5ba9669ed3f7039c9c30a17db7017a470e6a43 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 17:14:54 +0530 Subject: [PATCH 062/149] worker and initializer tests --- .../LogUploadWorkManagerInitializer.kt | 6 ++ .../LogUploadWorkManagerInitializerTest.kt | 19 ++++++ .../loguploader/LogUploadWorkerTest.kt | 64 +++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt index 7d6502db7dd..fcd7945573e 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt @@ -158,6 +158,9 @@ class LogUploadWorkManagerInitializer @Inject constructor( /** Returns the [UUID] of the work request that is enqueued for uploading exception logs. */ fun getWorkRequestForExceptionsId(): UUID = workRequestForUploadingExceptions.id + /** Returns the [UUID] of the work request that is enqueued for uploading performance metrics logs. */ + fun getWorkRequestForPerformanceMetricsId(): UUID = workRequestForUploadingPerformanceMetrics.id + /** * Returns the [UUID] of the work request that is enqueued for scheduling memory usage * performance metrics collection. @@ -185,6 +188,9 @@ class LogUploadWorkManagerInitializer @Inject constructor( /** Returns the [Data] that goes into the work request that is enqueued for uploading exception logs. */ fun getWorkRequestDataForExceptions(): Data = workerCaseForUploadingExceptions + /** Returns the [Data] that goes into the work request that is enqueued for uploading performance metric logs. */ + fun getWorkRequestDataForPerformanceMetrics(): Data = workerCaseForUploadingPerformanceMetrics + /** * Returns the [Data] that goes into the work request that is enqueued for scheduling storage * usage performance metrics collection. diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt index 4e0daef7a27..2484ccf91e9 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt @@ -122,6 +122,8 @@ class LogUploadWorkManagerInitializerTest { val enqueuedEventWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForEventsId() val enqueuedExceptionWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForExceptionsId() + val enqueuedPerformanceMetricsWorkRequestId = + logUploadWorkManagerInitializer.getWorkRequestForPerformanceMetricsId() val enqueuedSchedulingStorageUsageMetricWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForSchedulingStorageUsageMetricLogsId() val enqueuedSchedulingMemoryUsageMetricWorkRequestId = @@ -133,6 +135,9 @@ class LogUploadWorkManagerInitializerTest { assertThat(fakeLogUploader.getMostRecentExceptionRequestId()).isEqualTo( enqueuedExceptionWorkRequestId ) + assertThat(fakeLogUploader.getMostRecentPerformanceMetricsRequestId()).isEqualTo( + enqueuedPerformanceMetricsWorkRequestId + ) assertThat(fakeLogScheduler.getMostRecentStorageUsageMetricLoggingRequestId()).isEqualTo( enqueuedSchedulingStorageUsageMetricWorkRequestId ) @@ -185,6 +190,20 @@ class LogUploadWorkManagerInitializerTest { ) } + @Test + fun testWorkRequest_verifyWorkRequestDataForPerformanceMetrics() { + val workerCaseForUploadingPerformanceMetrics: Data = Data.Builder() + .putString( + LogUploadWorker.WORKER_CASE_KEY, + LogUploadWorker.PERFORMANCE_METRICS_WORKER + ) + .build() + + assertThat(logUploadWorkManagerInitializer.getWorkRequestDataForPerformanceMetrics()).isEqualTo( + workerCaseForUploadingPerformanceMetrics + ) + } + @Test fun testWorkRequest_verifyWorkRequestData_forSchedulingStorageUsageMetricLogs() { val workerCaseForSchedulingStorageUsageMetricLogs: Data = Data.Builder() diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt index ffdd501d390..57180da6239 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt @@ -26,18 +26,22 @@ import org.mockito.Mockito.`when` import org.mockito.Mockito.mock import org.mockito.Mockito.reset import org.oppia.android.app.model.EventLog +import org.oppia.android.app.model.OppiaMetricLog 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.OppiaLogger +import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.domain.oppialogger.exceptions.ExceptionsController 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.FakeSyncStatusManager import org.oppia.android.testing.logging.SyncStatusTestModule import org.oppia.android.testing.mockito.anyOrNull @@ -58,6 +62,7 @@ import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.DATA_UPLOADED import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.DATA_UPLOADING import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NETWORK_ERROR import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NO_CONNECTIVITY +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -69,6 +74,7 @@ import javax.inject.Singleton private const val TEST_TIMESTAMP = 1556094120000 private const val TEST_TOPIC_ID = "test_topicId" +private const val TEST_APK_SIZE = Long.MAX_VALUE /** Tests for [LogUploadWorker]. */ // FunctionName: test names are conventionally named with underscores. @@ -80,9 +86,11 @@ class LogUploadWorkerTest { @Inject lateinit var networkConnectionUtil: NetworkConnectionDebugUtil @Inject lateinit var fakeEventLogger: FakeEventLogger @Inject lateinit var fakeExceptionLogger: FakeExceptionLogger + @Inject lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger @Inject lateinit var oppiaLogger: OppiaLogger @Inject lateinit var analyticsController: AnalyticsController @Inject lateinit var exceptionsController: ExceptionsController + @Inject lateinit var performanceMetricsController: PerformanceMetricsController @Inject lateinit var logUploadWorkerFactory: LogUploadWorkerFactory @Inject lateinit var dataProviders: DataProviders @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers @@ -105,6 +113,13 @@ class LogUploadWorkerTest { .setTimestamp(TEST_TIMESTAMP) .build() + private val apkSizeTestLoggableMetric = OppiaMetricLog.LoggableMetric.newBuilder() + .setApkSizeMetric( + OppiaMetricLog.ApkSizeMetric.newBuilder() + .setApkSizeBytes(TEST_APK_SIZE) + .build() + ).build() + private val exception = Exception("TEST") @Before @@ -203,6 +218,46 @@ class LogUploadWorkerTest { assertThat(loggedExceptionStackTraceElems).isEqualTo(expectedExceptionStackTraceElems) } + @Test + fun testWorker_logPerformanceMetric_withoutNetwork_enqueueRequest_verifySuccess() { + networkConnectionUtil.setCurrentConnectionStatus(NONE) + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + OppiaMetricLog.Priority.LOW_PRIORITY + ) + + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData = Data.Builder().putString( + LogUploadWorker.WORKER_CASE_KEY, + LogUploadWorker.PERFORMANCE_METRICS_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + + val workInfo = workManager.getWorkInfoById(request.id) + val loggedPerformanceMetric = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + assertThat(loggedPerformanceMetric.loggableMetric.loggableMetricTypeCase).isEqualTo( + OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC + ) + assertThat(loggedPerformanceMetric.currentScreen).isEqualTo( + OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED + ) + assertThat(loggedPerformanceMetric.priority).isEqualTo(OppiaMetricLog.Priority.LOW_PRIORITY) + assertThat(loggedPerformanceMetric.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(loggedPerformanceMetric.loggableMetric.apkSizeMetric.apkSizeBytes).isEqualTo( + TEST_APK_SIZE + ) + } + @Test fun testWorker_logEvent_withoutNetwork_enqueueRequest_verifyCorrectSyncStatusSequence() { networkConnectionUtil.setCurrentConnectionStatus(NONE) @@ -310,6 +365,11 @@ class LogUploadWorkerTest { @Provides fun bindFakeExceptionLogger(fakeLogger: FakeExceptionLogger): ExceptionLogger = fakeLogger + + @Provides + fun bindFakePerformanceMetricsLogger( + fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger = fakePerformanceMetricsEventLogger } @Module @@ -322,6 +382,10 @@ class LogUploadWorkerTest { @Provides @ExceptionLogStorageCacheSize fun provideExceptionLogStorageSize(): Int = 2 + + @Provides + @PerformanceMetricsLogStorageCacheSize + fun providePerformanceMetricsLogStorageCacheSize(): Int = 2 } @Module From af51d7d852bf90fea11e24f0b861616b6a5ad54f Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 27 Jun 2022 22:49:42 +0530 Subject: [PATCH 063/149] event bundle creator tests --- .../util/logging/EventBundleCreator.kt | 2 +- .../util/logging/EventBundleCreatorTest.kt | 363 ++++++++++++++++++ 2 files changed, 364 insertions(+), 1 deletion(-) 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 6b686e7f6f2..1eb2bb04c38 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 @@ -113,7 +113,7 @@ class EventBundleCreator @Inject constructor( fun fillPerformanceMetricsEventBundle(oppiaMetricLog: OppiaMetricLog, bundle: Bundle): String { bundle.putLong("timestamp", oppiaMetricLog.timestampMillis) bundle.putString("priority", oppiaMetricLog.priority.toAnalyticsName()) - bundle.putBoolean("is_app_in_foreground", oppiaMetricLog.isAppInForeground) + bundle.putString("is_app_in_foreground", oppiaMetricLog.isAppInForeground.toString()) bundle.putString("memory_tier", oppiaMetricLog.memoryTier.toAnalyticsName()) bundle.putString("storage_tier", oppiaMetricLog.storageTier.toAnalyticsName()) bundle.putString("network_type", oppiaMetricLog.networkType.toAnalyticsName()) 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 863a4d427f3..85a74150f78 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 @@ -28,6 +28,23 @@ import org.oppia.android.app.model.EventLog.RevisionCardContext import org.oppia.android.app.model.EventLog.StoryContext import org.oppia.android.app.model.EventLog.SubmitAnswerContext import org.oppia.android.app.model.EventLog.TopicContext +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.HOME_SCREEN +import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED +import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric +import org.oppia.android.app.model.OppiaMetricLog.MemoryTier +import org.oppia.android.app.model.OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER +import org.oppia.android.app.model.OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER +import org.oppia.android.app.model.OppiaMetricLog.NetworkType +import org.oppia.android.app.model.OppiaMetricLog.NetworkType.CELLULAR +import org.oppia.android.app.model.OppiaMetricLog.NetworkType.WIFI +import org.oppia.android.app.model.OppiaMetricLog.Priority +import org.oppia.android.app.model.OppiaMetricLog.Priority.HIGH_PRIORITY +import org.oppia.android.app.model.OppiaMetricLog.Priority.MEDIUM_PRIORITY +import org.oppia.android.app.model.OppiaMetricLog.StorageTier +import org.oppia.android.app.model.OppiaMetricLog.StorageTier.HIGH_STORAGE +import org.oppia.android.app.model.OppiaMetricLog.StorageTier.MEDIUM_STORAGE import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics import org.oppia.android.util.platformparameter.PlatformParameterValue @@ -74,6 +91,12 @@ class EventBundleCreatorTest { private const val TEST_IS_ANSWER_CORRECT = true private const val TEST_IS_ANSWER_CORRECT_STR = "true" private const val TEST_CONTENT_ID = "test_content_id" + private const val TEST_CPU_USAGE = Long.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 + private const val TEST_NETWORK_USAGE = Long.MAX_VALUE + private const val TEST_MEMORY_USAGE = Long.MAX_VALUE } @Inject @@ -97,6 +120,26 @@ class EventBundleCreatorTest { assertThat(bundle).string("priority").isEqualTo("unspecified_priority") } + @Test + fun testFillPerformanceMetricsBundle_defaultEvent_defaultsBundleAndRetsUnknownActivityContext() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + OppiaMetricLog.getDefaultInstance(), bundle + ) + + assertThat(typeName).isEqualTo("unknown_loggable_metric") + assertThat(bundle).hasSize(7) + assertThat(bundle).longInt("timestamp").isEqualTo(0) + assertThat(bundle).string("priority").isEqualTo("unspecified_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("false") + assertThat(bundle).string("memory_tier").isEqualTo("unspecified_memory_tier") + assertThat(bundle).string("storage_tier").isEqualTo("unspecified_storage_tier") + assertThat(bundle).string("network_type").isEqualTo("unspecified_network_type") + assertThat(bundle).string("current_screen").isEqualTo("unspecified_current_screen") + } + @Test fun testFillEventBundle_eventWithDefaultedContext_fillsPriorityAndTimeAndRetsUnknownContext() { setUpTestApplicationComponent() @@ -133,6 +176,118 @@ class EventBundleCreatorTest { assertThat(bundle).string("priority").isEqualTo("optional") } + @Test + fun testFillMetricsBundle_eventWithDefaultedContext_fillsDetailsAndRetsUnknownContext() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = createPerformanceMetricLog( + timestamp = TEST_TIMESTAMP_1, + priority = HIGH_PRIORITY, + currentScreen = HOME_SCREEN, + memoryTier = HIGH_MEMORY_TIER, + storageTier = HIGH_STORAGE, + networkType = WIFI, + isAppInForeground = true + ) + + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetricLog, + bundle + ) + + assertThat(typeName).isEqualTo("unknown_loggable_metric") + assertThat(bundle).hasSize(7) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffTimestamp_savesDifferentTimestampInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = createPerformanceMetricLog(timestamp = TEST_TIMESTAMP_2) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_2) + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDifferentPriority_savesDifferentPriorityInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = + createPerformanceMetricLog(priority = MEDIUM_PRIORITY) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("priority").isEqualTo("medium_priority") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffMemoryTier_savesDiffMemoryTierInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = + createPerformanceMetricLog(memoryTier = MEDIUM_MEMORY_TIER) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("memory_tier").isEqualTo("medium_memory") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffStorageTier_savesDiffStorageTierInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = + createPerformanceMetricLog(storageTier = MEDIUM_STORAGE) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("storage_tier").isEqualTo("medium_storage") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffCurrentScreen_savesDiffCurrentScreenInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = + createPerformanceMetricLog(currentScreen = SCREEN_UNSPECIFIED) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("current_screen").isEqualTo("unspecified_current_screen") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffNetworkType_savesDiffNetworkTypeInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = + createPerformanceMetricLog(networkType = CELLULAR) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("network_type").isEqualTo("cellular") + } + + @Test + fun testFillPerformanceMetricBundle_eventWithDiffAppInForeground_savesDiffValueInBundle() { + setUpTestApplicationComponent() + val bundle = Bundle() + val performanceMetricLog = createPerformanceMetricLog(isAppInForeground = false) + + eventBundleCreator.fillPerformanceMetricsEventBundle(performanceMetricLog, bundle) + + assertThat(bundle).string("is_app_in_foreground").isEqualTo("false") + } + @Test fun testFillEventBundle_openExpActivityEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() @@ -205,6 +360,151 @@ class EventBundleCreatorTest { assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) } + @Test + fun testFillPerformanceMetricBundle_createApkSizeLoggableMetric_bundlesAllDetailsCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createApkSizeLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("apk_size_metric") + assertThat(bundle).hasSize(8) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("apk_size_bytes").isEqualTo(TEST_APK_SIZE) + } + + @Test + fun testFillPerformanceMetricBundle_createStorageUsageLogMetric_bundlesAllDetailsCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createStorageUsageLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("storage_usage_metric") + assertThat(bundle).hasSize(8) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("storage_usage_bytes").isEqualTo(TEST_STORAGE_USAGE) + } + + @Test + fun testFillPerformanceMetricBundle_createStartupLatencyMetric_bundlesAllDetailsCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createStartupLatencyLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("startup_latency_metric") + assertThat(bundle).hasSize(8) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("startup_latency_millis").isEqualTo(TEST_STARTUP_LATENCY) + } + + @Test + fun testFillPerformanceMetricBundle_createMemoryUsageMetric_fillsAllDetailsInBundleCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createMemoryUsageLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("memory_usage_metric") + assertThat(bundle).hasSize(8) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("total_pss_bytes").isEqualTo(TEST_MEMORY_USAGE) + } + + @Test + fun testFillPerformanceMetricBundle_createNetworkUsageMetric_fillsAllDetailsInBundleCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createNetworkUsageTestLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("network_usage_metric") + assertThat(bundle).hasSize(9) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("bytes_received").isEqualTo(TEST_NETWORK_USAGE) + assertThat(bundle).longInt("bytes_sent").isEqualTo(TEST_NETWORK_USAGE) + } + + @Test + fun testFillPerformanceMetricBundle_createCpuUsageLogMetric_fillsAllDetailsInBundleCorrectly() { + setUpTestApplicationComponent() + val bundle = Bundle() + + val performanceMetric = createPerformanceMetricLog( + loggableMetric = createCpuUsageLoggableMetric() + ) + val typeName = eventBundleCreator.fillPerformanceMetricsEventBundle( + performanceMetric, bundle + ) + + assertThat(typeName).isEqualTo("cpu_usage_metric") + assertThat(bundle).hasSize(8) + assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) + assertThat(bundle).string("priority").isEqualTo("high_priority") + assertThat(bundle).string("is_app_in_foreground").isEqualTo("true") + assertThat(bundle).string("memory_tier").isEqualTo("high_memory") + assertThat(bundle).string("storage_tier").isEqualTo("high_storage") + assertThat(bundle).string("network_type").isEqualTo("wifi") + assertThat(bundle).string("current_screen").isEqualTo("home_screen") + assertThat(bundle).longInt("cpu_usage").isEqualTo(TEST_CPU_USAGE) + } + @Test fun testFillEventBundle_openPracticeTabContextEvent_fillsAllFieldsInBundleAndReturnsName() { setUpTestApplicationComponent() @@ -947,6 +1247,26 @@ class EventBundleCreatorTest { this.context = context }.build() + private fun createPerformanceMetricLog( + timestamp: Long = TEST_TIMESTAMP_1, + priority: Priority = HIGH_PRIORITY, + currentScreen: CurrentScreen = HOME_SCREEN, + memoryTier: MemoryTier = HIGH_MEMORY_TIER, + storageTier: StorageTier = HIGH_STORAGE, + isAppInForeground: Boolean = true, + networkType: NetworkType = WIFI, + loggableMetric: LoggableMetric = LoggableMetric.getDefaultInstance() + ) = OppiaMetricLog.newBuilder().apply { + this.timestampMillis = timestamp + this.priority = priority + this.currentScreen = currentScreen + this.memoryTier = memoryTier + this.storageTier = storageTier + this.isAppInForeground = isAppInForeground + this.networkType = networkType + this.loggableMetric = loggableMetric + }.build() + private fun createOpenExplorationActivity( explorationContext: ExplorationContext = createExplorationContext() ) = createEventContext(explorationContext, EventContextBuilder::setOpenExplorationActivity) @@ -1136,6 +1456,49 @@ class EventBundleCreatorTest { this.contentId = contentId }.build() + private fun createApkSizeLoggableMetric() = OppiaMetricLog.LoggableMetric.newBuilder() + .setApkSizeMetric( + OppiaMetricLog.ApkSizeMetric.newBuilder() + .setApkSizeBytes(TEST_APK_SIZE) + .build() + ).build() + + private fun createStorageUsageLoggableMetric() = LoggableMetric.newBuilder() + .setStorageUsageMetric( + OppiaMetricLog.StorageUsageMetric.newBuilder() + .setStorageUsageBytes(TEST_STORAGE_USAGE) + .build() + ).build() + + private fun createStartupLatencyLoggableMetric() = LoggableMetric.newBuilder() + .setStartupLatencyMetric( + OppiaMetricLog.StartupLatencyMetric.newBuilder() + .setStartupLatencyMillis(TEST_STARTUP_LATENCY) + .build() + ).build() + + private fun createCpuUsageLoggableMetric() = LoggableMetric.newBuilder() + .setCpuUsageMetric( + OppiaMetricLog.CpuUsageMetric.newBuilder() + .setCpuUsageMetric(TEST_CPU_USAGE) + .build() + ).build() + + private fun createNetworkUsageTestLoggableMetric() = LoggableMetric.newBuilder() + .setNetworkUsageMetric( + OppiaMetricLog.NetworkUsageMetric.newBuilder() + .setBytesReceived(TEST_NETWORK_USAGE) + .setBytesSent(TEST_NETWORK_USAGE) + .build() + ).build() + + private fun createMemoryUsageLoggableMetric() = LoggableMetric.newBuilder() + .setMemoryUsageMetric( + OppiaMetricLog.MemoryUsageMetric.newBuilder() + .setTotalPssBytes(TEST_MEMORY_USAGE) + .build() + ).build() + private fun setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() { setUpTestApplicationComponent() } From b569ad7b972ca3c72424f9fed3ef7272f004ff29 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 30 Jun 2022 01:15:36 +0530 Subject: [PATCH 064/149] module tests --- .../util/logging/EventBundleCreatorTest.kt | 2 +- .../firebase/LogReportingModuleTest.kt | 150 ++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt 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 85a74150f78..a1c4eff0a0a 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 @@ -177,7 +177,7 @@ class EventBundleCreatorTest { } @Test - fun testFillMetricsBundle_eventWithDefaultedContext_fillsDetailsAndRetsUnknownContext() { + fun testFillMetricsBundle_eventWithDefaultLoggableMetric_fillsDetailsAndRetsUnknownContext() { setUpTestApplicationComponent() val bundle = Bundle() val performanceMetricLog = createPerformanceMetricLog( diff --git a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt new file mode 100644 index 00000000000..b42f3e44d18 --- /dev/null +++ b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt @@ -0,0 +1,150 @@ +package org.oppia.android.util.logging.firebase + +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 +import dagger.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.Provides +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestDispatcherModule +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.EventLogger +import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.SyncStatusModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +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 + +/** Tests for [LogReportingModule]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = LogReportingModuleTest.TestApplication::class) +class LogReportingModuleTest { + + @Inject + lateinit var performanceMetricsEventLogger: PerformanceMetricsEventLogger + + @Inject + lateinit var eventLogger: EventLogger + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testModule_injectsProductionImplementationOfEventLogger() { + Truth.assertThat(eventLogger).isInstanceOf(FirebaseEventLogger::class.java) + } + + @Test + fun testModule_injectsProductionImplementationOfPerformanceMetricsEventLogger() { + Truth.assertThat(performanceMetricsEventLogger).isInstanceOf(FirebaseEventLogger::class.java) + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + } + + @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, LogReportingModule::class, TestDispatcherModule::class, + RobolectricModule::class, FakeOppiaClockModule::class, + NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, + TestPlatformParameterModule::class, LoggerModule::class, SyncStatusModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(logReportingModuleTest: LogReportingModuleTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerLogReportingModuleTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(test: LogReportingModuleTest) { + component.inject(test) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From 8c773f92f767688d79287eae26714b15288ee836 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 30 Jun 2022 01:16:27 +0530 Subject: [PATCH 065/149] nits --- .../android/util/logging/firebase/LogReportingModuleTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt index b42f3e44d18..92431f28419 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt @@ -10,8 +10,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -36,6 +34,8 @@ 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 /** Tests for [LogReportingModule]. */ // FunctionName: test names are conventionally named with underscores. From 5311ed3b3f991c664c064304945af14db73922d3 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 9 Jul 2022 20:31:24 +0530 Subject: [PATCH 066/149] performanceMetricsUtils tests --- .../PerformanceMetricsUtils.kt | 19 ++- .../PerformanceMetricsUtilsTest.kt | 133 ++++++++++++++++-- 2 files changed, 133 insertions(+), 19 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 874ca709f4a..03670435b99 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -4,14 +4,13 @@ import android.app.ActivityManager import android.app.Application import android.content.Context import android.net.TrafficStats -import android.os.Environment import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.OnLifecycleEvent -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.ConsoleLogger import java.io.File import javax.inject.Inject +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.ConsoleLogger class PerformanceMetricsUtils @Inject constructor( private val context: Application, @@ -29,7 +28,7 @@ class PerformanceMetricsUtils @Inject constructor( val apkPath = context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir val apkFile = File(apkPath) - apkSize = ((apkFile.length() / 1024).toString()).toLong() + apkSize = ((apkFile.length() / 1024)) } catch (e: Exception) { consoleLogger.e( "PerformanceMetricsUtils", @@ -86,9 +85,9 @@ class PerformanceMetricsUtils @Inject constructor( * capacity of the device. */ fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = - when (Environment.getDataDirectory().totalSpace / (1024 * 1024 * 1024)) { - in 0..5 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 5..20 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + when ((context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024)) { + in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } @@ -100,9 +99,9 @@ class PerformanceMetricsUtils @Inject constructor( val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val memoryInfo = ActivityManager.MemoryInfo() activityManager.getMemoryInfo(memoryInfo) - return when (memoryInfo.totalMem / (1024 * 1024 * 1024)) { - in 0..1 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - in 1..2 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { + in 0.00..1.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + in 1.00..2.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index cd744a9c5c5..36630976a20 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -1,18 +1,25 @@ package org.oppia.android.util.logging.performancemetrics +import android.app.ActivityManager import android.app.Application +import android.content.ComponentName import android.content.Context +import android.content.pm.ApplicationInfo +import android.content.pm.PackageInfo +import android.net.TrafficStats import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides +import java.io.File +import javax.inject.Inject +import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mock +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule @@ -24,7 +31,6 @@ 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.SyncStatusManagerImpl 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 @@ -35,15 +41,22 @@ import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAUL 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.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton +import org.robolectric.shadows.ShadowActivityManager + +private const val TEST_PACKAGE_NAME = "TEST_PACKAGE_NAME" +private const val TEST_PACKAGE_LABEL = "TEST_PACKAGE_LABEL" +private const val TEST_APP_PATH = "TEST_APP_PATH" +private const val TEST_PID = 1 -/** Tests for [SyncStatusManagerImpl]. */ +/** Tests for [PerformanceMetricsUtils]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) +@RunWith(RobolectricTestRunner::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(application = PerformanceMetricsUtilsTest.TestApplication::class) class PerformanceMetricsUtilsTest { @@ -51,14 +64,116 @@ class PerformanceMetricsUtilsTest { @Inject lateinit var performanceMetricsUtils: PerformanceMetricsUtils - @Mock - lateinit var context: Context + @Inject + lateinit var context: Application @Before fun setUp() { setUpTestApplicationComponent() } + @Test + fun testPerformanceMetricsUtils_setTotalMemory_returnsCorrectMemoryTier() { + val activityManager: ActivityManager = + RuntimeEnvironment.application.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val memoryInfo = ActivityManager.MemoryInfo() + memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() + shadowActivityManager.setMemoryInfo(memoryInfo) + val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + Truth.assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) + } + + @Test + fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { + val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace + val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + val expectedStorageValue = permanentStorageUsage + cacheStorageUsage + + Truth.assertThat(performanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) + } + + @Test + fun testPerformanceMetricsUtils_getTotalStorageUsageTier_returnsCorrectStorageUsageTier() { + val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace + val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + val expectedStorageValue = permanentStorageUsage + cacheStorageUsage + + val expectedStorageTierValue = when (expectedStorageValue.toDouble() / (1024 * 1024 * 1024)) { + in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + else -> OppiaMetricLog.StorageTier.HIGH_STORAGE + } + + Truth.assertThat(performanceMetricsUtils.getDeviceStorageTier()) + .isEqualTo(expectedStorageTierValue) + } + + @Test + fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { + val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + + Truth.assertThat(performanceMetricsUtils.getTotalSentBytes()) + .isEqualTo(expectedNetworkBytesSent) + } + + @Test + fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { + val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + + Truth.assertThat(performanceMetricsUtils.getTotalReceivedBytes()) + .isEqualTo(expectedNetworkBytesReceived) + } + + @Test + fun testPerformanceMetricsUtils_setAppProcesses_getMemoryUsage_returnsCorrectMemoryUsage() { + val process1 = ActivityManager.RunningAppProcessInfo().apply { + this.pid = TEST_PID + this.importanceReasonComponent = ComponentName("com.robolectric", "process 1") + } + val process2 = ActivityManager.RunningAppProcessInfo().apply { + this.pid = TEST_PID + this.importanceReasonComponent = ComponentName("com.robolectric", "process 2") + } + var totalPssUsedTest = 0 + val activityManager: ActivityManager = + RuntimeEnvironment.application.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + shadowActivityManager.setProcesses(listOf(process1, process2)) + val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(TEST_PID).toIntArray()) + if (processMemoryInfo != null) { + for (element in processMemoryInfo) { + totalPssUsedTest += element.totalPss + } + } + Truth.assertThat(performanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) + } + + @Test + fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnssCorrectApkSize() { + val applicationInfo = ApplicationInfo() + val testApkSize = (File(TEST_APP_PATH).length() / 1024) + applicationInfo.apply { + this.packageName = TEST_PACKAGE_NAME + this.sourceDir = TEST_APP_PATH + this.name = TEST_PACKAGE_LABEL + this.flags = 0 + } + val packageManager = RuntimeEnvironment.application.packageManager + val shadowPackageManager = shadowOf(packageManager) + + shadowPackageManager.removePackage(RuntimeEnvironment.application.packageName) + shadowPackageManager.installPackage( + PackageInfo().apply { + this.packageName = TEST_PACKAGE_NAME + this.applicationInfo = applicationInfo + } + ) + + val apkSize = performanceMetricsUtils.getApkSize() + Truth.assertThat(apkSize).isEqualTo(testApkSize) + } + @Test fun testPerformanceMetricsUtils_putAppInForeground_verifyIsAppInForegroundReturnsCorrectValue() { performanceMetricsUtils.onAppInForeground() From 56f8e035343f2e8c625f1ff109e66833014f6e67 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 9 Jul 2022 20:40:24 +0530 Subject: [PATCH 067/149] nits --- .../performancemetrics/PerformanceMetricsUtils.kt | 11 +++++++---- .../performancemetrics/PerformanceMetricsUtilsTest.kt | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 03670435b99..e1406c838c2 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -7,10 +7,10 @@ import android.net.TrafficStats import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.OnLifecycleEvent -import java.io.File -import javax.inject.Inject import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.ConsoleLogger +import java.io.File +import javax.inject.Inject class PerformanceMetricsUtils @Inject constructor( private val context: Application, @@ -84,12 +84,15 @@ class PerformanceMetricsUtils @Inject constructor( * Returns the [OppiaMetricLog.StorageTier] of the device by analysing the total storage * capacity of the device. */ - fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = - when ((context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024)) { + fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { + return when ( + (context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024) + ) { in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } + } /** * Returns the [OppiaMetricLog.MemoryTier] of the device by analysing the total memory diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 36630976a20..2a1ed48922e 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -13,9 +13,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import java.io.File -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -47,6 +44,9 @@ import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import org.robolectric.shadows.ShadowActivityManager +import java.io.File +import javax.inject.Inject +import javax.inject.Singleton private const val TEST_PACKAGE_NAME = "TEST_PACKAGE_NAME" private const val TEST_PACKAGE_LABEL = "TEST_PACKAGE_LABEL" From 21f5e973e3edeec21d2a2a9dfdb6d11bd07210b7 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 10 Jul 2022 02:14:31 +0530 Subject: [PATCH 068/149] renamed logUpload to logReport + nits --- .../app/application/ApplicationComponent.kt | 7 ++-- .../AdministratorControlsActivityTest.kt | 4 +-- .../AdministratorControlsFragmentTest.kt | 4 +-- .../AppVersionActivityTest.kt | 4 +-- .../ProfileAndDeviceIdActivityTest.kt | 4 +-- .../ProfileAndDeviceIdFragmentTest.kt | 4 +-- .../CompletedStoryListActivityTest.kt | 4 +-- .../LessonThumbnailImageViewTest.kt | 4 +-- .../MathExpressionInteractionsViewTest.kt | 4 +-- .../DrawableBindingAdaptersTest.kt | 4 +-- .../ImageViewBindingAdaptersTest.kt | 4 +-- .../databinding/MarginBindingAdaptersTest.kt | 4 +-- ...StateAssemblerMarginBindingAdaptersTest.kt | 4 +-- ...tateAssemblerPaddingBindingAdaptersTest.kt | 4 +-- .../TextViewBindingAdaptersTest.kt | 4 +-- .../databinding/ViewBindingAdaptersTest.kt | 4 +-- .../DeveloperOptionsActivityTest.kt | 4 +-- .../DeveloperOptionsFragmentTest.kt | 4 +-- .../MarkChaptersCompletedActivityTest.kt | 4 +-- .../MarkChaptersCompletedFragmentTest.kt | 4 +-- .../MarkStoriesCompletedActivityTest.kt | 4 +-- .../MarkStoriesCompletedFragmentTest.kt | 4 +-- .../MarkTopicsCompletedActivityTest.kt | 4 +-- .../MarkTopicsCompletedFragmentTest.kt | 4 +-- .../devoptions/ViewEventLogsActivityTest.kt | 4 +-- .../devoptions/ViewEventLogsFragmentTest.kt | 5 ++- .../ForceNetworkTypeActivityTest.kt | 4 +-- .../ForceNetworkTypeFragmentTest.kt | 4 +-- .../MathExpressionParserActivityTest.kt | 4 +-- .../MathExpressionParserFragmentTest.kt | 4 +-- .../android/app/faq/FAQListFragmentTest.kt | 4 +-- .../android/app/faq/FAQSingleActivityTest.kt | 4 +-- .../android/app/faq/FaqListActivityTest.kt | 4 +-- .../android/app/help/HelpActivityTest.kt | 4 +-- .../android/app/help/HelpFragmentTest.kt | 4 +-- .../android/app/home/HomeActivityTest.kt | 4 +-- .../app/home/RecentlyPlayedFragmentTest.kt | 4 +-- .../app/home/TopicSummaryViewModelTest.kt | 4 +-- .../android/app/home/WelcomeViewModelTest.kt | 4 +-- .../PromotedStoryListViewModelTest.kt | 4 +-- .../PromotedStoryViewModelTest.kt | 4 +-- .../mydownloads/MyDownloadsActivityTest.kt | 4 +-- .../mydownloads/MyDownloadsFragmentTest.kt | 4 +-- .../app/onboarding/OnboardingActivityTest.kt | 4 +-- .../app/onboarding/OnboardingFragmentTest.kt | 4 +-- .../OngoingTopicListActivityTest.kt | 4 +-- .../app/options/AppLanguageActivityTest.kt | 4 +-- .../app/options/AppLanguageFragmentTest.kt | 4 +-- .../app/options/AudioLanguageActivityTest.kt | 4 +-- .../app/options/AudioLanguageFragmentTest.kt | 4 +-- .../app/options/OptionsActivityTest.kt | 4 +-- .../app/options/OptionsFragmentTest.kt | 4 +-- .../options/ReadingTextSizeActivityTest.kt | 4 +-- .../options/ReadingTextSizeFragmentTest.kt | 4 +-- .../app/parser/CustomBulletSpanTest.kt | 4 +-- .../android/app/parser/HtmlParserTest.kt | 4 +-- .../app/player/audio/AudioFragmentTest.kt | 4 +-- .../exploration/ExplorationActivityTest.kt | 4 +-- .../app/player/state/StateFragmentTest.kt | 4 +-- .../app/profile/AddProfileActivityTest.kt | 4 +-- .../app/profile/AdminAuthActivityTest.kt | 4 +-- .../app/profile/AdminPinActivityTest.kt | 4 +-- .../app/profile/PinPasswordActivityTest.kt | 4 +-- .../app/profile/ProfileChooserFragmentTest.kt | 4 +-- .../ProfilePictureActivityTest.kt | 4 +-- .../ProfileProgressActivityTest.kt | 4 +-- .../ProfileProgressFragmentTest.kt | 4 +-- .../app/recyclerview/BindableAdapterTest.kt | 4 +-- .../resumelesson/ResumeLessonActivityTest.kt | 4 +-- .../resumelesson/ResumeLessonFragmentTest.kt | 4 +-- .../profile/ProfileEditActivityTest.kt | 4 +-- .../profile/ProfileEditFragmentTest.kt | 4 +-- .../profile/ProfileListActivityTest.kt | 4 +-- .../profile/ProfileListFragmentTest.kt | 4 +-- .../profile/ProfileRenameActivityTest.kt | 4 +-- .../profile/ProfileRenameFragmentTest.kt | 4 +-- .../profile/ProfileResetPinActivityTest.kt | 4 +-- .../profile/ProfileResetPinFragmentTest.kt | 4 +-- .../android/app/splash/SplashActivityTest.kt | 4 +-- .../android/app/story/StoryActivityTest.kt | 4 +-- .../android/app/story/StoryFragmentTest.kt | 4 +-- .../app/testing/DragDropTestActivityTest.kt | 4 +-- ...ImageRegionSelectionInteractionViewTest.kt | 4 +-- .../InputInteractionViewTestActivityTest.kt | 4 +-- .../NavigationDrawerActivityDebugTest.kt | 4 +-- .../NavigationDrawerActivityProdTest.kt | 4 +-- ...tFontScaleConfigurationUtilActivityTest.kt | 4 +-- .../testing/TopicTestActivityForStoryTest.kt | 4 +-- .../app/thirdparty/LicenseListActivityTest.kt | 4 +-- .../app/thirdparty/LicenseListFragmentTest.kt | 4 +-- .../LicenseTextViewerActivityTest.kt | 4 +-- .../LicenseTextViewerFragmentTest.kt | 4 +-- .../ThirdPartyDependencyListActivityTest.kt | 4 +-- .../ThirdPartyDependencyListFragmentTest.kt | 4 +-- .../android/app/topic/TopicActivityTest.kt | 4 +-- .../android/app/topic/TopicFragmentTest.kt | 4 +-- .../conceptcard/ConceptCardFragmentTest.kt | 4 +-- .../app/topic/info/TopicInfoFragmentTest.kt | 4 +-- .../topic/lessons/TopicLessonsFragmentTest.kt | 4 +-- .../practice/TopicPracticeFragmentTest.kt | 4 +-- .../QuestionPlayerActivityTest.kt | 4 +-- .../revision/TopicRevisionFragmentTest.kt | 4 +-- .../revisioncard/RevisionCardActivityTest.kt | 4 +-- .../revisioncard/RevisionCardFragmentTest.kt | 4 +-- .../app/utility/RatioExtensionsTest.kt | 4 +-- .../walkthrough/WalkthroughActivityTest.kt | 4 +-- .../WalkthroughFinalFragmentTest.kt | 4 +-- .../WalkthroughTopicListFragmentTest.kt | 4 +-- .../WalkthroughWelcomeFragmentTest.kt | 4 +-- .../activity/ActivityIntentFactoriesTest.kt | 4 +-- .../android/app/home/HomeActivityLocalTest.kt | 4 +-- .../app/parser/FractionParsingUiErrorTest.kt | 4 +-- .../app/parser/StringToRatioParserTest.kt | 4 +-- .../ExplorationActivityLocalTest.kt | 4 +-- .../player/state/StateFragmentLocalTest.kt | 4 +-- .../ProfileChooserFragmentLocalTest.kt | 4 +-- .../app/story/StoryActivityLocalTest.kt | 4 +-- .../app/testing/CompletedStoryListSpanTest.kt | 4 +-- .../oppia/android/app/testing/HomeSpanTest.kt | 4 +-- .../app/testing/OngoingTopicListSpanTest.kt | 4 +-- .../PlatformParameterIntegrationTest.kt | 4 +-- .../app/testing/ProfileChooserSpanTest.kt | 4 +-- .../testing/ProfileProgressSpanCountTest.kt | 4 +-- .../app/testing/RecentlyPlayedSpanTest.kt | 4 +-- .../app/testing/TopicRevisionSpanTest.kt | 4 +-- .../app/testing/activity/TestActivityTest.kt | 4 +-- .../AdministratorControlsFragmentTest.kt | 4 +-- .../testing/options/OptionsFragmentTest.kt | 4 +-- .../player/split/PlayerSplitScreenTest.kt | 4 +-- .../state/StateFragmentAccessibilityTest.kt | 4 +-- .../topic/info/TopicInfoFragmentLocalTest.kt | 4 +-- .../lessons/TopicLessonsFragmentLocalTest.kt | 4 +-- .../QuestionPlayerActivityLocalTest.kt | 4 +-- .../RevisionCardActivityLocalTest.kt | 4 +-- .../AppLanguageResourceHandlerTest.kt | 4 +-- .../AppLanguageWatcherMixinTest.kt | 4 +-- .../MathExpressionAccessibilityUtilTest.kt | 4 +-- .../analytics/PerformanceMetricsLogger.kt | 6 ++++ .../PerformanceMetricsLoggerModule.kt | 16 ++++++++++ ....kt => LogReportWorkManagerInitializer.kt} | 6 ++-- ...rkerModule.kt => LogReportWorkerModule.kt} | 6 ++-- .../MetricLogSchedulingWorkerTest.kt | 22 ++++++------- ...=> LogReportWorkManagerInitializerTest.kt} | 32 +++++++++---------- .../loguploader/LogUploadWorkerTest.kt | 2 +- ...alizeDefaultLocaleRuleCustomContextTest.kt | 4 +-- ...InitializeDefaultLocaleRuleOmissionTest.kt | 4 +-- .../junit/InitializeDefaultLocaleRuleTest.kt | 4 +-- .../PerformanceMetricsUtilsTest.kt | 20 ++++++------ 148 files changed, 348 insertions(+), 326 deletions(-) create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt rename domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/{LogUploadWorkManagerInitializer.kt => LogReportWorkManagerInitializer.kt} (97%) rename domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/{LogUploadWorkerModule.kt => LogReportWorkerModule.kt} (71%) rename domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/{LogUploadWorkManagerInitializerTest.kt => LogReportWorkManagerInitializerTest.kt} (90%) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index 25aece298ef..92dbefc5948 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -37,7 +37,7 @@ 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.exceptions.UncaughtExceptionLoggerModule -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -63,6 +63,7 @@ import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Provider import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule /** * Root Dagger component for the application. All application-scoped modules should be included in @@ -93,7 +94,7 @@ import javax.inject.Singleton ViewBindingShimModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, RatioInputModule::class, UncaughtExceptionLoggerModule::class, ApplicationStartupListenerModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionDebugModule::class, FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, @@ -104,7 +105,7 @@ import javax.inject.Singleton NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - MetricLogSchedulerModule::class, + MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, // TODO(#59): Remove this module once we completely migrate to Bazel from Gradle as we can then // directly exclude debug files from the build and thus won't be requiring this module. NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class 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 ba2a841558c..8d30edd05ee 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 @@ -88,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -735,7 +735,7 @@ class AdministratorControlsActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 c7694223169..73ddaab9bbd 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 @@ -80,7 +80,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -601,7 +601,7 @@ class AdministratorControlsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 894b70c8199..1fee7fa0522 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 @@ -69,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -280,7 +280,7 @@ class AppVersionActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 beb69438acf..45550967b2e 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 @@ -59,7 +59,7 @@ 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.loguploader.LogUploadWorkerFactory -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -189,7 +189,7 @@ class ProfileAndDeviceIdActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 d6f4bc57c84..cdc3c07e7a9 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 @@ -78,7 +78,7 @@ import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.oppialogger.analytics.LearnerAnalyticsLogger import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule @@ -649,7 +649,7 @@ class ProfileAndDeviceIdFragmentTest { LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 df59509cf92..51f03a82354 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 @@ -70,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -503,7 +503,7 @@ class CompletedStoryListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e45061db40d..849767cce79 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 @@ -53,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -161,7 +161,7 @@ class LessonThumbnailImageViewTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 453409d3d18..01ccd5fe013 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 @@ -68,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1763,7 +1763,7 @@ class MathExpressionInteractionsViewTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0a9961aaa12..fee4f9a446c 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 @@ -59,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -172,7 +172,7 @@ class DrawableBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6b36d3068dd..da2f0639a6a 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 @@ -63,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -214,7 +214,7 @@ class ImageViewBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1153bd7ef6f..4a162efbdc8 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 @@ -64,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -302,7 +302,7 @@ class MarginBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e297c8cf07f..7fec1fa404b 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 @@ -66,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -490,7 +490,7 @@ class StateAssemblerMarginBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1bf0b3191c5..903ca29892d 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 @@ -64,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -488,7 +488,7 @@ class StateAssemblerPaddingBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 c20b2af3164..df9df7eef91 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 @@ -57,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -321,7 +321,7 @@ class TextViewBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 c1735ce7351..48a6a45b480 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 @@ -61,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -222,7 +222,7 @@ class ViewBindingAdaptersTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e5022299560..eee61266254 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 @@ -79,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -313,7 +313,7 @@ class DeveloperOptionsActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 3c039beadf5..ae43836818c 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 @@ -75,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -644,7 +644,7 @@ class DeveloperOptionsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1244ee96e90..67e6c7b8764 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 @@ -56,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -175,7 +175,7 @@ class MarkChaptersCompletedActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 928e30a086a..4bfc7128e20 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -903,7 +903,7 @@ class MarkChaptersCompletedFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0deb989b06d..4bc82fbb4ff 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 @@ -56,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -175,7 +175,7 @@ class MarkStoriesCompletedActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 5e8c2c5dc4f..9897f5aeec8 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -580,7 +580,7 @@ class MarkStoriesCompletedFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0aedf6d8d4e..f440739ad8e 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 @@ -56,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -175,7 +175,7 @@ class MarkTopicsCompletedActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 9f677943e57..8c7e419e49a 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -550,7 +550,7 @@ class MarkTopicsCompletedFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 109e70e701c..bd39b6bb65b 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 @@ -57,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -163,7 +163,7 @@ class ViewEventLogsActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 8d6e26325a3..8c635cfd9e3 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 @@ -17,7 +17,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.firebase.FirebaseApp import dagger.Component -import org.hamcrest.Matchers.not import org.junit.After import org.junit.Before import org.junit.Rule @@ -63,7 +62,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -564,7 +563,7 @@ class ViewEventLogsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 dd0cdd29398..c701931d9fe 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 @@ -57,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -167,7 +167,7 @@ class ForceNetworkTypeActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 defd8e3d336..699a45c0f65 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 @@ -62,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -383,7 +383,7 @@ class ForceNetworkTypeFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 149e44b36d2..f998c1ac080 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 @@ -54,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -152,7 +152,7 @@ class MathExpressionParserActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 39a65aa5273..0125a1793f0 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 @@ -64,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1402,7 +1402,7 @@ class MathExpressionParserFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 f5401ca0893..5501266a661 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 @@ -68,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -236,7 +236,7 @@ class FAQListFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 41e9dcb8eb2..5998c5afd47 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 @@ -62,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -208,7 +208,7 @@ class FAQSingleActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 baad49bd787..d20de2c03c7 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -141,7 +141,7 @@ class FaqListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 7a284ed0d26..dbc0c076144 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -143,7 +143,7 @@ class HelpActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 2d3e25a941f..ea488b52f61 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 @@ -75,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1177,7 +1177,7 @@ class HelpFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 647e2af2237..567a3ad5870 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 @@ -97,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1742,7 +1742,7 @@ class HomeActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 157e4032e81..ebda635c9d4 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 @@ -84,7 +84,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1495,7 +1495,7 @@ class RecentlyPlayedFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4b6b1351d10..cb10c9a9d6d 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -361,7 +361,7 @@ class TopicSummaryViewModelTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 b041e1e92d1..a2d82246de5 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -345,7 +345,7 @@ class WelcomeViewModelTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 94ea2653fc9..16ab31e65b5 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 @@ -53,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -357,7 +357,7 @@ class PromotedStoryListViewModelTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 58f9a657ff1..8efa68c1fef 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -367,7 +367,7 @@ class PromotedStoryViewModelTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 7c074f3ac7e..73e4d11932b 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 @@ -49,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -131,7 +131,7 @@ class MyDownloadsActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e00a159ed6a..87a332e0df4 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 @@ -60,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -222,7 +222,7 @@ class MyDownloadsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4a75018850e..8f6a4573fb9 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -140,7 +140,7 @@ class OnboardingActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 a6dd984f1f4..660363cbed7 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 @@ -77,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -683,7 +683,7 @@ class OnboardingFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e5caa8c9196..833b7929f65 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 @@ -69,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -447,7 +447,7 @@ class OngoingTopicListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 395f1bfa6d0..40a5d10712c 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -150,7 +150,7 @@ class AppLanguageActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1720dc9ebf2..812ffe1738e 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 @@ -59,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -246,7 +246,7 @@ class AppLanguageFragmentTest { ViewBindingShimModule::class, ApplicationStartupListenerModule::class, RatioInputModule::class, HintsAndSolutionConfigModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, - LogUploadWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, + LogReportWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, NetworkConnectionUtilDebugModule::class, NetworkConnectionDebugUtilModule::class, 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 fa2bed58f8b..0b932e7aad7 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -150,7 +150,7 @@ class AudioLanguageActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4376d4ebeb3..fa758996c03 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 @@ -58,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -238,7 +238,7 @@ class AudioLanguageFragmentTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, ApplicationStartupListenerModule::class, RatioInputModule::class, HintsAndSolutionConfigModule::class, - WorkManagerConfigurationModule::class, LogUploadWorkerModule::class, + WorkManagerConfigurationModule::class, LogReportWorkerModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 51ef476ad81..a4f4df3e3b1 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -142,7 +142,7 @@ class OptionsActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 27884619dd4..4ed44b60526 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 @@ -72,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule @@ -700,7 +700,7 @@ class OptionsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 ae37f1cea24..b4cb06e9a0c 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -150,7 +150,7 @@ class ReadingTextSizeActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 52e4e3e40fe..dab2043f995 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -305,7 +305,7 @@ class ReadingTextSizeFragmentTest { ViewBindingShimModule::class, ApplicationStartupListenerModule::class, RatioInputModule::class, HintsAndSolutionConfigModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, - LogUploadWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, + LogReportWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, NetworkConnectionUtilDebugModule::class, NetworkConnectionDebugUtilModule::class, diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt index 1fc440a2c5f..44bbda831aa 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -245,7 +245,7 @@ class CustomBulletSpanTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, PlatformParameterModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 29b83b1a068..f7490c25752 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 @@ -78,7 +78,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -700,7 +700,7 @@ class HtmlParserTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 026a0eb3a6a..c1cffe9c8f5 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 @@ -74,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.profile.ProfileManagementController @@ -467,7 +467,7 @@ class AudioFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 13ea34c89a2..431ea6eb36c 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 @@ -105,7 +105,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1947,7 +1947,7 @@ class ExplorationActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 080310ccaf2..f32ca4e7b68 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 @@ -128,7 +128,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -4306,7 +4306,7 @@ class StateFragmentTest { ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigFastShowTestModule::class, HintsAndSolutionProdModule::class, - WorkManagerConfigurationModule::class, LogUploadWorkerModule::class, + WorkManagerConfigurationModule::class, LogReportWorkerModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkConnectionUtilDebugModule::class, 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 9629aa9a6c1..3e866796a8b 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 @@ -84,7 +84,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1721,7 +1721,7 @@ class AddProfileActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 98236590291..d0c5b636d32 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 @@ -70,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -660,7 +660,7 @@ class AdminAuthActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6159eddba5c..c220eb08173 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 @@ -79,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1079,7 +1079,7 @@ class AdminPinActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 76f4a79eb69..043021539ed 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 @@ -73,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1140,7 +1140,7 @@ class PinPasswordActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 d90eee72e20..41b280efba5 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 @@ -72,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.profile.ProfileManagementController @@ -518,7 +518,7 @@ class ProfileChooserFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 f0c957a2ea4..db12973e33e 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 @@ -58,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -193,7 +193,7 @@ class ProfilePictureActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6b05ea0bf15..ad43ceca782 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -144,7 +144,7 @@ class ProfileProgressActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 b2955dcb059..b991bac7dbe 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 @@ -90,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -845,7 +845,7 @@ class ProfileProgressFragmentTest { LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, ApplicationStartupListenerModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 a207a2e9a59..68132e157c6 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 @@ -89,7 +89,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -760,7 +760,7 @@ class BindableAdapterTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 636fe149c84..fc2a7a323f3 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -214,7 +214,7 @@ class ResumeLessonActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 098001373d2..2b4094e5eeb 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 @@ -63,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -276,7 +276,7 @@ class ResumeLessonFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 efdbb35eeff..eea092c13b5 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 @@ -66,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.profile.ProfileManagementController @@ -367,7 +367,7 @@ class ProfileEditActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 ddcda48de71..475ebd23393 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 @@ -66,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.profile.ProfileManagementController @@ -344,7 +344,7 @@ class ProfileEditFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 4bf44638958..af26d939ac4 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -140,7 +140,7 @@ class ProfileListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 bbf88cff9dc..0e2645bacc9 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -378,7 +378,7 @@ class ProfileListFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 a6a0d30c004..b7cc4d67ae4 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -162,7 +162,7 @@ class ProfileRenameActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 f88763417df..7967db9bfff 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 @@ -67,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -452,7 +452,7 @@ class ProfileRenameFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 67a3fd83b5d..a9ab73dbd64 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -173,7 +173,7 @@ class ProfileResetPinActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4a137a97356..9585ebd8817 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 @@ -68,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1015,7 +1015,7 @@ class ProfileResetPinFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 3fe1604bb31..a6b8d607d97 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 @@ -73,7 +73,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -478,7 +478,7 @@ class SplashActivityTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 9cca4e9781e..b11467a1861 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 @@ -64,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -224,7 +224,7 @@ class StoryActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 f22f9aeab77..e86ef0bb891 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 @@ -98,7 +98,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -892,7 +892,7 @@ class StoryFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0d3c55261f1..0f7adf5a130 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 @@ -61,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -217,7 +217,7 @@ class DragDropTestActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0985f555568..573071b961c 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -380,7 +380,7 @@ class ImageRegionSelectionInteractionViewTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 68404f0feaa..9f0e6365fac 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 @@ -67,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1115,7 +1115,7 @@ class InputInteractionViewTestActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 017b47e5702..55ff0dc8c01 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 @@ -87,7 +87,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -428,7 +428,7 @@ class NavigationDrawerActivityDebugTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 8acb7046c00..a6169d0cf5c 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 @@ -95,7 +95,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -977,7 +977,7 @@ class NavigationDrawerActivityProdTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, 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 42d893f3abb..f1b724482fc 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 @@ -56,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -195,7 +195,7 @@ class TestFontScaleConfigurationUtilActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6311b17fa9a..6d5e1045f63 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -192,7 +192,7 @@ class TopicTestActivityForStoryTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 9d2caf4de06..ea121f9976c 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -152,7 +152,7 @@ class LicenseListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 31d05596c1c..b0136bebb4b 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 @@ -67,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -362,7 +362,7 @@ class LicenseListFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 8f88e75d8bb..1dbb4731e47 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -161,7 +161,7 @@ class LicenseTextViewerActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 62406e2ba8d..8d2bfd528ab 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 @@ -57,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -340,7 +340,7 @@ class LicenseTextViewerFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 6f904e3c2f9..46380df8985 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -149,7 +149,7 @@ class ThirdPartyDependencyListActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 1109f817ac6..f3a604e49f2 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 @@ -66,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -472,7 +472,7 @@ class ThirdPartyDependencyListFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 93e663a8a4a..09a8ab8b3f5 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 @@ -63,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -198,7 +198,7 @@ class TopicActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 48700e24d59..591fa171629 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 @@ -74,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -652,7 +652,7 @@ class TopicFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 c0898715487..cf1f9701301 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 @@ -72,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -423,7 +423,7 @@ class ConceptCardFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4c8c0eef8b6..dd1329ba465 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 @@ -76,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -479,7 +479,7 @@ class TopicInfoFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 d8036b9b35a..41bd01642d1 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 @@ -82,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1001,7 +1001,7 @@ class TopicLessonsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 5a15bdcbd35..b4464d235ea 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -424,7 +424,7 @@ class TopicPracticeFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 18bedd79642..bf0d63f7266 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 @@ -96,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.InternalMasteryMultiplyFactor @@ -715,7 +715,7 @@ class QuestionPlayerActivityTest { ViewBindingShimModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigFastShowTestModule::class, HintsAndSolutionProdModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, - LogUploadWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, + LogReportWorkerModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, NetworkConfigProdModule::class, NetworkConnectionUtilDebugModule::class, NetworkConnectionDebugUtilModule::class, 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 726c9e6eb80..ac77601c7e9 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -320,7 +320,7 @@ class TopicRevisionFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 c83c20ddef9..9998f05c23d 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 @@ -64,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -274,7 +274,7 @@ class RevisionCardActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 445a72e33f0..74c0468351a 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 @@ -82,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -586,7 +586,7 @@ class RevisionCardFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 c9dd3e508cc..429aad5cb3b 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 @@ -49,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -147,7 +147,7 @@ class RatioExtensionsTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4eca4362df3..1e7327dc36e 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 @@ -62,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -225,7 +225,7 @@ class WalkthroughActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 5180aa3350b..0291f29ac9c 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 @@ -65,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -282,7 +282,7 @@ class WalkthroughFinalFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 7e51303ff99..8996550eb8f 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 @@ -66,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -308,7 +308,7 @@ class WalkthroughTopicListFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 d124e67a7fb..aa815ea3c47 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 @@ -61,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -205,7 +205,7 @@ class WalkthroughWelcomeFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 92711443d86..d2133a1f742 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -171,7 +171,7 @@ class ActivityIntentFactoriesTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 d62ea81ea88..146ca02b16e 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 @@ -53,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -142,7 +142,7 @@ class HomeActivityLocalTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1c456d24630..41e78046d7c 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 @@ -48,7 +48,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -253,7 +253,7 @@ class FractionParsingUiErrorTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::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 27063d77e1f..83ff801efcb 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 @@ -49,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -257,7 +257,7 @@ class StringToRatioParserTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 360220da811..bb23e464b63 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 @@ -54,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -203,7 +203,7 @@ class ExplorationActivityLocalTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 4fe37db7c6f..955e2439d2e 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -2287,7 +2287,7 @@ class StateFragmentLocalTest { AccessibilityTestModule::class, LogStorageModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 9831c6fe66f..f722be029ce 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -133,7 +133,7 @@ class ProfileChooserFragmentLocalTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 ebca8ce96a5..da0b4ee2db6 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 @@ -52,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -157,7 +157,7 @@ class StoryActivityLocalTest { ImageClickInputModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 724a72ab179..c7be7965342 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 @@ -54,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -165,7 +165,7 @@ class CompletedStoryListSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 db17bd4e90e..8100882ac57 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 @@ -54,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -179,7 +179,7 @@ class HomeSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 e1940a4ff1a..758b5626894 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 @@ -55,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -176,7 +176,7 @@ class OngoingTopicListSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6a6e051cc77..1ad2174689b 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 @@ -68,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterController import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -349,7 +349,7 @@ class PlatformParameterIntegrationTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 9b0988a43ed..28d25e7c35c 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 @@ -53,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -378,7 +378,7 @@ class ProfileChooserSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 ddb8bf06ac8..df705333f9f 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 @@ -54,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -162,7 +162,7 @@ class ProfileProgressSpanCountTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 493ac5ce52b..e5efacb041d 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 @@ -56,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -297,7 +297,7 @@ class RecentlyPlayedSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 edf710c64b4..2f57d063b42 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 @@ -53,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -162,7 +162,7 @@ class TopicRevisionSpanTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 1866c48e456..bb05f88930f 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 @@ -50,7 +50,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -188,7 +188,7 @@ class TestActivityTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 14ce543faa6..9e55690a67f 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 @@ -60,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -187,7 +187,7 @@ class AdministratorControlsFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 da8a16bdcd9..5f62603f0fc 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 @@ -63,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule @@ -298,7 +298,7 @@ class OptionsFragmentTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, ApplicationStartupListenerModule::class, RatioInputModule::class, HintsAndSolutionConfigModule::class, NetworkConfigProdModule::class, - WorkManagerConfigurationModule::class, LogUploadWorkerModule::class, + WorkManagerConfigurationModule::class, LogReportWorkerModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 5b20e41d31c..58fe182bf36 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -195,7 +195,7 @@ class PlayerSplitScreenTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 24565f44dd7..7cc0d781c48 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -204,7 +204,7 @@ class StateFragmentAccessibilityTest { ImageClickInputModule::class, LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, CachingTestModule::class, RatioInputModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 fd517ae0c36..2988800f422 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 @@ -50,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -145,7 +145,7 @@ class TopicInfoFragmentLocalTest { ImageClickInputModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 919664f7e58..205a5fecaab 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 @@ -49,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -148,7 +148,7 @@ class TopicLessonsFragmentLocalTest { ImageClickInputModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 3af85d95b99..1efcd7ce08e 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,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.InternalMasteryMultiplyFactor @@ -499,7 +499,7 @@ class QuestionPlayerActivityLocalTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, ApplicationStartupListenerModule::class, RatioInputModule::class, HintsAndSolutionConfigModule::class, NetworkConfigProdModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 fda93fb355e..88dd1c0c09f 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 @@ -49,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -138,7 +138,7 @@ class RevisionCardActivityLocalTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 e23173d0f1b..0ad3e2ed6fa 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 @@ -55,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -546,7 +546,7 @@ class AppLanguageResourceHandlerTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 daa9f02e4a6..caf58633774 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 @@ -60,7 +60,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -261,7 +261,7 @@ class AppLanguageWatcherMixinTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 badd403918f..b6e3b935c70 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 @@ -67,7 +67,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1320,7 +1320,7 @@ class MathExpressionAccessibilityUtilTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 4683ed468ae..05b2073b7e1 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 @@ -24,6 +24,7 @@ class PerformanceMetricsLogger @Inject constructor( firstTimestamp = oppiaClock.getCurrentTimeMs() } + /** Logs the apk size of the application as a performance metric. */ fun logApkSize() { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -32,6 +33,7 @@ class PerformanceMetricsLogger @Inject constructor( ) } + /** Logs the storage usage of the application as a performance metric. */ fun logStorageUsage() { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -40,6 +42,7 @@ class PerformanceMetricsLogger @Inject constructor( ) } + /** Logs the startup latency of the application as a performance metric. */ fun logStartupLatency() { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp if (startupLatency >= 0) { @@ -51,6 +54,7 @@ class PerformanceMetricsLogger @Inject constructor( } } + /** Logs the memrory usage of the application as a performance metric. */ fun logMemoryUsage() { performanceMetricsController.logMediumPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -59,6 +63,7 @@ class PerformanceMetricsLogger @Inject constructor( ) } + /** Logs the network usage of the application as a performance metric. */ fun logNetworkUsage() { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -70,6 +75,7 @@ class PerformanceMetricsLogger @Inject constructor( ) } + /** Logs the cpu usage of the application as a performance metric. */ fun logCpuUsage(cpuUsage: Long) { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt new file mode 100644 index 00000000000..be6f5cd174d --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt @@ -0,0 +1,16 @@ +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 [PerformanceMetricsLogger] as an [ApplicationStartupListener] */ +@Module +interface PerformanceMetricsLoggerModule { + @Binds + @IntoSet + fun bindPerformanceMetricsLogger( + performanceMetricsLogger: PerformanceMetricsLogger + ): ApplicationStartupListener +} diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt similarity index 97% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt index ec9041df00a..519f1322fe6 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt @@ -20,7 +20,7 @@ import javax.inject.Singleton /** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ @Singleton -class LogUploadWorkManagerInitializer @Inject constructor( +class LogReportWorkManagerInitializer @Inject constructor( private val context: Context, private val logUploader: LogUploader, private val metricLogScheduler: MetricLogScheduler, @@ -132,8 +132,8 @@ class LogUploadWorkManagerInitializer @Inject constructor( ) } - /** Returns the worker constraints set for the log uploading work requests. */ - fun getLogUploadWorkerConstraints(): Constraints = logReportWorkerConstraints + /** Returns the worker constraints set for the log reporting work requests. */ + fun getLogReportWorkerConstraints(): Constraints = logReportWorkerConstraints /** Returns the [UUID] of the work request that is enqueued for uploading event logs. */ fun getWorkRequestForEventsId(): UUID = workRequestForUploadingEvents.id diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkerModule.kt similarity index 71% rename from domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerModule.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkerModule.kt index 97da4387bc0..d3b8e0efbfc 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkerModule.kt @@ -7,11 +7,11 @@ import org.oppia.android.domain.oppialogger.ApplicationStartupListener /** Provides [LogUploadWorker] related dependencies. */ @Module -interface LogUploadWorkerModule { +interface LogReportWorkerModule { @Binds @IntoSet - fun bindLogUploadWorkRequest( - logUploadWorkManagerInitializer: LogUploadWorkManagerInitializer + fun bindLogReportWorkRequest( + logReportWorkManagerInitializer: LogReportWorkManagerInitializer ): ApplicationStartupListener } 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 ebfa05f7b9f..db2e6f40f83 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 @@ -13,7 +13,7 @@ import androidx.work.WorkInfo import androidx.work.WorkManager import androidx.work.testing.SynchronousExecutor import androidx.work.testing.WorkManagerTestInitHelper -import com.google.common.truth.Truth +import com.google.common.truth.Truth.assertThat import dagger.Binds import dagger.BindsInstance import dagger.Component @@ -32,7 +32,7 @@ import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSiz import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsController import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.testing.oppialogger.loguploader.FakeLogUploader @@ -124,8 +124,8 @@ class MetricLogSchedulingWorkerTest { testCoroutineDispatchers.runCurrent() val workInfo = workManager.getWorkInfoById(request.id) - Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - Truth.assertThat( + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + assertThat( fakePerformanceMetricsEventLogger .getMostRecentPerformanceMetricsEvent() .loggableMetric @@ -150,8 +150,8 @@ class MetricLogSchedulingWorkerTest { testCoroutineDispatchers.runCurrent() val workInfo = workManager.getWorkInfoById(request.id) - Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - Truth.assertThat( + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + assertThat( fakePerformanceMetricsEventLogger .getMostRecentPerformanceMetricsEvent() .loggableMetric @@ -176,8 +176,8 @@ class MetricLogSchedulingWorkerTest { testCoroutineDispatchers.runCurrent() val workInfo = workManager.getWorkInfoById(request.id) - Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - Truth.assertThat( + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + assertThat( fakePerformanceMetricsEventLogger .getMostRecentPerformanceMetricsEvent() .loggableMetric @@ -203,8 +203,8 @@ class MetricLogSchedulingWorkerTest { testCoroutineDispatchers.runCurrent() val workInfo = workManager.getWorkInfoById(request.id) - Truth.assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) - Truth.assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) + assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() } private fun setUpTestApplicationComponent() { @@ -290,7 +290,7 @@ class MetricLogSchedulingWorkerTest { @Component( modules = [ TestModule::class, RobolectricModule::class, TestLogStorageModule::class, - TestDispatcherModule::class, LogUploadWorkerModule::class, + TestDispatcherModule::class, LogReportWorkerModule::class, TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt similarity index 90% rename from domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt rename to domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt index 4e0daef7a27..b8ca4b125a7 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkManagerInitializerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializerTest.kt @@ -58,7 +58,7 @@ import javax.inject.Singleton @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(manifest = Config.NONE) -class LogUploadWorkManagerInitializerTest { +class LogReportWorkManagerInitializerTest { @Inject lateinit var logUploadWorkerFactory: LogUploadWorkerFactory @@ -67,7 +67,7 @@ class LogUploadWorkManagerInitializerTest { lateinit var metricLogSchedulingWorkerFactory: MetricLogSchedulingWorkerFactory @Inject - lateinit var logUploadWorkManagerInitializer: LogUploadWorkManagerInitializer + lateinit var logReportWorkManagerInitializer: LogReportWorkManagerInitializer @Inject lateinit var exceptionsController: ExceptionsController @@ -116,18 +116,18 @@ class LogUploadWorkManagerInitializerTest { @Test fun testWorkRequest_onCreate_enqueuesRequest_verifyRequestId() { - logUploadWorkManagerInitializer.onCreate() + logReportWorkManagerInitializer.onCreate() testCoroutineDispatchers.runCurrent() - val enqueuedEventWorkRequestId = logUploadWorkManagerInitializer.getWorkRequestForEventsId() + val enqueuedEventWorkRequestId = logReportWorkManagerInitializer.getWorkRequestForEventsId() val enqueuedExceptionWorkRequestId = - logUploadWorkManagerInitializer.getWorkRequestForExceptionsId() + logReportWorkManagerInitializer.getWorkRequestForExceptionsId() val enqueuedSchedulingStorageUsageMetricWorkRequestId = - logUploadWorkManagerInitializer.getWorkRequestForSchedulingStorageUsageMetricLogsId() + logReportWorkManagerInitializer.getWorkRequestForSchedulingStorageUsageMetricLogsId() val enqueuedSchedulingMemoryUsageMetricWorkRequestId = - logUploadWorkManagerInitializer.getWorkRequestForSchedulingMemoryUsageMetricLogsId() + logReportWorkManagerInitializer.getWorkRequestForSchedulingMemoryUsageMetricLogsId() val enqueuedSchedulingPeriodicPerformanceMetricWorkRequestId = - logUploadWorkManagerInitializer.getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId() + logReportWorkManagerInitializer.getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId() assertThat(fakeLogUploader.getMostRecentEventRequestId()).isEqualTo(enqueuedEventWorkRequestId) assertThat(fakeLogUploader.getMostRecentExceptionRequestId()).isEqualTo( @@ -152,7 +152,7 @@ class LogUploadWorkManagerInitializerTest { .build() val logUploadingWorkRequestConstraints = - logUploadWorkManagerInitializer.getLogUploadWorkerConstraints() + logReportWorkManagerInitializer.getLogReportWorkerConstraints() assertThat(logUploadingWorkRequestConstraints).isEqualTo(workerConstraints) } @@ -166,7 +166,7 @@ class LogUploadWorkManagerInitializerTest { ) .build() - assertThat(logUploadWorkManagerInitializer.getWorkRequestDataForEvents()).isEqualTo( + assertThat(logReportWorkManagerInitializer.getWorkRequestDataForEvents()).isEqualTo( workerCaseForUploadingEvents ) } @@ -180,7 +180,7 @@ class LogUploadWorkManagerInitializerTest { ) .build() - assertThat(logUploadWorkManagerInitializer.getWorkRequestDataForExceptions()).isEqualTo( + assertThat(logReportWorkManagerInitializer.getWorkRequestDataForExceptions()).isEqualTo( workerCaseForUploadingExceptions ) } @@ -195,7 +195,7 @@ class LogUploadWorkManagerInitializerTest { .build() assertThat( - logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingStorageUsageMetricLogs() + logReportWorkManagerInitializer.getWorkRequestDataForSchedulingStorageUsageMetricLogs() ).isEqualTo( workerCaseForSchedulingStorageUsageMetricLogs ) @@ -211,7 +211,7 @@ class LogUploadWorkManagerInitializerTest { .build() assertThat( - logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs() + logReportWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs() ).isEqualTo( workerCaseForSchedulingPeriodicPerformanceMetricLogs ) @@ -227,7 +227,7 @@ class LogUploadWorkManagerInitializerTest { .build() assertThat( - logUploadWorkManagerInitializer.getWorkRequestDataForSchedulingMemoryUsageMetricLogs() + logReportWorkManagerInitializer.getWorkRequestDataForSchedulingMemoryUsageMetricLogs() ).isEqualTo( workerCaseForSchedulingMemoryUsageMetricLogs ) @@ -282,7 +282,7 @@ class LogUploadWorkManagerInitializerTest { modules = [ TestModule::class, TestLogReportingModule::class, RobolectricModule::class, TestLogStorageModule::class, TestDispatcherModule::class, - LogUploadWorkerModule::class, TestFirebaseLogUploaderModule::class, + LogReportWorkerModule::class, TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, LoggerModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, @@ -297,6 +297,6 @@ class LogUploadWorkManagerInitializerTest { fun build(): TestApplicationComponent } - fun inject(logUploadWorkRequestTest: LogUploadWorkManagerInitializerTest) + fun inject(logUploadWorkRequestTest: LogReportWorkManagerInitializerTest) } } diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt index ffdd501d390..3e7881b4525 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt @@ -336,7 +336,7 @@ class LogUploadWorkerTest { @Component( modules = [ TestModule::class, RobolectricModule::class, TestLogStorageModule::class, - TestDispatcherModule::class, LogUploadWorkerModule::class, + TestDispatcherModule::class, LogReportWorkerModule::class, TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, 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 ff396b8c9a1..d69d9dd7945 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 @@ -50,7 +50,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -254,7 +254,7 @@ class InitializeDefaultLocaleRuleCustomContextTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 455863ee05c..1f855c35610 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 @@ -47,7 +47,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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -130,7 +130,7 @@ class InitializeDefaultLocaleRuleOmissionTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, 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 79b77aefb03..c389bd48a8b 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -134,7 +134,7 @@ class InitializeDefaultLocaleRuleTest { PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverTestModule::class, ViewBindingShimModule::class, RatioInputModule::class, NetworkConfigProdModule::class, ApplicationStartupListenerModule::class, HintsAndSolutionConfigModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, ExplorationStorageModule::class, NetworkModule::class, HintsAndSolutionProdModule::class, diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 2a1ed48922e..17ff259bda2 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -8,7 +8,7 @@ import android.content.pm.ApplicationInfo import android.content.pm.PackageInfo import android.net.TrafficStats import androidx.test.core.app.ApplicationProvider -import com.google.common.truth.Truth +import com.google.common.truth.Truth.assertThat import dagger.BindsInstance import dagger.Component import dagger.Module @@ -81,7 +81,7 @@ class PerformanceMetricsUtilsTest { memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() shadowActivityManager.setMemoryInfo(memoryInfo) val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - Truth.assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) } @Test @@ -90,7 +90,7 @@ class PerformanceMetricsUtilsTest { val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace val expectedStorageValue = permanentStorageUsage + cacheStorageUsage - Truth.assertThat(performanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) + assertThat(performanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) } @Test @@ -105,7 +105,7 @@ class PerformanceMetricsUtilsTest { else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } - Truth.assertThat(performanceMetricsUtils.getDeviceStorageTier()) + assertThat(performanceMetricsUtils.getDeviceStorageTier()) .isEqualTo(expectedStorageTierValue) } @@ -113,7 +113,7 @@ class PerformanceMetricsUtilsTest { fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(context.applicationInfo.uid) - Truth.assertThat(performanceMetricsUtils.getTotalSentBytes()) + assertThat(performanceMetricsUtils.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) } @@ -121,7 +121,7 @@ class PerformanceMetricsUtilsTest { fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(context.applicationInfo.uid) - Truth.assertThat(performanceMetricsUtils.getTotalReceivedBytes()) + assertThat(performanceMetricsUtils.getTotalReceivedBytes()) .isEqualTo(expectedNetworkBytesReceived) } @@ -146,7 +146,7 @@ class PerformanceMetricsUtilsTest { totalPssUsedTest += element.totalPss } } - Truth.assertThat(performanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) + assertThat(performanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) } @Test @@ -171,21 +171,21 @@ class PerformanceMetricsUtilsTest { ) val apkSize = performanceMetricsUtils.getApkSize() - Truth.assertThat(apkSize).isEqualTo(testApkSize) + assertThat(apkSize).isEqualTo(testApkSize) } @Test fun testPerformanceMetricsUtils_putAppInForeground_verifyIsAppInForegroundReturnsCorrectValue() { performanceMetricsUtils.onAppInForeground() - Truth.assertThat(performanceMetricsUtils.isAppInForeground()).isTrue() + assertThat(performanceMetricsUtils.isAppInForeground()).isTrue() } @Test fun testPerformanceMetricsUtils_putAppInBackground_verifyIsAppInForegroundReturnsCorrectValue() { performanceMetricsUtils.onAppInBackground() - Truth.assertThat(performanceMetricsUtils.isAppInForeground()).isFalse() + assertThat(performanceMetricsUtils.isAppInForeground()).isFalse() } private fun setUpTestApplicationComponent() { From 54b8b9564fd43edaa3782fda365e0d8ea031a723 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 10 Jul 2022 02:15:29 +0530 Subject: [PATCH 069/149] nits --- .../org/oppia/android/app/application/ApplicationComponent.kt | 2 +- .../learneranalytics/ProfileAndDeviceIdActivityTest.kt | 2 +- .../learneranalytics/ProfileAndDeviceIdFragmentTest.kt | 2 +- .../oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index 92dbefc5948..b2f76c423b4 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -36,6 +36,7 @@ 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.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -63,7 +64,6 @@ import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Provider import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule /** * Root Dagger component for the application. All application-scoped modules should be included in 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 45550967b2e..78c1e48a2ad 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 @@ -58,8 +58,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.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule 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 cdc3c07e7a9..0cc4803fbc6 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,9 +76,9 @@ 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.LearnerAnalyticsLogger +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory -import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule 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 db2e6f40f83..5f7ab410179 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,8 +31,8 @@ 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.PerformanceMetricsController -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker 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 From 3b3fa6d21c2710e2810ba5a99053de4a982fab6a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 10 Jul 2022 02:23:27 +0530 Subject: [PATCH 070/149] nits --- .../oppia/android/util/logging/EventBundleCreatorTest.kt | 2 +- .../android/util/logging/firebase/LogReportingModuleTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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 a1c4eff0a0a..2f179ae66e2 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 @@ -177,7 +177,7 @@ class EventBundleCreatorTest { } @Test - fun testFillMetricsBundle_eventWithDefaultLoggableMetric_fillsDetailsAndRetsUnknownContext() { + fun testFillMetricsBundle_eventWithDefaultLoggableMetric_fillsDetailsAndRetsUnknownLog() { setUpTestApplicationComponent() val bundle = Bundle() val performanceMetricLog = createPerformanceMetricLog( diff --git a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt index 92431f28419..83f50f95c21 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt @@ -4,7 +4,7 @@ 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 +import com.google.common.truth.Truth.assertThat import dagger.Binds import dagger.BindsInstance import dagger.Component @@ -58,12 +58,12 @@ class LogReportingModuleTest { @Test fun testModule_injectsProductionImplementationOfEventLogger() { - Truth.assertThat(eventLogger).isInstanceOf(FirebaseEventLogger::class.java) + assertThat(eventLogger).isInstanceOf(FirebaseEventLogger::class.java) } @Test fun testModule_injectsProductionImplementationOfPerformanceMetricsEventLogger() { - Truth.assertThat(performanceMetricsEventLogger).isInstanceOf(FirebaseEventLogger::class.java) + assertThat(performanceMetricsEventLogger).isInstanceOf(FirebaseEventLogger::class.java) } private fun setUpTestApplicationComponent() { From 36978b56347f422de36f2f6b901c8a2da07f3ba3 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 05:23:04 +0530 Subject: [PATCH 071/149] review updates. --- .../analytics/PerformanceMetricsController.kt | 16 +++--- .../analytics/PerformanceMetricsLogger.kt | 54 +++++++++++++++---- .../PerformanceMetricsControllerTest.kt | 5 +- .../LogReportWorkManagerInitializerTest.kt | 18 +++---- .../FakePerformanceMetricsEventLogger.kt | 2 +- .../FakePerformanceMetricsEventLoggerTest.kt | 6 +-- .../PerformanceMetricsUtils.kt | 1 + 7 files changed, 61 insertions(+), 41 deletions(-) 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 5ff35a789be..515da6e81b3 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 @@ -17,8 +17,8 @@ import javax.inject.Inject /** * Controller for handling performance metrics event logging. * - * Callers should not use this class directly; instead, they should use ``OppiaLogger`` which - * provides convenience log methods. + * Callers should not use this class directly; instead, they should use ``PerformanceMetricsLogger`` + * which provides convenience log methods. */ class PerformanceMetricsController @Inject constructor( private val performanceMetricsUtils: PerformanceMetricsUtils, @@ -124,9 +124,8 @@ class PerformanceMetricsController @Inject constructor( private fun getLeastRecentMetricLogIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = oppiaMetricLogs.oppiaMetricLogList.withIndex() .filter { it.value.priority == Priority.LOW_PRIORITY } - .minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentMediumPriorityEventIndex( - oppiaMetricLogs - ) + .minByOrNull { it.value.timestampMillis }?.index + ?: getLeastRecentMediumPriorityEventIndex(oppiaMetricLogs) /** * Returns the index of the least recent event from the existing store on the basis of recency and @@ -139,9 +138,8 @@ class PerformanceMetricsController @Inject constructor( private fun getLeastRecentMediumPriorityEventIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = oppiaMetricLogs.oppiaMetricLogList.withIndex() .filter { it.value.priority == Priority.MEDIUM_PRIORITY } - .minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentGeneralEventIndex( - oppiaMetricLogs - ) + .minByOrNull { it.value.timestampMillis }?.index + ?: getLeastRecentGeneralEventIndex(oppiaMetricLogs) /** Returns the index of the least recent event regardless of their priority. */ private fun getLeastRecentGeneralEventIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = @@ -157,7 +155,7 @@ class PerformanceMetricsController @Inject constructor( * As we are using the await call on the deferred output of readDataAsync, the failure case would * be caught and it'll throw an error. */ - suspend fun getMetricLogStoreList(): MutableList { + suspend fun getMetricLogStoreList(): List { return metricLogStore.readDataAsync().await().oppiaMetricLogList } 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 05b2073b7e1..3eb79f5d07e 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 @@ -7,6 +7,12 @@ import org.oppia.android.util.system.OppiaClock import javax.inject.Inject import javax.inject.Singleton +/** + * Convenience logger for performance metrics related analytics events. + * + * This logger is meant primarily to be used directly in places where a certain performance metric + * has to be logged. + */ @Singleton class PerformanceMetricsLogger @Inject constructor( private val performanceMetricsController: PerformanceMetricsController, @@ -15,8 +21,11 @@ class PerformanceMetricsLogger @Inject constructor( ) : ApplicationStartupListener { /** - * Use 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]. + * 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 firstTimestamp: Long = Long.MAX_VALUE @@ -24,7 +33,11 @@ class PerformanceMetricsLogger @Inject constructor( firstTimestamp = oppiaClock.getCurrentTimeMs() } - /** Logs the apk size of the application as a performance metric. */ + /** + * Logs the apk size of the application as a performance metric for the current state of the app. + * It must be noted that the value of this metric won't change across calls during the same + * session. + */ fun logApkSize() { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -33,7 +46,11 @@ class PerformanceMetricsLogger @Inject constructor( ) } - /** Logs the storage usage of the application as a performance metric. */ + /** + * Logs the storage 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 + * session. + */ fun logStorageUsage() { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -42,7 +59,10 @@ class PerformanceMetricsLogger @Inject constructor( ) } - /** Logs the startup latency of the application as a performance metric. */ + /** + * Logs the startup latency of the application as a performance metric for the current state of + * the app. This metric should only be logged when the application starts. + */ fun logStartupLatency() { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp if (startupLatency >= 0) { @@ -54,7 +74,11 @@ class PerformanceMetricsLogger @Inject constructor( } } - /** Logs the memrory usage of the application as a performance metric. */ + /** + * Logs the memory 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 + * session. + */ fun logMemoryUsage() { performanceMetricsController.logMediumPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -63,7 +87,11 @@ class PerformanceMetricsLogger @Inject constructor( ) } - /** Logs the network usage of the application as a performance metric. */ + /** + * Logs the network 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 + * session. + */ fun logNetworkUsage() { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -75,7 +103,11 @@ class PerformanceMetricsLogger @Inject constructor( ) } - /** Logs the cpu usage of the application as a performance metric. */ + /** + * 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 + * session. + */ fun logCpuUsage(cpuUsage: Long) { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), @@ -95,7 +127,7 @@ class PerformanceMetricsLogger @Inject constructor( * application. These metrics are important to log and should be prioritized over metrics logged * via [logMediumPriorityMetricEvent] and [logLowPriorityMetricEvent]. */ - internal fun PerformanceMetricsController.logHighPriorityMetricEvent( + private fun PerformanceMetricsController.logHighPriorityMetricEvent( timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric @@ -122,7 +154,7 @@ class PerformanceMetricsLogger @Inject constructor( * application. These metrics are important to log (but not as important as high priority metrics) * and should be prioritized over metrics logged via [logLowPriorityMetricEvent]. */ - internal fun PerformanceMetricsController.logMediumPriorityMetricEvent( + private fun PerformanceMetricsController.logMediumPriorityMetricEvent( timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric @@ -152,7 +184,7 @@ class PerformanceMetricsLogger @Inject constructor( * it's unexpected for events to actually be dropped since the app is configured to support a * large number of cached events at one time). */ - internal fun PerformanceMetricsController.logLowPriorityMetricEvent( + private fun PerformanceMetricsController.logLowPriorityMetricEvent( timestamp: Long, currentScreen: OppiaMetricLog.CurrentScreen, loggableMetric: OppiaMetricLog.LoggableMetric 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 f2ccbaa92c4..055c2357a71 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 @@ -62,7 +62,7 @@ private const val TEST_STARTUP_LATENCY = Long.MAX_VALUE private const val TEST_NETWORK_USAGE = Long.MAX_VALUE private const val TEST_MEMORY_USAGE = Long.MAX_VALUE -/** Tests for [PerformanceMetricsControllerTest]. */ +/** Tests for [PerformanceMetricsController]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @@ -76,9 +76,6 @@ class PerformanceMetricsControllerTest { @Inject lateinit var oppiaLogger: OppiaLogger - @Inject - lateinit var performanceMetricsLogger: PerformanceMetricsLogger - @Inject lateinit var networkConnectionUtil: NetworkConnectionDebugUtil 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 b8ca4b125a7..c5984f10891 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 @@ -180,9 +180,9 @@ class LogReportWorkManagerInitializerTest { ) .build() - assertThat(logReportWorkManagerInitializer.getWorkRequestDataForExceptions()).isEqualTo( - workerCaseForUploadingExceptions - ) + assertThat( + logReportWorkManagerInitializer.getWorkRequestDataForExceptions() + ).isEqualTo(workerCaseForUploadingExceptions) } @Test @@ -196,9 +196,7 @@ class LogReportWorkManagerInitializerTest { assertThat( logReportWorkManagerInitializer.getWorkRequestDataForSchedulingStorageUsageMetricLogs() - ).isEqualTo( - workerCaseForSchedulingStorageUsageMetricLogs - ) + ).isEqualTo(workerCaseForSchedulingStorageUsageMetricLogs) } @Test @@ -212,9 +210,7 @@ class LogReportWorkManagerInitializerTest { assertThat( logReportWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs() - ).isEqualTo( - workerCaseForSchedulingPeriodicPerformanceMetricLogs - ) + ).isEqualTo(workerCaseForSchedulingPeriodicPerformanceMetricLogs) } @Test @@ -228,9 +224,7 @@ class LogReportWorkManagerInitializerTest { assertThat( logReportWorkManagerInitializer.getWorkRequestDataForSchedulingMemoryUsageMetricLogs() - ).isEqualTo( - workerCaseForSchedulingMemoryUsageMetricLogs - ) + ).isEqualTo(workerCaseForSchedulingMemoryUsageMetricLogs) } private fun setUpTestApplicationComponent() { diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt index 310c9c7a4df..c48666eb680 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricsEventLogger.kt @@ -6,7 +6,7 @@ import java.util.concurrent.CopyOnWriteArrayList import javax.inject.Inject import javax.inject.Singleton -/** A test specific fake for the event logger. */ +/** A test specific fake for the event logger. */ @Singleton class FakePerformanceMetricsEventLogger @Inject constructor() : PerformanceMetricsEventLogger { private val performanceMetricsEventList = CopyOnWriteArrayList() diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt index c0f2294ffa4..a517f95109a 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt @@ -25,7 +25,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -/** Tests for [FakePerformanceMetricsEventLoggerTest]. */ +/** Tests for [FakePerformanceMetricsEventLogger]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @@ -86,11 +86,9 @@ class FakePerformanceMetricsEventLoggerTest { performanceMetricsEventLogger.logPerformanceMetric(metricLog1) fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() - val eventException = assertThrows(NoSuchElementException::class) { + assertThrows(NoSuchElementException::class) { fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() } - - assertThat(eventException).isInstanceOf(NoSuchElementException::class.java) } @Test diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index e1406c838c2..b1fdf0c6520 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -12,6 +12,7 @@ import org.oppia.android.util.logging.ConsoleLogger import java.io.File import javax.inject.Inject +/** Utility to extract performance metrics from the underlying android system. */ class PerformanceMetricsUtils @Inject constructor( private val context: Application, private val consoleLogger: ConsoleLogger From 69b4356bd3ebca8b7743bb6fdb3af289433d4685 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 05:23:51 +0530 Subject: [PATCH 072/149] nit --- .../testing/FakePerformanceMetricsEventLoggerTest.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt index a517f95109a..63afc482661 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricsEventLoggerTest.kt @@ -33,8 +33,10 @@ import javax.inject.Singleton @Config(manifest = Config.NONE) class FakePerformanceMetricsEventLoggerTest { - @Inject lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger - @Inject lateinit var performanceMetricsEventLogger: PerformanceMetricsEventLogger + @Inject + lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + @Inject + lateinit var performanceMetricsEventLogger: PerformanceMetricsEventLogger private val metricLog1 = OppiaMetricLog.newBuilder().setPriority(HIGH_PRIORITY).build() private val metricLog2 = OppiaMetricLog.newBuilder().setPriority(MEDIUM_PRIORITY).build() @@ -86,7 +88,7 @@ class FakePerformanceMetricsEventLoggerTest { performanceMetricsEventLogger.logPerformanceMetric(metricLog1) fakePerformanceMetricsEventLogger.clearAllPerformanceMetricsEvents() - assertThrows(NoSuchElementException::class) { + assertThrows(NoSuchElementException::class) { fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() } } From 6d9af12e6143f38d0fb87bf3d4bd5bc3aa18a422 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 05:59:37 +0530 Subject: [PATCH 073/149] review updates - 2 --- .../analytics/PerformanceMetricsController.kt | 2 +- .../analytics/PerformanceMetricsLogger.kt | 36 ++++++++++++------- .../logscheduler/MetricLogSchedulingWorker.kt | 15 ++++++-- .../analytics/PerformanceMetricsLoggerTest.kt | 12 +++---- 4 files changed, 44 insertions(+), 21 deletions(-) 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 515da6e81b3..8826217958d 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 @@ -131,7 +131,7 @@ class PerformanceMetricsController @Inject constructor( * Returns the index of the least recent event from the existing store on the basis of recency and * priority. * - * At first, it checks the index of the least recent event which has LOW priority. If that + * At first, it checks the index of the least recent event which has MEDIUM priority. If that * returns null, then it checks the index of the least recent event regardless of the * priority is returned. */ 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 3eb79f5d07e..c4151ae1dc1 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 @@ -37,11 +37,13 @@ class PerformanceMetricsLogger @Inject constructor( * Logs the apk size of the application as a performance metric for the current state of the app. * It must be noted that the value of this metric won't change across calls during the same * session. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logApkSize() { + fun logApkSize(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.HOME_SCREEN, + currentScreen, createApkSizeLoggableMetric(performanceMetricsUtils.getApkSize()) ) } @@ -50,11 +52,13 @@ class PerformanceMetricsLogger @Inject constructor( * Logs the storage 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 * session. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logStorageUsage() { + fun logStorageUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.HOME_SCREEN, + currentScreen, createStorageUsageLoggableMetric(performanceMetricsUtils.getUsedStorage()) ) } @@ -62,13 +66,15 @@ class PerformanceMetricsLogger @Inject constructor( /** * Logs the startup latency of the application as a performance metric for the current state of * the app. This metric should only be logged when the application starts. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logStartupLatency() { + fun logStartupLatency(currentScreen: OppiaMetricLog.CurrentScreen) { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp if (startupLatency >= 0) { performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.HOME_SCREEN, + currentScreen, createStartupLatencyLoggableMetric(startupLatency) ) } @@ -78,11 +84,13 @@ class PerformanceMetricsLogger @Inject constructor( * Logs the memory 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 * session. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logMemoryUsage() { + fun logMemoryUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logMediumPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + currentScreen, createMemoryUsageLoggableMetric(performanceMetricsUtils.getTotalPssUsed()) ) } @@ -91,11 +99,13 @@ class PerformanceMetricsLogger @Inject constructor( * Logs the network 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 * session. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logNetworkUsage() { + fun logNetworkUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + currentScreen, createNetworkUsageLoggableMetric( performanceMetricsUtils.getTotalReceivedBytes(), performanceMetricsUtils.getTotalSentBytes() @@ -107,11 +117,13 @@ class PerformanceMetricsLogger @Inject constructor( * 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 * session. + * + * @param [currentScreen] denotes the application screen at which this metric has been logged. */ - fun logCpuUsage(cpuUsage: Long) { + fun logCpuUsage(cpuUsage: Long, currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logHighPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), - OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED, + currentScreen, createCpuUsageLoggableMetric(cpuUsage) ) } 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 cca134716cc..a4e25a3fb15 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 @@ -27,8 +27,19 @@ class MetricLogSchedulingWorker private constructor( ) : ListenableWorker(context, params) { companion object { - const val WORKER_CASE_KEY = "worker_case_key" - const val TAG = "LogGenerationWorker.tag" + private const val TAG = "MetricLogSchedulingWorker" + /** + * Input data for the worker consists of a key-value pair on the basis of which work is done. + * + * [WORKER_CASE_KEY] is the key for that data. + * When [PERIODIC_METRIC_WORKER] is the value, the worker schedules logging of periodic + * performance metrics. + * When [STORAGE_USAGE_WORKER] is the value, the worker schedules logging of storage usage + * performance metrics. + * When [MEMORY_USAGE_WORKER] is the value, the worker schedules logging of memory usage + * performance metrics. + */ + const val WORKER_CASE_KEY = "metric_log_scheduling_worker_case_key" const val PERIODIC_METRIC_WORKER = "periodic_metric_worker" const val STORAGE_USAGE_WORKER = "storage_usage_worker" const val MEMORY_USAGE_WORKER = "memory_usage_worker" 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 4bfef9bf990..af883bd8cad 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 @@ -86,7 +86,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logApkSize() + performanceMetricsLogger.logApkSize(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) @@ -105,7 +105,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logStorageUsage() + performanceMetricsLogger.logStorageUsage(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) @@ -126,7 +126,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logMemoryUsage() + performanceMetricsLogger.logMemoryUsage(SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) @@ -144,7 +144,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logStartupLatency() + performanceMetricsLogger.logStartupLatency(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) @@ -165,7 +165,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE) + performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE, SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) @@ -185,7 +185,7 @@ class PerformanceMetricsLoggerTest { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsUtils.isAppInForeground() - performanceMetricsLogger.logNetworkUsage() + performanceMetricsLogger.logNetworkUsage(SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() assertThat(loggedEvent.timestampMillis).isEqualTo(TEST_TIMESTAMP) From 2899d724c27d261579e81bed5776cf8b0f3829b0 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 20:16:17 +0530 Subject: [PATCH 074/149] isAppInForeground revamp --- .../analytics/ApplicationLifecycleObserver.kt | 3 +++ .../analytics/PerformanceMetricsController.kt | 17 +++++++++++++++- .../logscheduler/MetricLogSchedulingWorker.kt | 7 +++---- .../analytics/PerformanceMetricsLoggerTest.kt | 15 ++++++++------ .../LogReportWorkManagerInitializerTest.kt | 2 +- .../PerformanceMetricsUtils.kt | 20 +------------------ 6 files changed, 33 insertions(+), 31 deletions(-) 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 e49bf08b3c4..5a9dd411387 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 @@ -24,6 +24,7 @@ class ApplicationLifecycleObserver @Inject constructor( private val learnerAnalyticsLogger: LearnerAnalyticsLogger, private val profileManagementController: ProfileManagementController, private val oppiaLogger: OppiaLogger, + private val performanceMetricsController: PerformanceMetricsController, @LearnerAnalyticsInactivityLimitMillis private val inactivityLimitMillis: Long, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) : ApplicationStartupListener, LifecycleObserver { @@ -39,6 +40,7 @@ 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() @@ -49,6 +51,7 @@ class ApplicationLifecycleObserver @Inject constructor( /** Occurs when application goes to background. */ @OnLifecycleEvent(Lifecycle.Event.ON_STOP) fun onAppInBackground() { + performanceMetricsController.setAppInBackground() firstTimestamp = oppiaClock.getCurrentTimeMs() logAppLifecycleEventInBackground(learnerAnalyticsLogger::logAppInBackground) } 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 8826217958d..359125ce6ec 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 @@ -30,6 +30,8 @@ class PerformanceMetricsController @Inject constructor( @PerformanceMetricsLogStorageCacheSize private val metricLogStorageCacheSize: Int ) { + private var isAppInForeground: Boolean = false + private val metricLogStore = cacheStoreFactory.create("metric_logs", OppiaMetricLogs.getDefaultInstance()) @@ -106,7 +108,7 @@ class PerformanceMetricsController @Inject constructor( this.priority = priority this.currentScreen = currentScreen this.loggableMetric = loggableMetric - this.isAppInForeground = performanceMetricsUtils.isAppInForeground() + this.isAppInForeground = isAppInForeground this.storageTier = performanceMetricsUtils.getDeviceStorageTier() this.memoryTier = performanceMetricsUtils.getDeviceMemoryTier() }.build() @@ -173,4 +175,17 @@ class PerformanceMetricsController @Inject constructor( } } } + + /** Sets [isAppInForeground] to true when application is in or returns to foreground. */ + fun setAppInForeground() { + isAppInForeground = true + } + + /** Sets [isAppInForeground] to false when application goes to background. */ + fun setAppInBackground() { + isAppInForeground = false + } + + /** Returns a boolean value indicating whether the application is currently in foreground or not. */ + fun getIsAppInForeground() = isAppInForeground } 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 a4e25a3fb15..b570055af22 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 @@ -70,8 +70,7 @@ class MetricLogSchedulingWorker private constructor( private fun schedulePeriodicMetricLogging(): Result { return try { - performanceMetricsLogger.logNetworkUsage() - // TODO(#4334): Add functionality to log cpu usage performance metric. + // TODO(#4340): Add functionality to log cpu and network usage performance metrics. Result.success() } catch (e: Exception) { consoleLogger.e(TAG, e.toString(), e) @@ -81,7 +80,7 @@ class MetricLogSchedulingWorker private constructor( private fun scheduleStorageUsageMetricLogging(): Result { return try { - performanceMetricsLogger.logStorageUsage() + // TODO(#4340): Add functionality to storage usage performance metrics. Result.success() } catch (e: Exception) { consoleLogger.e(TAG, e.toString(), e) @@ -91,7 +90,7 @@ class MetricLogSchedulingWorker private constructor( private fun scheduleMemoryUsageMetricLogging(): Result { return try { - performanceMetricsLogger.logMemoryUsage() + // TODO(#4340): Add functionality to log memory usage performance metrics. Result.success() } catch (e: Exception) { consoleLogger.e(TAG, e.toString(), e) 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 af883bd8cad..28b50de598b 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 @@ -64,6 +64,9 @@ class PerformanceMetricsLoggerTest { @Inject lateinit var performanceMetricsLogger: PerformanceMetricsLogger + @Inject + lateinit var performanceMetricsController: PerformanceMetricsController + @Inject lateinit var fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger @@ -85,7 +88,7 @@ class PerformanceMetricsLoggerTest { val apkSize = performanceMetricsUtils.getApkSize() val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logApkSize(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -104,7 +107,7 @@ class PerformanceMetricsLoggerTest { val storageUsage = performanceMetricsUtils.getUsedStorage() val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logStorageUsage(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -125,7 +128,7 @@ class PerformanceMetricsLoggerTest { val memoryUsage = performanceMetricsUtils.getTotalPssUsed() val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logMemoryUsage(SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -143,7 +146,7 @@ class PerformanceMetricsLoggerTest { fun testLogger_logStartupLatencyPerformanceMetric_verifyLogsMetricCorrectly() { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logStartupLatency(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -164,7 +167,7 @@ class PerformanceMetricsLoggerTest { fun testLogger_logCpuUsagePerformanceMetric_verifyLogsMetricCorrectly() { val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE, SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -184,7 +187,7 @@ class PerformanceMetricsLoggerTest { val bytesReceived = performanceMetricsUtils.getTotalReceivedBytes() val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() - val isAppInForeground = performanceMetricsUtils.isAppInForeground() + val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logNetworkUsage(SCREEN_UNSPECIFIED) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() 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 c5984f10891..5e8494285d3 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 @@ -228,7 +228,7 @@ class LogReportWorkManagerInitializerTest { } private fun setUpTestApplicationComponent() { - DaggerLogUploadWorkManagerInitializerTest_TestApplicationComponent.builder() + DaggerLogReportWorkManagerInitializerTest_TestApplicationComponent.builder() .setApplication(ApplicationProvider.getApplicationContext()) .build() .inject(this) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index b1fdf0c6520..0cd9fcd3de8 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -4,9 +4,6 @@ import android.app.ActivityManager import android.app.Application import android.content.Context import android.net.TrafficStats -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleObserver -import androidx.lifecycle.OnLifecycleEvent import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.ConsoleLogger import java.io.File @@ -16,7 +13,7 @@ import javax.inject.Inject class PerformanceMetricsUtils @Inject constructor( private val context: Application, private val consoleLogger: ConsoleLogger -) : LifecycleObserver { +) { // Keep the default value as false as the app is considered to be in the background until it comes // to foreground. @@ -109,19 +106,4 @@ class PerformanceMetricsUtils @Inject constructor( else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER } } - - /** Occurs when application comes to foreground. */ - @OnLifecycleEvent(Lifecycle.Event.ON_START) - fun onAppInForeground() { - isAppInForeground = true - } - - /** Occurs when application goes to background. */ - @OnLifecycleEvent(Lifecycle.Event.ON_STOP) - fun onAppInBackground() { - isAppInForeground = false - } - - /** Returns a boolean value indicating whether the application is in foreground or not. */ - fun isAppInForeground(): Boolean = isAppInForeground } From 366705de004a29fe9a293087eefb1a22ce9ac31c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 22:57:09 +0530 Subject: [PATCH 075/149] isAppInForeground revamp --- .../analytics/PerformanceMetricsController.kt | 2 +- .../PerformanceMetricsControllerTest.kt | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) 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 359125ce6ec..2a351cd7493 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 @@ -108,7 +108,7 @@ class PerformanceMetricsController @Inject constructor( this.priority = priority this.currentScreen = currentScreen this.loggableMetric = loggableMetric - this.isAppInForeground = isAppInForeground + this.isAppInForeground = this@PerformanceMetricsController.isAppInForeground this.storageTier = performanceMetricsUtils.getDeviceStorageTier() this.memoryTier = performanceMetricsUtils.getDeviceMemoryTier() }.build() 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 055c2357a71..ea846d12e49 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 @@ -378,6 +378,68 @@ class PerformanceMetricsControllerTest { assertThat(secondMetricLog.timestampMillis).isEqualTo(1556094110000) } + @Test + fun testController_setAppInForeground_logMetric_logsMetricWithAppInForeground() { + performanceMetricsController.setAppInForeground() + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + APK_SIZE_METRIC + ) + assertThat(performanceMetricsLog.isAppInForeground).isTrue() + } + + @Test + fun testController_setAppInBackground_logMetric_logsMetricWithAppInBackground() { + performanceMetricsController.setAppInBackground() + performanceMetricsController.logPerformanceMetricsEvent( + TEST_TIMESTAMP, + SCREEN_UNSPECIFIED, + apkSizeTestLoggableMetric, + LOW_PRIORITY + ) + + val performanceMetricsLog = + fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() + + assertThat(performanceMetricsLog.timestampMillis).isEqualTo(TEST_TIMESTAMP) + assertThat(performanceMetricsLog.currentScreen).isEqualTo(SCREEN_UNSPECIFIED) + assertThat(performanceMetricsLog.priority).isEqualTo(LOW_PRIORITY) + assertThat(performanceMetricsLog.loggableMetric.loggableMetricTypeCase).isEqualTo( + APK_SIZE_METRIC + ) + assertThat(performanceMetricsLog.isAppInForeground).isFalse() + } + + @Test + fun testController_setAppInBackground_getIsAppInForeground_returnsCorrectValue(){ + performanceMetricsController.setAppInBackground() + + val isAppInForeground = performanceMetricsController.getIsAppInForeground() + + assertThat(isAppInForeground).isFalse() + } + + @Test + fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue(){ + performanceMetricsController.setAppInForeground() + + val isAppInForeground = performanceMetricsController.getIsAppInForeground() + + assertThat(isAppInForeground).isTrue() + } + private fun logMultiplePerformanceMetrics() { performanceMetricsController.logPerformanceMetricsEvent( 1556094120000, From 741a9d5a46a34490a3f87ccb57cc58da8cb61341 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 15 Jul 2022 23:00:31 +0530 Subject: [PATCH 076/149] nits --- .../oppialogger/analytics/PerformanceMetricsControllerTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ea846d12e49..d7b5cb17413 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 @@ -423,7 +423,7 @@ class PerformanceMetricsControllerTest { } @Test - fun testController_setAppInBackground_getIsAppInForeground_returnsCorrectValue(){ + fun testController_setAppInBackground_getIsAppInForeground_returnsCorrectValue() { performanceMetricsController.setAppInBackground() val isAppInForeground = performanceMetricsController.getIsAppInForeground() @@ -432,7 +432,7 @@ class PerformanceMetricsControllerTest { } @Test - fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue(){ + fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue() { performanceMetricsController.setAppInForeground() val isAppInForeground = performanceMetricsController.getIsAppInForeground() From e61ea0d555ee2548324a602c9e0fe1d903f3b378 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 16 Jul 2022 02:29:47 +0530 Subject: [PATCH 077/149] domain tests repair --- .../logscheduler/MetricLogSchedulingWorker.kt | 2 +- .../MetricLogSchedulingWorkerTest.kt | 36 ++----------------- 2 files changed, 4 insertions(+), 34 deletions(-) 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 b570055af22..d70bd46b113 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 @@ -80,7 +80,7 @@ class MetricLogSchedulingWorker private constructor( private fun scheduleStorageUsageMetricLogging(): Result { return try { - // TODO(#4340): Add functionality to storage usage performance metrics. + // TODO(#4340): Add functionality to log storage usage performance metrics. Result.success() } catch (e: Exception) { consoleLogger.e(TAG, e.toString(), e) 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 5f7ab410179..601f82670cf 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 @@ -125,12 +125,7 @@ class MetricLogSchedulingWorkerTest { val workInfo = workManager.getWorkInfoById(request.id) assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - assertThat( - fakePerformanceMetricsEventLogger - .getMostRecentPerformanceMetricsEvent() - .loggableMetric - .loggableMetricTypeCase - ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.STORAGE_USAGE_METRIC) + // TODO(#4340): Verify functionality to log storage usage performance metrics. } @Test @@ -151,12 +146,7 @@ class MetricLogSchedulingWorkerTest { val workInfo = workManager.getWorkInfoById(request.id) assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - assertThat( - fakePerformanceMetricsEventLogger - .getMostRecentPerformanceMetricsEvent() - .loggableMetric - .loggableMetricTypeCase - ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.NETWORK_USAGE_METRIC) + // TODO(#4340): Verify functionality to log cpu and network usage performance metrics. } @Test @@ -177,28 +167,16 @@ class MetricLogSchedulingWorkerTest { val workInfo = workManager.getWorkInfoById(request.id) assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - assertThat( - fakePerformanceMetricsEventLogger - .getMostRecentPerformanceMetricsEvent() - .loggableMetric - .loggableMetricTypeCase - ).isEqualTo(OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.MEMORY_USAGE_METRIC) + // TODO(#4340): Verify functionality to log memory usage performance metrics. } @Test fun testWorker_enqueueRequest_writeFails_verifyFailure() { val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) - val inputData = Data.Builder().putString( - MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.STORAGE_USAGE_WORKER - ).build() - val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() - .setInputData(inputData) .build() - setUpPerformanceMetricsEventLoggerToFail() workManager.enqueue(request) testCoroutineDispatchers.runCurrent() val workInfo = workManager.getWorkInfoById(request.id) @@ -214,14 +192,6 @@ class MetricLogSchedulingWorkerTest { .inject(this) } - private fun setUpPerformanceMetricsEventLoggerToFail() { - // Simulate the log attempt itself failing during the job. Note that the reset is necessary here - // to remove the default stubbing for the mock so that it can properly trigger a failure. - Mockito.reset(mockPerformanceMetricsEventLogger) - Mockito.`when`(mockPerformanceMetricsEventLogger.logPerformanceMetric(anyOrNull())) - .thenThrow(IllegalStateException("Failure.")) - } - @Qualifier annotation class MockPerformanceMetricsEventLogger From 7cd27e09c2f787a7d84c640b77e2a64e90db84fc Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 03:22:40 +0530 Subject: [PATCH 078/149] app tests repair --- .../AdministratorControlsActivityTest.kt | 3 +- .../AdministratorControlsFragmentTest.kt | 3 +- .../AppVersionActivityTest.kt | 3 +- .../ProfileAndDeviceIdActivityTest.kt | 3 +- .../ProfileAndDeviceIdFragmentTest.kt | 64 ++++++++++++++++++- .../CompletedStoryListActivityTest.kt | 3 +- .../LessonThumbnailImageViewTest.kt | 3 +- .../MathExpressionInteractionsViewTest.kt | 3 +- .../DrawableBindingAdaptersTest.kt | 3 +- .../ImageViewBindingAdaptersTest.kt | 4 +- .../databinding/MarginBindingAdaptersTest.kt | 4 +- ...StateAssemblerMarginBindingAdaptersTest.kt | 4 +- ...tateAssemblerPaddingBindingAdaptersTest.kt | 4 +- .../TextViewBindingAdaptersTest.kt | 3 +- .../databinding/ViewBindingAdaptersTest.kt | 4 +- .../DeveloperOptionsActivityTest.kt | 3 +- .../DeveloperOptionsFragmentTest.kt | 3 +- .../MarkChaptersCompletedActivityTest.kt | 3 +- .../MarkChaptersCompletedFragmentTest.kt | 3 +- .../MarkStoriesCompletedActivityTest.kt | 3 +- .../MarkStoriesCompletedFragmentTest.kt | 3 +- .../MarkTopicsCompletedActivityTest.kt | 3 +- .../MarkTopicsCompletedFragmentTest.kt | 3 +- .../devoptions/ViewEventLogsActivityTest.kt | 3 +- .../devoptions/ViewEventLogsFragmentTest.kt | 4 +- .../ForceNetworkTypeActivityTest.kt | 4 +- .../ForceNetworkTypeFragmentTest.kt | 4 +- .../MathExpressionParserActivityTest.kt | 3 +- .../MathExpressionParserFragmentTest.kt | 3 +- .../android/app/faq/FAQListFragmentTest.kt | 3 +- .../android/app/faq/FAQSingleActivityTest.kt | 3 +- .../android/app/faq/FaqListActivityTest.kt | 3 +- .../android/app/help/HelpActivityTest.kt | 3 +- .../android/app/help/HelpFragmentTest.kt | 3 +- .../android/app/home/HomeActivityTest.kt | 3 +- .../app/home/RecentlyPlayedFragmentTest.kt | 3 +- .../app/home/TopicSummaryViewModelTest.kt | 3 +- .../android/app/home/WelcomeViewModelTest.kt | 3 +- .../PromotedStoryListViewModelTest.kt | 3 +- .../PromotedStoryViewModelTest.kt | 3 +- .../mydownloads/MyDownloadsActivityTest.kt | 3 +- .../mydownloads/MyDownloadsFragmentTest.kt | 3 +- .../app/onboarding/OnboardingActivityTest.kt | 3 +- .../app/onboarding/OnboardingFragmentTest.kt | 3 +- .../OngoingTopicListActivityTest.kt | 3 +- .../app/options/AppLanguageActivityTest.kt | 3 +- .../app/options/AppLanguageFragmentTest.kt | 3 +- .../app/options/AudioLanguageActivityTest.kt | 3 +- .../app/options/AudioLanguageFragmentTest.kt | 3 +- .../app/options/OptionsActivityTest.kt | 3 +- .../app/options/OptionsFragmentTest.kt | 63 +++++++++++++++++- .../options/ReadingTextSizeActivityTest.kt | 3 +- .../options/ReadingTextSizeFragmentTest.kt | 3 +- .../app/parser/CustomBulletSpanTest.kt | 4 +- .../android/app/parser/HtmlParserTest.kt | 3 +- .../app/player/audio/AudioFragmentTest.kt | 3 +- .../exploration/ExplorationActivityTest.kt | 4 +- .../app/player/state/StateFragmentTest.kt | 3 +- .../app/profile/AddProfileActivityTest.kt | 3 +- .../app/profile/AdminAuthActivityTest.kt | 3 +- .../app/profile/AdminPinActivityTest.kt | 3 +- .../app/profile/PinPasswordActivityTest.kt | 3 +- .../app/profile/ProfileChooserFragmentTest.kt | 3 +- .../ProfilePictureActivityTest.kt | 3 +- .../ProfileProgressActivityTest.kt | 3 +- .../ProfileProgressFragmentTest.kt | 3 +- .../app/recyclerview/BindableAdapterTest.kt | 3 +- .../resumelesson/ResumeLessonActivityTest.kt | 3 +- .../resumelesson/ResumeLessonFragmentTest.kt | 3 +- .../profile/ProfileEditActivityTest.kt | 3 +- .../profile/ProfileEditFragmentTest.kt | 3 +- .../profile/ProfileListActivityTest.kt | 3 +- .../profile/ProfileListFragmentTest.kt | 3 +- .../profile/ProfileRenameActivityTest.kt | 3 +- .../profile/ProfileRenameFragmentTest.kt | 3 +- .../profile/ProfileResetPinActivityTest.kt | 3 +- .../profile/ProfileResetPinFragmentTest.kt | 3 +- .../android/app/splash/SplashActivityTest.kt | 3 +- .../android/app/story/StoryActivityTest.kt | 3 +- .../android/app/story/StoryFragmentTest.kt | 3 +- .../app/testing/DragDropTestActivityTest.kt | 3 +- ...ImageRegionSelectionInteractionViewTest.kt | 3 +- .../InputInteractionViewTestActivityTest.kt | 3 +- .../NavigationDrawerActivityDebugTest.kt | 3 +- .../NavigationDrawerActivityProdTest.kt | 3 +- ...tFontScaleConfigurationUtilActivityTest.kt | 3 +- .../testing/TopicTestActivityForStoryTest.kt | 3 +- .../app/thirdparty/LicenseListActivityTest.kt | 4 +- .../app/thirdparty/LicenseListFragmentTest.kt | 4 +- .../LicenseTextViewerActivityTest.kt | 4 +- .../LicenseTextViewerFragmentTest.kt | 4 +- .../ThirdPartyDependencyListActivityTest.kt | 4 +- .../ThirdPartyDependencyListFragmentTest.kt | 4 +- .../android/app/topic/TopicActivityTest.kt | 3 +- .../android/app/topic/TopicFragmentTest.kt | 3 +- .../conceptcard/ConceptCardFragmentTest.kt | 3 +- .../app/topic/info/TopicInfoFragmentTest.kt | 3 +- .../topic/lessons/TopicLessonsFragmentTest.kt | 3 +- .../practice/TopicPracticeFragmentTest.kt | 3 +- .../QuestionPlayerActivityTest.kt | 3 +- .../revision/TopicRevisionFragmentTest.kt | 3 +- .../revisioncard/RevisionCardActivityTest.kt | 3 +- .../revisioncard/RevisionCardFragmentTest.kt | 3 +- .../app/utility/RatioExtensionsTest.kt | 3 +- .../walkthrough/WalkthroughActivityTest.kt | 3 +- .../WalkthroughFinalFragmentTest.kt | 3 +- .../WalkthroughTopicListFragmentTest.kt | 3 +- .../WalkthroughWelcomeFragmentTest.kt | 3 +- .../activity/ActivityIntentFactoriesTest.kt | 3 +- .../android/app/home/HomeActivityLocalTest.kt | 3 +- .../app/parser/FractionParsingUiErrorTest.kt | 3 +- .../app/parser/StringToRatioParserTest.kt | 3 +- .../ExplorationActivityLocalTest.kt | 3 +- .../player/state/StateFragmentLocalTest.kt | 3 +- .../ProfileChooserFragmentLocalTest.kt | 3 +- .../app/story/StoryActivityLocalTest.kt | 3 +- .../app/testing/CompletedStoryListSpanTest.kt | 3 +- .../oppia/android/app/testing/HomeSpanTest.kt | 3 +- .../app/testing/OngoingTopicListSpanTest.kt | 3 +- .../PlatformParameterIntegrationTest.kt | 3 +- .../app/testing/ProfileChooserSpanTest.kt | 3 +- .../testing/ProfileProgressSpanCountTest.kt | 3 +- .../app/testing/RecentlyPlayedSpanTest.kt | 3 +- .../app/testing/TopicRevisionSpanTest.kt | 3 +- .../app/testing/activity/TestActivityTest.kt | 3 +- .../AdministratorControlsFragmentTest.kt | 3 +- .../testing/options/OptionsFragmentTest.kt | 63 +++++++++++++++++- .../player/split/PlayerSplitScreenTest.kt | 3 +- .../state/StateFragmentAccessibilityTest.kt | 3 +- .../topic/info/TopicInfoFragmentLocalTest.kt | 3 +- .../lessons/TopicLessonsFragmentLocalTest.kt | 3 +- .../QuestionPlayerActivityLocalTest.kt | 3 +- .../RevisionCardActivityLocalTest.kt | 3 +- .../MathExpressionAccessibilityUtilTest.kt | 3 +- 134 files changed, 465 insertions(+), 134 deletions(-) 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 8d30edd05ee..977e569c172 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 @@ -119,6 +119,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AdministratorControlsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -745,7 +746,7 @@ class AdministratorControlsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 73ddaab9bbd..ea8adc9dc9d 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 @@ -111,6 +111,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -611,7 +612,7 @@ class AdministratorControlsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 1fee7fa0522..4460ceaaca0 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 @@ -99,6 +99,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AppVersionActivity]. */ @RunWith(AndroidJUnit4::class) @@ -290,7 +291,7 @@ class AppVersionActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 78c1e48a2ad..2997420032a 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 @@ -93,6 +93,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileAndDeviceIdActivity]. */ // Function name: test names are conventionally named with underscores. @@ -198,7 +199,7 @@ class ProfileAndDeviceIdActivityTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, SyncStatusModule::class, SplitScreenInteractionModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, - MathEquationInputModule::class + MathEquationInputModule::class, MetricLogSchedulerModule::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 0cc4803fbc6..05b0f951e4f 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 @@ -122,6 +122,20 @@ import org.robolectric.annotation.LooperMode import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +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.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PlatformParameterSingleton /** Tests for [ProfileAndDeviceIdFragment]. */ // Same parameter value: helpers reduce test context, even if they are used by 1 test. @@ -632,6 +646,54 @@ class ProfileAndDeviceIdFragmentTest { @CacheLatexRendering fun provideCacheLatexRendering(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE) + + @Provides + @EnablePerformanceMetricsCollection + fun provideEnablePerformanceMetricCollection( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION + ) ?: PlatformParameterValue.createDefaultParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE + ) + } + + @Provides + @PerformanceMetricsCollectionUploadTimeIntervalInMinutes + fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } } // TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them. @@ -658,7 +720,7 @@ class ProfileAndDeviceIdFragmentTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, SyncStatusModule::class, SplitScreenInteractionModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, - MathEquationInputModule::class + MathEquationInputModule::class, MetricLogSchedulerModule::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 51f03a82354..a52cf52621c 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 @@ -104,6 +104,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [CompletedStoryListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -513,7 +514,7 @@ class CompletedStoryListActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 849767cce79..4e3d4a12952 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 @@ -81,6 +81,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LessonThumbnailImageView]. */ @RunWith(AndroidJUnit4::class) @@ -171,7 +172,7 @@ class LessonThumbnailImageViewTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 01ccd5fe013..598314e224e 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 @@ -104,6 +104,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [MathExpressionInteractionsView] & its view model. @@ -1773,7 +1774,7 @@ class MathExpressionInteractionsViewTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 fee4f9a446c..e87f76184c0 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 @@ -86,6 +86,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DrawableBindingAdapters]. */ @RunWith(AndroidJUnit4::class) @@ -182,7 +183,7 @@ class DrawableBindingAdaptersTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 da2f0639a6a..b92b886dbb6 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 @@ -91,6 +91,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ImageViewBindingAdapters]. */ @RunWith(AndroidJUnit4::class) @@ -223,7 +224,8 @@ class ImageViewBindingAdaptersTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 4a162efbdc8..20d279828af 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 @@ -93,6 +93,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f @@ -311,7 +312,8 @@ class MarginBindingAdaptersTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 7fec1fa404b..c7e511421a9 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 @@ -95,6 +95,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f @@ -499,7 +500,8 @@ class StateAssemblerMarginBindingAdaptersTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 903ca29892d..76cb1480af6 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 @@ -93,6 +93,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f @@ -497,7 +498,8 @@ class StateAssemblerPaddingBindingAdaptersTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 df9df7eef91..ac5a1872b7d 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 @@ -86,6 +86,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TextViewBindingAdapters]. */ @RunWith(AndroidJUnit4::class) @@ -331,7 +332,7 @@ class TextViewBindingAdaptersTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 48a6a45b480..e98b83d7ec1 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 @@ -90,6 +90,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Default value for float comparison. */ private const val TOLERANCE = 1e-5f @@ -231,7 +232,8 @@ class ViewBindingAdaptersTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 eee61266254..ea148f2eef4 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 @@ -109,6 +109,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DeveloperOptionsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -324,7 +325,7 @@ class DeveloperOptionsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ae43836818c..b6ae7ecd986 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 @@ -106,6 +106,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DeveloperOptionsFragment]. */ @RunWith(AndroidJUnit4::class) @@ -655,7 +656,7 @@ class DeveloperOptionsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 67e6c7b8764..afacba93560 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 @@ -85,6 +85,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkChaptersCompletedActivity]. */ @RunWith(AndroidJUnit4::class) @@ -186,7 +187,7 @@ class MarkChaptersCompletedActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 4bfc7128e20..b0c93e3b74d 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 @@ -97,6 +97,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkChaptersCompletedFragment]. */ @RunWith(AndroidJUnit4::class) @@ -914,7 +915,7 @@ class MarkChaptersCompletedFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 4bc82fbb4ff..817e248d693 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 @@ -85,6 +85,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkStoriesCompletedActivity]. */ @RunWith(AndroidJUnit4::class) @@ -186,7 +187,7 @@ class MarkStoriesCompletedActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 9897f5aeec8..6e4e6e672f6 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 @@ -97,6 +97,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkStoriesCompletedFragment]. */ @RunWith(AndroidJUnit4::class) @@ -591,7 +592,7 @@ class MarkStoriesCompletedFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 f440739ad8e..127762a0095 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 @@ -85,6 +85,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkTopicsCompletedActivity]. */ @RunWith(AndroidJUnit4::class) @@ -186,7 +187,7 @@ class MarkTopicsCompletedActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8c7e419e49a..87a6d389b4d 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 @@ -97,6 +97,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkTopicsCompletedFragment]. */ @RunWith(AndroidJUnit4::class) @@ -561,7 +562,7 @@ class MarkTopicsCompletedFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 bd39b6bb65b..360fd17227f 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 @@ -86,6 +86,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -174,7 +175,7 @@ class ViewEventLogsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8c635cfd9e3..d94857f0186 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 @@ -93,6 +93,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" @@ -573,7 +574,8 @@ class ViewEventLogsFragmentTest { PlatformParameterSingletonModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 c701931d9fe..0e074e9030e 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 @@ -86,6 +86,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ForceNetworkTypeActivity]. */ @RunWith(AndroidJUnit4::class) @@ -177,7 +178,8 @@ class ForceNetworkTypeActivityTest { PlatformParameterSingletonModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 699a45c0f65..4074a532ea4 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 @@ -92,6 +92,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ForceNetworkTypeFragment]. */ @RunWith(AndroidJUnit4::class) @@ -393,7 +394,8 @@ class ForceNetworkTypeFragmentTest { PlatformParameterSingletonModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 f998c1ac080..c5370780520 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 @@ -83,6 +83,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MathExpressionParserActivity] and its presenter. */ // FunctionName: test names are conventionally named with underscores. @@ -162,7 +163,7 @@ class MathExpressionParserActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 0125a1793f0..fe424a0e887 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 @@ -95,6 +95,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MathExpressionParserFragment] and its presenter and view model. */ // FunctionName: test names are conventionally named with underscores. @@ -1412,7 +1413,7 @@ class MathExpressionParserFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 5501266a661..6dd750b7ae2 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 @@ -96,6 +96,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQListFragment]. */ @RunWith(AndroidJUnit4::class) @@ -246,7 +247,7 @@ class FAQListFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 5998c5afd47..a9bf73c2b76 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 @@ -93,6 +93,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQSingleActivity]. */ @RunWith(AndroidJUnit4::class) @@ -218,7 +219,7 @@ class FAQSingleActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 d20de2c03c7..cedbf66ea25 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 @@ -80,6 +80,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -151,7 +152,7 @@ class FaqListActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 dbc0c076144..6e47d950228 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [HelpActivity]. */ @RunWith(AndroidJUnit4::class) @@ -153,7 +154,7 @@ class HelpActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ea488b52f61..d04f0d501b7 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 @@ -107,6 +107,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -1187,7 +1188,7 @@ class HelpFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 567a3ad5870..ecace072c3c 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 @@ -138,6 +138,7 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Time: Tue Apr 23 2019 23:22:00 private const val EVENING_TIMESTAMP = 1556061720000 @@ -1752,7 +1753,7 @@ class HomeActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ebda635c9d4..f96f93fc963 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 @@ -123,6 +123,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_FRAGMENT_TAG = "recently_played_test_fragment" private const val TOLERANCE = 1e-5f @@ -1505,7 +1506,7 @@ class RecentlyPlayedFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 cb10c9a9d6d..658dd6dc934 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 @@ -81,6 +81,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_FRAGMENT_TAG = "topic_summary_view_model_test_fragment" @@ -372,7 +373,7 @@ class TopicSummaryViewModelTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 a2d82246de5..e3d45c1fa90 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 @@ -82,6 +82,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Time: Wed Apr 24 2019 08:22:00 private const val MORNING_TIMESTAMP = 1556094120000 @@ -356,7 +357,7 @@ class WelcomeViewModelTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 16ab31e65b5..00c3183c591 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 @@ -82,6 +82,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [PromotedStoryListViewModel] data. */ @RunWith(AndroidJUnit4::class) @@ -368,7 +369,7 @@ class PromotedStoryListViewModelTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8efa68c1fef..f7388170964 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 @@ -80,6 +80,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [PromotedStoryViewModel] data. */ @RunWith(AndroidJUnit4::class) @@ -378,7 +379,7 @@ class PromotedStoryViewModelTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 73e4d11932b..50c85db58de 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 @@ -78,6 +78,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -141,7 +142,7 @@ class MyDownloadsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 87a332e0df4..64b4f968233 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 @@ -88,6 +88,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MyDownloadsFragment]. */ @RunWith(AndroidJUnit4::class) @@ -232,7 +233,7 @@ class MyDownloadsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8f6a4573fb9..7307d09d382 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OnboardingActivity]. */ @RunWith(AndroidJUnit4::class) @@ -150,7 +151,7 @@ class OnboardingActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 660363cbed7..04e9b3902fc 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 @@ -107,6 +107,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OnboardingFragment]. */ @RunWith(AndroidJUnit4::class) @@ -693,7 +694,7 @@ class OnboardingFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 833b7929f65..5d09d9002e8 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 @@ -102,6 +102,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OngoingTopicListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -457,7 +458,7 @@ class OngoingTopicListActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 40a5d10712c..12c408051ca 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AppLanguageActivity]. */ @RunWith(AndroidJUnit4::class) @@ -160,7 +161,7 @@ class AppLanguageActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 812ffe1738e..302ee208cd5 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 @@ -91,6 +91,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val ENGLISH = 0 private const val FRENCH = 1 @@ -255,7 +256,7 @@ class AppLanguageFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 0b932e7aad7..cda1d316007 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AudioLanguageActivity]. */ @RunWith(AndroidJUnit4::class) @@ -160,7 +161,7 @@ class AudioLanguageActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 fa758996c03..816dbf9a5c1 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 @@ -90,6 +90,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val ENGLISH = 1 private const val FRENCH = 2 @@ -248,7 +249,7 @@ class AudioLanguageFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 a4f4df3e3b1..11bb88f1698 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OptionsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -152,7 +153,7 @@ class OptionsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 4ed44b60526..b44044e2cf5 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 @@ -115,6 +115,19 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +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.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes /** Tests for [OptionsFragment]. */ @RunWith(AndroidJUnit4::class) @@ -683,6 +696,54 @@ class OptionsFragmentTest { return platformParameterSingleton.getBooleanPlatformParameter(CACHE_LATEX_RENDERING) ?: PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE) } + + @Provides + @EnablePerformanceMetricsCollection + fun provideEnablePerformanceMetricCollection( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION + ) ?: PlatformParameterValue.createDefaultParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE + ) + } + + @Provides + @PerformanceMetricsCollectionUploadTimeIntervalInMinutes + fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } } // TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them. @@ -710,7 +771,7 @@ class OptionsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b4cb06e9a0c..a746476cf5a 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ReadingTextSizeActivity]. */ @RunWith(AndroidJUnit4::class) @@ -160,7 +161,7 @@ class ReadingTextSizeActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 dab2043f995..41238f1180f 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 @@ -97,6 +97,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // TODO(#1815): Remove these duplicate values once Screenshot tests are implemented. private const val SMALL_TEXT_SIZE_SCALE = 0.8f @@ -314,7 +315,7 @@ class ReadingTextSizeFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt index 44bbda831aa..15b59cacf49 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt @@ -81,6 +81,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -255,7 +256,8 @@ class CustomBulletSpanTest { NetworkConfigProdModule::class, PlatformParameterSingletonModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::class ] ) 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 f7490c25752..f6ca29e4e59 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 @@ -112,6 +112,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton import kotlin.reflect.KClass +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // TODO(#277): Add tests for UrlImageParser. /** Tests for [HtmlParser]. */ @@ -710,7 +711,7 @@ class HtmlParserTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 c1cffe9c8f5..ec697cebbf5 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 @@ -110,6 +110,7 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * TODO(#59): Make this test work with Espresso. @@ -477,7 +478,7 @@ class AudioFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 431ea6eb36c..f2e6bd2bbd7 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 @@ -160,6 +160,7 @@ import java.io.IOException import java.util.concurrent.TimeoutException import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ExplorationActivity]. */ @RunWith(AndroidJUnit4::class) @@ -1956,7 +1957,8 @@ class ExplorationActivityTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 f32ca4e7b68..1ddc99293cc 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 @@ -183,6 +183,7 @@ import java.io.IOException import java.util.concurrent.TimeoutException import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) @@ -4316,7 +4317,7 @@ class StateFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 3e866796a8b..f0a1162911b 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 @@ -118,6 +118,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -1731,7 +1732,7 @@ class AddProfileActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 d0c5b636d32..cf121763fb4 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 @@ -102,6 +102,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -671,7 +672,7 @@ class AdminAuthActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 c220eb08173..5088fbd614b 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 @@ -113,6 +113,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -1089,7 +1090,7 @@ class AdminPinActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 043021539ed..acf48d9fea1 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 @@ -108,6 +108,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -1151,7 +1152,7 @@ class PinPasswordActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 41b280efba5..e9b50d473b5 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 @@ -104,6 +104,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileChooserFragment]. */ @RunWith(AndroidJUnit4::class) @@ -528,7 +529,7 @@ class ProfileChooserFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 db12973e33e..85572c0ad39 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 @@ -88,6 +88,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfilePictureActivity]. */ @RunWith(AndroidJUnit4::class) @@ -203,7 +204,7 @@ class ProfilePictureActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ad43ceca782..34d4efb28aa 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileProgressActivity]. */ @RunWith(AndroidJUnit4::class) @@ -154,7 +155,7 @@ class ProfileProgressActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b991bac7dbe..717b06c6bf2 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 @@ -128,6 +128,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileProgressFragment]. */ @RunWith(AndroidJUnit4::class) @@ -855,7 +856,7 @@ class ProfileProgressFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 68132e157c6..ccb086b4699 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 @@ -121,6 +121,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Provider import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [BindableAdapter]. */ @RunWith(AndroidJUnit4::class) @@ -771,7 +772,7 @@ class BindableAdapterTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 fc2a7a323f3..8569bd5f9b2 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 @@ -98,6 +98,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ResumeLessonActivity]. */ @RunWith(AndroidJUnit4::class) @@ -224,7 +225,7 @@ class ResumeLessonActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 2b4094e5eeb..28bf5b8a49d 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 @@ -96,6 +96,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ResumeLessonFragment]. */ @RunWith(AndroidJUnit4::class) @@ -286,7 +287,7 @@ class ResumeLessonFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 eea092c13b5..6a652d81799 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 @@ -98,6 +98,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileEditActivity]. */ @RunWith(AndroidJUnit4::class) @@ -377,7 +378,7 @@ class ProfileEditActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 475ebd23393..b4b55a007bb 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 @@ -99,6 +99,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -354,7 +355,7 @@ class ProfileEditFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 af26d939ac4..43097198b8e 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -150,7 +151,7 @@ class ProfileListActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 0e2645bacc9..72eb091b911 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 @@ -96,6 +96,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -388,7 +389,7 @@ class ProfileListFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b7cc4d67ae4..43ce8198148 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 @@ -83,6 +83,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ProfileRenameActivity]. */ @RunWith(AndroidJUnit4::class) @@ -173,7 +174,7 @@ class ProfileRenameActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 7967db9bfff..0dd6ee2cb45 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 @@ -101,6 +101,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileRenameFragment]. */ @RunWith(AndroidJUnit4::class) @@ -462,7 +463,7 @@ class ProfileRenameFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 a9ab73dbd64..8c55c827a14 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 @@ -84,6 +84,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -184,7 +185,7 @@ class ProfileResetPinActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 9585ebd8817..ea7cf311d32 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 @@ -102,6 +102,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -1026,7 +1027,7 @@ class ProfileResetPinFragmentTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 a6b8d607d97..42c55825e63 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 @@ -111,6 +111,7 @@ import java.util.Date import java.util.Locale import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [SplashActivity]. For context on the activity test rule setup see: @@ -488,7 +489,7 @@ class SplashActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b11467a1861..bce785d798a 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 @@ -98,6 +98,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StoryActivity]. */ @RunWith(AndroidJUnit4::class) @@ -234,7 +235,7 @@ class StoryActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 e86ef0bb891..cb7db9687ea 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 @@ -141,6 +141,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StoryFragment]. */ @RunWith(AndroidJUnit4::class) @@ -902,7 +903,7 @@ class StoryFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 0f7adf5a130..cebebb93b7e 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 @@ -89,6 +89,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -227,7 +228,7 @@ class DragDropTestActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 573071b961c..590a0c5ef7e 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 @@ -104,6 +104,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) @@ -390,7 +391,7 @@ class ImageRegionSelectionInteractionViewTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 9f0e6365fac..09b615fdc10 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 @@ -99,6 +99,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [InputInteractionViewTestActivity]. */ @RunWith(AndroidJUnit4::class) @@ -1125,7 +1126,7 @@ class InputInteractionViewTestActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 55ff0dc8c01..8f9bb80bb64 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 @@ -120,6 +120,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [NavigationDrawerTestActivity]. */ @RunWith(AndroidJUnit4::class) @@ -438,7 +439,7 @@ class NavigationDrawerActivityDebugTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 a6169d0cf5c..d68fe6bc380 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 @@ -130,6 +130,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [NavigationDrawerTestActivity]. */ @RunWith(AndroidJUnit4::class) @@ -987,7 +988,7 @@ class NavigationDrawerActivityProdTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 f1b724482fc..40485e110c4 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 @@ -84,6 +84,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TestFontScaleConfigurationUtilActivity]. */ @RunWith(AndroidJUnit4::class) @@ -205,7 +206,7 @@ class TestFontScaleConfigurationUtilActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 6d5e1045f63..a452f930ceb 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 @@ -92,6 +92,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicTestActivityForStory]. */ @RunWith(AndroidJUnit4::class) @@ -202,7 +203,7 @@ class TopicTestActivityForStoryTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ea121f9976c..1b32649c25e 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 @@ -80,6 +80,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -161,7 +162,8 @@ class LicenseListActivityTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 b0136bebb4b..8d6bbe6898c 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 @@ -97,6 +97,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListFragmentTest]. */ @RunWith(AndroidJUnit4::class) @@ -371,7 +372,8 @@ class LicenseListFragmentTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 1dbb4731e47..a493467016f 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 @@ -81,6 +81,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -170,7 +171,8 @@ class LicenseTextViewerActivityTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 8d2bfd528ab..9946b12e588 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 @@ -87,6 +87,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseTextViewerFragmentTest]. */ @RunWith(AndroidJUnit4::class) @@ -349,7 +350,8 @@ class LicenseTextViewerFragmentTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 46380df8985..1a7f4627b81 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 @@ -80,6 +80,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ThirdPartyDependencyListActivity]. */ @RunWith(AndroidJUnit4::class) @@ -158,7 +159,8 @@ class ThirdPartyDependencyListActivityTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 f3a604e49f2..bba6d9ace5d 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 @@ -96,6 +96,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ThirdPartyDependencyListFragmentTest]. */ @RunWith(AndroidJUnit4::class) @@ -481,7 +482,8 @@ class ThirdPartyDependencyListFragmentTest { AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, - LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::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 09a8ab8b3f5..d03885fc004 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 @@ -96,6 +96,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicActivity]. */ @RunWith(AndroidJUnit4::class) @@ -208,7 +209,7 @@ class TopicActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 591fa171629..ab2d09cdfc5 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 @@ -106,6 +106,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val INFO_TAB_POSITION = 0 private const val LESSON_TAB_POSITION = 1 @@ -663,7 +664,7 @@ class TopicFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 cf1f9701301..9777529f8a0 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 @@ -112,6 +112,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ConceptCardFragment]. */ @RunWith(AndroidJUnit4::class) @@ -434,7 +435,7 @@ class ConceptCardFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 dd1329ba465..278a2f7c8e8 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 @@ -110,6 +110,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TOPIC_NAME = "Fractions" @@ -490,7 +491,7 @@ class TopicInfoFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 41bd01642d1..dc6aa315c5b 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 @@ -122,6 +122,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicLessonsFragment]. */ @RunWith(AndroidJUnit4::class) @@ -1012,7 +1013,7 @@ class TopicLessonsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b4464d235ea..e5326df8386 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 @@ -104,6 +104,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicPracticeFragment]. */ @RunWith(AndroidJUnit4::class) @@ -435,7 +436,7 @@ class TopicPracticeFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 bf0d63f7266..5b6af6e6de2 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 @@ -146,6 +146,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private val SKILL_ID_LIST = listOf(FRACTIONS_SKILL_ID_0) @@ -724,7 +725,7 @@ class QuestionPlayerActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 ac77601c7e9..6c625608b4f 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 @@ -106,6 +106,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicRevisionFragment]. */ @RunWith(AndroidJUnit4::class) @@ -331,7 +332,7 @@ class TopicRevisionFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 9998f05c23d..a01c9f13d94 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 @@ -100,6 +100,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RevisionCardActivity]. */ @RunWith(AndroidJUnit4::class) @@ -285,7 +286,7 @@ class RevisionCardActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 74c0468351a..c5798a9da1f 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 @@ -124,6 +124,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RevisionCardActivity]. */ @RunWith(AndroidJUnit4::class) @@ -597,7 +598,7 @@ class RevisionCardFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 429aad5cb3b..fc89336b918 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 @@ -77,6 +77,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RatioExtensions]. */ @RunWith(AndroidJUnit4::class) @@ -158,7 +159,7 @@ class RatioExtensionsTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 1e7327dc36e..351c038eb46 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 @@ -91,6 +91,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughActivity]. */ @RunWith(AndroidJUnit4::class) @@ -236,7 +237,7 @@ class WalkthroughActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 0291f29ac9c..39948fbc887 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 @@ -95,6 +95,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughFinalFragment]. */ @RunWith(AndroidJUnit4::class) @@ -293,7 +294,7 @@ class WalkthroughFinalFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8996550eb8f..890475cdd81 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 @@ -101,6 +101,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughTopicListFragment]. */ @RunWith(AndroidJUnit4::class) @@ -319,7 +320,7 @@ class WalkthroughTopicListFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 aa815ea3c47..62f88914205 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 @@ -92,6 +92,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughWelcomeFragment]. */ @RunWith(AndroidJUnit4::class) @@ -216,7 +217,7 @@ class WalkthroughWelcomeFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 d2133a1f742..5e9d8522fa0 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 @@ -79,6 +79,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ActivityIntentFactories]. */ // FunctionName: test names are conventionally named with underscores. @@ -181,7 +182,7 @@ class ActivityIntentFactoriesTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 146ca02b16e..953788851d4 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 @@ -82,6 +82,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -153,7 +154,7 @@ class HomeActivityLocalTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 41e78046d7c..39ecf1734d5 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 @@ -77,6 +77,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FractionParsingUiError]. */ @RunWith(AndroidJUnit4::class) @@ -263,7 +264,7 @@ class FractionParsingUiErrorTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { 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 83ff801efcb..bc748fac77e 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 @@ -77,6 +77,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StringToRatioParser]. */ @RunWith(AndroidJUnit4::class) @@ -267,7 +268,7 @@ class StringToRatioParserTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 bb23e464b63..eaccf032506 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 @@ -88,6 +88,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -214,7 +215,7 @@ class ExplorationActivityLocalTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 955e2439d2e..67a0a3b7e20 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 @@ -165,6 +165,7 @@ import java.util.Locale import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [StateFragment] that can only be run locally, e.g. using Robolectric, and not on an @@ -2297,7 +2298,7 @@ class StateFragmentLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 f722be029ce..ee67e748d72 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -142,7 +143,7 @@ class ProfileChooserFragmentLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 da0b4ee2db6..8d67fb985bd 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 @@ -81,6 +81,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TEST_STORY_ID = "GJ2rLXRKD5hw" @@ -167,7 +168,7 @@ class StoryActivityLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 c7be7965342..e603a5acc10 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 @@ -81,6 +81,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -176,7 +177,7 @@ class CompletedStoryListSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 8100882ac57..cb23e1bca0d 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 @@ -82,6 +82,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -190,7 +191,7 @@ class HomeSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 758b5626894..4614a4d1cf0 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 @@ -82,6 +82,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -187,7 +188,7 @@ class OngoingTopicListSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 1ad2174689b..98cfb71ab59 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 @@ -111,6 +111,7 @@ import retrofit2.mock.MockRetrofit import java.util.UUID import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests to verify the working of Platform Parameter Architecture. */ @RunWith(AndroidJUnit4::class) @@ -360,7 +361,7 @@ class PlatformParameterIntegrationTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 28d25e7c35c..1c0126f5ba5 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 @@ -82,6 +82,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TAG_PROFILE_CHOOSER_FRAGMENT_RECYCLER_VIEW = "profile_recycler_view" @@ -389,7 +390,7 @@ class ProfileChooserSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 df705333f9f..91ad53abe3b 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 @@ -81,6 +81,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -173,7 +174,7 @@ class ProfileProgressSpanCountTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 e5efacb041d..27f9f783381 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 @@ -87,6 +87,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -308,7 +309,7 @@ class RecentlyPlayedSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 2f57d063b42..137bb548f84 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 @@ -80,6 +80,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -173,7 +174,7 @@ class TopicRevisionSpanTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 bb05f88930f..cbf46c58852 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 @@ -78,6 +78,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TestActivity]. */ // FunctionName: test names are conventionally named with underscores. @@ -198,7 +199,7 @@ class TestActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 9e55690a67f..21c1aff4373 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 @@ -88,6 +88,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @Config( @@ -197,7 +198,7 @@ class AdministratorControlsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 5f62603f0fc..e3e9cb3ee08 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 @@ -104,6 +104,19 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +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.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes @RunWith(AndroidJUnit4::class) @Config(application = OptionsFragmentTest.TestApplication::class, qualifiers = "sw600dp") @@ -280,6 +293,54 @@ class OptionsFragmentTest { return platformParameterSingleton.getBooleanPlatformParameter(CACHE_LATEX_RENDERING) ?: PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE) } + + @Provides + @EnablePerformanceMetricsCollection + fun provideEnablePerformanceMetricCollection( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION + ) ?: PlatformParameterValue.createDefaultParameter( + ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE + ) + } + + @Provides + @PerformanceMetricsCollectionUploadTimeIntervalInMinutes + fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } + + @Provides + @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes + fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getIntegerPlatformParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES + ) ?: PlatformParameterValue.createDefaultParameter( + PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL + ) + } } // TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them. @@ -307,7 +368,7 @@ class OptionsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 58fe182bf36..70aebe74e57 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 @@ -77,6 +77,7 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Devices reference: https://material.io/resources/devices/ @RunWith(AndroidJUnit4::class) @@ -206,7 +207,7 @@ class PlayerSplitScreenTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 7cc0d781c48..b0327dc6163 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 @@ -92,6 +92,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) @@ -215,7 +216,7 @@ class StateFragmentAccessibilityTest { AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 2988800f422..dfbd3042b67 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 @@ -79,6 +79,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" @@ -155,7 +156,7 @@ class TopicInfoFragmentLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 205a5fecaab..89f3c6bf57b 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 @@ -78,6 +78,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TEST_STORY_ID = "GJ2rLXRKD5hw" @@ -158,7 +159,7 @@ class TopicLessonsFragmentLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 1efcd7ce08e..7581fc6607d 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 @@ -111,6 +111,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [QuestionPlayerActivity] that can only be run locally, e.g. using Robolectric, and not on an @@ -508,7 +509,7 @@ class QuestionPlayerActivityLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 88dd1c0c09f..d4b811f012b 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 @@ -80,6 +80,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @@ -147,7 +148,7 @@ class RevisionCardActivityLocalTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 b6e3b935c70..c858580a0b3 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 @@ -110,6 +110,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [MathExpressionAccessibilityUtil]. @@ -1330,7 +1331,7 @@ class MathExpressionAccessibilityUtilTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { From 69e8feb2c981b14c5825eb0c29cf9c489764cfcb Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 03:26:21 +0530 Subject: [PATCH 079/149] nits. --- .../AdministratorControlsActivityTest.kt | 2 +- .../AdministratorControlsFragmentTest.kt | 2 +- .../AppVersionActivityTest.kt | 2 +- .../ProfileAndDeviceIdActivityTest.kt | 2 +- .../ProfileAndDeviceIdFragmentTest.kt | 28 +++++++++---------- .../CompletedStoryListActivityTest.kt | 2 +- .../LessonThumbnailImageViewTest.kt | 2 +- .../MathExpressionInteractionsViewTest.kt | 2 +- .../DrawableBindingAdaptersTest.kt | 2 +- .../ImageViewBindingAdaptersTest.kt | 2 +- .../databinding/MarginBindingAdaptersTest.kt | 2 +- ...StateAssemblerMarginBindingAdaptersTest.kt | 2 +- ...tateAssemblerPaddingBindingAdaptersTest.kt | 2 +- .../TextViewBindingAdaptersTest.kt | 2 +- .../databinding/ViewBindingAdaptersTest.kt | 2 +- .../DeveloperOptionsActivityTest.kt | 2 +- .../DeveloperOptionsFragmentTest.kt | 2 +- .../MarkChaptersCompletedActivityTest.kt | 2 +- .../MarkChaptersCompletedFragmentTest.kt | 2 +- .../MarkStoriesCompletedActivityTest.kt | 2 +- .../MarkStoriesCompletedFragmentTest.kt | 2 +- .../MarkTopicsCompletedActivityTest.kt | 2 +- .../MarkTopicsCompletedFragmentTest.kt | 2 +- .../devoptions/ViewEventLogsActivityTest.kt | 2 +- .../devoptions/ViewEventLogsFragmentTest.kt | 2 +- .../ForceNetworkTypeActivityTest.kt | 2 +- .../ForceNetworkTypeFragmentTest.kt | 2 +- .../MathExpressionParserActivityTest.kt | 2 +- .../MathExpressionParserFragmentTest.kt | 2 +- .../android/app/faq/FAQListFragmentTest.kt | 2 +- .../android/app/faq/FAQSingleActivityTest.kt | 2 +- .../android/app/faq/FaqListActivityTest.kt | 2 +- .../android/app/help/HelpActivityTest.kt | 2 +- .../android/app/help/HelpFragmentTest.kt | 2 +- .../android/app/home/HomeActivityTest.kt | 2 +- .../app/home/RecentlyPlayedFragmentTest.kt | 2 +- .../app/home/TopicSummaryViewModelTest.kt | 2 +- .../android/app/home/WelcomeViewModelTest.kt | 2 +- .../PromotedStoryListViewModelTest.kt | 2 +- .../PromotedStoryViewModelTest.kt | 2 +- .../mydownloads/MyDownloadsActivityTest.kt | 2 +- .../mydownloads/MyDownloadsFragmentTest.kt | 2 +- .../app/onboarding/OnboardingActivityTest.kt | 2 +- .../app/onboarding/OnboardingFragmentTest.kt | 2 +- .../OngoingTopicListActivityTest.kt | 2 +- .../app/options/AppLanguageActivityTest.kt | 2 +- .../app/options/AppLanguageFragmentTest.kt | 2 +- .../app/options/AudioLanguageActivityTest.kt | 2 +- .../app/options/AudioLanguageFragmentTest.kt | 2 +- .../app/options/OptionsActivityTest.kt | 2 +- .../app/options/OptionsFragmentTest.kt | 26 ++++++++--------- .../options/ReadingTextSizeActivityTest.kt | 2 +- .../options/ReadingTextSizeFragmentTest.kt | 2 +- .../app/parser/CustomBulletSpanTest.kt | 2 +- .../android/app/parser/HtmlParserTest.kt | 2 +- .../app/player/audio/AudioFragmentTest.kt | 2 +- .../exploration/ExplorationActivityTest.kt | 2 +- .../app/player/state/StateFragmentTest.kt | 2 +- .../app/profile/AddProfileActivityTest.kt | 2 +- .../app/profile/AdminAuthActivityTest.kt | 2 +- .../app/profile/AdminPinActivityTest.kt | 2 +- .../app/profile/PinPasswordActivityTest.kt | 2 +- .../app/profile/ProfileChooserFragmentTest.kt | 2 +- .../app/recyclerview/BindableAdapterTest.kt | 2 +- .../resumelesson/ResumeLessonActivityTest.kt | 2 +- .../resumelesson/ResumeLessonFragmentTest.kt | 2 +- .../profile/ProfileEditActivityTest.kt | 2 +- .../profile/ProfileEditFragmentTest.kt | 2 +- .../profile/ProfileListActivityTest.kt | 2 +- .../profile/ProfileListFragmentTest.kt | 2 +- .../profile/ProfileRenameActivityTest.kt | 2 +- .../profile/ProfileRenameFragmentTest.kt | 2 +- .../profile/ProfileResetPinActivityTest.kt | 2 +- .../profile/ProfileResetPinFragmentTest.kt | 2 +- .../android/app/splash/SplashActivityTest.kt | 2 +- .../android/app/story/StoryActivityTest.kt | 2 +- .../android/app/story/StoryFragmentTest.kt | 2 +- .../app/testing/DragDropTestActivityTest.kt | 2 +- ...ImageRegionSelectionInteractionViewTest.kt | 2 +- .../InputInteractionViewTestActivityTest.kt | 2 +- .../NavigationDrawerActivityDebugTest.kt | 2 +- .../NavigationDrawerActivityProdTest.kt | 2 +- ...tFontScaleConfigurationUtilActivityTest.kt | 2 +- .../testing/TopicTestActivityForStoryTest.kt | 2 +- .../app/thirdparty/LicenseListActivityTest.kt | 2 +- .../app/thirdparty/LicenseListFragmentTest.kt | 2 +- .../LicenseTextViewerActivityTest.kt | 2 +- .../LicenseTextViewerFragmentTest.kt | 2 +- .../ThirdPartyDependencyListActivityTest.kt | 2 +- .../ThirdPartyDependencyListFragmentTest.kt | 2 +- .../android/app/topic/TopicActivityTest.kt | 2 +- .../android/app/topic/TopicFragmentTest.kt | 2 +- .../conceptcard/ConceptCardFragmentTest.kt | 2 +- .../app/topic/info/TopicInfoFragmentTest.kt | 2 +- .../topic/lessons/TopicLessonsFragmentTest.kt | 2 +- .../practice/TopicPracticeFragmentTest.kt | 2 +- .../QuestionPlayerActivityTest.kt | 2 +- .../revision/TopicRevisionFragmentTest.kt | 2 +- .../revisioncard/RevisionCardActivityTest.kt | 2 +- .../revisioncard/RevisionCardFragmentTest.kt | 2 +- .../app/utility/RatioExtensionsTest.kt | 2 +- .../walkthrough/WalkthroughActivityTest.kt | 2 +- .../WalkthroughFinalFragmentTest.kt | 2 +- .../WalkthroughTopicListFragmentTest.kt | 2 +- .../WalkthroughWelcomeFragmentTest.kt | 2 +- .../activity/ActivityIntentFactoriesTest.kt | 2 +- .../android/app/home/HomeActivityLocalTest.kt | 2 +- .../app/parser/FractionParsingUiErrorTest.kt | 2 +- .../app/parser/StringToRatioParserTest.kt | 2 +- .../ExplorationActivityLocalTest.kt | 2 +- .../player/state/StateFragmentLocalTest.kt | 2 +- .../ProfileChooserFragmentLocalTest.kt | 2 +- .../app/story/StoryActivityLocalTest.kt | 2 +- .../app/testing/CompletedStoryListSpanTest.kt | 2 +- .../oppia/android/app/testing/HomeSpanTest.kt | 2 +- .../app/testing/OngoingTopicListSpanTest.kt | 2 +- .../PlatformParameterIntegrationTest.kt | 2 +- .../app/testing/ProfileChooserSpanTest.kt | 2 +- .../testing/ProfileProgressSpanCountTest.kt | 2 +- .../app/testing/RecentlyPlayedSpanTest.kt | 2 +- .../app/testing/TopicRevisionSpanTest.kt | 2 +- .../app/testing/activity/TestActivityTest.kt | 2 +- .../AdministratorControlsFragmentTest.kt | 2 +- .../testing/options/OptionsFragmentTest.kt | 26 ++++++++--------- .../player/split/PlayerSplitScreenTest.kt | 2 +- .../state/StateFragmentAccessibilityTest.kt | 2 +- .../topic/info/TopicInfoFragmentLocalTest.kt | 2 +- .../lessons/TopicLessonsFragmentLocalTest.kt | 2 +- .../QuestionPlayerActivityLocalTest.kt | 2 +- .../RevisionCardActivityLocalTest.kt | 2 +- .../MathExpressionAccessibilityUtilTest.kt | 2 +- 131 files changed, 168 insertions(+), 168 deletions(-) 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 977e569c172..4d9f37c391d 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 @@ -110,6 +110,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -119,7 +120,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AdministratorControlsActivity]. */ @RunWith(AndroidJUnit4::class) 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 ea8adc9dc9d..aa3efb3527f 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 @@ -102,6 +102,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -111,7 +112,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 4460ceaaca0..fd77b04b827 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 @@ -90,6 +90,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -99,7 +100,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AppVersionActivity]. */ @RunWith(AndroidJUnit4::class) 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 2997420032a..6b3535732da 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 @@ -82,6 +82,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -93,7 +94,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileAndDeviceIdActivity]. */ // Function name: test names are conventionally named with underscores. 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 05b0f951e4f..22ced61634d 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 @@ -100,6 +100,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -109,23 +110,11 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering 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.oppia.android.util.system.OppiaClock -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode -import java.util.concurrent.TimeUnit -import javax.inject.Inject -import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule 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.EnableLanguageSelectionUi import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection +import org.oppia.android.util.platformparameter.LearnerStudyAnalytics import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES @@ -136,6 +125,17 @@ import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHigh import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton +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.oppia.android.util.system.OppiaClock +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 [ProfileAndDeviceIdFragment]. */ // Same parameter value: helpers reduce test context, even if they are used by 1 test. 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 a52cf52621c..6c050d5b0ea 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 @@ -95,6 +95,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +105,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [CompletedStoryListActivity]. */ @RunWith(AndroidJUnit4::class) 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 4e3d4a12952..9dc0f066dd5 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 @@ -74,6 +74,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LessonThumbnailImageView]. */ @RunWith(AndroidJUnit4::class) 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 598314e224e..c6a03932dda 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 @@ -95,6 +95,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +105,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [MathExpressionInteractionsView] & its view model. 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 e87f76184c0..0437e00e060 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 @@ -79,6 +79,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -86,7 +87,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DrawableBindingAdapters]. */ @RunWith(AndroidJUnit4::class) 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 b92b886dbb6..120beb3c4f9 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 @@ -84,6 +84,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -91,7 +92,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ImageViewBindingAdapters]. */ @RunWith(AndroidJUnit4::class) 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 20d279828af..26090315305 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 @@ -85,6 +85,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -93,7 +94,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f 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 c7e511421a9..f5ffa1de780 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 @@ -87,6 +87,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -95,7 +96,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f 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 76cb1480af6..0cfb6d6f74f 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 @@ -85,6 +85,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -93,7 +94,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TOLERANCE = 1e-5f 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 ac5a1872b7d..40e2f930ad2 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 @@ -78,6 +78,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -86,7 +87,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TextViewBindingAdapters]. */ @RunWith(AndroidJUnit4::class) 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 e98b83d7ec1..01c976301ff 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 @@ -82,6 +82,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -90,7 +91,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Default value for float comparison. */ private const val TOLERANCE = 1e-5f 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 ea148f2eef4..cead4fc5994 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 @@ -100,6 +100,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -109,7 +110,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DeveloperOptionsActivity]. */ @RunWith(AndroidJUnit4::class) 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 b6ae7ecd986..fd77706f78f 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 @@ -97,6 +97,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -106,7 +107,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [DeveloperOptionsFragment]. */ @RunWith(AndroidJUnit4::class) 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 afacba93560..46c7ef44614 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 @@ -76,6 +76,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -85,7 +86,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkChaptersCompletedActivity]. */ @RunWith(AndroidJUnit4::class) 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 b0c93e3b74d..d554d4023a6 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -97,7 +98,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkChaptersCompletedFragment]. */ @RunWith(AndroidJUnit4::class) 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 817e248d693..c0b304a64db 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 @@ -76,6 +76,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -85,7 +86,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkStoriesCompletedActivity]. */ @RunWith(AndroidJUnit4::class) 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 6e4e6e672f6..1714b4d0ef5 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -97,7 +98,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkStoriesCompletedFragment]. */ @RunWith(AndroidJUnit4::class) 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 127762a0095..12683d2dcd2 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 @@ -76,6 +76,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -85,7 +86,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkTopicsCompletedActivity]. */ @RunWith(AndroidJUnit4::class) 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 87a6d389b4d..1140035311a 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -97,7 +98,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MarkTopicsCompletedFragment]. */ @RunWith(AndroidJUnit4::class) 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 360fd17227f..1c4e1040e50 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 @@ -77,6 +77,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -86,7 +87,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) 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 d94857f0186..58d97e34090 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 @@ -84,6 +84,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -93,7 +94,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" 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 0e074e9030e..c92212fce49 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 @@ -77,6 +77,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -86,7 +87,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ForceNetworkTypeActivity]. */ @RunWith(AndroidJUnit4::class) 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 4074a532ea4..f28d4097747 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 @@ -83,6 +83,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -92,7 +93,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ForceNetworkTypeFragment]. */ @RunWith(AndroidJUnit4::class) 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 c5370780520..c4b16e8146f 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 @@ -74,6 +74,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -83,7 +84,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MathExpressionParserActivity] and its presenter. */ // FunctionName: test names are conventionally named with underscores. 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 fe424a0e887..52910e2df8f 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 @@ -86,6 +86,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -95,7 +96,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MathExpressionParserFragment] and its presenter and view model. */ // FunctionName: test names are conventionally named with underscores. 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 6dd750b7ae2..27363d8d244 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -96,7 +97,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQListFragment]. */ @RunWith(AndroidJUnit4::class) 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 a9bf73c2b76..a3e394b9b7f 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 @@ -83,6 +83,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParser @@ -93,7 +94,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQSingleActivity]. */ @RunWith(AndroidJUnit4::class) 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 cedbf66ea25..92b3855580d 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FAQListActivity]. */ @RunWith(AndroidJUnit4::class) 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 6e47d950228..cdfccc05985 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [HelpActivity]. */ @RunWith(AndroidJUnit4::class) 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 d04f0d501b7..8f35b6f7dc8 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 @@ -98,6 +98,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -107,7 +108,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 ecace072c3c..ba91913bcc7 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 @@ -128,6 +128,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -138,7 +139,6 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Time: Tue Apr 23 2019 23:22:00 private const val EVENING_TIMESTAMP = 1556061720000 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 f96f93fc963..00f5c55342e 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 @@ -115,6 +115,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -123,7 +124,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_FRAGMENT_TAG = "recently_played_test_fragment" private const val TOLERANCE = 1e-5f 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 658dd6dc934..0fd6350d394 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 @@ -72,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_FRAGMENT_TAG = "topic_summary_view_model_test_fragment" 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 e3d45c1fa90..e8c13953753 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Time: Wed Apr 24 2019 08:22:00 private const val MORNING_TIMESTAMP = 1556094120000 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 00c3183c591..47a517e6dfb 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [PromotedStoryListViewModel] data. */ @RunWith(AndroidJUnit4::class) 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 f7388170964..4c3c00e3641 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [PromotedStoryViewModel] data. */ @RunWith(AndroidJUnit4::class) 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 50c85db58de..0dac5a18c04 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 @@ -69,6 +69,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -78,7 +79,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 64b4f968233..21870637f07 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 @@ -80,6 +80,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -88,7 +89,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [MyDownloadsFragment]. */ @RunWith(AndroidJUnit4::class) 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 7307d09d382..b066ccb1179 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OnboardingActivity]. */ @RunWith(AndroidJUnit4::class) 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 04e9b3902fc..b5fbd111635 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 @@ -98,6 +98,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -107,7 +108,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OnboardingFragment]. */ @RunWith(AndroidJUnit4::class) 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 5d09d9002e8..428c331180c 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -102,7 +103,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OngoingTopicListActivity]. */ @RunWith(AndroidJUnit4::class) 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 12c408051ca..175b033b72b 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AppLanguageActivity]. */ @RunWith(AndroidJUnit4::class) 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 302ee208cd5..340983a5bf1 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 @@ -82,6 +82,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -91,7 +92,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val ENGLISH = 0 private const val FRENCH = 1 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 cda1d316007..920be688d93 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [AudioLanguageActivity]. */ @RunWith(AndroidJUnit4::class) 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 816dbf9a5c1..5ecf33722a4 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 @@ -81,6 +81,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -90,7 +91,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val ENGLISH = 1 private const val FRENCH = 2 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 11bb88f1698..aaa1ec4e7a0 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [OptionsActivity]. */ @RunWith(AndroidJUnit4::class) 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 b44044e2cf5..f584410d413 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -101,10 +102,22 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering +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.EnableLanguageSelectionUi +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE @@ -115,19 +128,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule -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.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes /** Tests for [OptionsFragment]. */ @RunWith(AndroidJUnit4::class) 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 a746476cf5a..fe5b879f009 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ReadingTextSizeActivity]. */ @RunWith(AndroidJUnit4::class) 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 41238f1180f..954673eb353 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -97,7 +98,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // TODO(#1815): Remove these duplicate values once Screenshot tests are implemented. private const val SMALL_TEXT_SIZE_SCALE = 0.8f diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt index 15b59cacf49..9a53d3cbc88 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt @@ -72,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.CustomBulletSpan @@ -81,7 +82,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 f6ca29e4e59..f69d7c85334 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 @@ -100,6 +100,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.CustomBulletSpan @@ -112,7 +113,6 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton import kotlin.reflect.KClass -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // TODO(#277): Add tests for UrlImageParser. /** Tests for [HtmlParser]. */ 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 ec697cebbf5..73a5b57665f 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 @@ -100,6 +100,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -110,7 +111,6 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * TODO(#59): Make this test work with Espresso. 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 f2e6bd2bbd7..9963976e3be 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 @@ -147,6 +147,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus @@ -160,7 +161,6 @@ import java.io.IOException import java.util.concurrent.TimeoutException import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ExplorationActivity]. */ @RunWith(AndroidJUnit4::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 1ddc99293cc..bc8423d23b7 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 @@ -171,6 +171,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -183,7 +184,6 @@ import java.io.IOException import java.util.concurrent.TimeoutException import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) 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 f0a1162911b..8a51c9e306c 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 @@ -109,6 +109,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -118,7 +119,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 cf121763fb4..584cf217dcd 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -102,7 +103,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 5088fbd614b..2e2f68de3eb 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 @@ -104,6 +104,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -113,7 +114,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 acf48d9fea1..f5f63d04b10 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 @@ -99,6 +99,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -108,7 +109,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 e9b50d473b5..069b2c73908 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 @@ -95,6 +95,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +105,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileChooserFragment]. */ @RunWith(AndroidJUnit4::class) 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 ccb086b4699..9cb4d6a398b 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 @@ -111,6 +111,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -121,7 +122,6 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Provider import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [BindableAdapter]. */ @RunWith(AndroidJUnit4::class) 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 8569bd5f9b2..aca6b69e420 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 @@ -90,6 +90,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -98,7 +99,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ResumeLessonActivity]. */ @RunWith(AndroidJUnit4::class) 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 28bf5b8a49d..4a7f284d485 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -96,7 +97,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ResumeLessonFragment]. */ @RunWith(AndroidJUnit4::class) 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 6a652d81799..9bb2b4d26c3 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 @@ -89,6 +89,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -98,7 +99,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileEditActivity]. */ @RunWith(AndroidJUnit4::class) 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 b4b55a007bb..8704ce7882f 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 @@ -91,6 +91,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -99,7 +100,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 43097198b8e..32e3cd038cc 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileListActivity]. */ @RunWith(AndroidJUnit4::class) 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 72eb091b911..f0c636366d0 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 @@ -87,6 +87,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -96,7 +97,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 43ce8198148..606274af1ab 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 @@ -74,6 +74,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -83,7 +84,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Test for [ProfileRenameActivity]. */ @RunWith(AndroidJUnit4::class) 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 0dd6ee2cb45..13f4d1ad17f 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 @@ -92,6 +92,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -101,7 +102,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileRenameFragment]. */ @RunWith(AndroidJUnit4::class) 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 8c55c827a14..a457543ed0c 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 @@ -75,6 +75,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -84,7 +85,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 ea7cf311d32..584b51d4e3c 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -102,7 +103,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 42c55825e63..85d908fac69 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 @@ -96,6 +96,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -111,7 +112,6 @@ import java.util.Date import java.util.Locale import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [SplashActivity]. For context on the activity test rule setup see: 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 bce785d798a..5801cd447ad 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 @@ -90,6 +90,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -98,7 +99,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StoryActivity]. */ @RunWith(AndroidJUnit4::class) 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 cb7db9687ea..8e999a8c535 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 @@ -131,6 +131,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -141,7 +142,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StoryFragment]. */ @RunWith(AndroidJUnit4::class) 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 cebebb93b7e..d0ed11757e0 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 @@ -81,6 +81,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -89,7 +90,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 590a0c5ef7e..d2cdfadb432 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 @@ -95,6 +95,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +105,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) 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 09b615fdc10..e9e7543a258 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 @@ -90,6 +90,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -99,7 +100,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [InputInteractionViewTestActivity]. */ @RunWith(AndroidJUnit4::class) 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 8f9bb80bb64..b51cb1952da 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 @@ -111,6 +111,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -120,7 +121,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [NavigationDrawerTestActivity]. */ @RunWith(AndroidJUnit4::class) 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 d68fe6bc380..5c4f91e8fc9 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 @@ -121,6 +121,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -130,7 +131,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [NavigationDrawerTestActivity]. */ @RunWith(AndroidJUnit4::class) 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 40485e110c4..987c4ed4471 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 @@ -76,6 +76,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -84,7 +85,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TestFontScaleConfigurationUtilActivity]. */ @RunWith(AndroidJUnit4::class) 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 a452f930ceb..6b1c97b1936 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 @@ -83,6 +83,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -92,7 +93,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicTestActivityForStory]. */ @RunWith(AndroidJUnit4::class) 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 1b32649c25e..9920f2af6dd 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListActivity]. */ @RunWith(AndroidJUnit4::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 8d6bbe6898c..565e428b2b1 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 @@ -88,6 +88,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -97,7 +98,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListFragmentTest]. */ @RunWith(AndroidJUnit4::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 a493467016f..9c208578ea0 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 @@ -72,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseListActivity]. */ @RunWith(AndroidJUnit4::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 9946b12e588..4738a3cfc3c 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 @@ -78,6 +78,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -87,7 +88,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [LicenseTextViewerFragmentTest]. */ @RunWith(AndroidJUnit4::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 1a7f4627b81..62d65d08453 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ThirdPartyDependencyListActivity]. */ @RunWith(AndroidJUnit4::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 bba6d9ace5d..f1e00d3102a 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 @@ -87,6 +87,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -96,7 +97,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ThirdPartyDependencyListFragmentTest]. */ @RunWith(AndroidJUnit4::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 d03885fc004..344e4e22406 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 @@ -87,6 +87,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -96,7 +97,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicActivity]. */ @RunWith(AndroidJUnit4::class) 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 ab2d09cdfc5..a5efce93c2b 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 @@ -97,6 +97,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -106,7 +107,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val INFO_TAB_POSITION = 0 private const val LESSON_TAB_POSITION = 1 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 9777529f8a0..49304c9457e 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 @@ -103,6 +103,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -112,7 +113,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ConceptCardFragment]. */ @RunWith(AndroidJUnit4::class) 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 278a2f7c8e8..ab9c46a064b 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 @@ -102,6 +102,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -110,7 +111,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TOPIC_NAME = "Fractions" 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 dc6aa315c5b..71fe05e98fe 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 @@ -113,6 +113,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -122,7 +123,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicLessonsFragment]. */ @RunWith(AndroidJUnit4::class) 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 e5326df8386..7e20451084d 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 @@ -95,6 +95,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -104,7 +105,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicPracticeFragment]. */ @RunWith(AndroidJUnit4::class) 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 5b6af6e6de2..d90263dd651 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 @@ -136,6 +136,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -146,7 +147,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private val SKILL_ID_LIST = listOf(FRACTIONS_SKILL_ID_0) 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 6c625608b4f..70f7bfdbd34 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 @@ -98,6 +98,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -106,7 +107,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TopicRevisionFragment]. */ @RunWith(AndroidJUnit4::class) 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 a01c9f13d94..f92a9ec72a9 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 @@ -91,6 +91,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -100,7 +101,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RevisionCardActivity]. */ @RunWith(AndroidJUnit4::class) 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 c5798a9da1f..27fde089236 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 @@ -115,6 +115,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -124,7 +125,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RevisionCardActivity]. */ @RunWith(AndroidJUnit4::class) 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 fc89336b918..59edf720373 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 @@ -69,6 +69,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -77,7 +78,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [RatioExtensions]. */ @RunWith(AndroidJUnit4::class) 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 351c038eb46..69fcf002216 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 @@ -82,6 +82,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -91,7 +92,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughActivity]. */ @RunWith(AndroidJUnit4::class) 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 39948fbc887..9d0e272f6cf 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 @@ -86,6 +86,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -95,7 +96,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughFinalFragment]. */ @RunWith(AndroidJUnit4::class) 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 890475cdd81..0a4a06107a9 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -101,7 +102,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughTopicListFragment]. */ @RunWith(AndroidJUnit4::class) 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 62f88914205..18893bcf2e9 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 @@ -83,6 +83,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -92,7 +93,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [WalkthroughWelcomeFragment]. */ @RunWith(AndroidJUnit4::class) 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 5e9d8522fa0..515d6354feb 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ActivityIntentFactories]. */ // FunctionName: test names are conventionally named with underscores. 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 953788851d4..d675fe39f33 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 39ecf1734d5..64afbecd280 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 @@ -67,6 +67,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.math.FractionParser import org.oppia.android.util.math.FractionParser.FractionParsingError import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule @@ -77,7 +78,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [FractionParsingUiError]. */ @RunWith(AndroidJUnit4::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 bc748fac77e..08017b58dca 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 @@ -69,6 +69,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -77,7 +78,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StringToRatioParser]. */ @RunWith(AndroidJUnit4::class) 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 eaccf032506..0816deead35 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 @@ -78,6 +78,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -88,7 +89,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 67a0a3b7e20..b5546e67338 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 @@ -150,6 +150,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -165,7 +166,6 @@ import java.util.Locale import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [StateFragment] that can only be run locally, e.g. using Robolectric, and not on an 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 ee67e748d72..4775f782cca 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 8d67fb985bd..7a1d45f9946 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 @@ -72,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TEST_STORY_ID = "GJ2rLXRKD5hw" 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 e603a5acc10..5bf245855f6 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 cb23e1bca0d..0dd2bd01bbf 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 4614a4d1cf0..076f747ab71 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 @@ -74,6 +74,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 98cfb71ab59..ecae6265e67 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 @@ -93,6 +93,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -111,7 +112,6 @@ import retrofit2.mock.MockRetrofit import java.util.UUID import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests to verify the working of Platform Parameter Architecture. */ @RunWith(AndroidJUnit4::class) 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 1c0126f5ba5..d2af5a02165 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -82,7 +83,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TAG_PROFILE_CHOOSER_FRAGMENT_RECYCLER_VIEW = "profile_recycler_view" 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 91ad53abe3b..97b1ca6c557 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 @@ -73,6 +73,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -81,7 +82,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 27f9f783381..a1c2f699e9a 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 @@ -78,6 +78,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -87,7 +88,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 137bb548f84..896af5e4a70 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 @@ -72,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 cbf46c58852..3343b496b9e 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 @@ -69,6 +69,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -78,7 +79,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [TestActivity]. */ // FunctionName: test names are conventionally named with underscores. 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 21c1aff4373..35afe0435a1 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 @@ -80,6 +80,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -88,7 +89,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @Config( 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 e3e9cb3ee08..8728912a940 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 @@ -82,6 +82,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -90,10 +91,22 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering +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.EnableLanguageSelectionUi +import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LearnerStudyAnalytics +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES +import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes +import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE @@ -104,19 +117,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule -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.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes @RunWith(AndroidJUnit4::class) @Config(application = OptionsFragmentTest.TestApplication::class, qualifiers = "sw600dp") 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 70aebe74e57..caba0fe543d 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -77,7 +78,6 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule // Devices reference: https://material.io/resources/devices/ @RunWith(AndroidJUnit4::class) 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 b0327dc6163..40bbcf13064 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 @@ -83,6 +83,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -92,7 +93,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [StateFragment]. */ @RunWith(AndroidJUnit4::class) 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 dfbd3042b67..0cb01a6031b 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 @@ -70,6 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -79,7 +80,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" 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 89f3c6bf57b..5c90311d36c 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 @@ -69,6 +69,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -78,7 +79,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule private const val TEST_TOPIC_ID = "GJ2rLXRKD5hw" private const val TEST_STORY_ID = "GJ2rLXRKD5hw" 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 7581fc6607d..2301bb9cbe4 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 @@ -102,6 +102,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -111,7 +112,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [QuestionPlayerActivity] that can only be run locally, e.g. using Robolectric, and not on an 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 d4b811f012b..681d0995402 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 @@ -71,6 +71,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -80,7 +81,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) 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 c858580a0b3..f90ef13477b 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 @@ -96,6 +96,7 @@ import org.oppia.android.util.locale.testing.LocaleTestModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.math.MathExpressionParser import org.oppia.android.util.math.MathExpressionParser.Companion.ErrorCheckingMode import org.oppia.android.util.math.MathExpressionParser.Companion.ErrorCheckingMode.ALL_ERRORS @@ -110,7 +111,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** * Tests for [MathExpressionAccessibilityUtil]. From fd2e4a4d96ec393dab8ffbf1968f0ffa22e4f225 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 03:27:49 +0530 Subject: [PATCH 080/149] nits. --- .../app/profileprogress/ProfilePictureActivityTest.kt | 6 +++--- .../app/profileprogress/ProfileProgressActivityTest.kt | 6 +++--- .../app/profileprogress/ProfileProgressFragmentTest.kt | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) 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 85572c0ad39..5846f5f4d64 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 @@ -16,6 +16,8 @@ import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import dagger.Component +import javax.inject.Inject +import javax.inject.Singleton import org.junit.After import org.junit.Before import org.junit.Rule @@ -79,6 +81,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -86,9 +89,6 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfilePictureActivity]. */ @RunWith(AndroidJUnit4::class) 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 34d4efb28aa..1c1577ae324 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 @@ -9,6 +9,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import com.google.common.truth.Truth.assertThat import dagger.Component +import javax.inject.Inject +import javax.inject.Singleton import org.junit.Before import org.junit.Rule import org.junit.Test @@ -70,6 +72,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -77,9 +80,6 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileProgressActivity]. */ @RunWith(AndroidJUnit4::class) 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 717b06c6bf2..122b56aaf2f 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 @@ -38,6 +38,8 @@ import com.google.common.truth.Truth.assertThat import dagger.Component import dagger.Module import dagger.Provides +import javax.inject.Inject +import javax.inject.Singleton import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.not import org.hamcrest.Matcher @@ -119,6 +121,7 @@ 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.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -126,9 +129,6 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule /** Tests for [ProfileProgressFragment]. */ @RunWith(AndroidJUnit4::class) From c6cac99483d69be4ece3e4729af0cf9b2be257d8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 03:31:17 +0530 Subject: [PATCH 081/149] nits. --- .../android/app/profileprogress/ProfilePictureActivityTest.kt | 4 ++-- .../app/profileprogress/ProfileProgressActivityTest.kt | 4 ++-- .../app/profileprogress/ProfileProgressFragmentTest.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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 5846f5f4d64..b256c0f0304 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 @@ -16,8 +16,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import dagger.Component -import javax.inject.Inject -import javax.inject.Singleton import org.junit.After import org.junit.Before import org.junit.Rule @@ -89,6 +87,8 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton /** Tests for [ProfilePictureActivity]. */ @RunWith(AndroidJUnit4::class) 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 1c1577ae324..ebac4a8977f 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 @@ -9,8 +9,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import com.google.common.truth.Truth.assertThat import dagger.Component -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Rule import org.junit.Test @@ -80,6 +78,8 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton /** Tests for [ProfileProgressActivity]. */ @RunWith(AndroidJUnit4::class) 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 122b56aaf2f..ce80f3325cd 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 @@ -38,8 +38,6 @@ import com.google.common.truth.Truth.assertThat import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.not import org.hamcrest.Matcher @@ -129,6 +127,8 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton /** Tests for [ProfileProgressFragment]. */ @RunWith(AndroidJUnit4::class) From bb2219258e14ce97b8a43c785cd14f4909c946ef Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 05:27:39 +0530 Subject: [PATCH 082/149] nits. --- .../PerformanceMetricsUtilsTest.kt | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 17ff259bda2..39ce9d7d0e6 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -174,20 +174,6 @@ class PerformanceMetricsUtilsTest { assertThat(apkSize).isEqualTo(testApkSize) } - @Test - fun testPerformanceMetricsUtils_putAppInForeground_verifyIsAppInForegroundReturnsCorrectValue() { - performanceMetricsUtils.onAppInForeground() - - assertThat(performanceMetricsUtils.isAppInForeground()).isTrue() - } - - @Test - fun testPerformanceMetricsUtils_putAppInBackground_verifyIsAppInForegroundReturnsCorrectValue() { - performanceMetricsUtils.onAppInBackground() - - assertThat(performanceMetricsUtils.isAppInForeground()).isFalse() - } - private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) } From d6389281c46a6cfc6774a546d1eb5e2b6fc182bf Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 18 Jul 2022 05:28:13 +0530 Subject: [PATCH 083/149] nit --- .../logging/performancemetrics/PerformanceMetricsUtilsTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 39ce9d7d0e6..7b6b5b81253 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -150,7 +150,7 @@ class PerformanceMetricsUtilsTest { } @Test - fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnssCorrectApkSize() { + fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnsCorrectApkSize() { val applicationInfo = ApplicationInfo() val testApkSize = (File(TEST_APP_PATH).length() / 1024) applicationInfo.apply { From fb23b3aa3d4df0083b15d0de82866f66d8c9422b Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 19 Jul 2022 00:29:00 +0530 Subject: [PATCH 084/149] test update. --- .../analytics/PerformanceMetricsLoggerTest.kt | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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 28b50de598b..fb6c6cf81b4 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 @@ -3,7 +3,6 @@ package org.oppia.android.domain.oppialogger.analytics import android.app.Application import android.content.Context import androidx.test.core.app.ApplicationProvider -import androidx.test.runner.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import dagger.BindsInstance import dagger.Component @@ -12,6 +11,8 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.MockitoAnnotations import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.HOME_SCREEN import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC @@ -45,6 +46,8 @@ import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -56,7 +59,7 @@ private const val TEST_CPU_USAGE = Long.MAX_VALUE /** Tests for [PerformanceMetricsLoggerTest]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) +@RunWith(RobolectricTestRunner::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(application = PerformanceMetricsLoggerTest.TestApplication::class) class PerformanceMetricsLoggerTest { @@ -76,8 +79,12 @@ class PerformanceMetricsLoggerTest { @Inject lateinit var performanceMetricsUtils: PerformanceMetricsUtils + @Mock + lateinit var context: Context + @Before fun setUp() { + MockitoAnnotations.initMocks(this) setUpTestApplicationComponent() fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) @@ -104,7 +111,7 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStorageUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val storageUsage = performanceMetricsUtils.getUsedStorage() + val storageUsage = getStorageUsage() val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() val storageTier = performanceMetricsUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() @@ -206,6 +213,14 @@ class PerformanceMetricsLoggerTest { ApplicationProvider.getApplicationContext().inject(this) } + private fun getStorageUsage(): Long { + val persistentUsage = + RuntimeEnvironment.application.filesDir.totalSpace - RuntimeEnvironment.application.filesDir.freeSpace + val cacheUsage = + RuntimeEnvironment.application.cacheDir.totalSpace - RuntimeEnvironment.application.cacheDir.freeSpace + return persistentUsage + cacheUsage + } + // TODO(#89): Move this to a common test application component. @Module class TestModule { From 0f70b120af49ae9bfd52d6299f71b9df7c3c656f Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 19 Jul 2022 00:37:43 +0530 Subject: [PATCH 085/149] test update. --- .../oppialogger/analytics/PerformanceMetricsLoggerTest.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 fb6c6cf81b4..e997afae49e 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 @@ -214,10 +214,11 @@ class PerformanceMetricsLoggerTest { } private fun getStorageUsage(): Long { + val application = RuntimeEnvironment.application val persistentUsage = - RuntimeEnvironment.application.filesDir.totalSpace - RuntimeEnvironment.application.filesDir.freeSpace + application.filesDir.totalSpace- application.filesDir.freeSpace val cacheUsage = - RuntimeEnvironment.application.cacheDir.totalSpace - RuntimeEnvironment.application.cacheDir.freeSpace + application.cacheDir.totalSpace - application.cacheDir.freeSpace return persistentUsage + cacheUsage } From 51d626cfcef6838a388fadcd6b279ef10188ec54 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 19 Jul 2022 00:41:12 +0530 Subject: [PATCH 086/149] nit --- .../oppialogger/analytics/PerformanceMetricsLoggerTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e997afae49e..123e71f4888 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 @@ -216,7 +216,7 @@ class PerformanceMetricsLoggerTest { private fun getStorageUsage(): Long { val application = RuntimeEnvironment.application val persistentUsage = - application.filesDir.totalSpace- application.filesDir.freeSpace + application.filesDir.totalSpace - application.filesDir.freeSpace val cacheUsage = application.cacheDir.totalSpace - application.cacheDir.freeSpace return persistentUsage + cacheUsage From d56c9cc2a8e6a744757d8728a4e07afc3a7632d8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 19 Jul 2022 01:44:31 +0530 Subject: [PATCH 087/149] todo issue number update -- static check --- .../oppia/android/util/logging/firebase/FirebaseEventLogger.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt index 50bf90c3da8..b2a1f71d4ef 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/FirebaseEventLogger.kt @@ -38,7 +38,7 @@ class FirebaseEventLogger private constructor( * Logs a performance metric to Firebase Analytics with [NETWORK_USER_PROPERTY] and [COUNTRY_USER_PROPERTY]. */ override fun logPerformanceMetric(oppiaMetricLog: OppiaMetricLog) { - // TODO(#4325): Add implementation to upload performance metrics logs to firebase. + // TODO(#4335): Add implementation to upload performance metrics logs to firebase. } private fun getNetworkStatus(): String { From 6d545ef30491ea2b2449f95cbcfdbd14131d8f8c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 19 Jul 2022 05:46:02 +0530 Subject: [PATCH 088/149] comments. --- .../logscheduler/MetricLogSchedulingWorker.kt | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) 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 d70bd46b113..93ef81693ac 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 @@ -30,18 +30,23 @@ class MetricLogSchedulingWorker private constructor( private const val TAG = "MetricLogSchedulingWorker" /** * Input data for the worker consists of a key-value pair on the basis of which work is done. - * * [WORKER_CASE_KEY] is the key for that data. - * When [PERIODIC_METRIC_WORKER] is the value, the worker schedules logging of periodic - * performance metrics. - * When [STORAGE_USAGE_WORKER] is the value, the worker schedules logging of storage usage - * performance metrics. - * When [MEMORY_USAGE_WORKER] is the value, the worker schedules logging of memory usage - * performance metrics. */ const val WORKER_CASE_KEY = "metric_log_scheduling_worker_case_key" + /** + * When [PERIODIC_METRIC_WORKER] is the value of the worker's key-value pair, the worker + * schedules logging of periodic performance metrics. + */ const val PERIODIC_METRIC_WORKER = "periodic_metric_worker" + /** + * When [STORAGE_USAGE_WORKER] is the value of the worker's key-value pair, the worker schedules + * logging of storage usage performance metrics. + */ const val STORAGE_USAGE_WORKER = "storage_usage_worker" + /** + * When [MEMORY_USAGE_WORKER] is the value of the worker's key-value pair, the worker schedules + * logging of memory usage performance metrics. + */ const val MEMORY_USAGE_WORKER = "memory_usage_worker" } @@ -104,6 +109,12 @@ class MetricLogSchedulingWorker private constructor( private val performanceMetricsLogger: PerformanceMetricsLogger, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) { + /** + * Returns a new [MetricLogSchedulingWorker]. + * + * This [MetricLogSchedulingWorker] implements the [ListenableWorker] for facilitating metric + * log scheduling. + */ fun create(context: Context, params: WorkerParameters): ListenableWorker { return MetricLogSchedulingWorker( context, From 11a73bceb830c1b2ea1e29dd9defb5dd8ad75f25 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 22 Jul 2022 05:02:39 +0530 Subject: [PATCH 089/149] nits. --- .../analytics/PerformanceMetricsController.kt | 8 ++- .../analytics/PerformanceMetricsLogger.kt | 23 ++++---- .../logscheduler/MetricLogSchedulingWorker.kt | 33 +++++------ .../LogReportWorkManagerInitializer.kt | 56 ++++++++++--------- .../logscheduler/FakeLogScheduler.kt | 4 +- .../ApplicationLifecycleObserverTest.kt | 17 ++++++ .../analytics/PerformanceMetricsLoggerTest.kt | 8 +-- .../MetricLogSchedulingWorkerTest.kt | 8 +-- .../LogReportWorkManagerInitializerTest.kt | 26 +++++---- .../util/logging/MetricLogScheduler.kt | 17 +++--- .../PerformanceMetricsLogScheduler.kt | 4 +- .../PerformanceMetricsUtils.kt | 6 +- .../PerformanceMetricsUtilsTest.kt | 11 ++-- 13 files changed, 123 insertions(+), 98 deletions(-) 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 2a351cd7493..30511bfb9b3 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 @@ -13,6 +13,7 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject +import javax.inject.Singleton /** * Controller for handling performance metrics event logging. @@ -20,6 +21,7 @@ import javax.inject.Inject * Callers should not use this class directly; instead, they should use ``PerformanceMetricsLogger`` * which provides convenience log methods. */ +@Singleton class PerformanceMetricsController @Inject constructor( private val performanceMetricsUtils: PerformanceMetricsUtils, private val consoleLogger: ConsoleLogger, @@ -178,14 +180,14 @@ class PerformanceMetricsController @Inject constructor( /** Sets [isAppInForeground] to true when application is in or returns to foreground. */ fun setAppInForeground() { - isAppInForeground = true + this.isAppInForeground = true } /** Sets [isAppInForeground] to false when application goes to background. */ fun setAppInBackground() { - isAppInForeground = false + this.isAppInForeground = false } /** Returns a boolean value indicating whether the application is currently in foreground or not. */ - fun getIsAppInForeground() = isAppInForeground + fun getIsAppInForeground() = this.isAppInForeground } 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 c4151ae1dc1..8c1d20f0ba2 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 @@ -36,9 +36,9 @@ class PerformanceMetricsLogger @Inject constructor( /** * Logs the apk size of the application as a performance metric for the current state of the app. * It must be noted that the value of this metric won't change across calls during the same - * session. + * application instance. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged */ fun logApkSize(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logLowPriorityMetricEvent( @@ -51,9 +51,9 @@ class PerformanceMetricsLogger @Inject constructor( /** * Logs the storage 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 - * session. + * application instance. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged */ fun logStorageUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logLowPriorityMetricEvent( @@ -67,7 +67,7 @@ class PerformanceMetricsLogger @Inject constructor( * Logs the startup latency of the application as a performance metric for the current state of * the app. This metric should only be logged when the application starts. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged */ fun logStartupLatency(currentScreen: OppiaMetricLog.CurrentScreen) { val startupLatency = oppiaClock.getCurrentTimeMs() - firstTimestamp @@ -83,9 +83,9 @@ class PerformanceMetricsLogger @Inject constructor( /** * Logs the memory 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 - * session. + * application instance. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged */ fun logMemoryUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logMediumPriorityMetricEvent( @@ -98,9 +98,9 @@ class PerformanceMetricsLogger @Inject constructor( /** * Logs the network 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 - * session. + * application instance. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged */ fun logNetworkUsage(currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logHighPriorityMetricEvent( @@ -116,9 +116,10 @@ class PerformanceMetricsLogger @Inject constructor( /** * 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 - * session. + * application instance. * - * @param [currentScreen] denotes the application screen at which this metric has been logged. + * @param currentScreen denotes the application screen at which this metric has been logged + * @param cpuUsage denotes the current cpu usage of the application */ fun logCpuUsage(cpuUsage: Long, currentScreen: OppiaMetricLog.CurrentScreen) { performanceMetricsController.logHighPriorityMetricEvent( 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 93ef81693ac..8767b2206a1 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 @@ -8,7 +8,6 @@ import com.google.common.util.concurrent.SettableFuture import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.async -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLogger import org.oppia.android.domain.util.getStringFromData import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.threading.BackgroundDispatcher @@ -22,41 +21,41 @@ class MetricLogSchedulingWorker private constructor( context: Context, params: WorkerParameters, private val consoleLogger: ConsoleLogger, - private val performanceMetricsLogger: PerformanceMetricsLogger, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) : ListenableWorker(context, params) { companion object { private const val TAG = "MetricLogSchedulingWorker" /** - * Input data for the worker consists of a key-value pair on the basis of which work is done. - * [WORKER_CASE_KEY] is the key for that data. + * The key for an input key-value pair for [MetricLogSchedulingWorker] where one of + * [PERIODIC_BACKGROUND_METRIC_WORKER], [PERIODIC_UI_METRIC_WORKER] and [STORAGE_USAGE_WORKER] indicates what + * kind of work to perform. */ const val WORKER_CASE_KEY = "metric_log_scheduling_worker_case_key" /** - * When [PERIODIC_METRIC_WORKER] is the value of the worker's key-value pair, the worker - * schedules logging of periodic performance metrics. + * Indicates to [MetricLogSchedulingWorker] that it should schedule logging for periodic + * performance metrics. */ - const val PERIODIC_METRIC_WORKER = "periodic_metric_worker" + const val PERIODIC_BACKGROUND_METRIC_WORKER = "periodic_background_metric_worker" /** - * When [STORAGE_USAGE_WORKER] is the value of the worker's key-value pair, the worker schedules - * logging of storage usage performance metrics. + * Indicates to [MetricLogSchedulingWorker] that it should schedule logging for storage usage + * performance metrics. */ const val STORAGE_USAGE_WORKER = "storage_usage_worker" /** - * When [MEMORY_USAGE_WORKER] is the value of the worker's key-value pair, the worker schedules - * logging of memory usage performance metrics. + * Indicates to [MetricLogSchedulingWorker] that it should schedule logging for ui-related + * memory usage performance metrics. */ - const val MEMORY_USAGE_WORKER = "memory_usage_worker" + const val PERIODIC_UI_METRIC_WORKER = "periodic_ui_metric_worker" } override fun startWork(): ListenableFuture { val backgroundScope = CoroutineScope(backgroundDispatcher) val result = backgroundScope.async { when (inputData.getStringFromData(WORKER_CASE_KEY)) { - PERIODIC_METRIC_WORKER -> schedulePeriodicMetricLogging() + PERIODIC_BACKGROUND_METRIC_WORKER -> schedulePeriodicBackgroundMetricLogging() STORAGE_USAGE_WORKER -> scheduleStorageUsageMetricLogging() - MEMORY_USAGE_WORKER -> scheduleMemoryUsageMetricLogging() + PERIODIC_UI_METRIC_WORKER -> schedulePeriodicUiMetricLogging() else -> Result.failure() } } @@ -73,7 +72,7 @@ class MetricLogSchedulingWorker private constructor( return future } - private fun schedulePeriodicMetricLogging(): Result { + private fun schedulePeriodicBackgroundMetricLogging(): Result { return try { // TODO(#4340): Add functionality to log cpu and network usage performance metrics. Result.success() @@ -93,7 +92,7 @@ class MetricLogSchedulingWorker private constructor( } } - private fun scheduleMemoryUsageMetricLogging(): Result { + private fun schedulePeriodicUiMetricLogging(): Result { return try { // TODO(#4340): Add functionality to log memory usage performance metrics. Result.success() @@ -106,7 +105,6 @@ class MetricLogSchedulingWorker private constructor( /** Creates an instance of [MetricLogSchedulingWorker] by properly injecting dependencies. */ class Factory @Inject constructor( private val consoleLogger: ConsoleLogger, - private val performanceMetricsLogger: PerformanceMetricsLogger, @BackgroundDispatcher private val backgroundDispatcher: CoroutineDispatcher ) { /** @@ -120,7 +118,6 @@ class MetricLogSchedulingWorker private constructor( context, params, consoleLogger, - performanceMetricsLogger, backgroundDispatcher ) } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt index 519f1322fe6..4327d66813f 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt @@ -16,10 +16,11 @@ import org.oppia.android.util.platformparameter.PlatformParameterValue import java.util.UUID import java.util.concurrent.TimeUnit import javax.inject.Inject -import javax.inject.Singleton -/** Enqueues unique periodic work requests for uploading events and exceptions to the remote service on application creation. */ -@Singleton +/** + * Enqueues unique periodic work requests for uploading events and exceptions to the remote service + * on application creation. + */ class LogReportWorkManagerInitializer @Inject constructor( private val context: Context, private val logUploader: LogUploader, @@ -49,10 +50,10 @@ class LogReportWorkManagerInitializer @Inject constructor( ) .build() - private val workerCaseForSchedulingPeriodicMetricLogs: Data = Data.Builder() + private val workerCaseForSchedulingPeriodicBackgroundMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER + MetricLogSchedulingWorker.PERIODIC_BACKGROUND_METRIC_WORKER ) .build() @@ -63,10 +64,10 @@ class LogReportWorkManagerInitializer @Inject constructor( ) .build() - private val workerCaseForSchedulingMemoryUsageMetricLogs: Data = Data.Builder() + private val workerCaseForSchedulingPeriodicUiMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.MEMORY_USAGE_WORKER + MetricLogSchedulingWorker.PERIODIC_UI_METRIC_WORKER ) .build() @@ -82,13 +83,13 @@ class LogReportWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForSchedulingPeriodicMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest + private val workRequestForSchedulingPeriodicBackgroundMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForSchedulingPeriodicMetricLogs) + .setInputData(workerCaseForSchedulingPeriodicBackgroundMetricLogs) .setConstraints(logReportWorkerConstraints) .build() @@ -103,14 +104,14 @@ class LogReportWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForSchedulingMemoryUsageMetricLogs: PeriodicWorkRequest = + private val workRequestForSchedulingPeriodicUiMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest .Builder( MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForSchedulingMemoryUsageMetricLogs) + .setInputData(workerCaseForSchedulingPeriodicUiMetricLogs) .setConstraints(logReportWorkerConstraints) .build() @@ -118,17 +119,17 @@ class LogReportWorkManagerInitializer @Inject constructor( val workManager = WorkManager.getInstance(context) logUploader.enqueueWorkRequestForEvents(workManager, workRequestForUploadingEvents) logUploader.enqueueWorkRequestForExceptions(workManager, workRequestForUploadingExceptions) - metricLogScheduler.enqueueWorkRequestForPeriodicMetrics( + metricLogScheduler.enqueueWorkRequestForPeriodicBackgroundMetrics( workManager, - workRequestForSchedulingPeriodicMetricLogs + workRequestForSchedulingPeriodicBackgroundMetricLogs ) metricLogScheduler.enqueueWorkRequestForStorageUsage( workManager, workRequestForSchedulingStorageUsageMetricLogs ) - metricLogScheduler.enqueueWorkRequestForMemoryUsage( + metricLogScheduler.enqueueWorkRequestForPeriodicUiMetrics( workManager, - workRequestForSchedulingMemoryUsageMetricLogs + workRequestForSchedulingPeriodicUiMetricLogs ) } @@ -145,8 +146,8 @@ class LogReportWorkManagerInitializer @Inject constructor( * Returns the [UUID] of the work request that is enqueued for scheduling memory usage * performance metrics collection. */ - fun getWorkRequestForSchedulingMemoryUsageMetricLogsId(): UUID = - workRequestForSchedulingMemoryUsageMetricLogs.id + fun getWorkRequestForSchedulingPeriodicUiMetricLogsId(): UUID = + workRequestForSchedulingPeriodicUiMetricLogs.id /** * Returns the [UUID] of the work request that is enqueued for scheduling storage usage @@ -159,13 +160,18 @@ class LogReportWorkManagerInitializer @Inject constructor( * Returns the [UUID] of the work request that is enqueued for scheduling periodic performance * metrics collection. */ - fun getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId(): UUID = - workRequestForSchedulingPeriodicMetricLogs.id + fun getWorkRequestForSchedulingPeriodicBackgroundPerformanceMetricLogsId(): UUID = + workRequestForSchedulingPeriodicBackgroundMetricLogs.id - /** Returns the [Data] that goes into the work request that is enqueued for uploading event logs. */ + /** + * Returns the [Data] that goes into the work request that is enqueued for uploading event logs. + */ fun getWorkRequestDataForEvents(): Data = workerCaseForUploadingEvents - /** Returns the [Data] that goes into the work request that is enqueued for uploading exception logs. */ + /** + * Returns the [Data] that goes into the work request that is enqueued for uploading exception + * logs. + */ fun getWorkRequestDataForExceptions(): Data = workerCaseForUploadingExceptions /** @@ -179,13 +185,13 @@ class LogReportWorkManagerInitializer @Inject constructor( * Returns the [Data] that goes into the work request that is enqueued for scheduling memory * usage performance metrics collection. */ - fun getWorkRequestDataForSchedulingMemoryUsageMetricLogs(): Data = - workerCaseForSchedulingMemoryUsageMetricLogs + fun getWorkRequestDataForSchedulingPeriodicUiMetricLogs(): Data = + workerCaseForSchedulingPeriodicUiMetricLogs /** * Returns the [Data] that goes into the work request that is enqueued for scheduling periodic * performance metrics collection. */ - fun getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs(): Data = - workerCaseForSchedulingPeriodicMetricLogs + fun getWorkRequestDataForSchedulingPeriodicBackgroundPerformanceMetricLogs(): Data = + workerCaseForSchedulingPeriodicBackgroundMetricLogs } diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt index 9ccfee3eedd..ac25dd88e99 100644 --- a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt @@ -14,7 +14,7 @@ class FakeLogScheduler @Inject constructor() : MetricLogScheduler { private val schedulingMemoryUsageMetricLoggingRequestIdList = mutableListOf() private val schedulingPeriodicPerformanceMetricLoggingRequestIdList = mutableListOf() - override fun enqueueWorkRequestForPeriodicMetrics( + override fun enqueueWorkRequestForPeriodicBackgroundMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) { @@ -28,7 +28,7 @@ class FakeLogScheduler @Inject constructor() : MetricLogScheduler { schedulingStorageUsageMetricLoggingRequestIdList.add(workRequest.id) } - override fun enqueueWorkRequestForMemoryUsage( + override fun enqueueWorkRequestForPeriodicUiMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) { 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 0b27589fbd2..2127964d663 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 @@ -63,6 +63,7 @@ class ApplicationLifecycleObserverTest { @Inject lateinit var monitorFactory: DataProviderTestMonitor.Factory @Inject lateinit var fakeEventLogger: FakeEventLogger @Inject lateinit var profileManagementController: ProfileManagementController + @Inject lateinit var performanceMetricsController: PerformanceMetricsController @Test fun testObserver_getSessionId_backgroundApp_thenForeground_limitExceeded_sessionIdUpdated() { @@ -152,6 +153,22 @@ class ApplicationLifecycleObserverTest { } } + @Test + fun testObserver_onAppInForeground_setsAppInForeground() { + setUpTestApplicationComponent() + applicationLifecycleObserver.onAppInForeground() + + assertThat(performanceMetricsController.getIsAppInForeground()).isTrue() + } + + @Test + fun testObserver_onAppInBackground_setsAppInBackground() { + setUpTestApplicationComponent() + applicationLifecycleObserver.onAppInBackground() + + assertThat(performanceMetricsController.getIsAppInForeground()).isFalse() + } + private fun waitInBackgroundFor(millis: Long) { applicationLifecycleObserver.onAppInBackground() testCoroutineDispatchers.runCurrent() 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 123e71f4888..96837c0441e 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 @@ -3,6 +3,7 @@ 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 @@ -12,7 +13,6 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -import org.mockito.MockitoAnnotations import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.HOME_SCREEN import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC @@ -46,7 +46,6 @@ import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.robolectric.RobolectricTestRunner import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode @@ -59,7 +58,7 @@ private const val TEST_CPU_USAGE = Long.MAX_VALUE /** Tests for [PerformanceMetricsLoggerTest]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") -@RunWith(RobolectricTestRunner::class) +@RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(application = PerformanceMetricsLoggerTest.TestApplication::class) class PerformanceMetricsLoggerTest { @@ -84,7 +83,6 @@ class PerformanceMetricsLoggerTest { @Before fun setUp() { - MockitoAnnotations.initMocks(this) setUpTestApplicationComponent() fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME) fakeOppiaClock.setCurrentTimeMs(TEST_TIMESTAMP) @@ -214,7 +212,7 @@ class PerformanceMetricsLoggerTest { } private fun getStorageUsage(): Long { - val application = RuntimeEnvironment.application + val application: Application = ApplicationProvider.getApplicationContext() val persistentUsage = application.filesDir.totalSpace - application.filesDir.freeSpace val cacheUsage = 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 601f82670cf..1c4574535bb 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 @@ -129,12 +129,12 @@ class MetricLogSchedulingWorkerTest { } @Test - fun testWorker_enqueueRequest_verifyPeriodicPerformanceMetricsLogging() { + fun testWorker_enqueueRequest_verifyPeriodicBackgroundPerformanceMetricsLogging() { val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) val inputData = Data.Builder().putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER + MetricLogSchedulingWorker.PERIODIC_BACKGROUND_METRIC_WORKER ).build() val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() @@ -150,12 +150,12 @@ class MetricLogSchedulingWorkerTest { } @Test - fun testWorker_enqueueRequest_verifyMemoryUsagePerformanceMetricsLogging() { + fun testWorker_enqueueRequest_verifyPeriodicUiPerformanceMetricsLogging() { val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) val inputData = Data.Builder().putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.MEMORY_USAGE_WORKER + MetricLogSchedulingWorker.PERIODIC_UI_METRIC_WORKER ).build() val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() 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 5e8494285d3..38876a92bd9 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 @@ -124,10 +124,11 @@ class LogReportWorkManagerInitializerTest { logReportWorkManagerInitializer.getWorkRequestForExceptionsId() val enqueuedSchedulingStorageUsageMetricWorkRequestId = logReportWorkManagerInitializer.getWorkRequestForSchedulingStorageUsageMetricLogsId() - val enqueuedSchedulingMemoryUsageMetricWorkRequestId = - logReportWorkManagerInitializer.getWorkRequestForSchedulingMemoryUsageMetricLogsId() - val enqueuedSchedulingPeriodicPerformanceMetricWorkRequestId = - logReportWorkManagerInitializer.getWorkRequestForSchedulingPeriodicPerformanceMetricLogsId() + val enqueuedSchedulingPeriodicUiMetricWorkRequestId = + logReportWorkManagerInitializer.getWorkRequestForSchedulingPeriodicUiMetricLogsId() + val enqueuedSchedulingPeriodicBackgroundPerformanceMetricWorkRequestId = + logReportWorkManagerInitializer + .getWorkRequestForSchedulingPeriodicBackgroundPerformanceMetricLogsId() assertThat(fakeLogUploader.getMostRecentEventRequestId()).isEqualTo(enqueuedEventWorkRequestId) assertThat(fakeLogUploader.getMostRecentExceptionRequestId()).isEqualTo( @@ -137,10 +138,10 @@ class LogReportWorkManagerInitializerTest { enqueuedSchedulingStorageUsageMetricWorkRequestId ) assertThat(fakeLogScheduler.getMostRecentMemoryUsageMetricLoggingRequestId()).isEqualTo( - enqueuedSchedulingMemoryUsageMetricWorkRequestId + enqueuedSchedulingPeriodicUiMetricWorkRequestId ) assertThat(fakeLogScheduler.getMostRecentPeriodicPerformanceMetricLoggingRequestId()).isEqualTo( - enqueuedSchedulingPeriodicPerformanceMetricWorkRequestId + enqueuedSchedulingPeriodicBackgroundPerformanceMetricWorkRequestId ) } @@ -200,30 +201,31 @@ class LogReportWorkManagerInitializerTest { } @Test - fun testWorkRequest_verifyWorkRequestData_forSchedulingPeriodicPerformanceMetricLogs() { + fun testWorkRequest_verifyWorkRequestData_forSchedulingPeriodicBackgroundPerformanceMetricLogs() { val workerCaseForSchedulingPeriodicPerformanceMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.PERIODIC_METRIC_WORKER + MetricLogSchedulingWorker.PERIODIC_BACKGROUND_METRIC_WORKER ) .build() assertThat( - logReportWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicPerformanceMetricLogs() + logReportWorkManagerInitializer + .getWorkRequestDataForSchedulingPeriodicBackgroundPerformanceMetricLogs() ).isEqualTo(workerCaseForSchedulingPeriodicPerformanceMetricLogs) } @Test - fun testWorkRequest_verifyWorkRequestData_forSchedulingMemoryUsageMetricLogs() { + fun testWorkRequest_verifyWorkRequestData_forSchedulingPeriodicUiMetricLogs() { val workerCaseForSchedulingMemoryUsageMetricLogs: Data = Data.Builder() .putString( MetricLogSchedulingWorker.WORKER_CASE_KEY, - MetricLogSchedulingWorker.MEMORY_USAGE_WORKER + MetricLogSchedulingWorker.PERIODIC_UI_METRIC_WORKER ) .build() assertThat( - logReportWorkManagerInitializer.getWorkRequestDataForSchedulingMemoryUsageMetricLogs() + logReportWorkManagerInitializer.getWorkRequestDataForSchedulingPeriodicUiMetricLogs() ).isEqualTo(workerCaseForSchedulingMemoryUsageMetricLogs) } diff --git a/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt b/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt index dca50b0be08..463179cf15a 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/MetricLogScheduler.kt @@ -6,23 +6,26 @@ import androidx.work.WorkManager /** Scheduler for scheduling metric log reports related to the performance of the application. */ interface MetricLogScheduler { /** - * Enqueues a [workRequest] using the [workManager] for generating metric logs of periodic + * Enqueues a [workRequest] using the [workManager] for scheduling metric collection of periodic * metrics like network and cpu usage. */ - fun enqueueWorkRequestForPeriodicMetrics( + fun enqueueWorkRequestForPeriodicBackgroundMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) /** - * Enqueues a [workRequest] using the [workManager] for generating metric logs for getting to - * know the storage usage of the application on the current device. + * Enqueues a [workRequest] using the [workManager] for scheduling metric collection of storage + * usage of the application on the current device. */ fun enqueueWorkRequestForStorageUsage(workManager: WorkManager, workRequest: PeriodicWorkRequest) /** - * Enqueues a [workRequest] using the [workManager] for generating metric logs for getting to - * know the memory usage of the application on the current device. + * Enqueues a [workRequest] using the [workManager] for scheduling metric collection of periodic + * ui metrics like memory usage. */ - fun enqueueWorkRequestForMemoryUsage(workManager: WorkManager, workRequest: PeriodicWorkRequest) + fun enqueueWorkRequestForPeriodicUiMetrics( + workManager: WorkManager, + workRequest: PeriodicWorkRequest + ) } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt index 065a1e706e6..0f019389ef3 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt @@ -15,7 +15,7 @@ private const val OPPIA_MEMORY_USAGE_WORK = "OPPIA_MEMORY_USAGE_WORK" * the performance of the application. */ class PerformanceMetricsLogScheduler @Inject constructor() : MetricLogScheduler { - override fun enqueueWorkRequestForPeriodicMetrics( + override fun enqueueWorkRequestForPeriodicBackgroundMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) { @@ -37,7 +37,7 @@ class PerformanceMetricsLogScheduler @Inject constructor() : MetricLogScheduler ) } - override fun enqueueWorkRequestForMemoryUsage( + override fun enqueueWorkRequestForPeriodicUiMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) { diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 0cd9fcd3de8..ee68aedebc6 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -9,16 +9,12 @@ import org.oppia.android.util.logging.ConsoleLogger import java.io.File import javax.inject.Inject -/** Utility to extract performance metrics from the underlying android system. */ +/** Utility to extract performance metrics from the underlying Android system. */ class PerformanceMetricsUtils @Inject constructor( private val context: Application, private val consoleLogger: ConsoleLogger ) { - // Keep the default value as false as the app is considered to be in the background until it comes - // to foreground. - private var isAppInForeground: Boolean = false - /** Returns the size of the app's installed APK file, in bytes. */ fun getApkSize(): Long { var apkSize: Long = 0 diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 7b6b5b81253..898a12369e1 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -75,7 +75,8 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_setTotalMemory_returnsCorrectMemoryTier() { val activityManager: ActivityManager = - RuntimeEnvironment.application.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + ApplicationProvider.getApplicationContext() + .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() @@ -137,7 +138,8 @@ class PerformanceMetricsUtilsTest { } var totalPssUsedTest = 0 val activityManager: ActivityManager = - RuntimeEnvironment.application.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + ApplicationProvider.getApplicationContext() + .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) shadowActivityManager.setProcesses(listOf(process1, process2)) val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(TEST_PID).toIntArray()) @@ -151,6 +153,7 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnsCorrectApkSize() { + val application: Application = ApplicationProvider.getApplicationContext() val applicationInfo = ApplicationInfo() val testApkSize = (File(TEST_APP_PATH).length() / 1024) applicationInfo.apply { @@ -159,10 +162,10 @@ class PerformanceMetricsUtilsTest { this.name = TEST_PACKAGE_LABEL this.flags = 0 } - val packageManager = RuntimeEnvironment.application.packageManager + val packageManager = application.packageManager val shadowPackageManager = shadowOf(packageManager) - shadowPackageManager.removePackage(RuntimeEnvironment.application.packageName) + shadowPackageManager.removePackage(application.packageName) shadowPackageManager.installPackage( PackageInfo().apply { this.packageName = TEST_PACKAGE_NAME From b0cb4d5d0974837ed7797c4a2e9a2780b99462c2 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 22 Jul 2022 13:01:01 +0530 Subject: [PATCH 090/149] utils test + nits --- .../LogReportWorkManagerInitializer.kt | 32 ++++---- .../analytics/PerformanceMetricsLoggerTest.kt | 1 - .../PerformanceMetricsUtils.kt | 3 +- .../PerformanceMetricsUtilsTest.kt | 76 +++++++++++++++---- 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt index 4327d66813f..3bab2316a2b 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogReportWorkManagerInitializer.kt @@ -83,34 +83,32 @@ class LogReportWorkManagerInitializer @Inject constructor( .setConstraints(logReportWorkerConstraints) .build() - private val workRequestForSchedulingPeriodicBackgroundMetricLogs: PeriodicWorkRequest = PeriodicWorkRequest - .Builder( + private val workRequestForSchedulingPeriodicBackgroundMetricLogs: PeriodicWorkRequest = + PeriodicWorkRequest.Builder( MetricLogSchedulingWorker::class.java, performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), TimeUnit.MINUTES ) - .setInputData(workerCaseForSchedulingPeriodicBackgroundMetricLogs) - .setConstraints(logReportWorkerConstraints) - .build() + .setInputData(workerCaseForSchedulingPeriodicBackgroundMetricLogs) + .setConstraints(logReportWorkerConstraints) + .build() private val workRequestForSchedulingStorageUsageMetricLogs: PeriodicWorkRequest = - PeriodicWorkRequest - .Builder( - MetricLogSchedulingWorker::class.java, - performanceMetricCollectionLowFrequencyTimeInterval.value.toLong(), - TimeUnit.MINUTES - ) + PeriodicWorkRequest.Builder( + MetricLogSchedulingWorker::class.java, + performanceMetricCollectionLowFrequencyTimeInterval.value.toLong(), + TimeUnit.MINUTES + ) .setInputData(workerCaseForSchedulingStorageUsageMetricLogs) .setConstraints(logReportWorkerConstraints) .build() private val workRequestForSchedulingPeriodicUiMetricLogs: PeriodicWorkRequest = - PeriodicWorkRequest - .Builder( - MetricLogSchedulingWorker::class.java, - performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), - TimeUnit.MINUTES - ) + PeriodicWorkRequest.Builder( + MetricLogSchedulingWorker::class.java, + performanceMetricsCollectionHighFrequencyTimeInterval.value.toLong(), + TimeUnit.MINUTES + ) .setInputData(workerCaseForSchedulingPeriodicUiMetricLogs) .setConstraints(logReportWorkerConstraints) .build() 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 96837c0441e..18c1280352c 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 @@ -46,7 +46,6 @@ import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index ee68aedebc6..0c2259167cd 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -1,7 +1,6 @@ package org.oppia.android.util.logging.performancemetrics import android.app.ActivityManager -import android.app.Application import android.content.Context import android.net.TrafficStats import org.oppia.android.app.model.OppiaMetricLog @@ -11,7 +10,7 @@ import javax.inject.Inject /** Utility to extract performance metrics from the underlying Android system. */ class PerformanceMetricsUtils @Inject constructor( - private val context: Application, + private val context: Context, private val consoleLogger: ConsoleLogger ) { diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt index 898a12369e1..d9ad5944f5e 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt @@ -8,6 +8,7 @@ import android.content.pm.ApplicationInfo import android.content.pm.PackageInfo import android.net.TrafficStats 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 @@ -16,6 +17,10 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.Mockito.`when` +import org.mockito.Mockito.mock +import org.mockito.Mockito.reset +import org.mockito.MockitoAnnotations import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.robolectric.RobolectricModule @@ -38,25 +43,25 @@ import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAUL 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.RobolectricTestRunner -import org.robolectric.RuntimeEnvironment import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import org.robolectric.shadows.ShadowActivityManager import java.io.File import javax.inject.Inject +import javax.inject.Qualifier import javax.inject.Singleton private const val TEST_PACKAGE_NAME = "TEST_PACKAGE_NAME" private const val TEST_PACKAGE_LABEL = "TEST_PACKAGE_LABEL" private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_PID = 1 +private const val TEST_UID = 1 /** Tests for [PerformanceMetricsUtils]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") -@RunWith(RobolectricTestRunner::class) +@RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(application = PerformanceMetricsUtilsTest.TestApplication::class) class PerformanceMetricsUtilsTest { @@ -64,11 +69,12 @@ class PerformanceMetricsUtilsTest { @Inject lateinit var performanceMetricsUtils: PerformanceMetricsUtils - @Inject - lateinit var context: Application + @field:[Inject MockContext] + lateinit var mockContext: Context @Before fun setUp() { + MockitoAnnotations.initMocks(this) setUpTestApplicationComponent() } @@ -77,18 +83,28 @@ class PerformanceMetricsUtilsTest { val activityManager: ActivityManager = ApplicationProvider.getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + `when`(mockContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(activityManager) + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() shadowActivityManager.setMemoryInfo(memoryInfo) val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) } @Test fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { - val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace - val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + val testFile = File(TEST_APP_PATH) + val cacheFile = File(TEST_APP_PATH) + reset(mockContext) + `when`(mockContext.applicationContext).thenReturn(mockContext) + `when`(mockContext.filesDir).thenReturn(testFile) + `when`(mockContext.cacheDir).thenReturn(cacheFile) + + val permanentStorageUsage = testFile.totalSpace - testFile.freeSpace + val cacheStorageUsage = cacheFile.totalSpace - cacheFile.freeSpace val expectedStorageValue = permanentStorageUsage + cacheStorageUsage assertThat(performanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) @@ -96,8 +112,15 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_getTotalStorageUsageTier_returnsCorrectStorageUsageTier() { - val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace - val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + val testFile = File(TEST_APP_PATH) + val cacheFile = File(TEST_APP_PATH) + reset(mockContext) + `when`(mockContext.applicationContext).thenReturn(mockContext) + `when`(mockContext.filesDir).thenReturn(testFile) + `when`(mockContext.cacheDir).thenReturn(cacheFile) + + val permanentStorageUsage = testFile.totalSpace - testFile.freeSpace + val cacheStorageUsage = cacheFile.totalSpace - cacheFile.freeSpace val expectedStorageValue = permanentStorageUsage + cacheStorageUsage val expectedStorageTierValue = when (expectedStorageValue.toDouble() / (1024 * 1024 * 1024)) { @@ -112,7 +135,11 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { - val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + val applicationInfo = ApplicationInfo().apply { + this.uid = TEST_UID + } + `when`(mockContext.applicationInfo).thenReturn(applicationInfo) + val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(mockContext.applicationInfo.uid) assertThat(performanceMetricsUtils.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) @@ -120,7 +147,11 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { - val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + val applicationInfo = ApplicationInfo().apply { + this.uid = TEST_UID + } + `when`(mockContext.applicationInfo).thenReturn(applicationInfo) + val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(mockContext.applicationInfo.uid) assertThat(performanceMetricsUtils.getTotalReceivedBytes()) .isEqualTo(expectedNetworkBytesReceived) @@ -128,6 +159,10 @@ class PerformanceMetricsUtilsTest { @Test fun testPerformanceMetricsUtils_setAppProcesses_getMemoryUsage_returnsCorrectMemoryUsage() { + val activityManager: ActivityManager = + ApplicationProvider.getApplicationContext() + .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + `when`(mockContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(activityManager) val process1 = ActivityManager.RunningAppProcessInfo().apply { this.pid = TEST_PID this.importanceReasonComponent = ComponentName("com.robolectric", "process 1") @@ -137,9 +172,7 @@ class PerformanceMetricsUtilsTest { this.importanceReasonComponent = ComponentName("com.robolectric", "process 2") } var totalPssUsedTest = 0 - val activityManager: ActivityManager = - ApplicationProvider.getApplicationContext() - .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) shadowActivityManager.setProcesses(listOf(process1, process2)) val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(TEST_PID).toIntArray()) @@ -148,6 +181,7 @@ class PerformanceMetricsUtilsTest { totalPssUsedTest += element.totalPss } } + assertThat(performanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) } @@ -181,15 +215,25 @@ class PerformanceMetricsUtilsTest { ApplicationProvider.getApplicationContext().inject(this) } + @Qualifier + annotation class MockContext + // TODO(#89): Move this to a common test application component. @Module class TestModule { @Provides @Singleton - fun provideContext(application: Application): Context { - return application + @MockContext + fun provideMockContext(): Context { + return mock(Context::class.java).also { + `when`(it.applicationContext).thenReturn(it) + } } + @Provides + @Singleton + fun providesContext(@MockContext delegate: Context): Context = delegate + // 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 From 9bc32db84a36a4b4f3fccd1fcd4e83b2196272e6 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 23 Jul 2022 10:42:57 +0530 Subject: [PATCH 091/149] utils test + nits --- .../app/application/ApplicationComponent.kt | 2 + .../devoptions/ViewEventLogsActivityTest.kt | 3 +- .../devoptions/ViewEventLogsFragmentTest.kt | 3 +- .../analytics/PerformanceMetricsController.kt | 2 +- .../analytics/PerformanceMetricsLogger.kt | 2 +- .../analytics/PerformanceMetricsLoggerTest.kt | 78 ++++++--- .../MetricLogSchedulingWorkerTest.kt | 34 +--- .../testing/FakePerformanceMetricUtils.kt | 67 +++++++ .../android/testing/TestLogReportingModule.kt | 6 + .../testing/FakePerformanceMetricUtilsTest.kt | 164 ++++++++++++++++++ .../PerformanceMetricsUtils.kt | 82 +-------- .../PerformanceMetricsUtilsModule.kt | 12 ++ .../ProdPerformanceMetricsUtils.kt | 88 ++++++++++ ....kt => ProdPerformanceMetricsUtilsTest.kt} | 29 ++-- 14 files changed, 423 insertions(+), 149 deletions(-) create mode 100644 testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt create mode 100644 testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt rename utility/src/test/java/org/oppia/android/util/logging/performancemetrics/{PerformanceMetricsUtilsTest.kt => ProdPerformanceMetricsUtilsTest.kt} (92%) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index b2f76c423b4..3983e27c65f 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -64,6 +64,7 @@ import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Provider import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** * Root Dagger component for the application. All application-scoped modules should be included in @@ -106,6 +107,7 @@ import javax.inject.Singleton MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, + PerformanceMetricsUtilsModule::class, // TODO(#59): Remove this module once we completely migrate to Bazel from Gradle as we can then // directly exclude debug files from the build and thus won't be requiring this module. NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class 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 1c4e1040e50..e9833859ade 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 @@ -87,6 +87,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -175,7 +176,7 @@ class ViewEventLogsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class, MetricLogSchedulerModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsUtilsModule::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 58d97e34090..9c9922f08f1 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 @@ -94,6 +94,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" @@ -575,7 +576,7 @@ class ViewEventLogsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, - MetricLogSchedulerModule::class + MetricLogSchedulerModule::class, PerformanceMetricsUtilsModule::class ] ) 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 30511bfb9b3..4f2d090101c 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 @@ -9,11 +9,11 @@ import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Controller for handling performance metrics event logging. 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 8c1d20f0ba2..4a4fae059aa 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 @@ -2,10 +2,10 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.system.OppiaClock import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Convenience logger for performance metrics related analytics events. 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 18c1280352c..3070f7b0a74 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 @@ -5,6 +5,7 @@ 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.Binds import dagger.BindsInstance import dagger.Component import dagger.Module @@ -43,16 +44,22 @@ 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.MetricLogSchedulerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.testing.FakePerformanceMetricUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils private const val TEST_TIMESTAMP = Long.MAX_VALUE private const val TEST_CPU_USAGE = Long.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 +private const val TEST_BYTES_SENT = Long.MAX_VALUE +private const val TEST_BYTES_RECEIVED = Long.MAX_VALUE /** Tests for [PerformanceMetricsLoggerTest]. */ // FunctionName: test names are conventionally named with underscores. @@ -75,23 +82,27 @@ class PerformanceMetricsLoggerTest { lateinit var fakeOppiaClock: FakeOppiaClock @Inject - lateinit var performanceMetricsUtils: PerformanceMetricsUtils + lateinit var fakePerformanceMetricUtils: FakePerformanceMetricUtils @Mock lateinit var context: Context + 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) } @Test fun testLogger_logApkSizePerformanceMetric_verifyLogsMetricCorrectly() { - val apkSize = performanceMetricsUtils.getApkSize() - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val apkSize = fakePerformanceMetricUtils.getApkSize() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logApkSize(HOME_SCREEN) @@ -108,10 +119,10 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStorageUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val storageUsage = getStorageUsage() - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() + val storageUsage = fakePerformanceMetricUtils.getUsedStorage() performanceMetricsLogger.logStorageUsage(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -129,9 +140,9 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logMemoryUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val memoryUsage = performanceMetricsUtils.getTotalPssUsed() - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val memoryUsage = fakePerformanceMetricUtils.getTotalPssUsed() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logMemoryUsage(SCREEN_UNSPECIFIED) @@ -148,8 +159,8 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStartupLatencyPerformanceMetric_verifyLogsMetricCorrectly() { - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logStartupLatency(HOME_SCREEN) @@ -169,8 +180,8 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logCpuUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE, SCREEN_UNSPECIFIED) @@ -187,10 +198,10 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logNetworkUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val bytesSent = performanceMetricsUtils.getTotalSentBytes() - val bytesReceived = performanceMetricsUtils.getTotalReceivedBytes() - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() - val storageTier = performanceMetricsUtils.getDeviceStorageTier() + val bytesSent = fakePerformanceMetricUtils.getTotalSentBytes() + val bytesReceived = fakePerformanceMetricUtils.getTotalReceivedBytes() + val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logNetworkUsage(SCREEN_UNSPECIFIED) @@ -210,13 +221,16 @@ class PerformanceMetricsLoggerTest { ApplicationProvider.getApplicationContext().inject(this) } - private fun getStorageUsage(): Long { - val application: Application = ApplicationProvider.getApplicationContext() - val persistentUsage = - application.filesDir.totalSpace - application.filesDir.freeSpace - val cacheUsage = - application.cacheDir.totalSpace - application.cacheDir.freeSpace - return persistentUsage + cacheUsage + private fun setUpFakePerformanceMetricsUtils() { + fakePerformanceMetricUtils.apply { + setApkSize(TEST_APK_SIZE) + setStorageUsage(TEST_STORAGE_USAGE) + setTotalPss(TEST_TOTAL_PSS) + setTotalSentBytes(TEST_BYTES_SENT) + setTotalReceivedBytes(TEST_BYTES_RECEIVED) + setDeviceStorageTier(testDeviceStorageTier) + setDeviceMemoryTier(testDeviceMemoryTier) + } } // TODO(#89): Move this to a common test application component. @@ -255,6 +269,14 @@ class PerformanceMetricsLoggerTest { fun provideEventLogStorageCacheSize(): Int = 2 } + @Module + interface TestPerformanceMetricsModule { + @Binds + fun bindPerformanceMetricsUtils( + fakePerformanceMetricUtils: FakePerformanceMetricUtils + ): PerformanceMetricsUtils + } + // TODO(#89): Move this to a common test application component. @Singleton @Component( @@ -263,7 +285,7 @@ class PerformanceMetricsLoggerTest { TestDispatcherModule::class, TestLogStorageModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, FakeOppiaClockModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, - LoggingIdentifierModule::class, SyncStatusTestModule::class, MetricLogSchedulerModule::class + LoggingIdentifierModule::class, SyncStatusTestModule::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 1c4574535bb..ac1d65d7ce8 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 @@ -40,7 +40,6 @@ 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.mockito.anyOrNull import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -62,6 +61,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Qualifier import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. @@ -91,9 +91,6 @@ class MetricLogSchedulingWorkerTest { @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - @field:[Inject MockPerformanceMetricsEventLogger] - lateinit var mockPerformanceMetricsEventLogger: PerformanceMetricsEventLogger - private lateinit var context: Context @Before @@ -192,34 +189,12 @@ class MetricLogSchedulingWorkerTest { .inject(this) } - @Qualifier - annotation class MockPerformanceMetricsEventLogger - // TODO(#89): Move this to a common test application component. @Module class TestModule { @Provides fun provideContext(application: Application): Context = application - @Provides - @Singleton - @MockPerformanceMetricsEventLogger - fun bindMockPerformanceMetricsEventLogger( - fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger - ): PerformanceMetricsEventLogger { - return Mockito.mock(PerformanceMetricsEventLogger::class.java).also { - Mockito.`when`(it.logPerformanceMetric(anyOrNull())).then { answer -> - fakePerformanceMetricsEventLogger.logPerformanceMetric( - answer.getArgument( - /* index= */ 0, /* clazz= */ - OppiaMetricLog::class.java - ) - ) - return@then null - } - } - } - @Provides fun bindFakeEventLogger(fakeEventLogger: FakeEventLogger): EventLogger = fakeEventLogger @@ -228,8 +203,8 @@ class MetricLogSchedulingWorkerTest { @Provides fun bindFakePerformanceMetricsEventLogger( - @MockPerformanceMetricsEventLogger delegate: PerformanceMetricsEventLogger - ): PerformanceMetricsEventLogger = delegate + fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger + ): PerformanceMetricsEventLogger = fakePerformanceMetricsEventLogger } @Module @@ -264,7 +239,8 @@ class MetricLogSchedulingWorkerTest { TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, - LoggingIdentifierModule::class, SyncStatusTestModule::class, ApplicationLifecycleModule::class + LoggingIdentifierModule::class, SyncStatusTestModule::class, + PerformanceMetricsUtilsModule::class, ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt new file mode 100644 index 00000000000..aa3e7a34503 --- /dev/null +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt @@ -0,0 +1,67 @@ +package org.oppia.android.testing + +import javax.inject.Inject +import javax.inject.Singleton +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils + +/** A test specific fake for performance metric utils. */ +@Singleton +class FakePerformanceMetricUtils @Inject constructor(): PerformanceMetricsUtils { + internal var testApkSize = 0L + internal var testStorageUsage = 0L + internal var testTotalPss = 0L + internal var testTotalBytesSent = 0L + internal var testTotalReceivedBytes = 0L + internal var testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE + internal var testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + + override fun getApkSize(): Long = testApkSize + + override fun getUsedStorage(): Long = testStorageUsage + + override fun getTotalPssUsed(): Long = testTotalPss + + override fun getTotalSentBytes(): Long = testTotalBytesSent + + override fun getTotalReceivedBytes(): Long = testTotalReceivedBytes + + override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = testDeviceStorageTier + + override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier = testDeviceMemoryTier + + /** Sets [apkSize] as the value of [testApkSize]. */ + fun setApkSize(apkSize: Long) { + testApkSize = apkSize + } + + /** Sets [storageUsage] as the value of [testStorageUsage]. */ + fun setStorageUsage(storageUsage: Long) { + testStorageUsage = storageUsage + } + + /** Sets [totalPss] as the value of [testTotalPss]. */ + fun setTotalPss(totalPss: Long) { + testTotalPss = totalPss + } + + /** Sets [sentBytes] as the value of [testTotalBytesSent]. */ + fun setTotalSentBytes(sentBytes: Long) { + testTotalBytesSent = sentBytes + } + + /** Sets [receivedBytes] as the value of [testTotalReceivedBytes]. */ + fun setTotalReceivedBytes(receivedBytes: Long) { + testTotalReceivedBytes = receivedBytes + } + + /** Sets [storageTier] as the value of [testDeviceStorageTier]. */ + fun setDeviceStorageTier(storageTier: OppiaMetricLog.StorageTier) { + testDeviceStorageTier = storageTier + } + + /** Sets [memoryTier] as the value of [testDeviceMemoryTier]. */ + fun setDeviceMemoryTier(memoryTier: OppiaMetricLog.MemoryTier) { + testDeviceMemoryTier = memoryTier + } +} \ No newline at end of file diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index de94a09c4c1..c3689977954 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -5,6 +5,7 @@ import dagger.Module import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** Provides fake log reporting dependencies. */ @Module @@ -20,4 +21,9 @@ interface TestLogReportingModule { fun bindFakePerformanceMetricsEventLogger( fakePerformanceMetricsEventLogger: FakePerformanceMetricsEventLogger ): PerformanceMetricsEventLogger + + @Binds + fun bindFakePerformanceMetricsUtils( + fakePerformanceMetricUtils: FakePerformanceMetricUtils + ): PerformanceMetricsUtils } diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt new file mode 100644 index 00000000000..5538b8952ee --- /dev/null +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt @@ -0,0 +1,164 @@ +package org.oppia.android.testing + +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 javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.app.model.OppiaMetricLog +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +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 +private const val TEST_BYTES_SENT = Long.MAX_VALUE +private const val TEST_BYTES_RECEIVED = Long.MAX_VALUE + +/** Tests for [FakePerformanceMetricUtils]. */ +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(manifest = Config.NONE) +class FakePerformanceMetricUtilsTest { + + @Inject + lateinit var fakePerformanceMetricUtils: FakePerformanceMetricUtils + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testFakeMetricUtils_setApkSize_returnsCorrectApkSize() { + fakePerformanceMetricUtils.setApkSize(TEST_APK_SIZE) + + assertThat(fakePerformanceMetricUtils.getApkSize()).isEqualTo(TEST_APK_SIZE) + } + + @Test + fun testFakeMetricUtils_doNotSetApkSize_returnsDefaultApkSize() { + assertThat(fakePerformanceMetricUtils.getApkSize()) + .isEqualTo(fakePerformanceMetricUtils.testApkSize) + } + + @Test + fun testFakeMetricUtils_setStorageUsage_returnsCorrectStorageSize() { + fakePerformanceMetricUtils.setStorageUsage(TEST_STORAGE_USAGE) + + assertThat(fakePerformanceMetricUtils.getUsedStorage()).isEqualTo(TEST_STORAGE_USAGE) + } + + @Test + fun testFakeMetricUtils_doNotSetStorageUsage_returnsDefaultStorageUsage() { + assertThat(fakePerformanceMetricUtils.getUsedStorage()) + .isEqualTo(fakePerformanceMetricUtils.testStorageUsage) + } + + @Test + fun testFakeMetricUtils_setTotalPss_returnsCorrectTotalPss() { + fakePerformanceMetricUtils.setTotalPss(TEST_TOTAL_PSS) + + assertThat(fakePerformanceMetricUtils.getTotalPssUsed()).isEqualTo(TEST_TOTAL_PSS) + } + + @Test + fun testFakeMetricUtils_doNotSetTotalPss_returnsDefaultTotalPss() { + assertThat(fakePerformanceMetricUtils.getTotalPssUsed()) + .isEqualTo(fakePerformanceMetricUtils.testTotalPss) + } + + @Test + fun testFakeMetricUtils_setTotalSentBytes_returnsCorrectTotalSentBytes() { + fakePerformanceMetricUtils.setTotalSentBytes(TEST_BYTES_SENT) + + assertThat(fakePerformanceMetricUtils.getTotalSentBytes()).isEqualTo(TEST_BYTES_SENT) + } + + @Test + fun testFakeMetricUtils_doNotSetTotalSentBytes_returnsDefaultTotalSentBytes() { + assertThat(fakePerformanceMetricUtils.getTotalSentBytes()) + .isEqualTo(fakePerformanceMetricUtils.testTotalBytesSent) + } + + @Test + fun testFakeMetricUtils_setTotalReceivedBytes_returnsCorrectTotalReceivedBytes() { + fakePerformanceMetricUtils.setTotalReceivedBytes(TEST_BYTES_RECEIVED) + + assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()).isEqualTo(TEST_BYTES_RECEIVED) + } + + @Test + fun testFakeMetricUtils_doNotSetTotalReceivedBytes_returnsDefaultTotalReceivedBytes() { + assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()) + .isEqualTo(fakePerformanceMetricUtils.testTotalReceivedBytes) + } + + @Test + fun testFakeMetricUtils_setDeviceStorageTier_returnsCorrectTotalDeviceStorageTier() { + val testDeviceStorageTier = OppiaMetricLog.StorageTier.LOW_STORAGE + fakePerformanceMetricUtils.setDeviceStorageTier(testDeviceStorageTier) + + assertThat(fakePerformanceMetricUtils.getDeviceStorageTier()).isEqualTo(testDeviceStorageTier) + } + + @Test + fun testFakeMetricUtils_doNotSetDeviceStorageTier_returnsDefaultTotalDeviceStorageTier() { + assertThat(fakePerformanceMetricUtils.getDeviceStorageTier()) + .isEqualTo(fakePerformanceMetricUtils.testDeviceStorageTier) + } + + @Test + fun testFakeMetricUtils_setDeviceMemoryTier_returnsCorrectTotalDeviceMemoryTier() { + val testDeviceMemoryTier = OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + fakePerformanceMetricUtils.setDeviceMemoryTier(testDeviceMemoryTier) + + assertThat(fakePerformanceMetricUtils.getDeviceMemoryTier()).isEqualTo(testDeviceMemoryTier) + } + + @Test + fun testFakeMetricUtils_doNotSetDeviceMemoryTier_returnsDefaultTotalDeviceMemoryTier() { + assertThat(fakePerformanceMetricUtils.getDeviceMemoryTier()) + .isEqualTo(fakePerformanceMetricUtils.testDeviceMemoryTier) + } + + private fun setUpTestApplicationComponent() { + DaggerFakePerformanceMetricUtilsTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .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(#89): Move this to a common test application component. + @Singleton + @Component(modules = [TestModule::class, TestLogReportingModule::class]) + interface TestApplicationComponent { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(fakePerformanceMetricUtilsTest: FakePerformanceMetricUtilsTest) + } +} \ No newline at end of file diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt index 0c2259167cd..ae5c36247dc 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt @@ -1,104 +1,38 @@ package org.oppia.android.util.logging.performancemetrics -import android.app.ActivityManager -import android.content.Context -import android.net.TrafficStats import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.ConsoleLogger -import java.io.File -import javax.inject.Inject /** Utility to extract performance metrics from the underlying Android system. */ -class PerformanceMetricsUtils @Inject constructor( - private val context: Context, - private val consoleLogger: ConsoleLogger -) { +interface PerformanceMetricsUtils { /** Returns the size of the app's installed APK file, in bytes. */ - fun getApkSize(): Long { - var apkSize: Long = 0 - try { - val apkPath = - context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir - val apkFile = File(apkPath) - apkSize = ((apkFile.length() / 1024)) - } catch (e: Exception) { - consoleLogger.e( - "PerformanceMetricsUtils", - "APK size could not be calculated." - ) - } - return apkSize - } + fun getApkSize(): Long /** * Returns the amount of storage usage by the app on user's device in bytes. * This storage size is the cumulative size of app-specific files which include the application * cache but not the apk size. */ - fun getUsedStorage(): Long { - var storageUsage: Long = 0 - try { - val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace - val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace - storageUsage = permanentStorageUsage + cacheStorageUsage - } catch (e: Exception) { - consoleLogger.e( - "PerformanceMetricsUtils", - "Storage usage could not be calculated." - ) - } - return storageUsage - } + fun getUsedStorage(): Long /** Returns the number of bytes sent by the application over a network since device reboot. */ - fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + fun getTotalSentBytes(): Long /** Returns the number of bytes received by the application over a network since device reboot. */ - fun getTotalReceivedBytes(): Long = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + fun getTotalReceivedBytes(): Long /** Returns the amount of memory used by the application on the device in bytes. */ - fun getTotalPssUsed(): Long { - val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - var totalPssUsed: Long = 0 - if (activityManager.runningAppProcesses != null) { - val pid = ActivityManager.RunningAppProcessInfo().pid - val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) - if (processMemoryInfo != null) { - for (element in processMemoryInfo) { - totalPssUsed += element.totalPss - } - } - } - return totalPssUsed - } + fun getTotalPssUsed(): Long /** * Returns the [OppiaMetricLog.StorageTier] of the device by analysing the total storage * capacity of the device. */ - fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { - return when ( - (context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024) - ) { - in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE - else -> OppiaMetricLog.StorageTier.HIGH_STORAGE - } - } + fun getDeviceStorageTier(): OppiaMetricLog.StorageTier /** * Returns the [OppiaMetricLog.MemoryTier] of the device by analysing the total memory * capacity of the device. */ - fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { - val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - val memoryInfo = ActivityManager.MemoryInfo() - activityManager.getMemoryInfo(memoryInfo) - return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..1.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - in 1.00..2.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER - else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER - } - } + fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt new file mode 100644 index 00000000000..f4ccead0bbd --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt @@ -0,0 +1,12 @@ +package org.oppia.android.util.logging.performancemetrics + +import dagger.Binds +import dagger.Module + +@Module +interface PerformanceMetricsUtilsModule { + @Binds + fun bindPerformanceMetricUtils( + prodPerformanceMetricsUtils: ProdPerformanceMetricsUtils + ): PerformanceMetricsUtils +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt new file mode 100644 index 00000000000..b5830cf6e6a --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt @@ -0,0 +1,88 @@ +package org.oppia.android.util.logging.performancemetrics + +import android.app.ActivityManager +import android.content.Context +import android.net.TrafficStats +import org.oppia.android.app.model.OppiaMetricLog +import org.oppia.android.util.logging.ConsoleLogger +import java.io.File +import javax.inject.Inject + +/** Utility to extract performance metrics from the underlying Android system. */ +class ProdPerformanceMetricsUtils @Inject constructor( + private val context: Context, + private val consoleLogger: ConsoleLogger +): PerformanceMetricsUtils { + + override fun getApkSize(): Long { + var apkSize: Long = 0 + try { + val apkPath = + context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir + val apkFile = File(apkPath) + apkSize = ((apkFile.length() / 1024)) + } catch (e: Exception) { + consoleLogger.e( + "PerformanceMetricsUtils", + "APK size could not be calculated." + ) + } + return apkSize + } + + override fun getUsedStorage(): Long { + var storageUsage: Long = 0 + try { + val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace + val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace + storageUsage = permanentStorageUsage + cacheStorageUsage + } catch (e: Exception) { + consoleLogger.e( + "PerformanceMetricsUtils", + "Storage usage could not be calculated." + ) + } + return storageUsage + } + + override fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + + override fun getTotalReceivedBytes(): Long = + TrafficStats.getUidRxBytes(context.applicationInfo.uid) + + override fun getTotalPssUsed(): Long { + val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + var totalPssUsed: Long = 0 + if (activityManager.runningAppProcesses != null) { + val pid = ActivityManager.RunningAppProcessInfo().pid + val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) + if (processMemoryInfo != null) { + for (element in processMemoryInfo) { + totalPssUsed += element.totalPss + } + } + } + return totalPssUsed + } + + override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { + return when ( + (context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024) + ) { + in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + else -> OppiaMetricLog.StorageTier.HIGH_STORAGE + } + } + + override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { + val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val memoryInfo = ActivityManager.MemoryInfo() + activityManager.getMemoryInfo(memoryInfo) + return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { + in 0.00..1.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + in 1.00..2.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER + } + } +} diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt similarity index 92% rename from utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt rename to utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt index d9ad5944f5e..d24f96afe2a 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt @@ -58,16 +58,16 @@ private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_PID = 1 private const val TEST_UID = 1 -/** Tests for [PerformanceMetricsUtils]. */ +/** Tests for [ProdPerformanceMetricsUtils]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) -@Config(application = PerformanceMetricsUtilsTest.TestApplication::class) -class PerformanceMetricsUtilsTest { +@Config(application = ProdPerformanceMetricsUtilsTest.TestApplication::class) +class ProdPerformanceMetricsUtilsTest { @Inject - lateinit var performanceMetricsUtils: PerformanceMetricsUtils + lateinit var prodPerformanceMetricsUtils: ProdPerformanceMetricsUtils @field:[Inject MockContext] lateinit var mockContext: Context @@ -89,7 +89,7 @@ class PerformanceMetricsUtilsTest { val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() shadowActivityManager.setMemoryInfo(memoryInfo) - val memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + val memoryTier = prodPerformanceMetricsUtils.getDeviceMemoryTier() assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) } @@ -107,7 +107,7 @@ class PerformanceMetricsUtilsTest { val cacheStorageUsage = cacheFile.totalSpace - cacheFile.freeSpace val expectedStorageValue = permanentStorageUsage + cacheStorageUsage - assertThat(performanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) + assertThat(prodPerformanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) } @Test @@ -129,7 +129,7 @@ class PerformanceMetricsUtilsTest { else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } - assertThat(performanceMetricsUtils.getDeviceStorageTier()) + assertThat(prodPerformanceMetricsUtils.getDeviceStorageTier()) .isEqualTo(expectedStorageTierValue) } @@ -141,7 +141,7 @@ class PerformanceMetricsUtilsTest { `when`(mockContext.applicationInfo).thenReturn(applicationInfo) val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(mockContext.applicationInfo.uid) - assertThat(performanceMetricsUtils.getTotalSentBytes()) + assertThat(prodPerformanceMetricsUtils.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) } @@ -153,7 +153,7 @@ class PerformanceMetricsUtilsTest { `when`(mockContext.applicationInfo).thenReturn(applicationInfo) val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(mockContext.applicationInfo.uid) - assertThat(performanceMetricsUtils.getTotalReceivedBytes()) + assertThat(prodPerformanceMetricsUtils.getTotalReceivedBytes()) .isEqualTo(expectedNetworkBytesReceived) } @@ -182,7 +182,7 @@ class PerformanceMetricsUtilsTest { } } - assertThat(performanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) + assertThat(prodPerformanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) } @Test @@ -207,7 +207,7 @@ class PerformanceMetricsUtilsTest { } ) - val apkSize = performanceMetricsUtils.getApkSize() + val apkSize = prodPerformanceMetricsUtils.getApkSize() assertThat(apkSize).isEqualTo(testApkSize) } @@ -292,7 +292,8 @@ class PerformanceMetricsUtilsTest { TestModule::class, TestLogReportingModule::class, TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, - TestPlatformParameterModule::class, SyncStatusModule::class + TestPlatformParameterModule::class, SyncStatusModule::class, + PerformanceMetricsUtilsModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { @@ -303,7 +304,7 @@ class PerformanceMetricsUtilsTest { fun build(): TestApplicationComponent } - fun inject(performanceMetricsUtilsTest: PerformanceMetricsUtilsTest) + fun inject(performanceMetricsUtilsTest: ProdPerformanceMetricsUtilsTest) } class TestApplication : Application(), DataProvidersInjectorProvider { @@ -313,7 +314,7 @@ class PerformanceMetricsUtilsTest { .build() } - fun inject(performanceMetricsUtilsTest: PerformanceMetricsUtilsTest) { + fun inject(performanceMetricsUtilsTest: ProdPerformanceMetricsUtilsTest) { component.inject(performanceMetricsUtilsTest) } From c65773912456a3e8bd5f97ef43747cff74d78998 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 23 Jul 2022 10:43:58 +0530 Subject: [PATCH 092/149] nits --- .../oppia/android/app/application/ApplicationComponent.kt | 2 +- .../android/app/devoptions/ViewEventLogsActivityTest.kt | 2 +- .../android/app/devoptions/ViewEventLogsFragmentTest.kt | 2 +- .../oppialogger/analytics/PerformanceMetricsController.kt | 2 +- .../oppialogger/analytics/PerformanceMetricsLogger.kt | 2 +- .../oppialogger/analytics/PerformanceMetricsLoggerTest.kt | 6 +++--- .../logscheduler/MetricLogSchedulingWorkerTest.kt | 5 +---- .../performancemetrics/ProdPerformanceMetricsUtils.kt | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index 3983e27c65f..a007a39fc72 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -55,6 +55,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -64,7 +65,6 @@ import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Provider import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** * Root Dagger component for the application. All application-scoped modules should be included in 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 e9833859ade..1f4fc1efdf1 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 @@ -78,6 +78,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -87,7 +88,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) 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 9c9922f08f1..dd6d9e847e5 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 @@ -85,6 +85,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -94,7 +95,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" 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 4f2d090101c..30511bfb9b3 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 @@ -9,11 +9,11 @@ import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Controller for handling performance metrics event logging. 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 4a4fae059aa..8c1d20f0ba2 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 @@ -2,10 +2,10 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.ApplicationStartupListener +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils import org.oppia.android.util.system.OppiaClock import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils /** * Convenience logger for performance metrics related analytics events. 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 3070f7b0a74..656af68763c 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 @@ -14,6 +14,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock +import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.HOME_SCREEN import org.oppia.android.app.model.OppiaMetricLog.CurrentScreen.SCREEN_UNSPECIFIED import org.oppia.android.app.model.OppiaMetricLog.LoggableMetric.LoggableMetricTypeCase.APK_SIZE_METRIC @@ -30,6 +31,7 @@ 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.FakePerformanceMetricUtils import org.oppia.android.testing.FakePerformanceMetricsEventLogger import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.logging.SyncStatusTestModule @@ -44,14 +46,12 @@ 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.PerformanceMetricsUtils import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.testing.FakePerformanceMetricUtils -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils private const val TEST_TIMESTAMP = Long.MAX_VALUE private const val TEST_CPU_USAGE = Long.MAX_VALUE 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 ac1d65d7ce8..c7c32b27010 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 @@ -22,8 +22,6 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito -import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.EventLogStorageCacheSize import org.oppia.android.domain.oppialogger.ExceptionLogStorageCacheSize import org.oppia.android.domain.oppialogger.LoggingIdentifierModule @@ -54,14 +52,13 @@ import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject -import javax.inject.Qualifier import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt index b5830cf6e6a..3be9cd66430 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt @@ -12,7 +12,7 @@ import javax.inject.Inject class ProdPerformanceMetricsUtils @Inject constructor( private val context: Context, private val consoleLogger: ConsoleLogger -): PerformanceMetricsUtils { +) : PerformanceMetricsUtils { override fun getApkSize(): Long { var apkSize: Long = 0 From bc55877a5c398927968b6614ccdc2882897dacdd Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 23 Jul 2022 10:50:01 +0530 Subject: [PATCH 093/149] test rearrangement --- .../PerformanceMetricsControllerTest.kt | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) 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 d7b5cb17413..a9170621d0d 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 @@ -378,6 +378,15 @@ class PerformanceMetricsControllerTest { assertThat(secondMetricLog.timestampMillis).isEqualTo(1556094110000) } + @Test + fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue() { + performanceMetricsController.setAppInForeground() + + val isAppInForeground = performanceMetricsController.getIsAppInForeground() + + assertThat(isAppInForeground).isTrue() + } + @Test fun testController_setAppInForeground_logMetric_logsMetricWithAppInForeground() { performanceMetricsController.setAppInForeground() @@ -400,6 +409,15 @@ class PerformanceMetricsControllerTest { assertThat(performanceMetricsLog.isAppInForeground).isTrue() } + @Test + fun testController_setAppInBackground_getIsAppInForeground_returnsCorrectValue() { + performanceMetricsController.setAppInBackground() + + val isAppInForeground = performanceMetricsController.getIsAppInForeground() + + assertThat(isAppInForeground).isFalse() + } + @Test fun testController_setAppInBackground_logMetric_logsMetricWithAppInBackground() { performanceMetricsController.setAppInBackground() @@ -422,24 +440,6 @@ class PerformanceMetricsControllerTest { assertThat(performanceMetricsLog.isAppInForeground).isFalse() } - @Test - fun testController_setAppInBackground_getIsAppInForeground_returnsCorrectValue() { - performanceMetricsController.setAppInBackground() - - val isAppInForeground = performanceMetricsController.getIsAppInForeground() - - assertThat(isAppInForeground).isFalse() - } - - @Test - fun testController_setAppInForeground_getIsAppInForeground_returnsCorrectValue() { - performanceMetricsController.setAppInForeground() - - val isAppInForeground = performanceMetricsController.getIsAppInForeground() - - assertThat(isAppInForeground).isTrue() - } - private fun logMultiplePerformanceMetrics() { performanceMetricsController.logPerformanceMetricsEvent( 1556094120000, From 61ae44ffd8d2ca19a1c5deac261b5cd0f8b20c68 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 23 Jul 2022 10:50:37 +0530 Subject: [PATCH 094/149] nits --- .../oppia/android/testing/FakePerformanceMetricUtils.kt | 8 ++++---- .../android/testing/FakePerformanceMetricUtilsTest.kt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt index aa3e7a34503..f94576ff69b 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt @@ -1,13 +1,13 @@ package org.oppia.android.testing -import javax.inject.Inject -import javax.inject.Singleton import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import javax.inject.Inject +import javax.inject.Singleton /** A test specific fake for performance metric utils. */ @Singleton -class FakePerformanceMetricUtils @Inject constructor(): PerformanceMetricsUtils { +class FakePerformanceMetricUtils @Inject constructor() : PerformanceMetricsUtils { internal var testApkSize = 0L internal var testStorageUsage = 0L internal var testTotalPss = 0L @@ -64,4 +64,4 @@ class FakePerformanceMetricUtils @Inject constructor(): PerformanceMetricsUtils fun setDeviceMemoryTier(memoryTier: OppiaMetricLog.MemoryTier) { testDeviceMemoryTier = memoryTier } -} \ No newline at end of file +} diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt index 5538b8952ee..ca27b93ae21 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt @@ -9,14 +9,14 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.oppia.android.app.model.OppiaMetricLog import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton private const val TEST_APK_SIZE = Long.MAX_VALUE private const val TEST_STORAGE_USAGE = Long.MAX_VALUE @@ -161,4 +161,4 @@ class FakePerformanceMetricUtilsTest { fun inject(fakePerformanceMetricUtilsTest: FakePerformanceMetricUtilsTest) } -} \ No newline at end of file +} From bdfaeb33168cbaf8faab9c4ccb692626e74a4160 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sun, 24 Jul 2022 01:48:36 +0530 Subject: [PATCH 095/149] test fixes. --- .../file_content_validation_checks.textproto | 1 + scripts/assets/test_file_exemptions.textproto | 11 +++++- .../testing/FakePerformanceMetricUtils.kt | 35 +++++++++++++++++++ .../PerformanceMetricsUtilsModule.kt | 1 + .../ProdPerformanceMetricsUtilsTest.kt | 2 +- 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/scripts/assets/file_content_validation_checks.textproto b/scripts/assets/file_content_validation_checks.textproto index 31cde32e18c..4588b4552ed 100644 --- a/scripts/assets/file_content_validation_checks.textproto +++ b/scripts/assets/file_content_validation_checks.textproto @@ -33,6 +33,7 @@ file_content_checks { failure_message: "SettableFuture should only be used in pre-approved locations since it's easy to potentially mess up & lead to a hanging ListenableFuture." exempted_file_name: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorker.kt" exempted_file_name: "domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt" + exempted_file_name: "domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorker.kt" exempted_file_name: "scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt" } file_content_checks { diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index ad6b4398d00..d67a548c804 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -621,7 +621,7 @@ exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/L 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/loguploader/LogUploadWorkerFactory.kt" -exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerModule.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/PlatformParameterSingletonImpl.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonModule.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerFactory.kt" @@ -636,6 +636,7 @@ exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateDe exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateGraph.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateList.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt" +exempted_file_path: "domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/ConceptCardRetriever.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/PrimeTopicAssetsController.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/PrimeTopicAssetsControllerImpl.kt" @@ -807,3 +808,11 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/Conc exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjector.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjectorProvider.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherModule.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.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/MetricLogSchedulerModule.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.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/analytics/PerformanceMetricsLoggerModule.kt" diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt index f94576ff69b..9978a6aa0ec 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt @@ -8,12 +8,47 @@ import javax.inject.Singleton /** A test specific fake for performance metric utils. */ @Singleton class FakePerformanceMetricUtils @Inject constructor() : PerformanceMetricsUtils { + /** + * Returns the apk size of the current device. + * + * It returns a default value unless a specific value has been set using [setApkSize]. + */ internal var testApkSize = 0L + /** + * Returns the storage usage of the current device. + * + * It returns a default value unless a specific value has been set using [setStorageUsage]. + */ internal var testStorageUsage = 0L + /** + * Returns the total pss of the current device. + * + * It returns a default value unless a specific value has been set using [setTotalPss]. + */ internal var testTotalPss = 0L + /** + * Returns the total sent bytes by the current device. + * + * It returns a default value unless a specific value has been set using [setTotalSentBytes]. + */ internal var testTotalBytesSent = 0L + /** + * Returns the total received bytes by the current device. + * + * It returns a default value unless a specific value has been set using [setTotalReceivedBytes]. + */ internal var testTotalReceivedBytes = 0L + /** + * Returns the storage tier of the current device. + * + * It returns a default value unless a specific value has been set using [setDeviceStorageTier]. + */ internal var testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE + /** + * Returns the memory tier of the current device. + * + * It returns a default value unless a specific value has been set using [setDeviceMemoryTier]. + */ internal var testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER override fun getApkSize(): Long = testApkSize diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt index f4ccead0bbd..acbc6486e70 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt @@ -3,6 +3,7 @@ package org.oppia.android.util.logging.performancemetrics import dagger.Binds import dagger.Module +/** Provides production-specific performance metrics utilities related dependencies. */ @Module interface PerformanceMetricsUtilsModule { @Binds diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt index d24f96afe2a..0baaa7e77ec 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt @@ -309,7 +309,7 @@ class ProdPerformanceMetricsUtilsTest { class TestApplication : Application(), DataProvidersInjectorProvider { private val component: TestApplicationComponent by lazy { - DaggerPerformanceMetricsUtilsTest_TestApplicationComponent.builder() + DaggerProdPerformanceMetricsUtilsTest_TestApplicationComponent.builder() .setApplication(this) .build() } From a728d8ce72e54c24d16bdfcb37eb6cf0384b288c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 25 Jul 2022 20:23:21 +0530 Subject: [PATCH 096/149] nits --- .../AdministratorControlsActivityTest.kt | 1 - .../AdministratorControlsFragmentTest.kt | 1 - .../ProfileAndDeviceIdFragmentTest.kt | 23 ----------------- .../app/options/OptionsFragmentTest.kt | 25 ------------------- .../testing/options/OptionsFragmentTest.kt | 25 ------------------- 5 files changed, 75 deletions(-) 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 1c683d3706b..8be81da36ff 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 @@ -90,7 +90,6 @@ 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.loguploader.LogReportWorkerModule -import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule 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 13184fab7f5..6643e741812 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,7 +81,6 @@ 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.loguploader.LogReportWorkerModule -import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule 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 f1f237e4830..6a147597875 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 @@ -108,29 +108,6 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.CacheLatexRendering -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.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PlatformParameterSingleton -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.oppia.android.util.system.OppiaClock import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode 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 c010a79e504..5fc41157154 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 @@ -98,31 +98,6 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.CacheLatexRendering -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.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS -import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PlatformParameterSingleton -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 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 8cd892c4936..7ace1afc8a9 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 @@ -87,32 +87,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.CacheLatexRendering import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_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.EnableLanguageSelectionUi -import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS -import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.LearnerStudyAnalytics -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PlatformParameterSingleton -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 From 2755ff3036e02b4e404275aa6bd6409fe88c6788 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 25 Jul 2022 21:02:05 +0530 Subject: [PATCH 097/149] nits --- .../domain/oppialogger/loguploader/LogUploadWorkerTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt index 276cd73ea25..6462832ec9f 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt @@ -71,6 +71,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Qualifier import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule private const val TEST_TIMESTAMP = 1556094120000 private const val TEST_TOPIC_ID = "test_topicId" @@ -404,7 +405,8 @@ class LogUploadWorkerTest { TestFirebaseLogUploaderModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, - LoggingIdentifierModule::class, SyncStatusTestModule::class, ApplicationLifecycleModule::class + LoggingIdentifierModule::class, SyncStatusTestModule::class, + PerformanceMetricsUtilsModule::class, ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { From b4d37da066ab5971f79ce0add627f456c3b01f13 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 25 Jul 2022 21:04:25 +0530 Subject: [PATCH 098/149] nits --- .../domain/oppialogger/loguploader/LogUploadWorkerTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt index 6462832ec9f..091c882dc04 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt @@ -63,6 +63,7 @@ import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.DATA_UPLOADIN import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NETWORK_ERROR import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NO_CONNECTIVITY import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -71,7 +72,6 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Qualifier import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule private const val TEST_TIMESTAMP = 1556094120000 private const val TEST_TOPIC_ID = "test_topicId" From 61884996ab723a73ffa3f2eaa8ae1a22f37c3180 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 26 Jul 2022 02:02:03 +0530 Subject: [PATCH 099/149] memory and storage tier updates --- .../src/main/proto/performance_metrics.proto | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/model/src/main/proto/performance_metrics.proto b/model/src/main/proto/performance_metrics.proto index a2781d59508..a6019cfb772 100644 --- a/model/src/main/proto/performance_metrics.proto +++ b/model/src/main/proto/performance_metrics.proto @@ -101,6 +101,7 @@ message OppiaMetricLog { // 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; } @@ -137,14 +138,15 @@ message OppiaMetricLog { // The undefined memory tier of a device. MEMORY_TIER_UNSPECIFIED = 0; - // The memory tier where the amount of memory is less than or equal to 1GB. - LOW_MEMORY_TIER = 1; // =<1GB + // The memory tier where the amount of memory is less than 2GB. + LOW_MEMORY_TIER = 1; // <2GB - // The memory tier where the amount of memory is less than or equal to 2GB and more than 1GB. - MEDIUM_MEMORY_TIER = 2; // =<2GB && >1GB + // The memory tier where the amount of memory is less than or equal to 3GB and more than or + // equal to 2GB. + MEDIUM_MEMORY_TIER = 2; // =<3GB && >2GB - // The memory tier where the amount of memory is greater than 2GB. - HIGH_MEMORY_TIER = 3; // >2GB + // The memory tier where the amount of memory is greater than 3GB. + HIGH_MEMORY_TIER = 3; // >3GB } // Supported storage tiers for indicating the total storage space on user's device. @@ -152,14 +154,15 @@ message OppiaMetricLog { // The undefined storage tier of a device. STORAGE_TIER_UNSPECIFIED = 0; - // The storage tier where the amount of storage is less than or equal to 5GB. - LOW_STORAGE = 1; // =<5GB + // The storage tier where the amount of storage is less than 32GB. + LOW_STORAGE = 1; // <32GB - // The storage tier where the amount of storage is less than or equal to 20GB and more than 5GB. - MEDIUM_STORAGE = 2; // =<20GB && >5GB + // The storage tier where the amount of storage is less than or equal to 64GB and more than or + // equal to 32GB. + MEDIUM_STORAGE = 2; // =<64GB && >=32GB - // The storage tier where the amount of storage is greater than 20GB. - HIGH_STORAGE = 3; // >20GB + // The storage tier where the amount of storage is greater than 64GB. + HIGH_STORAGE = 3; // >64GB } // Supported network types for indicating the current network situation on user's device. From 2fca0cb3ee723682ac3d0a8f5ff7a44dd4c28f23 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 26 Jul 2022 02:24:55 +0530 Subject: [PATCH 100/149] memory and storage tier updates --- .../performancemetrics/ProdPerformanceMetricsUtils.kt | 8 ++++---- .../performancemetrics/ProdPerformanceMetricsUtilsTest.kt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt index 3be9cd66430..9262161df96 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt @@ -69,8 +69,8 @@ class ProdPerformanceMetricsUtils @Inject constructor( return when ( (context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024) ) { - in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + in 0.00..32.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 32.00..64.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } } @@ -80,8 +80,8 @@ class ProdPerformanceMetricsUtils @Inject constructor( val memoryInfo = ActivityManager.MemoryInfo() activityManager.getMemoryInfo(memoryInfo) return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..1.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - in 1.00..2.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + in 0.00..2.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + in 2.00..3.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt index 0baaa7e77ec..62bbd8ce7e6 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt @@ -91,7 +91,7 @@ class ProdPerformanceMetricsUtilsTest { shadowActivityManager.setMemoryInfo(memoryInfo) val memoryTier = prodPerformanceMetricsUtils.getDeviceMemoryTier() - assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER) } @Test @@ -124,8 +124,8 @@ class ProdPerformanceMetricsUtilsTest { val expectedStorageValue = permanentStorageUsage + cacheStorageUsage val expectedStorageTierValue = when (expectedStorageValue.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..5.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 5.00..20.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + in 0.00..32.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 32.00..64.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } From e8c69596f7e5b2161e1597e33a0db2d7cbd2ce58 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 27 Jul 2022 09:37:09 +0530 Subject: [PATCH 101/149] updates. --- .../app/application/ApplicationComponent.kt | 4 +- .../devoptions/ViewEventLogsActivityTest.kt | 4 +- .../devoptions/ViewEventLogsFragmentTest.kt | 4 +- .../analytics/PerformanceMetricsController.kt | 8 +- .../analytics/PerformanceMetricsLogger.kt | 14 +- .../analytics/PerformanceMetricsLoggerTest.kt | 10 +- ...ls.kt => FakePerformanceMetricAssessor.kt} | 53 ++----- .../android/testing/TestLogReportingModule.kt | 6 +- ...t => FakePerformanceMetricAssessorTest.kt} | 82 +++-------- ...Utils.kt => PerformanceMetricsAssessor.kt} | 2 +- .../PerformanceMetricsAssessorImpl.kt | 68 +++++++++ ...kt => PerformanceMetricsAssessorModule.kt} | 8 +- .../ProdPerformanceMetricsUtils.kt | 88 ------------ ... => PerformanceMetricsAssessorImplTest.kt} | 132 ++++++------------ 14 files changed, 172 insertions(+), 311 deletions(-) rename testing/src/main/java/org/oppia/android/testing/{FakePerformanceMetricUtils.kt => FakePerformanceMetricAssessor.kt} (53%) rename testing/src/test/java/org/oppia/android/testing/{FakePerformanceMetricUtilsTest.kt => FakePerformanceMetricAssessorTest.kt} (55%) rename utility/src/main/java/org/oppia/android/util/logging/performancemetrics/{PerformanceMetricsUtils.kt => PerformanceMetricsAssessor.kt} (97%) create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt rename utility/src/main/java/org/oppia/android/util/logging/performancemetrics/{PerformanceMetricsUtilsModule.kt => PerformanceMetricsAssessorModule.kt} (53%) delete mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt rename utility/src/test/java/org/oppia/android/util/logging/performancemetrics/{ProdPerformanceMetricsUtilsTest.kt => PerformanceMetricsAssessorImplTest.kt} (68%) diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index a007a39fc72..153d4a1627f 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -55,7 +55,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -107,7 +107,7 @@ import javax.inject.Singleton MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, - PerformanceMetricsUtilsModule::class, + PerformanceMetricsAssessorModule::class, // TODO(#59): Remove this module once we completely migrate to Bazel from Gradle as we can then // directly exclude debug files from the build and thus won't be requiring this module. NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class 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 1f4fc1efdf1..dfba1f68306 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 @@ -78,7 +78,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -176,7 +176,7 @@ class ViewEventLogsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsUtilsModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::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 dd6d9e847e5..ba06114ec26 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 @@ -85,7 +85,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -576,7 +576,7 @@ class ViewEventLogsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, - MetricLogSchedulerModule::class, PerformanceMetricsUtilsModule::class + MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class ] ) 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 30511bfb9b3..50db2c80b8c 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 @@ -9,7 +9,7 @@ import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject @@ -23,7 +23,7 @@ import javax.inject.Singleton */ @Singleton class PerformanceMetricsController @Inject constructor( - private val performanceMetricsUtils: PerformanceMetricsUtils, + private val performanceMetricsAssessor: PerformanceMetricsAssessor, private val consoleLogger: ConsoleLogger, private val networkConnectionUtil: NetworkConnectionUtil, private val exceptionLogger: ExceptionLogger, @@ -111,8 +111,8 @@ class PerformanceMetricsController @Inject constructor( this.currentScreen = currentScreen this.loggableMetric = loggableMetric this.isAppInForeground = this@PerformanceMetricsController.isAppInForeground - this.storageTier = performanceMetricsUtils.getDeviceStorageTier() - this.memoryTier = performanceMetricsUtils.getDeviceMemoryTier() + this.storageTier = performanceMetricsAssessor.getDeviceStorageTier() + this.memoryTier = performanceMetricsAssessor.getDeviceMemoryTier() }.build() } 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 8c1d20f0ba2..48a6bda8ad1 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 @@ -2,7 +2,7 @@ package org.oppia.android.domain.oppialogger.analytics import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.domain.oppialogger.ApplicationStartupListener -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor import org.oppia.android.util.system.OppiaClock import javax.inject.Inject import javax.inject.Singleton @@ -16,7 +16,7 @@ import javax.inject.Singleton @Singleton class PerformanceMetricsLogger @Inject constructor( private val performanceMetricsController: PerformanceMetricsController, - private val performanceMetricsUtils: PerformanceMetricsUtils, + private val performanceMetricsAssessor: PerformanceMetricsAssessor, private val oppiaClock: OppiaClock ) : ApplicationStartupListener { @@ -44,7 +44,7 @@ class PerformanceMetricsLogger @Inject constructor( performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), currentScreen, - createApkSizeLoggableMetric(performanceMetricsUtils.getApkSize()) + createApkSizeLoggableMetric(performanceMetricsAssessor.getApkSize()) ) } @@ -59,7 +59,7 @@ class PerformanceMetricsLogger @Inject constructor( performanceMetricsController.logLowPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), currentScreen, - createStorageUsageLoggableMetric(performanceMetricsUtils.getUsedStorage()) + createStorageUsageLoggableMetric(performanceMetricsAssessor.getUsedStorage()) ) } @@ -91,7 +91,7 @@ class PerformanceMetricsLogger @Inject constructor( performanceMetricsController.logMediumPriorityMetricEvent( oppiaClock.getCurrentTimeMs(), currentScreen, - createMemoryUsageLoggableMetric(performanceMetricsUtils.getTotalPssUsed()) + createMemoryUsageLoggableMetric(performanceMetricsAssessor.getTotalPssUsed()) ) } @@ -107,8 +107,8 @@ class PerformanceMetricsLogger @Inject constructor( oppiaClock.getCurrentTimeMs(), currentScreen, createNetworkUsageLoggableMetric( - performanceMetricsUtils.getTotalReceivedBytes(), - performanceMetricsUtils.getTotalSentBytes() + performanceMetricsAssessor.getTotalReceivedBytes(), + performanceMetricsAssessor.getTotalSentBytes() ) ) } 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 656af68763c..c489c96f3d5 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 @@ -31,7 +31,7 @@ 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.FakePerformanceMetricUtils +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 @@ -46,7 +46,7 @@ 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.PerformanceMetricsUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode @@ -82,7 +82,7 @@ class PerformanceMetricsLoggerTest { lateinit var fakeOppiaClock: FakeOppiaClock @Inject - lateinit var fakePerformanceMetricUtils: FakePerformanceMetricUtils + lateinit var fakePerformanceMetricUtils: FakePerformanceMetricAssessor @Mock lateinit var context: Context @@ -273,8 +273,8 @@ class PerformanceMetricsLoggerTest { interface TestPerformanceMetricsModule { @Binds fun bindPerformanceMetricsUtils( - fakePerformanceMetricUtils: FakePerformanceMetricUtils - ): PerformanceMetricsUtils + fakePerformanceMetricUtils: FakePerformanceMetricAssessor + ): PerformanceMetricsAssessor } // TODO(#89): Move this to a common test application component. diff --git a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt similarity index 53% rename from testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt rename to testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt index 9978a6aa0ec..f797b922029 100644 --- a/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricUtils.kt +++ b/testing/src/main/java/org/oppia/android/testing/FakePerformanceMetricAssessor.kt @@ -1,55 +1,20 @@ package org.oppia.android.testing import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor import javax.inject.Inject import javax.inject.Singleton /** A test specific fake for performance metric utils. */ @Singleton -class FakePerformanceMetricUtils @Inject constructor() : PerformanceMetricsUtils { - /** - * Returns the apk size of the current device. - * - * It returns a default value unless a specific value has been set using [setApkSize]. - */ - internal var testApkSize = 0L - /** - * Returns the storage usage of the current device. - * - * It returns a default value unless a specific value has been set using [setStorageUsage]. - */ - internal var testStorageUsage = 0L - /** - * Returns the total pss of the current device. - * - * It returns a default value unless a specific value has been set using [setTotalPss]. - */ - internal var testTotalPss = 0L - /** - * Returns the total sent bytes by the current device. - * - * It returns a default value unless a specific value has been set using [setTotalSentBytes]. - */ - internal var testTotalBytesSent = 0L - /** - * Returns the total received bytes by the current device. - * - * It returns a default value unless a specific value has been set using [setTotalReceivedBytes]. - */ - internal var testTotalReceivedBytes = 0L - /** - * Returns the storage tier of the current device. - * - * It returns a default value unless a specific value has been set using [setDeviceStorageTier]. - */ - internal var testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE - /** - * Returns the memory tier of the current device. - * - * It returns a default value unless a specific value has been set using [setDeviceMemoryTier]. - */ - internal var testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER +class FakePerformanceMetricAssessor @Inject constructor() : PerformanceMetricsAssessor { + private var testApkSize = 0L + private var testStorageUsage = 0L + private var testTotalPss = 0L + private var testTotalBytesSent = 0L + private var testTotalReceivedBytes = 0L + private var testDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE + private var testDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER override fun getApkSize(): Long = testApkSize diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index c3689977954..b6788fdc45f 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -5,7 +5,7 @@ import dagger.Module import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtils +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor /** Provides fake log reporting dependencies. */ @Module @@ -24,6 +24,6 @@ interface TestLogReportingModule { @Binds fun bindFakePerformanceMetricsUtils( - fakePerformanceMetricUtils: FakePerformanceMetricUtils - ): PerformanceMetricsUtils + fakePerformanceMetricUtils: FakePerformanceMetricAssessor + ): PerformanceMetricsAssessor } diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt similarity index 55% rename from testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt rename to testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt index ca27b93ae21..a7a418fabc4 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricUtilsTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt @@ -18,20 +18,20 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -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 -private const val TEST_BYTES_SENT = Long.MAX_VALUE -private const val TEST_BYTES_RECEIVED = Long.MAX_VALUE +private const val DEFAULT_TEST_APK_SIZE = Long.MAX_VALUE +private const val DEFAULT_TEST_STORAGE_USAGE = Long.MAX_VALUE +private const val DEFAULT_TEST_TOTAL_PSS = Long.MAX_VALUE +private const val DEFAULT_TEST_BYTES_SENT = Long.MAX_VALUE +private const val DEFAULT_TEST_BYTES_RECEIVED = Long.MAX_VALUE -/** Tests for [FakePerformanceMetricUtils]. */ +/** Tests for [FakePerformanceMetricAssessor]. */ @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @Config(manifest = Config.NONE) -class FakePerformanceMetricUtilsTest { +class FakePerformanceMetricAssessorTest { @Inject - lateinit var fakePerformanceMetricUtils: FakePerformanceMetricUtils + lateinit var fakePerformanceMetricUtils: FakePerformanceMetricAssessor @Before fun setUp() { @@ -40,67 +40,37 @@ class FakePerformanceMetricUtilsTest { @Test fun testFakeMetricUtils_setApkSize_returnsCorrectApkSize() { - fakePerformanceMetricUtils.setApkSize(TEST_APK_SIZE) + fakePerformanceMetricUtils.setApkSize(DEFAULT_TEST_APK_SIZE) - assertThat(fakePerformanceMetricUtils.getApkSize()).isEqualTo(TEST_APK_SIZE) - } - - @Test - fun testFakeMetricUtils_doNotSetApkSize_returnsDefaultApkSize() { - assertThat(fakePerformanceMetricUtils.getApkSize()) - .isEqualTo(fakePerformanceMetricUtils.testApkSize) + assertThat(fakePerformanceMetricUtils.getApkSize()).isEqualTo(DEFAULT_TEST_APK_SIZE) } @Test fun testFakeMetricUtils_setStorageUsage_returnsCorrectStorageSize() { - fakePerformanceMetricUtils.setStorageUsage(TEST_STORAGE_USAGE) + fakePerformanceMetricUtils.setStorageUsage(DEFAULT_TEST_STORAGE_USAGE) - assertThat(fakePerformanceMetricUtils.getUsedStorage()).isEqualTo(TEST_STORAGE_USAGE) - } - - @Test - fun testFakeMetricUtils_doNotSetStorageUsage_returnsDefaultStorageUsage() { - assertThat(fakePerformanceMetricUtils.getUsedStorage()) - .isEqualTo(fakePerformanceMetricUtils.testStorageUsage) + assertThat(fakePerformanceMetricUtils.getUsedStorage()).isEqualTo(DEFAULT_TEST_STORAGE_USAGE) } @Test fun testFakeMetricUtils_setTotalPss_returnsCorrectTotalPss() { - fakePerformanceMetricUtils.setTotalPss(TEST_TOTAL_PSS) + fakePerformanceMetricUtils.setTotalPss(DEFAULT_TEST_TOTAL_PSS) - assertThat(fakePerformanceMetricUtils.getTotalPssUsed()).isEqualTo(TEST_TOTAL_PSS) - } - - @Test - fun testFakeMetricUtils_doNotSetTotalPss_returnsDefaultTotalPss() { - assertThat(fakePerformanceMetricUtils.getTotalPssUsed()) - .isEqualTo(fakePerformanceMetricUtils.testTotalPss) + assertThat(fakePerformanceMetricUtils.getTotalPssUsed()).isEqualTo(DEFAULT_TEST_TOTAL_PSS) } @Test fun testFakeMetricUtils_setTotalSentBytes_returnsCorrectTotalSentBytes() { - fakePerformanceMetricUtils.setTotalSentBytes(TEST_BYTES_SENT) + fakePerformanceMetricUtils.setTotalSentBytes(DEFAULT_TEST_BYTES_SENT) - assertThat(fakePerformanceMetricUtils.getTotalSentBytes()).isEqualTo(TEST_BYTES_SENT) - } - - @Test - fun testFakeMetricUtils_doNotSetTotalSentBytes_returnsDefaultTotalSentBytes() { - assertThat(fakePerformanceMetricUtils.getTotalSentBytes()) - .isEqualTo(fakePerformanceMetricUtils.testTotalBytesSent) + assertThat(fakePerformanceMetricUtils.getTotalSentBytes()).isEqualTo(DEFAULT_TEST_BYTES_SENT) } @Test fun testFakeMetricUtils_setTotalReceivedBytes_returnsCorrectTotalReceivedBytes() { - fakePerformanceMetricUtils.setTotalReceivedBytes(TEST_BYTES_RECEIVED) + fakePerformanceMetricUtils.setTotalReceivedBytes(DEFAULT_TEST_BYTES_RECEIVED) - assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()).isEqualTo(TEST_BYTES_RECEIVED) - } - - @Test - fun testFakeMetricUtils_doNotSetTotalReceivedBytes_returnsDefaultTotalReceivedBytes() { - assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()) - .isEqualTo(fakePerformanceMetricUtils.testTotalReceivedBytes) + assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()).isEqualTo(DEFAULT_TEST_BYTES_RECEIVED) } @Test @@ -111,12 +81,6 @@ class FakePerformanceMetricUtilsTest { assertThat(fakePerformanceMetricUtils.getDeviceStorageTier()).isEqualTo(testDeviceStorageTier) } - @Test - fun testFakeMetricUtils_doNotSetDeviceStorageTier_returnsDefaultTotalDeviceStorageTier() { - assertThat(fakePerformanceMetricUtils.getDeviceStorageTier()) - .isEqualTo(fakePerformanceMetricUtils.testDeviceStorageTier) - } - @Test fun testFakeMetricUtils_setDeviceMemoryTier_returnsCorrectTotalDeviceMemoryTier() { val testDeviceMemoryTier = OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER @@ -125,14 +89,8 @@ class FakePerformanceMetricUtilsTest { assertThat(fakePerformanceMetricUtils.getDeviceMemoryTier()).isEqualTo(testDeviceMemoryTier) } - @Test - fun testFakeMetricUtils_doNotSetDeviceMemoryTier_returnsDefaultTotalDeviceMemoryTier() { - assertThat(fakePerformanceMetricUtils.getDeviceMemoryTier()) - .isEqualTo(fakePerformanceMetricUtils.testDeviceMemoryTier) - } - private fun setUpTestApplicationComponent() { - DaggerFakePerformanceMetricUtilsTest_TestApplicationComponent.builder() + DaggerFakePerformanceMetricAssessorTest_TestApplicationComponent.builder() .setApplication(ApplicationProvider.getApplicationContext()) .build() .inject(this) @@ -159,6 +117,6 @@ class FakePerformanceMetricUtilsTest { fun build(): TestApplicationComponent } - fun inject(fakePerformanceMetricUtilsTest: FakePerformanceMetricUtilsTest) + fun inject(fakePerformanceMetricAssessorTest: FakePerformanceMetricAssessorTest) } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt similarity index 97% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt rename to utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt index ae5c36247dc..5bdd9ba5761 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessor.kt @@ -3,7 +3,7 @@ package org.oppia.android.util.logging.performancemetrics import org.oppia.android.app.model.OppiaMetricLog /** Utility to extract performance metrics from the underlying Android system. */ -interface PerformanceMetricsUtils { +interface PerformanceMetricsAssessor { /** Returns the size of the app's installed APK file, in bytes. */ fun getApkSize(): Long 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 new file mode 100644 index 00000000000..bad71ff509e --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt @@ -0,0 +1,68 @@ +package org.oppia.android.util.logging.performancemetrics + +import android.app.ActivityManager +import android.content.Context +import android.net.TrafficStats +import org.oppia.android.app.model.OppiaMetricLog +import java.io.File +import javax.inject.Inject + +/** Utility to extract performance metrics from the underlying Android system. */ +class PerformanceMetricsAssessorImpl @Inject constructor( + private val context: Context +) : PerformanceMetricsAssessor { + + private val activityManager: ActivityManager by lazy { + context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + } + + override fun getApkSize(): Long { + val apkPath = + context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir + return File(apkPath).length() / 1024 + } + + override fun getUsedStorage(): Long { + val permanentStorageUsage = context.filesDir?.listFiles()?.map { it.length() }?.sum() + val cacheStorageUsage = context.cacheDir?.listFiles()?.map { it.length() }?.sum() + return (cacheStorageUsage?.let { permanentStorageUsage?.plus(it) }) ?: 0L + } + + override fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + + override fun getTotalReceivedBytes(): Long = + TrafficStats.getUidRxBytes(context.applicationInfo.uid) + + override fun getTotalPssUsed(): Long { + val pid = ActivityManager.RunningAppProcessInfo().pid + activityManager.runningAppProcesses + val processMemoryInfo = activityManager.getProcessMemoryInfo(intArrayOf(pid)) + return processMemoryInfo?.map { it.totalPss }?.sum()?.toLong() ?: 0L + } + + override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { + val permanentStorageUsage = context.filesDir?.listFiles()?.map { it.length() }?.sum() + val cacheStorageUsage = context.cacheDir?.listFiles()?.map { it.length() }?.sum() + val usedStorage = (cacheStorageUsage?.let { permanentStorageUsage?.plus(it) }) + if (usedStorage != null) { + return when ( + usedStorage.let { it / (1024 * 1024 * 1024) } + ) { + in 0L until 32L -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 32L..64L -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + else -> OppiaMetricLog.StorageTier.HIGH_STORAGE + } + } + return OppiaMetricLog.StorageTier.UNRECOGNIZED + } + + override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { + val memoryInfo = ActivityManager.MemoryInfo() + activityManager.getMemoryInfo(memoryInfo) + return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { + in 0.00..2.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER + in 2.00..3.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER + else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER + } + } +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt similarity index 53% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt rename to utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt index acbc6486e70..2a13dbe33c6 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt @@ -5,9 +5,9 @@ import dagger.Module /** Provides production-specific performance metrics utilities related dependencies. */ @Module -interface PerformanceMetricsUtilsModule { +interface PerformanceMetricsAssessorModule { @Binds - fun bindPerformanceMetricUtils( - prodPerformanceMetricsUtils: ProdPerformanceMetricsUtils - ): PerformanceMetricsUtils + fun bindPerformanceMetricsAssessor( + performanceMetricsUtilsImpl: PerformanceMetricsAssessorImpl + ): PerformanceMetricsAssessor } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt deleted file mode 100644 index 9262161df96..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtils.kt +++ /dev/null @@ -1,88 +0,0 @@ -package org.oppia.android.util.logging.performancemetrics - -import android.app.ActivityManager -import android.content.Context -import android.net.TrafficStats -import org.oppia.android.app.model.OppiaMetricLog -import org.oppia.android.util.logging.ConsoleLogger -import java.io.File -import javax.inject.Inject - -/** Utility to extract performance metrics from the underlying Android system. */ -class ProdPerformanceMetricsUtils @Inject constructor( - private val context: Context, - private val consoleLogger: ConsoleLogger -) : PerformanceMetricsUtils { - - override fun getApkSize(): Long { - var apkSize: Long = 0 - try { - val apkPath = - context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir - val apkFile = File(apkPath) - apkSize = ((apkFile.length() / 1024)) - } catch (e: Exception) { - consoleLogger.e( - "PerformanceMetricsUtils", - "APK size could not be calculated." - ) - } - return apkSize - } - - override fun getUsedStorage(): Long { - var storageUsage: Long = 0 - try { - val permanentStorageUsage = context.filesDir.totalSpace - context.filesDir.freeSpace - val cacheStorageUsage = context.cacheDir.totalSpace - context.cacheDir.freeSpace - storageUsage = permanentStorageUsage + cacheStorageUsage - } catch (e: Exception) { - consoleLogger.e( - "PerformanceMetricsUtils", - "Storage usage could not be calculated." - ) - } - return storageUsage - } - - override fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) - - override fun getTotalReceivedBytes(): Long = - TrafficStats.getUidRxBytes(context.applicationInfo.uid) - - override fun getTotalPssUsed(): Long { - val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - var totalPssUsed: Long = 0 - if (activityManager.runningAppProcesses != null) { - val pid = ActivityManager.RunningAppProcessInfo().pid - val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(pid).toIntArray()) - if (processMemoryInfo != null) { - for (element in processMemoryInfo) { - totalPssUsed += element.totalPss - } - } - } - return totalPssUsed - } - - override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { - return when ( - (context.filesDir.totalSpace + context.cacheDir.totalSpace).toDouble() / (1024 * 1024 * 1024) - ) { - in 0.00..32.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 32.00..64.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE - else -> OppiaMetricLog.StorageTier.HIGH_STORAGE - } - } - - override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { - val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - val memoryInfo = ActivityManager.MemoryInfo() - activityManager.getMemoryInfo(memoryInfo) - return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..2.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - in 2.00..3.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER - else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER - } - } -} diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt similarity index 68% rename from utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt rename to utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt index 62bbd8ce7e6..a0628b78bda 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/ProdPerformanceMetricsUtilsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt @@ -17,9 +17,6 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.`when` -import org.mockito.Mockito.mock -import org.mockito.Mockito.reset import org.mockito.MockitoAnnotations import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.testing.TestLogReportingModule @@ -49,28 +46,27 @@ import org.robolectric.annotation.LooperMode import org.robolectric.shadows.ShadowActivityManager import java.io.File import javax.inject.Inject -import javax.inject.Qualifier import javax.inject.Singleton -private const val TEST_PACKAGE_NAME = "TEST_PACKAGE_NAME" private const val TEST_PACKAGE_LABEL = "TEST_PACKAGE_LABEL" private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_PID = 1 -private const val TEST_UID = 1 +private const val TEST_FILE_NAME = "TEST_FILE_NAME" +private const val TEST_FILE_CONTENT = "TEST_FILE_CONTENT" -/** Tests for [ProdPerformanceMetricsUtils]. */ +/** Tests for [PerformanceMetricsAssessorImpl]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) -@Config(application = ProdPerformanceMetricsUtilsTest.TestApplication::class) -class ProdPerformanceMetricsUtilsTest { +@Config(application = PerformanceMetricsAssessorImplTest.TestApplication::class) +class PerformanceMetricsAssessorImplTest { @Inject - lateinit var prodPerformanceMetricsUtils: ProdPerformanceMetricsUtils + lateinit var performanceMetricsUtilsImpl: PerformanceMetricsAssessorImpl - @field:[Inject MockContext] - lateinit var mockContext: Context + @Inject + lateinit var context: Context @Before fun setUp() { @@ -83,77 +79,61 @@ class ProdPerformanceMetricsUtilsTest { val activityManager: ActivityManager = ApplicationProvider.getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - `when`(mockContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(activityManager) - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() shadowActivityManager.setMemoryInfo(memoryInfo) - val memoryTier = prodPerformanceMetricsUtils.getDeviceMemoryTier() + val memoryTier = performanceMetricsUtilsImpl.getDeviceMemoryTier() assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER) } @Test fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { - val testFile = File(TEST_APP_PATH) - val cacheFile = File(TEST_APP_PATH) - reset(mockContext) - `when`(mockContext.applicationContext).thenReturn(mockContext) - `when`(mockContext.filesDir).thenReturn(testFile) - `when`(mockContext.cacheDir).thenReturn(cacheFile) - - val permanentStorageUsage = testFile.totalSpace - testFile.freeSpace - val cacheStorageUsage = cacheFile.totalSpace - cacheFile.freeSpace - val expectedStorageValue = permanentStorageUsage + cacheStorageUsage - - assertThat(prodPerformanceMetricsUtils.getUsedStorage()).isEqualTo(expectedStorageValue) + context.openFileOutput(TEST_FILE_NAME, Context.MODE_PRIVATE).use { + it.write(TEST_FILE_CONTENT.toByteArray()) + } + val cacheFile = File.createTempFile(TEST_APP_PATH, null, context.cacheDir) + val expectedStorageValue = TEST_FILE_CONTENT.length + cacheFile.length() + + assertThat(performanceMetricsUtilsImpl.getUsedStorage()).isEqualTo(expectedStorageValue) } @Test fun testPerformanceMetricsUtils_getTotalStorageUsageTier_returnsCorrectStorageUsageTier() { - val testFile = File(TEST_APP_PATH) - val cacheFile = File(TEST_APP_PATH) - reset(mockContext) - `when`(mockContext.applicationContext).thenReturn(mockContext) - `when`(mockContext.filesDir).thenReturn(testFile) - `when`(mockContext.cacheDir).thenReturn(cacheFile) - - val permanentStorageUsage = testFile.totalSpace - testFile.freeSpace - val cacheStorageUsage = cacheFile.totalSpace - cacheFile.freeSpace - val expectedStorageValue = permanentStorageUsage + cacheStorageUsage - - val expectedStorageTierValue = when (expectedStorageValue.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..32.00 -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 32.00..64.00 -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE + context.openFileOutput(TEST_FILE_NAME, Context.MODE_PRIVATE).use { + it.write(TEST_FILE_CONTENT.toByteArray()) + } + val cacheFile = File.createTempFile(TEST_APP_PATH, null, context.cacheDir) + val expectedStorageValue = TEST_FILE_CONTENT.length + cacheFile.length() + + val expectedStorageTierValue = when (expectedStorageValue / (1024 * 1024 * 1024)) { + in 0L until 32L -> OppiaMetricLog.StorageTier.LOW_STORAGE + in 32L..64L -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE else -> OppiaMetricLog.StorageTier.HIGH_STORAGE } - assertThat(prodPerformanceMetricsUtils.getDeviceStorageTier()) + assertThat(performanceMetricsUtilsImpl.getDeviceStorageTier()) .isEqualTo(expectedStorageTierValue) } @Test fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { - val applicationInfo = ApplicationInfo().apply { - this.uid = TEST_UID - } - `when`(mockContext.applicationInfo).thenReturn(applicationInfo) - val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(mockContext.applicationInfo.uid) + val expectedNetworkBytesSent = TrafficStats.getUidTxBytes( + ApplicationProvider.getApplicationContext().applicationInfo.uid + ) - assertThat(prodPerformanceMetricsUtils.getTotalSentBytes()) + assertThat(performanceMetricsUtilsImpl.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) } @Test fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { - val applicationInfo = ApplicationInfo().apply { - this.uid = TEST_UID - } - `when`(mockContext.applicationInfo).thenReturn(applicationInfo) - val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(mockContext.applicationInfo.uid) + val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes( + ApplicationProvider.getApplicationContext().applicationInfo.uid + ) - assertThat(prodPerformanceMetricsUtils.getTotalReceivedBytes()) + assertThat(performanceMetricsUtilsImpl.getTotalReceivedBytes()) .isEqualTo(expectedNetworkBytesReceived) } @@ -162,27 +142,16 @@ class ProdPerformanceMetricsUtilsTest { val activityManager: ActivityManager = ApplicationProvider.getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - `when`(mockContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(activityManager) val process1 = ActivityManager.RunningAppProcessInfo().apply { this.pid = TEST_PID this.importanceReasonComponent = ComponentName("com.robolectric", "process 1") } - val process2 = ActivityManager.RunningAppProcessInfo().apply { - this.pid = TEST_PID - this.importanceReasonComponent = ComponentName("com.robolectric", "process 2") - } - var totalPssUsedTest = 0 - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) - shadowActivityManager.setProcesses(listOf(process1, process2)) + shadowActivityManager.setProcesses(listOf(process1)) val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(TEST_PID).toIntArray()) - if (processMemoryInfo != null) { - for (element in processMemoryInfo) { - totalPssUsedTest += element.totalPss - } - } + val totalPssUsedTest = processMemoryInfo?.get(0)?.totalPss?.toLong() ?: 0L - assertThat(prodPerformanceMetricsUtils.getTotalPssUsed()).isEqualTo(totalPssUsedTest) + assertThat(performanceMetricsUtilsImpl.getTotalPssUsed()).isEqualTo(totalPssUsedTest) } @Test @@ -191,7 +160,7 @@ class ProdPerformanceMetricsUtilsTest { val applicationInfo = ApplicationInfo() val testApkSize = (File(TEST_APP_PATH).length() / 1024) applicationInfo.apply { - this.packageName = TEST_PACKAGE_NAME + this.packageName = context.packageName this.sourceDir = TEST_APP_PATH this.name = TEST_PACKAGE_LABEL this.flags = 0 @@ -202,12 +171,12 @@ class ProdPerformanceMetricsUtilsTest { shadowPackageManager.removePackage(application.packageName) shadowPackageManager.installPackage( PackageInfo().apply { - this.packageName = TEST_PACKAGE_NAME + this.packageName = context.packageName this.applicationInfo = applicationInfo } ) - val apkSize = prodPerformanceMetricsUtils.getApkSize() + val apkSize = performanceMetricsUtilsImpl.getApkSize() assertThat(apkSize).isEqualTo(testApkSize) } @@ -215,24 +184,13 @@ class ProdPerformanceMetricsUtilsTest { ApplicationProvider.getApplicationContext().inject(this) } - @Qualifier - annotation class MockContext - // TODO(#89): Move this to a common test application component. @Module class TestModule { - @Provides - @Singleton - @MockContext - fun provideMockContext(): Context { - return mock(Context::class.java).also { - `when`(it.applicationContext).thenReturn(it) - } - } @Provides @Singleton - fun providesContext(@MockContext delegate: Context): Context = delegate + fun providesContext(application: Application): Context = 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. @@ -293,7 +251,7 @@ class ProdPerformanceMetricsUtilsTest { TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, SyncStatusModule::class, - PerformanceMetricsUtilsModule::class + PerformanceMetricsAssessorModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { @@ -304,17 +262,17 @@ class ProdPerformanceMetricsUtilsTest { fun build(): TestApplicationComponent } - fun inject(performanceMetricsUtilsTest: ProdPerformanceMetricsUtilsTest) + fun inject(performanceMetricsUtilsTest: PerformanceMetricsAssessorImplTest) } class TestApplication : Application(), DataProvidersInjectorProvider { private val component: TestApplicationComponent by lazy { - DaggerProdPerformanceMetricsUtilsTest_TestApplicationComponent.builder() + DaggerPerformanceMetricsAssessorImplTest_TestApplicationComponent.builder() .setApplication(this) .build() } - fun inject(performanceMetricsUtilsTest: ProdPerformanceMetricsUtilsTest) { + fun inject(performanceMetricsUtilsTest: PerformanceMetricsAssessorImplTest) { component.inject(performanceMetricsUtilsTest) } From 5fb46abe5d4f3d35433a1983689109233f0f657a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 27 Jul 2022 09:38:34 +0530 Subject: [PATCH 102/149] nits --- .../oppia/android/app/devoptions/ViewEventLogsActivityTest.kt | 3 ++- .../oppialogger/analytics/PerformanceMetricsController.kt | 2 +- .../oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt | 4 ++-- .../java/org/oppia/android/testing/TestLogReportingModule.kt | 2 +- .../android/testing/FakePerformanceMetricAssessorTest.kt | 3 ++- .../performancemetrics/PerformanceMetricsAssessorImplTest.kt | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) 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 dfba1f68306..c7017adf922 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 @@ -176,7 +176,8 @@ class ViewEventLogsActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class, + PerformanceMetricsAssessorModule::class ] ) interface TestApplicationComponent : ApplicationComponent { 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 50db2c80b8c..ee8cca7b6c5 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 @@ -8,8 +8,8 @@ import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSiz import org.oppia.android.util.data.DataProvider import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.networking.NetworkConnectionUtil import java.lang.IllegalStateException import javax.inject.Inject 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 c7c32b27010..8e6ef1fd294 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 @@ -51,8 +51,8 @@ import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.annotation.Config @@ -237,7 +237,7 @@ class MetricLogSchedulingWorkerTest { NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, - PerformanceMetricsUtilsModule::class, ApplicationLifecycleModule::class + PerformanceMetricsAssessorModule::class, ApplicationLifecycleModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index b6788fdc45f..a918f453d1a 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -4,8 +4,8 @@ import dagger.Binds import dagger.Module import org.oppia.android.util.logging.EventLogger import org.oppia.android.util.logging.ExceptionLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger /** Provides fake log reporting dependencies. */ @Module diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt index a7a418fabc4..6f087646ec8 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt @@ -70,7 +70,8 @@ class FakePerformanceMetricAssessorTest { fun testFakeMetricUtils_setTotalReceivedBytes_returnsCorrectTotalReceivedBytes() { fakePerformanceMetricUtils.setTotalReceivedBytes(DEFAULT_TEST_BYTES_RECEIVED) - assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()).isEqualTo(DEFAULT_TEST_BYTES_RECEIVED) + assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()) + .isEqualTo(DEFAULT_TEST_BYTES_RECEIVED) } @Test 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 a0628b78bda..fc6a10133ff 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 @@ -120,8 +120,8 @@ class PerformanceMetricsAssessorImplTest { @Test fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { val expectedNetworkBytesSent = TrafficStats.getUidTxBytes( - ApplicationProvider.getApplicationContext().applicationInfo.uid - ) + ApplicationProvider.getApplicationContext().applicationInfo.uid + ) assertThat(performanceMetricsUtilsImpl.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) From ac38e85b3919dddd26a46293120eed9154edd983 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 27 Jul 2022 09:52:14 +0530 Subject: [PATCH 103/149] test file exemptions refactor due to file renaming. --- scripts/assets/test_file_exemptions.textproto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index d67a548c804..a3bb7e584ca 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -808,8 +808,8 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/Conc exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjector.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjectorProvider.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherModule.kt" -exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtilsModule.kt" -exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsUtils.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt" +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/MetricLogSchedulerModule.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt" From b987305fe3068050d9d0c475c19a5ccf58916613 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Mon, 8 Aug 2022 21:04:48 +0530 Subject: [PATCH 104/149] additional tests, nit fixes. --- .../analytics/PerformanceMetricsLoggerTest.kt | 40 +-- .../android/testing/TestLogReportingModule.kt | 2 +- .../FakePerformanceMetricAssessorTest.kt | 105 ++++++-- .../PerformanceMetricsAssessorImpl.kt | 50 ++-- .../PerformanceMetricsAssessorModule.kt | 50 +++- .../PerformanceMetricsAssessorImplTest.kt | 230 ++++++++++++------ 6 files changed, 320 insertions(+), 157 deletions(-) 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 c489c96f3d5..e26b8767689 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 @@ -82,7 +82,7 @@ class PerformanceMetricsLoggerTest { lateinit var fakeOppiaClock: FakeOppiaClock @Inject - lateinit var fakePerformanceMetricUtils: FakePerformanceMetricAssessor + lateinit var fakePerformanceMetricAssessor: FakePerformanceMetricAssessor @Mock lateinit var context: Context @@ -100,9 +100,9 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logApkSizePerformanceMetric_verifyLogsMetricCorrectly() { - val apkSize = fakePerformanceMetricUtils.getApkSize() - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val apkSize = fakePerformanceMetricAssessor.getApkSize() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logApkSize(HOME_SCREEN) @@ -119,10 +119,10 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStorageUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() - val storageUsage = fakePerformanceMetricUtils.getUsedStorage() + val storageUsage = fakePerformanceMetricAssessor.getUsedStorage() performanceMetricsLogger.logStorageUsage(HOME_SCREEN) val loggedEvent = fakePerformanceMetricsEventLogger.getMostRecentPerformanceMetricsEvent() @@ -140,9 +140,9 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logMemoryUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val memoryUsage = fakePerformanceMetricUtils.getTotalPssUsed() - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val memoryUsage = fakePerformanceMetricAssessor.getTotalPssUsed() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logMemoryUsage(SCREEN_UNSPECIFIED) @@ -159,8 +159,8 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logStartupLatencyPerformanceMetric_verifyLogsMetricCorrectly() { - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logStartupLatency(HOME_SCREEN) @@ -180,8 +180,8 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logCpuUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logCpuUsage(TEST_CPU_USAGE, SCREEN_UNSPECIFIED) @@ -198,10 +198,10 @@ class PerformanceMetricsLoggerTest { @Test fun testLogger_logNetworkUsagePerformanceMetric_verifyLogsMetricCorrectly() { - val bytesSent = fakePerformanceMetricUtils.getTotalSentBytes() - val bytesReceived = fakePerformanceMetricUtils.getTotalReceivedBytes() - val memoryTier = fakePerformanceMetricUtils.getDeviceMemoryTier() - val storageTier = fakePerformanceMetricUtils.getDeviceStorageTier() + val bytesSent = fakePerformanceMetricAssessor.getTotalSentBytes() + val bytesReceived = fakePerformanceMetricAssessor.getTotalReceivedBytes() + val memoryTier = fakePerformanceMetricAssessor.getDeviceMemoryTier() + val storageTier = fakePerformanceMetricAssessor.getDeviceStorageTier() val isAppInForeground = performanceMetricsController.getIsAppInForeground() performanceMetricsLogger.logNetworkUsage(SCREEN_UNSPECIFIED) @@ -222,7 +222,7 @@ class PerformanceMetricsLoggerTest { } private fun setUpFakePerformanceMetricsUtils() { - fakePerformanceMetricUtils.apply { + fakePerformanceMetricAssessor.apply { setApkSize(TEST_APK_SIZE) setStorageUsage(TEST_STORAGE_USAGE) setTotalPss(TEST_TOTAL_PSS) @@ -273,7 +273,7 @@ class PerformanceMetricsLoggerTest { interface TestPerformanceMetricsModule { @Binds fun bindPerformanceMetricsUtils( - fakePerformanceMetricUtils: FakePerformanceMetricAssessor + fakePerformanceMetricAssessor: FakePerformanceMetricAssessor ): PerformanceMetricsAssessor } diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index a918f453d1a..4c5011946d5 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -24,6 +24,6 @@ interface TestLogReportingModule { @Binds fun bindFakePerformanceMetricsUtils( - fakePerformanceMetricUtils: FakePerformanceMetricAssessor + fakePerformanceMetricAssessor: FakePerformanceMetricAssessor ): PerformanceMetricsAssessor } diff --git a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt index 6f087646ec8..cb43cd5aaf0 100644 --- a/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/FakePerformanceMetricAssessorTest.kt @@ -18,11 +18,17 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -private const val DEFAULT_TEST_APK_SIZE = Long.MAX_VALUE -private const val DEFAULT_TEST_STORAGE_USAGE = Long.MAX_VALUE -private const val DEFAULT_TEST_TOTAL_PSS = Long.MAX_VALUE -private const val DEFAULT_TEST_BYTES_SENT = Long.MAX_VALUE -private const val DEFAULT_TEST_BYTES_RECEIVED = Long.MAX_VALUE +private const val ONE_MEGABYTE = 1024L * 1024L +private const val TEST_APK_SIZE = ONE_MEGABYTE * 3L +private const val TEST_STORAGE_USAGE = ONE_MEGABYTE * 7L +private const val TEST_TOTAL_PSS = ONE_MEGABYTE * 2L +private const val TEST_BYTES_SENT = ONE_MEGABYTE +private const val TEST_BYTES_RECEIVED = ONE_MEGABYTE +private const val DEFAULT_TEST_APK_SIZE = 0L +private const val DEFAULT_TEST_STORAGE_USAGE = 0L +private const val DEFAULT_TEST_TOTAL_PSS = 0L +private const val DEFAULT_TEST_BYTES_SENT = 0L +private const val DEFAULT_TEST_BYTES_RECEIVED = 0L /** Tests for [FakePerformanceMetricAssessor]. */ @RunWith(AndroidJUnit4::class) @@ -31,7 +37,7 @@ private const val DEFAULT_TEST_BYTES_RECEIVED = Long.MAX_VALUE class FakePerformanceMetricAssessorTest { @Inject - lateinit var fakePerformanceMetricUtils: FakePerformanceMetricAssessor + lateinit var fakePerformanceMetricAssessor: FakePerformanceMetricAssessor @Before fun setUp() { @@ -39,55 +45,100 @@ class FakePerformanceMetricAssessorTest { } @Test - fun testFakeMetricUtils_setApkSize_returnsCorrectApkSize() { - fakePerformanceMetricUtils.setApkSize(DEFAULT_TEST_APK_SIZE) + fun testFakeMetricAssessor_setApkSize_returnsCorrectApkSize() { + fakePerformanceMetricAssessor.setApkSize(TEST_APK_SIZE) - assertThat(fakePerformanceMetricUtils.getApkSize()).isEqualTo(DEFAULT_TEST_APK_SIZE) + assertThat(fakePerformanceMetricAssessor.getApkSize()).isEqualTo(TEST_APK_SIZE) } @Test - fun testFakeMetricUtils_setStorageUsage_returnsCorrectStorageSize() { - fakePerformanceMetricUtils.setStorageUsage(DEFAULT_TEST_STORAGE_USAGE) + fun testFakeMetricAssessor_getApkSize_returnsDefaultApkSize() { + assertThat(fakePerformanceMetricAssessor.getApkSize()).isEqualTo(DEFAULT_TEST_APK_SIZE) + } + + @Test + fun testFakeMetricAssessor_setStorageUsage_returnsCorrectStorageSize() { + fakePerformanceMetricAssessor.setStorageUsage(TEST_STORAGE_USAGE) - assertThat(fakePerformanceMetricUtils.getUsedStorage()).isEqualTo(DEFAULT_TEST_STORAGE_USAGE) + assertThat(fakePerformanceMetricAssessor.getUsedStorage()).isEqualTo(TEST_STORAGE_USAGE) + } + + @Test + fun testFakeMetricAssessor_getStorageUsage_returnsDefaultStorageUsage() { + assertThat(fakePerformanceMetricAssessor.getUsedStorage()).isEqualTo(DEFAULT_TEST_STORAGE_USAGE) } @Test - fun testFakeMetricUtils_setTotalPss_returnsCorrectTotalPss() { - fakePerformanceMetricUtils.setTotalPss(DEFAULT_TEST_TOTAL_PSS) + fun testFakeMetricAssessor_setTotalPss_returnsCorrectTotalPss() { + fakePerformanceMetricAssessor.setTotalPss(TEST_TOTAL_PSS) - assertThat(fakePerformanceMetricUtils.getTotalPssUsed()).isEqualTo(DEFAULT_TEST_TOTAL_PSS) + assertThat(fakePerformanceMetricAssessor.getTotalPssUsed()).isEqualTo(TEST_TOTAL_PSS) } @Test - fun testFakeMetricUtils_setTotalSentBytes_returnsCorrectTotalSentBytes() { - fakePerformanceMetricUtils.setTotalSentBytes(DEFAULT_TEST_BYTES_SENT) + fun testFakeMetricAssessor_getTotalPss_returnsDefaultTotalPss() { + assertThat(fakePerformanceMetricAssessor.getUsedStorage()).isEqualTo(DEFAULT_TEST_TOTAL_PSS) + } + + @Test + fun testFakeMetricAssessor_setTotalSentBytes_returnsCorrectTotalSentBytes() { + fakePerformanceMetricAssessor.setTotalSentBytes(TEST_BYTES_SENT) - assertThat(fakePerformanceMetricUtils.getTotalSentBytes()).isEqualTo(DEFAULT_TEST_BYTES_SENT) + assertThat(fakePerformanceMetricAssessor.getTotalSentBytes()).isEqualTo(TEST_BYTES_SENT) + } + + @Test + fun testFakeMetricAssessor_getTotalSentBytes_returnsDefaultTotalSentBytes() { + assertThat(fakePerformanceMetricAssessor.getTotalSentBytes()).isEqualTo(DEFAULT_TEST_BYTES_SENT) } @Test - fun testFakeMetricUtils_setTotalReceivedBytes_returnsCorrectTotalReceivedBytes() { - fakePerformanceMetricUtils.setTotalReceivedBytes(DEFAULT_TEST_BYTES_RECEIVED) + fun testFakeMetricAssessor_setTotalReceivedBytes_returnsCorrectTotalReceivedBytes() { + fakePerformanceMetricAssessor.setTotalReceivedBytes(TEST_BYTES_RECEIVED) - assertThat(fakePerformanceMetricUtils.getTotalReceivedBytes()) + assertThat(fakePerformanceMetricAssessor.getTotalReceivedBytes()) + .isEqualTo(TEST_BYTES_RECEIVED) + } + + @Test + fun testFakeMetricAssessor_getTotalReceivedBytes_returnsDefaultTotalReceivedBytes() { + assertThat(fakePerformanceMetricAssessor.getTotalReceivedBytes()) .isEqualTo(DEFAULT_TEST_BYTES_RECEIVED) } @Test - fun testFakeMetricUtils_setDeviceStorageTier_returnsCorrectTotalDeviceStorageTier() { + fun testFakeMetricAssessor_setDeviceStorageTier_returnsCorrectTotalDeviceStorageTier() { val testDeviceStorageTier = OppiaMetricLog.StorageTier.LOW_STORAGE - fakePerformanceMetricUtils.setDeviceStorageTier(testDeviceStorageTier) + fakePerformanceMetricAssessor.setDeviceStorageTier(testDeviceStorageTier) - assertThat(fakePerformanceMetricUtils.getDeviceStorageTier()).isEqualTo(testDeviceStorageTier) + assertThat(fakePerformanceMetricAssessor.getDeviceStorageTier()) + .isEqualTo(testDeviceStorageTier) } @Test - fun testFakeMetricUtils_setDeviceMemoryTier_returnsCorrectTotalDeviceMemoryTier() { + fun testFakeMetricAssessor_getDeviceStorageTier_returnsDefaultTotalDeviceStorageTier() { + val defaultTestDeviceStorageTier = OppiaMetricLog.StorageTier.MEDIUM_STORAGE + + assertThat(fakePerformanceMetricAssessor.getDeviceStorageTier()).isEqualTo( + defaultTestDeviceStorageTier + ) + } + + @Test + fun testFakeMetricAssessor_setDeviceMemoryTier_returnsCorrectTotalDeviceMemoryTier() { val testDeviceMemoryTier = OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - fakePerformanceMetricUtils.setDeviceMemoryTier(testDeviceMemoryTier) + fakePerformanceMetricAssessor.setDeviceMemoryTier(testDeviceMemoryTier) + + assertThat(fakePerformanceMetricAssessor.getDeviceMemoryTier()).isEqualTo(testDeviceMemoryTier) + } + + @Test + fun testFakeMetricAssessor_getDeviceMemoryTier_returnsDefaultTotalDeviceMemoryTier() { + val defaultTestDeviceMemoryTier = OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER - assertThat(fakePerformanceMetricUtils.getDeviceMemoryTier()).isEqualTo(testDeviceMemoryTier) + assertThat(fakePerformanceMetricAssessor.getDeviceMemoryTier()).isEqualTo( + defaultTestDeviceMemoryTier + ) } private fun setUpTestApplicationComponent() { 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 bad71ff509e..862262f7dd8 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 @@ -4,12 +4,24 @@ import android.app.ActivityManager import android.content.Context import android.net.TrafficStats 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 +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 java.io.File import javax.inject.Inject +import javax.inject.Singleton /** Utility to extract performance metrics from the underlying Android system. */ +@Singleton class PerformanceMetricsAssessorImpl @Inject constructor( - private val context: Context + private val context: Context, + @LowStorageTierUpperBound private val lowStorageTierUpperBound: Long, + @MediumStorageTierUpperBound private val mediumStorageTierUpperBound: Long, + @LowMemoryTierUpperBound private val lowMemoryTierUpperBound: Long, + @MediumMemoryTierUpperBound private val mediumMemoryTierUpperBound: Long ) : PerformanceMetricsAssessor { private val activityManager: ActivityManager by lazy { @@ -19,13 +31,13 @@ class PerformanceMetricsAssessorImpl @Inject constructor( override fun getApkSize(): Long { val apkPath = context.packageManager.getPackageInfo(context.packageName, 0).applicationInfo.sourceDir - return File(apkPath).length() / 1024 + return File(apkPath).length() } override fun getUsedStorage(): Long { - val permanentStorageUsage = context.filesDir?.listFiles()?.map { it.length() }?.sum() - val cacheStorageUsage = context.cacheDir?.listFiles()?.map { it.length() }?.sum() - return (cacheStorageUsage?.let { permanentStorageUsage?.plus(it) }) ?: 0L + val permanentStorageUsage = context.filesDir?.listFiles()?.map { it.length() }?.sum() ?: 0L + val cacheStorageUsage = context.cacheDir?.listFiles()?.map { it.length() }?.sum() ?: 0L + return permanentStorageUsage + cacheStorageUsage } override fun getTotalSentBytes(): Long = TrafficStats.getUidTxBytes(context.applicationInfo.uid) @@ -35,34 +47,24 @@ class PerformanceMetricsAssessorImpl @Inject constructor( override fun getTotalPssUsed(): Long { val pid = ActivityManager.RunningAppProcessInfo().pid - activityManager.runningAppProcesses val processMemoryInfo = activityManager.getProcessMemoryInfo(intArrayOf(pid)) return processMemoryInfo?.map { it.totalPss }?.sum()?.toLong() ?: 0L } - override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { - val permanentStorageUsage = context.filesDir?.listFiles()?.map { it.length() }?.sum() - val cacheStorageUsage = context.cacheDir?.listFiles()?.map { it.length() }?.sum() - val usedStorage = (cacheStorageUsage?.let { permanentStorageUsage?.plus(it) }) - if (usedStorage != null) { - return when ( - usedStorage.let { it / (1024 * 1024 * 1024) } - ) { - in 0L until 32L -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 32L..64L -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE - else -> OppiaMetricLog.StorageTier.HIGH_STORAGE - } + override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = + when (getUsedStorage()) { + in 0L until lowStorageTierUpperBound -> LOW_STORAGE + in lowStorageTierUpperBound..mediumStorageTierUpperBound -> MEDIUM_STORAGE + else -> HIGH_STORAGE } - return OppiaMetricLog.StorageTier.UNRECOGNIZED - } override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { val memoryInfo = ActivityManager.MemoryInfo() activityManager.getMemoryInfo(memoryInfo) - return when (memoryInfo.totalMem.toDouble() / (1024 * 1024 * 1024)) { - in 0.00..2.00 -> OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER - in 2.00..3.00 -> OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER - else -> OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER + return when (memoryInfo.totalMem) { + in 0L until lowMemoryTierUpperBound -> LOW_MEMORY_TIER + in lowMemoryTierUpperBound..mediumMemoryTierUpperBound -> MEDIUM_MEMORY_TIER + else -> HIGH_MEMORY_TIER } } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt index 2a13dbe33c6..8e166caa9e9 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt @@ -1,13 +1,51 @@ package org.oppia.android.util.logging.performancemetrics -import dagger.Binds import dagger.Module +import dagger.Provides +import org.oppia.android.app.model.OppiaMetricLog.MemoryTier +import org.oppia.android.app.model.OppiaMetricLog.StorageTier +import javax.inject.Qualifier + +private const val ONE_GIGABYTE = 1024L * 1024L * 1024L +private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L +private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L +private const val THIRTY_TWO_GIGABYTES = ONE_GIGABYTE * 36L +private const val SIXTY_FOUR_GIGABYTES = ONE_GIGABYTE * 64L + +/** Corresponds to a long value that denotes the non-inclusive upper bound of [StorageTier.LOW_STORAGE]. */ +@Qualifier annotation class LowStorageTierUpperBound + +/** Corresponds to a long value that denotes the inclusive upper bound of [StorageTier.MEDIUM_STORAGE]. */ +@Qualifier annotation class MediumStorageTierUpperBound + +/** Corresponds to a long value that denotes the non-inclusive upper bound of [MemoryTier.LOW_MEMORY_TIER]. */ +@Qualifier annotation class LowMemoryTierUpperBound + +/** Corresponds to a long value that denotes the inclusive upper bound of [MemoryTier.MEDIUM_MEMORY_TIER]. */ +@Qualifier annotation class MediumMemoryTierUpperBound /** Provides production-specific performance metrics utilities related dependencies. */ @Module -interface PerformanceMetricsAssessorModule { - @Binds - fun bindPerformanceMetricsAssessor( - performanceMetricsUtilsImpl: PerformanceMetricsAssessorImpl - ): PerformanceMetricsAssessor +class PerformanceMetricsAssessorModule { + + @Provides + fun providePerformanceMetricsAssessor( + performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl + ): PerformanceMetricsAssessor = performanceMetricsAssessorImpl + + @Provides + @LowStorageTierUpperBound + fun provideLowStorageTierUpperBound(): Long = THIRTY_TWO_GIGABYTES + + @Provides + @MediumStorageTierUpperBound + fun provideMediumStorageTierUpperBound(): Long = SIXTY_FOUR_GIGABYTES + + @Provides + @LowMemoryTierUpperBound + fun provideLowMemoryTierUpperBound(): Long = TWO_GIGABYTES + + @Provides + @MediumMemoryTierUpperBound + fun provideMediumMemoryTierUpperBound(): Long = THREE_GIGABYTES } 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 fc6a10133ff..6e4a09999e7 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 @@ -2,24 +2,28 @@ package org.oppia.android.util.logging.performancemetrics import android.app.ActivityManager import android.app.Application -import android.content.ComponentName import android.content.Context -import android.content.pm.ApplicationInfo import android.content.pm.PackageInfo import android.net.TrafficStats 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.Rule import org.junit.Test import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations +import org.mockito.junit.MockitoJUnit +import org.mockito.junit.MockitoRule import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.junit.OppiaParameterizedTestRunner +import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.Parameter +import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.RunParameterized +import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.SelectRunnerPlatform +import org.oppia.android.testing.junit.ParameterizedRobolectricTestRunner import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.testing.time.FakeOppiaClockModule @@ -48,136 +52,180 @@ import java.io.File import javax.inject.Inject import javax.inject.Singleton -private const val TEST_PACKAGE_LABEL = "TEST_PACKAGE_LABEL" private const val TEST_APP_PATH = "TEST_APP_PATH" -private const val TEST_PID = 1 private const val TEST_FILE_NAME = "TEST_FILE_NAME" -private const val TEST_FILE_CONTENT = "TEST_FILE_CONTENT" +private const val ONE_KILOBYTE = 1024 +private const val ONE_MEGABYTE = ONE_KILOBYTE * 1024 +private const val TWO_MEGABYTES = ONE_MEGABYTE * 2L +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 /** Tests for [PerformanceMetricsAssessorImpl]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) +@RunWith(OppiaParameterizedTestRunner::class) +@SelectRunnerPlatform(ParameterizedRobolectricTestRunner::class) @Config(application = PerformanceMetricsAssessorImplTest.TestApplication::class) class PerformanceMetricsAssessorImplTest { + @Parameter + var totalMemory: Long = Long.MIN_VALUE // Inited because primitives can't be lateinit. + + @Rule + @JvmField + val mockitoRule: MockitoRule = MockitoJUnit.rule() + @Inject - lateinit var performanceMetricsUtilsImpl: PerformanceMetricsAssessorImpl + lateinit var performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl @Inject lateinit var context: Context + private val activityManager by lazy { + context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + } + @Before fun setUp() { - MockitoAnnotations.initMocks(this) setUpTestApplicationComponent() } @Test - fun testPerformanceMetricsUtils_setTotalMemory_returnsCorrectMemoryTier() { - val activityManager: ActivityManager = - ApplicationProvider.getApplicationContext() - .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) - val memoryInfo = ActivityManager.MemoryInfo() - memoryInfo.totalMem = (1.5 * 1024 * 1024 * 1024).toLong() - shadowActivityManager.setMemoryInfo(memoryInfo) - val memoryTier = performanceMetricsUtilsImpl.getDeviceMemoryTier() + fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(ONE_MEGABYTE)) + File.createTempFile(TEST_FILE_NAME, null, context.cacheDir) + .writeBytes(ByteArray(ONE_MEGABYTE)) - assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER) + assertThat(performanceMetricsAssessorImpl.getUsedStorage()).isEqualTo(ONE_MEGABYTE * 2) } @Test - fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { - context.openFileOutput(TEST_FILE_NAME, Context.MODE_PRIVATE).use { - it.write(TEST_FILE_CONTENT.toByteArray()) - } - val cacheFile = File.createTempFile(TEST_APP_PATH, null, context.cacheDir) - val expectedStorageValue = TEST_FILE_CONTENT.length + cacheFile.length() + fun testPerformanceMetricsUtils_writeBytesLowerThanLowTierHigherBound_retsLowStorageUsageTier() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(ONE_KILOBYTE)) + assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) + .isEqualTo(OppiaMetricLog.StorageTier.LOW_STORAGE) + } - assertThat(performanceMetricsUtilsImpl.getUsedStorage()).isEqualTo(expectedStorageValue) + @Test + fun testPerformanceMetricsUtils_writeBytesEqualToLowTierHigherBound_retsLowStorageUsageTier() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(ONE_MEGABYTE)) + assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) + .isEqualTo(OppiaMetricLog.StorageTier.LOW_STORAGE) } @Test - fun testPerformanceMetricsUtils_getTotalStorageUsageTier_returnsCorrectStorageUsageTier() { - context.openFileOutput(TEST_FILE_NAME, Context.MODE_PRIVATE).use { - it.write(TEST_FILE_CONTENT.toByteArray()) - } - val cacheFile = File.createTempFile(TEST_APP_PATH, null, context.cacheDir) - val expectedStorageValue = TEST_FILE_CONTENT.length + cacheFile.length() + fun testPerformanceMetricsUtils_writeBytesEqualToMedTierLowerBound_retsMediumStorageUsageTier() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(TWO_MEGABYTES.toInt())) + assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) + .isEqualTo(OppiaMetricLog.StorageTier.MEDIUM_STORAGE) + } - val expectedStorageTierValue = when (expectedStorageValue / (1024 * 1024 * 1024)) { - in 0L until 32L -> OppiaMetricLog.StorageTier.LOW_STORAGE - in 32L..64L -> OppiaMetricLog.StorageTier.MEDIUM_STORAGE - else -> OppiaMetricLog.StorageTier.HIGH_STORAGE - } + @Test + fun testPerformanceMetricsUtils_writeBytesEqualToMedTierHigherBound_retsMediumStorageUsageTier() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(THREE_MEGABYTES.toInt())) + assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) + .isEqualTo(OppiaMetricLog.StorageTier.MEDIUM_STORAGE) + } - assertThat(performanceMetricsUtilsImpl.getDeviceStorageTier()) - .isEqualTo(expectedStorageTierValue) + @Test + fun testPerformanceMetricsUtils_writeBytesGreaterThanHighTierLowerBound_retsHighStorageTier() { + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) + .write(ByteArray(TWO_MEGABYTES.toInt() * 2)) + assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) + .isEqualTo(OppiaMetricLog.StorageTier.HIGH_STORAGE) } @Test fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { - val expectedNetworkBytesSent = TrafficStats.getUidTxBytes( - ApplicationProvider.getApplicationContext().applicationInfo.uid - ) + val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(context.applicationInfo.uid) - assertThat(performanceMetricsUtilsImpl.getTotalSentBytes()) + assertThat(performanceMetricsAssessorImpl.getTotalSentBytes()) .isEqualTo(expectedNetworkBytesSent) } @Test fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { - val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes( - ApplicationProvider.getApplicationContext().applicationInfo.uid - ) + val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(context.applicationInfo.uid) - assertThat(performanceMetricsUtilsImpl.getTotalReceivedBytes()) + assertThat(performanceMetricsAssessorImpl.getTotalReceivedBytes()) .isEqualTo(expectedNetworkBytesReceived) } - @Test - fun testPerformanceMetricsUtils_setAppProcesses_getMemoryUsage_returnsCorrectMemoryUsage() { - val activityManager: ActivityManager = - ApplicationProvider.getApplicationContext() - .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - val process1 = ActivityManager.RunningAppProcessInfo().apply { - this.pid = TEST_PID - this.importanceReasonComponent = ComponentName("com.robolectric", "process 1") - } - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) - shadowActivityManager.setProcesses(listOf(process1)) - val processMemoryInfo = activityManager.getProcessMemoryInfo(arrayOf(TEST_PID).toIntArray()) - val totalPssUsedTest = processMemoryInfo?.get(0)?.totalPss?.toLong() ?: 0L - - assertThat(performanceMetricsUtilsImpl.getTotalPssUsed()).isEqualTo(totalPssUsedTest) - } - @Test fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnsCorrectApkSize() { - val application: Application = ApplicationProvider.getApplicationContext() - val applicationInfo = ApplicationInfo() - val testApkSize = (File(TEST_APP_PATH).length() / 1024) - applicationInfo.apply { - this.packageName = context.packageName + val shadowPackageManager = shadowOf(context.packageManager) + File(TEST_APP_PATH).writeBytes(ByteArray(ONE_MEGABYTE)) + val applicationInfo = context.applicationInfo.apply { this.sourceDir = TEST_APP_PATH - this.name = TEST_PACKAGE_LABEL - this.flags = 0 } - val packageManager = application.packageManager - val shadowPackageManager = shadowOf(packageManager) - - shadowPackageManager.removePackage(application.packageName) + shadowPackageManager.removePackage(context.packageName) shadowPackageManager.installPackage( PackageInfo().apply { this.packageName = context.packageName this.applicationInfo = applicationInfo } ) + val apkSize = performanceMetricsAssessorImpl.getApkSize() + assertThat(apkSize).isEqualTo(ONE_MEGABYTE) + } - val apkSize = performanceMetricsUtilsImpl.getApkSize() - assertThat(apkSize).isEqualTo(testApkSize) + @Test + @RunParameterized( + OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=0"), + OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=1147483648"), + OppiaParameterizedTestRunner.Iteration("memoryJustBelowUpperBound", "totalMemory=2147483647") + ) + fun testPerformanceMetricsUtils_setTotalMemoryForLowMemoryRange_returnsCorrectLowMemoryTier() { + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val memoryInfo = ActivityManager.MemoryInfo() + memoryInfo.totalMem = totalMemory + shadowActivityManager.setMemoryInfo(memoryInfo) + val memoryTier = performanceMetricsAssessorImpl.getDeviceMemoryTier() + + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.LOW_MEMORY_TIER) + } + + @Test + @RunParameterized( + OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=2147483648"), + OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=2684354560"), + OppiaParameterizedTestRunner.Iteration("memoryEqualToUpperBound", "totalMemory=3221225472") + ) + fun testPerformanceMetricsUtils_setTotalMemoryForMediumMemoryRange_retsCorrectMediumMemoryTier() { + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val memoryInfo = ActivityManager.MemoryInfo() + memoryInfo.totalMem = totalMemory + shadowActivityManager.setMemoryInfo(memoryInfo) + val memoryTier = performanceMetricsAssessorImpl.getDeviceMemoryTier() + + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.MEDIUM_MEMORY_TIER) + } + + @Test + @RunParameterized( + OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=3221225473"), + OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=5221225472"), + OppiaParameterizedTestRunner.Iteration( + "memoryEqualToMaxValue", + "totalMemory=9223372036854775807" + ) + ) + fun testPerformanceMetricsUtils_setTotalMemoryForHighMemoryRange_retsCorrectHighMemoryTier() { + val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val memoryInfo = ActivityManager.MemoryInfo() + memoryInfo.totalMem = totalMemory + shadowActivityManager.setMemoryInfo(memoryInfo) + val memoryTier = performanceMetricsAssessorImpl.getDeviceMemoryTier() + + assertThat(memoryTier).isEqualTo(OppiaMetricLog.MemoryTier.HIGH_MEMORY_TIER) } private fun setUpTestApplicationComponent() { @@ -243,6 +291,30 @@ class PerformanceMetricsAssessorImplTest { } } + @Module + class TestPerformanceMetricsAssessorModule { + @Provides + fun providePerformanceMetricsAssessor( + performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl + ): PerformanceMetricsAssessor = performanceMetricsAssessorImpl + + @Provides + @LowStorageTierUpperBound + fun provideLowStorageTierUpperBound(): Long = TWO_MEGABYTES + + @Provides + @MediumStorageTierUpperBound + fun provideMediumStorageTierUpperBound(): Long = THREE_MEGABYTES + + @Provides + @LowMemoryTierUpperBound + fun provideLowMemoryTierUpperBound(): Long = TWO_GIGABYTES + + @Provides + @MediumMemoryTierUpperBound + fun provideMediumMemoryTierUpperBound(): Long = THREE_GIGABYTES + } + // TODO(#89): Move this to a common test application component. @Singleton @Component( @@ -251,7 +323,7 @@ class PerformanceMetricsAssessorImplTest { TestDispatcherModule::class, RobolectricModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, SyncStatusModule::class, - PerformanceMetricsAssessorModule::class + TestPerformanceMetricsAssessorModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { From 5fffa651d5076e58ce96f9a2cb1a3555bcae6a1c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 10 Aug 2022 04:18:24 +0530 Subject: [PATCH 105/149] activity manager shadow and assessor test --- .../robolectric/OppiaShadowActivityManager.kt | 33 +++++++++++++++++++ .../PerformanceMetricsAssessorImplTest.kt | 22 ++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt new file mode 100644 index 00000000000..653aeb59846 --- /dev/null +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt @@ -0,0 +1,33 @@ +package org.oppia.android.testing.robolectric + +import android.app.ActivityManager +import android.os.Debug +import org.robolectric.annotation.Implementation +import org.robolectric.annotation.Implements + +/** + * Shadows the Activity Manager to extend its testing capabilities. + * + * There is an existing robolectric shadow of Activity Manager but that doesn't provide us enough + * control over MemoryInfo and hence MemoryUsage can't be tested using that. + */ +@Implements(ActivityManager::class) +class OppiaShadowActivityManager { + + private var processMemoryInfo: Array? = arrayOfNulls(1) + //arrayOf(Debug.MemoryInfo().apply { this.otherPss = 2 }) + + /** + * Sets [memoryInfo] as part of [processMemoryInfo] which is then returned whenever + * [getProcessMemoryInfo] is called. + */ + fun setProcessMemoryInfo(memoryInfo: Debug.MemoryInfo) { + processMemoryInfo?.set(0, memoryInfo) + } + + /** Returns [processMemoryInfo] as the memory usage info of the application. */ + @Implementation + fun getProcessMemoryInfo(pids: IntArray?): Array? { + return processMemoryInfo + } +} 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 6e4a09999e7..27d0d9fb59b 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 @@ -5,6 +5,7 @@ import android.app.Application import android.content.Context import android.content.pm.PackageInfo import android.net.TrafficStats +import android.os.Debug import androidx.test.core.app.ApplicationProvider import com.google.common.truth.Truth.assertThat import dagger.BindsInstance @@ -51,6 +52,8 @@ import org.robolectric.shadows.ShadowActivityManager import java.io.File import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.testing.robolectric.OppiaShadowActivityManager +import org.robolectric.shadow.api.Shadow private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" @@ -68,7 +71,10 @@ private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L @LooperMode(LooperMode.Mode.PAUSED) @RunWith(OppiaParameterizedTestRunner::class) @SelectRunnerPlatform(ParameterizedRobolectricTestRunner::class) -@Config(application = PerformanceMetricsAssessorImplTest.TestApplication::class) +@Config( + application = PerformanceMetricsAssessorImplTest.TestApplication::class, + shadows = [OppiaShadowActivityManager::class] + ) class PerformanceMetricsAssessorImplTest { @Parameter @@ -159,6 +165,20 @@ class PerformanceMetricsAssessorImplTest { .isEqualTo(expectedNetworkBytesReceived) } + @Test + fun testAssessor_setProcessMemoryInfo_setTotalPss_returnsCorrectMemoryUsage() { + val shadow = Shadow.extract(activityManager) as OppiaShadowActivityManager + shadow.setProcessMemoryInfo( + Debug.MemoryInfo().apply { + this.nativePss = 2 + this.dalvikPss = 1 + this.otherPss = 4 + } + ) + + assertThat(performanceMetricsAssessorImpl.getTotalPssUsed()).isEqualTo(7) + } + @Test fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnsCorrectApkSize() { val shadowPackageManager = shadowOf(context.packageManager) From 14091e1b579a407f233f0eb61da25414b1c70b57 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 10 Aug 2022 04:19:28 +0530 Subject: [PATCH 106/149] nit --- .../android/testing/robolectric/OppiaShadowActivityManager.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt index 653aeb59846..4ef02a9571f 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt @@ -14,8 +14,8 @@ import org.robolectric.annotation.Implements @Implements(ActivityManager::class) class OppiaShadowActivityManager { - private var processMemoryInfo: Array? = arrayOfNulls(1) - //arrayOf(Debug.MemoryInfo().apply { this.otherPss = 2 }) + private var processMemoryInfo: Array? = + arrayOf(Debug.MemoryInfo().apply { this.otherPss = 2 }) /** * Sets [memoryInfo] as part of [processMemoryInfo] which is then returned whenever From 7a2e78f2b13501e3260116a82a2b6f9d7e4bf07d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 10 Aug 2022 04:20:17 +0530 Subject: [PATCH 107/149] nit --- .../PerformanceMetricsAssessorImplTest.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 27d0d9fb59b..2f9d76aafec 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 @@ -25,6 +25,7 @@ import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.Parameter import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.RunParameterized import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.SelectRunnerPlatform import org.oppia.android.testing.junit.ParameterizedRobolectricTestRunner +import org.oppia.android.testing.robolectric.OppiaShadowActivityManager import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestDispatcherModule import org.oppia.android.testing.time.FakeOppiaClockModule @@ -48,12 +49,11 @@ import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import org.robolectric.shadow.api.Shadow import org.robolectric.shadows.ShadowActivityManager import java.io.File import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.testing.robolectric.OppiaShadowActivityManager -import org.robolectric.shadow.api.Shadow private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" @@ -74,7 +74,7 @@ private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L @Config( application = PerformanceMetricsAssessorImplTest.TestApplication::class, shadows = [OppiaShadowActivityManager::class] - ) +) class PerformanceMetricsAssessorImplTest { @Parameter From 76ef3e3a57ce8ee4a6304224a92e113d2ac3e58d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 12 Aug 2022 03:19:42 +0530 Subject: [PATCH 108/149] shadow traffic stats + assessor test fix. --- .../robolectric/OppiaShadowActivityManager.kt | 28 +++++++++-- .../robolectric/OppiaShadowTrafficStats.kt | 47 +++++++++++++++++++ .../PerformanceMetricsAssessorImplTest.kt | 21 +++++---- 3 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt index 4ef02a9571f..e203bbce1dd 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt @@ -9,13 +9,14 @@ import org.robolectric.annotation.Implements * Shadows the Activity Manager to extend its testing capabilities. * * There is an existing robolectric shadow of Activity Manager but that doesn't provide us enough - * control over MemoryInfo and hence MemoryUsage can't be tested using that. + * control over Debug.MemoryInfo and hence memory usage can't be tested using that. */ @Implements(ActivityManager::class) class OppiaShadowActivityManager { - private var processMemoryInfo: Array? = - arrayOf(Debug.MemoryInfo().apply { this.otherPss = 2 }) + private var processMemoryInfo: Array? = arrayOf(Debug.MemoryInfo()) + + private var memoryInfo: ActivityManager.MemoryInfo = ActivityManager.MemoryInfo() /** * Sets [memoryInfo] as part of [processMemoryInfo] which is then returned whenever @@ -25,9 +26,28 @@ class OppiaShadowActivityManager { processMemoryInfo?.set(0, memoryInfo) } - /** Returns [processMemoryInfo] as the memory usage info of the application. */ + /** Sets [memoryInfo] as equal to [memoryInfoValue]. */ + fun setMemoryInfo(memoryInfoValue: ActivityManager.MemoryInfo) { + this.memoryInfo = memoryInfoValue + } + + /** + * Robolectric shadow override of [ActivityManager.getProcessMemoryInfo]. Note that the value of + * [pids] isn't taken into account in this implementation unlike the actual one. + */ @Implementation fun getProcessMemoryInfo(pids: IntArray?): Array? { return processMemoryInfo } + + /** Robolectric shadow override of [ActivityManager.getMemoryInfo]. */ + @Implementation + fun getMemoryInfo(outInfo: ActivityManager.MemoryInfo) { + outInfo.apply { + availMem = memoryInfo.availMem + outInfo.lowMemory = memoryInfo.lowMemory + outInfo.threshold = memoryInfo.threshold + outInfo.totalMem = memoryInfo.totalMem + } + } } diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt new file mode 100644 index 00000000000..34b2e22b4da --- /dev/null +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt @@ -0,0 +1,47 @@ +package org.oppia.android.testing.robolectric + +import android.net.TrafficStats +import org.robolectric.annotation.Implementation +import org.robolectric.annotation.Implements + +private var uidTxBytes = 0L +private var uidRxBytes = 0L + +/** + * Shadows the Traffic Stats to extend its testing capabilities. + * + * There is an existing robolectric shadow of Traffic Stats but that doesn't provide us enough + * control over network bytes sent/received for a specific UID and hence network usage can't be + * tested using that. + */ +@Implements(TrafficStats::class) +class OppiaShadowTrafficStats { + + /** Sets [uidTxBytes] as equal to [bytes]. */ + fun setUidTxBytes(bytes: Long) { + uidTxBytes = bytes + } + + /** Sets [uidRxBytes] as equal to [bytes]. */ + fun setUidRxBytes(bytes: Long) { + uidRxBytes = bytes + } + + companion object { + /** + * Robolectric shadow override of [TrafficStats.getUidRxBytes]. Note that the value of + * [uid] isn't taken into account in this implementation unlike the actual one. + */ + @Implementation + @JvmStatic + fun getUidRxBytes(uid: Int): Long = uidRxBytes + + /** + * Robolectric shadow override of [TrafficStats.getUidTxBytes]. Note that the value of + * [uid] isn't taken into account in this implementation unlike the actual one. + */ + @Implementation + @JvmStatic + fun getUidTxBytes(uid: Int): Long = uidTxBytes + } +} 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 2f9d76aafec..8c51fdc929f 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 @@ -50,11 +50,10 @@ import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import org.robolectric.shadow.api.Shadow -import org.robolectric.shadows.ShadowActivityManager import java.io.File import javax.inject.Inject import javax.inject.Singleton - +import org.oppia.android.testing.robolectric.OppiaShadowTrafficStats private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" private const val ONE_KILOBYTE = 1024 @@ -73,7 +72,7 @@ private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L @SelectRunnerPlatform(ParameterizedRobolectricTestRunner::class) @Config( application = PerformanceMetricsAssessorImplTest.TestApplication::class, - shadows = [OppiaShadowActivityManager::class] + shadows = [OppiaShadowActivityManager::class, OppiaShadowTrafficStats::class] ) class PerformanceMetricsAssessorImplTest { @@ -151,18 +150,20 @@ class PerformanceMetricsAssessorImplTest { @Test fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { - val expectedNetworkBytesSent = TrafficStats.getUidTxBytes(context.applicationInfo.uid) + val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats + shadow.setUidTxBytes(20L) assertThat(performanceMetricsAssessorImpl.getTotalSentBytes()) - .isEqualTo(expectedNetworkBytesSent) + .isEqualTo(20L) } @Test fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { - val expectedNetworkBytesReceived = TrafficStats.getUidRxBytes(context.applicationInfo.uid) + val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats + shadow.setUidRxBytes(20L) assertThat(performanceMetricsAssessorImpl.getTotalReceivedBytes()) - .isEqualTo(expectedNetworkBytesReceived) + .isEqualTo(20L) } @Test @@ -204,7 +205,7 @@ class PerformanceMetricsAssessorImplTest { OppiaParameterizedTestRunner.Iteration("memoryJustBelowUpperBound", "totalMemory=2147483647") ) fun testPerformanceMetricsUtils_setTotalMemoryForLowMemoryRange_returnsCorrectLowMemoryTier() { - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) @@ -220,7 +221,7 @@ class PerformanceMetricsAssessorImplTest { OppiaParameterizedTestRunner.Iteration("memoryEqualToUpperBound", "totalMemory=3221225472") ) fun testPerformanceMetricsUtils_setTotalMemoryForMediumMemoryRange_retsCorrectMediumMemoryTier() { - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) @@ -239,7 +240,7 @@ class PerformanceMetricsAssessorImplTest { ) ) fun testPerformanceMetricsUtils_setTotalMemoryForHighMemoryRange_retsCorrectHighMemoryTier() { - val shadowActivityManager: ShadowActivityManager = shadowOf(activityManager) + val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) From 3feeddb5c9e8ec45c00858f25348220d13ff1588 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 12 Aug 2022 04:04:24 +0530 Subject: [PATCH 109/149] custom shadow tests --- .../robolectric/OppiaShadowTrafficStats.kt | 14 +- .../OppiaShadowActivityManagerTest.kt | 152 ++++++++++++++++++ .../OppiaShadowTrafficStatsTest.kt | 104 ++++++++++++ .../PerformanceMetricsAssessorImplTest.kt | 2 +- 4 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt create mode 100644 testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt index 34b2e22b4da..bd418b58025 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStats.kt @@ -4,8 +4,9 @@ import android.net.TrafficStats import org.robolectric.annotation.Implementation import org.robolectric.annotation.Implements -private var uidTxBytes = 0L -private var uidRxBytes = 0L +private const val DEFAULT_BYTE_VALUE = 0L +private var uidTxBytes = DEFAULT_BYTE_VALUE +private var uidRxBytes = DEFAULT_BYTE_VALUE /** * Shadows the Traffic Stats to extend its testing capabilities. @@ -43,5 +44,14 @@ class OppiaShadowTrafficStats { @Implementation @JvmStatic fun getUidTxBytes(uid: Int): Long = uidTxBytes + + /** + * Resets [uidTxBytes] and [uidRxBytes] values. This should always be called in a tear-down + * method to avoid leaking state between tests. + */ + fun reset() { + uidRxBytes = DEFAULT_BYTE_VALUE + uidTxBytes = DEFAULT_BYTE_VALUE + } } } diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt new file mode 100644 index 00000000000..22e9bd554a5 --- /dev/null +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt @@ -0,0 +1,152 @@ +package org.oppia.android.testing.robolectric + +import android.app.ActivityManager +import android.app.Application +import android.content.Context +import android.os.Build +import android.os.Debug +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.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import javax.inject.Singleton + +private val oppiaShadowActivityManager by lazy { OppiaShadowActivityManager() } + +/** Tests for [OppiaShadowActivityManager]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config( + manifest = Config.NONE, + sdk = [Build.VERSION_CODES.P], + shadows = [OppiaShadowActivityManager::class] +) +class OppiaShadowActivityManagerTest { + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testCustomShadow_initialState_debugMemoryInfo_returnsDefaultState() { + val defaultDebugMemoryShadow = oppiaShadowActivityManager.getProcessMemoryInfo(intArrayOf(0)) + assertThat(defaultDebugMemoryShadow).isNotNull() + assertThat(defaultDebugMemoryShadow?.size).isNotEqualTo(0) + assertThat(defaultDebugMemoryShadow?.get(0)?.totalPss).isEqualTo(0) + } + + @Test + fun testCustomShadow_initialState_memoryInfo_returnsDefaultState() { + val outInfo = ActivityManager.MemoryInfo() + oppiaShadowActivityManager.getMemoryInfo(outInfo) + assertThat(outInfo.totalMem).isEqualTo(0) + assertThat(outInfo.availMem).isEqualTo(0) + assertThat(outInfo.lowMemory).isEqualTo(false) + assertThat(outInfo.threshold).isEqualTo(0) + } + + @Test + fun testCustomShadow_setDebugMemoryInfo_returnsCorrectValue() { + val debugMemoryInfo = Debug.MemoryInfo().apply { + this.nativePss = 2 + this.dalvikPss = 1 + this.otherPss = 3 + } + oppiaShadowActivityManager.setProcessMemoryInfo(debugMemoryInfo) + + val returnedDebugMemoryInfo = oppiaShadowActivityManager.getProcessMemoryInfo(intArrayOf(0)) + assertThat(returnedDebugMemoryInfo?.get(0)?.nativePss).isEqualTo(2) + assertThat(returnedDebugMemoryInfo?.get(0)?.dalvikPss).isEqualTo(1) + assertThat(returnedDebugMemoryInfo?.get(0)?.otherPss).isEqualTo(3) + // Since totalPss = nativePss + dalvikPss + otherPss. + assertThat(returnedDebugMemoryInfo?.get(0)?.totalPss).isEqualTo(6) + } + + @Test + fun testCustomShadow_setMemoryInfo_returnsCorrectOutInfo() { + val memoryInfo = ActivityManager.MemoryInfo().apply { + this.availMem = 1 + this.totalMem = 2 + this.lowMemory = true + this.threshold = 10 + } + oppiaShadowActivityManager.setMemoryInfo(memoryInfo) + + val outInfo = ActivityManager.MemoryInfo() + oppiaShadowActivityManager.getMemoryInfo(outInfo) + assertThat(outInfo.totalMem).isEqualTo(2) + assertThat(outInfo.availMem).isEqualTo(1) + assertThat(outInfo.lowMemory).isEqualTo(true) + assertThat(outInfo.threshold).isEqualTo(10) + } + + @Test + fun testCustomShadow_setMemoryInfo_setDataInOutInfo_returnsCorrectDataInOutInfo() { + val memoryInfo = ActivityManager.MemoryInfo().apply { + this.availMem = 1 + this.totalMem = 2 + this.lowMemory = true + this.threshold = 10 + } + oppiaShadowActivityManager.setMemoryInfo(memoryInfo) + + val outInfo = ActivityManager.MemoryInfo().apply { + this.availMem = 5 + this.totalMem = 3 + this.lowMemory = false + this.threshold = 43 + } + + oppiaShadowActivityManager.getMemoryInfo(outInfo) + assertThat(outInfo.totalMem).isEqualTo(2) + assertThat(outInfo.availMem).isEqualTo(1) + assertThat(outInfo.lowMemory).isEqualTo(true) + assertThat(outInfo.threshold).isEqualTo(10) + } + + private fun setUpTestApplicationComponent() { + DaggerOppiaShadowActivityManagerTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .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(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class + ] + ) + interface TestApplicationComponent { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + + fun build(): TestApplicationComponent + } + + fun inject(oppiaShadowActivityManagerTest: OppiaShadowActivityManagerTest) + } +} diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt new file mode 100644 index 00000000000..24f9c6bbde6 --- /dev/null +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt @@ -0,0 +1,104 @@ +package org.oppia.android.testing.robolectric + +import android.app.Application +import android.content.Context +import android.os.Build +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.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import javax.inject.Singleton + +private val oppiaShadowTrafficStats by lazy { OppiaShadowTrafficStats() } + +/** Tests for [OppiaShadowTrafficStats]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config( + manifest = Config.NONE, + sdk = [Build.VERSION_CODES.P], + shadows = [OppiaShadowTrafficStats::class] +) +class OppiaShadowTrafficStatsTest { + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @After + fun tearDown() { + // Make sure this is reset between tests. + OppiaShadowTrafficStats.reset() + } + + @Test + fun testCustomShadow_initialState_returnsDefaultValuesForTxAndRxBytes() { + assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(0L) + assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(0L) + + OppiaShadowTrafficStats.reset() + } + + @Test + fun testCustomShadow_setUidTxBytes_returnsCorrectTxBytesValue() { + oppiaShadowTrafficStats.setUidTxBytes(9) + assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(9L) + + OppiaShadowTrafficStats.reset() + } + + @Test + fun testCustomShadow_setUidRxBytes_returnsCorrectTxBytesValue() { + oppiaShadowTrafficStats.setUidRxBytes(9) + assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(9L) + + OppiaShadowTrafficStats.reset() + } + + private fun setUpTestApplicationComponent() { + DaggerOppiaShadowTrafficStatsTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .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(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class + ] + ) + interface TestApplicationComponent { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + + fun build(): TestApplicationComponent + } + + fun inject(oppiaShadowTrafficStatsTest: OppiaShadowTrafficStatsTest) + } +} 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 8c51fdc929f..116c452ca47 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 @@ -26,6 +26,7 @@ import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.RunParameter import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.SelectRunnerPlatform import org.oppia.android.testing.junit.ParameterizedRobolectricTestRunner 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.FakeOppiaClockModule @@ -53,7 +54,6 @@ import org.robolectric.shadow.api.Shadow import java.io.File import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.testing.robolectric.OppiaShadowTrafficStats private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" private const val ONE_KILOBYTE = 1024 From 14f9f1d9210f00b856dffb8be73a6355753d7939 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 12 Aug 2022 04:13:05 +0530 Subject: [PATCH 110/149] module deps --- .../PerformanceMetricsAssessorImplTest.kt | 46 +------------------ 1 file changed, 2 insertions(+), 44 deletions(-) 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 116c452ca47..3a4ea757a66 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 @@ -39,14 +39,6 @@ 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.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode @@ -54,6 +46,8 @@ import org.robolectric.shadow.api.Shadow import java.io.File import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule + private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" private const val ONE_KILOBYTE = 1024 @@ -276,42 +270,6 @@ class PerformanceMetricsAssessorImplTest { fun provideGlobalLogLevel(): LogLevel = LogLevel.VERBOSE } - @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) - } - } - @Module class TestPerformanceMetricsAssessorModule { @Provides From cf95756b1b8ff6e7006e54853932cef5a261d807 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 13 Aug 2022 02:30:50 +0530 Subject: [PATCH 111/149] tests --- .../PerformanceMetricsLoggerModule.kt | 10 +- .../PerformanceMetricsLoggerModuleTest.kt | 106 ++++++++++++++++++ scripts/assets/test_file_exemptions.textproto | 2 - .../MetricLogSchedulerModule.kt | 10 +- .../MetricLogSchedulerModuleTest.kt | 79 +++++++++++++ .../PerformanceMetricsAssessorImplTest.kt | 20 +++- 6 files changed, 214 insertions(+), 13 deletions(-) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt create mode 100644 utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt index be6f5cd174d..ee7481194df 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt @@ -1,16 +1,16 @@ package org.oppia.android.domain.oppialogger.analytics -import dagger.Binds import dagger.Module +import dagger.Provides import dagger.multibindings.IntoSet import org.oppia.android.domain.oppialogger.ApplicationStartupListener /** Binds [PerformanceMetricsLogger] as an [ApplicationStartupListener] */ @Module -interface PerformanceMetricsLoggerModule { - @Binds +class PerformanceMetricsLoggerModule { + @Provides @IntoSet - fun bindPerformanceMetricsLogger( + fun providePerformanceMetricsLogger( performanceMetricsLogger: PerformanceMetricsLogger - ): ApplicationStartupListener + ): ApplicationStartupListener = performanceMetricsLogger } diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt new file mode 100644 index 00000000000..2530c249db3 --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt @@ -0,0 +1,106 @@ +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.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import dagger.multibindings.Multibinds +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +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 +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestDispatcherModule +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.LoggerModule +import org.oppia.android.util.logging.SyncStatusModule +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +/** Tests for [PerformanceMetricsLoggerModule]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsLoggerModuleTest.TestApplication::class) +class PerformanceMetricsLoggerModuleTest { + @Inject + lateinit var startupListeners: Set<@JvmSuppressWildcards ApplicationStartupListener> + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testInjectApplicationStartupListenerSet_includesPerformanceMetricsLogger() { + assertThat(startupListeners.any { it is PerformanceMetricsLogger }).isTrue() + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + + @Multibinds + fun bindStartupListenerSet(): Set + } + + // 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, + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, + LoggerModule::class, SyncStatusModule::class, PerformanceMetricsLoggerModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(test: PerformanceMetricsLoggerModuleTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsLoggerModuleTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(test: PerformanceMetricsLoggerModuleTest) { + component.inject(test) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index a3bb7e584ca..519fa5002e0 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -811,8 +811,6 @@ 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/PerformanceMetricsAssessorModule.kt" 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/MetricLogSchedulerModule.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsEventLogger.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.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/analytics/PerformanceMetricsLoggerModule.kt" diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt index b570833641b..bb93e31a8dc 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt @@ -1,14 +1,14 @@ package org.oppia.android.util.logging.performancemetrics -import dagger.Binds import dagger.Module +import dagger.Provides import org.oppia.android.util.logging.MetricLogScheduler /** Provides Log Generator related dependencies. */ @Module -interface MetricLogSchedulerModule { - @Binds - fun bindMetricLogScheduler( +class MetricLogSchedulerModule { + @Provides + fun provideMetricLogScheduler( performanceMetricLogScheduler: PerformanceMetricsLogScheduler - ): MetricLogScheduler + ): MetricLogScheduler = performanceMetricLogScheduler } diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt new file mode 100644 index 00000000000..535faf6b640 --- /dev/null +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt @@ -0,0 +1,79 @@ +package org.oppia.android.util.logging.performancemetrics + +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.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.time.FakeOppiaClockModule +import org.oppia.android.util.locale.LocaleProdModule +import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.MetricLogScheduler +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +/** Tests for [MetricLogSchedulerModule]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(manifest = Config.NONE) +class MetricLogSchedulerModuleTest { + + @Inject + lateinit var metricLogScheduler: MetricLogScheduler + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testModule_injectsProductionImplementationOfMetricLogScheduler() { + assertThat(metricLogScheduler).isInstanceOf(PerformanceMetricsLogScheduler::class.java) + } + + private fun setUpTestApplicationComponent() { + DaggerMetricLogSchedulerModuleTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + } + + // TODO(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class, MetricLogSchedulerModule::class, LoggerModule::class, + RobolectricModule::class, LocaleProdModule::class, FakeOppiaClockModule::class + ] + ) + interface TestApplicationComponent { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + + fun build(): TestApplicationComponent + } + + fun inject(metricLogSchedulerModuleTest: MetricLogSchedulerModuleTest) + } +} 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 3a4ea757a66..7c376b2fef5 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 @@ -49,6 +49,9 @@ import javax.inject.Singleton import org.oppia.android.testing.platformparameter.TestPlatformParameterModule private const val TEST_APP_PATH = "TEST_APP_PATH" +private const val TEST_APP_PATH_CACHE = "TEST_APP_PATH_CACHE" +private const val TEST_APP_SUB_PATH = "TEST_APP_SUB_PATH" +private const val TEST_APP_SEMI_SUB_PATH = "TEST_APP_SEMI_SUB_PATH" private const val TEST_FILE_NAME = "TEST_FILE_NAME" private const val ONE_KILOBYTE = 1024 private const val ONE_MEGABYTE = ONE_KILOBYTE * 1024 @@ -93,7 +96,7 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_getTotalStorageUsed_returnsCorrectStorageUsage() { + fun testAssessor_createFilesWithContent_getTotalStorageUsed_retsCorrectStorageUsage() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) .write(ByteArray(ONE_MEGABYTE)) File.createTempFile(TEST_FILE_NAME, null, context.cacheDir) @@ -102,6 +105,21 @@ class PerformanceMetricsAssessorImplTest { assertThat(performanceMetricsAssessorImpl.getUsedStorage()).isEqualTo(ONE_MEGABYTE * 2) } + @Test + fun testAssessor_createFilesWithContent_withNesting_getTotStorageUsed_retsCorrectStorageUsage() { + val mainFile = File(TEST_APP_PATH) + val cacheFile = File.createTempFile(TEST_APP_PATH_CACHE, null, context.cacheDir) + val subFile = File(mainFile, TEST_APP_SUB_PATH) + val semiSubFile = File(subFile, TEST_APP_SEMI_SUB_PATH) + + context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE).write(ByteArray(ONE_MEGABYTE)) + cacheFile.writeBytes(ByteArray(ONE_MEGABYTE)) + context.openFileOutput(subFile.name, Context.MODE_PRIVATE).write(ByteArray(ONE_MEGABYTE)) + context.openFileOutput(semiSubFile.name, Context.MODE_PRIVATE).write(ByteArray(ONE_MEGABYTE)) + + assertThat(performanceMetricsAssessorImpl.getUsedStorage()).isEqualTo(ONE_MEGABYTE * 4) + } + @Test fun testPerformanceMetricsUtils_writeBytesLowerThanLowTierHigherBound_retsLowStorageUsageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) From d68406704fd43e014e570c6bfd7ff27fc023cda5 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 13 Aug 2022 02:35:39 +0530 Subject: [PATCH 112/149] nits --- .../analytics/PerformanceMetricsLoggerModuleTest.kt | 4 ++-- .../performancemetrics/MetricLogSchedulerModuleTest.kt | 4 ++-- .../PerformanceMetricsAssessorImplTest.kt | 9 +-------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt index 2530c249db3..d52ead57e0f 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModuleTest.kt @@ -10,8 +10,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.multibindings.Multibinds -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -32,6 +30,8 @@ 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 javax.inject.Inject +import javax.inject.Singleton /** Tests for [PerformanceMetricsLoggerModule]. */ // FunctionName: test names are conventionally named with underscores. diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt index 535faf6b640..c040cbb70c3 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt @@ -9,8 +9,6 @@ import dagger.Binds import dagger.BindsInstance import dagger.Component import dagger.Module -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -21,6 +19,8 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.MetricLogScheduler import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton /** Tests for [MetricLogSchedulerModule]. */ // FunctionName: test names are conventionally named with underscores. 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 7c376b2fef5..52616203ef7 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 @@ -13,11 +13,8 @@ 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.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule import org.oppia.android.app.model.OppiaMetricLog import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.junit.OppiaParameterizedTestRunner @@ -25,6 +22,7 @@ import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.Parameter import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.RunParameterized import org.oppia.android.testing.junit.OppiaParameterizedTestRunner.SelectRunnerPlatform import org.oppia.android.testing.junit.ParameterizedRobolectricTestRunner +import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.OppiaShadowActivityManager import org.oppia.android.testing.robolectric.OppiaShadowTrafficStats import org.oppia.android.testing.robolectric.RobolectricModule @@ -46,7 +44,6 @@ import org.robolectric.shadow.api.Shadow import java.io.File import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.testing.platformparameter.TestPlatformParameterModule private const val TEST_APP_PATH = "TEST_APP_PATH" private const val TEST_APP_PATH_CACHE = "TEST_APP_PATH_CACHE" @@ -76,10 +73,6 @@ class PerformanceMetricsAssessorImplTest { @Parameter var totalMemory: Long = Long.MIN_VALUE // Inited because primitives can't be lateinit. - @Rule - @JvmField - val mockitoRule: MockitoRule = MockitoJUnit.rule() - @Inject lateinit var performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl From 96054c78604a3e8442e1250c5777e504316ad904 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 13 Aug 2022 05:25:36 +0530 Subject: [PATCH 113/149] metricLogScheduler refactor and test --- .../app/application/ApplicationComponent.kt | 2 +- .../AdministratorControlsActivityTest.kt | 2 +- .../AdministratorControlsFragmentTest.kt | 2 +- .../AppVersionActivityTest.kt | 2 +- .../ProfileAndDeviceIdActivityTest.kt | 2 +- .../ProfileAndDeviceIdFragmentTest.kt | 2 +- .../CompletedStoryListActivityTest.kt | 2 +- .../LessonThumbnailImageViewTest.kt | 2 +- .../MathExpressionInteractionsViewTest.kt | 2 +- .../DrawableBindingAdaptersTest.kt | 2 +- .../ImageViewBindingAdaptersTest.kt | 2 +- .../databinding/MarginBindingAdaptersTest.kt | 2 +- ...StateAssemblerMarginBindingAdaptersTest.kt | 2 +- ...tateAssemblerPaddingBindingAdaptersTest.kt | 2 +- .../TextViewBindingAdaptersTest.kt | 2 +- .../databinding/ViewBindingAdaptersTest.kt | 2 +- .../DeveloperOptionsActivityTest.kt | 2 +- .../DeveloperOptionsFragmentTest.kt | 2 +- .../MarkChaptersCompletedActivityTest.kt | 2 +- .../MarkChaptersCompletedFragmentTest.kt | 2 +- .../MarkStoriesCompletedActivityTest.kt | 2 +- .../MarkStoriesCompletedFragmentTest.kt | 2 +- .../MarkTopicsCompletedActivityTest.kt | 2 +- .../MarkTopicsCompletedFragmentTest.kt | 2 +- .../devoptions/ViewEventLogsActivityTest.kt | 2 +- .../devoptions/ViewEventLogsFragmentTest.kt | 2 +- .../ForceNetworkTypeActivityTest.kt | 2 +- .../ForceNetworkTypeFragmentTest.kt | 2 +- .../MathExpressionParserActivityTest.kt | 2 +- .../MathExpressionParserFragmentTest.kt | 2 +- .../android/app/faq/FAQListFragmentTest.kt | 2 +- .../android/app/faq/FAQSingleActivityTest.kt | 2 +- .../android/app/faq/FaqListActivityTest.kt | 2 +- .../android/app/help/HelpActivityTest.kt | 2 +- .../android/app/help/HelpFragmentTest.kt | 2 +- .../android/app/home/HomeActivityTest.kt | 2 +- .../app/home/RecentlyPlayedFragmentTest.kt | 2 +- .../app/home/TopicSummaryViewModelTest.kt | 2 +- .../android/app/home/WelcomeViewModelTest.kt | 2 +- .../PromotedStoryListViewModelTest.kt | 2 +- .../PromotedStoryViewModelTest.kt | 2 +- .../mydownloads/MyDownloadsActivityTest.kt | 2 +- .../mydownloads/MyDownloadsFragmentTest.kt | 2 +- .../app/onboarding/OnboardingActivityTest.kt | 2 +- .../app/onboarding/OnboardingFragmentTest.kt | 2 +- .../OngoingTopicListActivityTest.kt | 2 +- .../app/options/AppLanguageActivityTest.kt | 2 +- .../app/options/AppLanguageFragmentTest.kt | 2 +- .../app/options/AudioLanguageActivityTest.kt | 2 +- .../app/options/AudioLanguageFragmentTest.kt | 2 +- .../app/options/OptionsActivityTest.kt | 2 +- .../app/options/OptionsFragmentTest.kt | 2 +- .../options/ReadingTextSizeActivityTest.kt | 2 +- .../options/ReadingTextSizeFragmentTest.kt | 2 +- .../app/parser/CustomBulletSpanTest.kt | 2 +- .../android/app/parser/HtmlParserTest.kt | 2 +- .../app/player/audio/AudioFragmentTest.kt | 2 +- .../exploration/ExplorationActivityTest.kt | 2 +- .../app/player/state/StateFragmentTest.kt | 2 +- .../app/profile/AddProfileActivityTest.kt | 2 +- .../app/profile/AdminAuthActivityTest.kt | 2 +- .../app/profile/AdminPinActivityTest.kt | 2 +- .../app/profile/PinPasswordActivityTest.kt | 2 +- .../app/profile/ProfileChooserFragmentTest.kt | 2 +- .../ProfilePictureActivityTest.kt | 2 +- .../ProfileProgressActivityTest.kt | 2 +- .../ProfileProgressFragmentTest.kt | 2 +- .../app/recyclerview/BindableAdapterTest.kt | 2 +- .../resumelesson/ResumeLessonActivityTest.kt | 2 +- .../resumelesson/ResumeLessonFragmentTest.kt | 2 +- .../profile/ProfileEditActivityTest.kt | 2 +- .../profile/ProfileEditFragmentTest.kt | 2 +- .../profile/ProfileListActivityTest.kt | 2 +- .../profile/ProfileListFragmentTest.kt | 2 +- .../profile/ProfileRenameActivityTest.kt | 2 +- .../profile/ProfileRenameFragmentTest.kt | 2 +- .../profile/ProfileResetPinActivityTest.kt | 2 +- .../profile/ProfileResetPinFragmentTest.kt | 2 +- .../android/app/splash/SplashActivityTest.kt | 2 +- .../android/app/story/StoryActivityTest.kt | 2 +- .../android/app/story/StoryFragmentTest.kt | 2 +- .../app/testing/DragDropTestActivityTest.kt | 2 +- ...ImageRegionSelectionInteractionViewTest.kt | 2 +- .../InputInteractionViewTestActivityTest.kt | 2 +- .../NavigationDrawerActivityDebugTest.kt | 2 +- .../NavigationDrawerActivityProdTest.kt | 2 +- ...tFontScaleConfigurationUtilActivityTest.kt | 2 +- .../testing/TopicTestActivityForStoryTest.kt | 2 +- .../app/thirdparty/LicenseListActivityTest.kt | 2 +- .../app/thirdparty/LicenseListFragmentTest.kt | 2 +- .../LicenseTextViewerActivityTest.kt | 2 +- .../LicenseTextViewerFragmentTest.kt | 2 +- .../ThirdPartyDependencyListActivityTest.kt | 2 +- .../ThirdPartyDependencyListFragmentTest.kt | 2 +- .../android/app/topic/TopicActivityTest.kt | 2 +- .../android/app/topic/TopicFragmentTest.kt | 2 +- .../conceptcard/ConceptCardFragmentTest.kt | 2 +- .../app/topic/info/TopicInfoFragmentTest.kt | 2 +- .../topic/lessons/TopicLessonsFragmentTest.kt | 2 +- .../practice/TopicPracticeFragmentTest.kt | 2 +- .../QuestionPlayerActivityTest.kt | 2 +- .../revision/TopicRevisionFragmentTest.kt | 2 +- .../revisioncard/RevisionCardActivityTest.kt | 2 +- .../revisioncard/RevisionCardFragmentTest.kt | 2 +- .../app/utility/RatioExtensionsTest.kt | 2 +- .../walkthrough/WalkthroughActivityTest.kt | 2 +- .../WalkthroughFinalFragmentTest.kt | 2 +- .../WalkthroughTopicListFragmentTest.kt | 2 +- .../WalkthroughWelcomeFragmentTest.kt | 2 +- .../activity/ActivityIntentFactoriesTest.kt | 2 +- .../android/app/home/HomeActivityLocalTest.kt | 2 +- .../app/parser/FractionParsingUiErrorTest.kt | 2 +- .../app/parser/StringToRatioParserTest.kt | 2 +- .../ExplorationActivityLocalTest.kt | 2 +- .../player/state/StateFragmentLocalTest.kt | 2 +- .../ProfileChooserFragmentLocalTest.kt | 2 +- .../app/story/StoryActivityLocalTest.kt | 2 +- .../app/testing/CompletedStoryListSpanTest.kt | 2 +- .../oppia/android/app/testing/HomeSpanTest.kt | 2 +- .../app/testing/OngoingTopicListSpanTest.kt | 2 +- .../PlatformParameterIntegrationTest.kt | 2 +- .../app/testing/ProfileChooserSpanTest.kt | 2 +- .../testing/ProfileProgressSpanCountTest.kt | 2 +- .../app/testing/RecentlyPlayedSpanTest.kt | 2 +- .../app/testing/TopicRevisionSpanTest.kt | 2 +- .../app/testing/activity/TestActivityTest.kt | 2 +- .../AdministratorControlsFragmentTest.kt | 2 +- .../testing/options/OptionsFragmentTest.kt | 2 +- .../player/split/PlayerSplitScreenTest.kt | 2 +- .../state/StateFragmentAccessibilityTest.kt | 2 +- .../topic/info/TopicInfoFragmentLocalTest.kt | 2 +- .../lessons/TopicLessonsFragmentLocalTest.kt | 2 +- .../QuestionPlayerActivityLocalTest.kt | 2 +- .../RevisionCardActivityLocalTest.kt | 2 +- .../MathExpressionAccessibilityUtilTest.kt | 2 +- .../logscheduler}/MetricLogSchedulerModule.kt | 2 +- .../PerformanceMetricsLogScheduler.kt | 2 +- .../PerformanceMetricsControllerTest.kt | 2 +- .../MetricLogSchedulerModuleTest.kt | 2 +- .../PerformanceMetricsLogSchedulerTest.kt | 205 ++++++++++++++++++ 140 files changed, 344 insertions(+), 139 deletions(-) rename {utility/src/main/java/org/oppia/android/util/logging/performancemetrics => domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler}/MetricLogSchedulerModule.kt (86%) rename {utility/src/main/java/org/oppia/android/util/logging/performancemetrics => domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler}/PerformanceMetricsLogScheduler.kt (96%) rename {utility/src/test/java/org/oppia/android/util/logging/performancemetrics => domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler}/MetricLogSchedulerModuleTest.kt (97%) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt diff --git a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt index 153d4a1627f..745b07d8482 100644 --- a/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt @@ -38,6 +38,7 @@ import org.oppia.android.domain.oppialogger.LoggingIdentifierModule import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -54,7 +55,6 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 8be81da36ff..5918ad0614f 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 @@ -89,6 +89,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -111,7 +112,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 6643e741812..ae58e53a313 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 @@ -80,6 +80,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -102,7 +103,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 fd77b04b827..4d3875e7a30 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -90,7 +91,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 6b3535732da..e0b44a0a5fa 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 @@ -58,6 +58,7 @@ 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -82,7 +83,6 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 6a147597875..1c99c20e542 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,7 @@ 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.LearnerAnalyticsLogger +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory @@ -101,7 +102,6 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 6c050d5b0ea..dc1c7fd5a82 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -95,7 +96,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9dc0f066dd5..e9fd803c1e3 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -74,7 +75,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 c6a03932dda..100c5a437f8 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -95,7 +96,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0437e00e060..1bee02bb647 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -79,7 +80,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 120beb3c4f9..6559b4e211b 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -84,7 +85,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 26090315305..51af7e5e519 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -85,7 +86,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f5ffa1de780..8f24ad52f76 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -87,7 +88,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0cfb6d6f74f..d4c2448a4db 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -85,7 +86,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 40e2f930ad2..ebd73e65eda 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -78,7 +79,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 01c976301ff..5127d9aec73 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -82,7 +83,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 cead4fc5994..f5be1badb63 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -100,7 +101,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 fd77706f78f..98130794bda 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -97,7 +98,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 46c7ef44614..1f3326161e7 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -76,7 +77,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d554d4023a6..62272000673 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 c0b304a64db..b4b998b9f7c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -76,7 +77,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 1714b4d0ef5..9613d6d6729 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 12683d2dcd2..5107bd10697 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -76,7 +77,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 1140035311a..7ddd3a668ac 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 c7017adf922..c844d062074 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -77,7 +78,6 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 ba06114ec26..4aadecec4e1 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 @@ -62,6 +62,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -84,7 +85,6 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 c92212fce49..1647b6b5dee 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -77,7 +78,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f28d4097747..d6c30067abe 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -83,7 +84,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 c4b16e8146f..e9a86da55ae 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -74,7 +75,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 52910e2df8f..6bf88c29bf3 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -86,7 +87,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 27363d8d244..e6f86c7cbbf 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 a3e394b9b7f..8b4552c403c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -83,7 +84,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParser 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 92b3855580d..66b90ab902a 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 cdfccc05985..659279b6035 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 8f35b6f7dc8..3e40c0f8838 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -98,7 +99,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 ba91913bcc7..09e36ec59ec 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -128,7 +129,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 00f5c55342e..672069768fd 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 @@ -84,6 +84,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -115,7 +116,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0fd6350d394..7e6cedb6445 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -72,7 +73,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 e8c13953753..7505e4d774c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 47a517e6dfb..aee3ce36441 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 4c3c00e3641..6208ea3fbec 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0dac5a18c04..a9b9c815a49 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -69,7 +70,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 21870637f07..a1aa44be743 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -80,7 +81,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 b066ccb1179..412a7674a49 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 b5fbd111635..4fe6508fac6 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -98,7 +99,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 428c331180c..c9d0f8ff1d1 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 175b033b72b..62965d09a72 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 340983a5bf1..78966f2e217 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -82,7 +83,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 920be688d93..eb69586b13c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5ecf33722a4..dbb338d76e2 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -81,7 +82,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 aaa1ec4e7a0..b90e05fd338 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5fc41157154..50701da0b58 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -92,7 +93,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 fe5b879f009..40fd59f6fb8 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 954673eb353..46284607705 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt index 9a53d3cbc88..454c6cb24df 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -72,7 +73,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.CustomBulletSpan 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 f69d7c85334..92754ce17e8 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 @@ -78,6 +78,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -100,7 +101,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.CustomBulletSpan 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 73a5b57665f..30186b1cc96 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -100,7 +101,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9963976e3be..2020e38b87b 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 @@ -105,6 +105,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -147,7 +148,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus 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 bc8423d23b7..3a986c0fbe0 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 @@ -128,6 +128,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -171,7 +172,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 8a51c9e306c..4cd82b31973 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 @@ -84,6 +84,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -109,7 +110,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 584cf217dcd..c4934f2611c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 2e2f68de3eb..4f66269badb 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -104,7 +105,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f5f63d04b10..f7f5fa8fe29 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -99,7 +100,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 069b2c73908..cdcee36d429 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -95,7 +96,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 b256c0f0304..fe7e91d8139 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 @@ -79,7 +79,7 @@ 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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 ebac4a8977f..00938b60667 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 @@ -70,7 +70,7 @@ 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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 ce80f3325cd..5bbb41337ed 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 @@ -119,7 +119,7 @@ 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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9cb4d6a398b..bc9a31d6db9 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 @@ -89,6 +89,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -111,7 +112,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 aca6b69e420..e76a4ac0ab6 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -90,7 +91,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f5e8ba07a83..1bf70dde862 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9bb2b4d26c3..f950c6f152c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -89,7 +90,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 8704ce7882f..84d523c5200 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -91,7 +92,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 32e3cd038cc..ea0e29aaac2 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f0c636366d0..6e8ac36d94f 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -87,7 +88,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 606274af1ab..55d6e85a511 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -74,7 +75,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 13f4d1ad17f..9744a3daead 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -92,7 +93,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 a457543ed0c..38c6df5615d 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -75,7 +76,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 584b51d4e3c..dc210acaa36 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 85d908fac69..e554c9df2e1 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 @@ -73,6 +73,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -96,7 +97,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5801cd447ad..54df28345a1 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -90,7 +91,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 8e999a8c535..74fae89ca56 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 @@ -98,6 +98,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -131,7 +132,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d0ed11757e0..fc866ddceb1 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -81,7 +82,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d2cdfadb432..ccfbff28de1 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -95,7 +96,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 e9e7543a258..da4d3031acd 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -90,7 +91,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 b51cb1952da..69a7cfcc0ac 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 @@ -87,6 +87,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -111,7 +112,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5c4f91e8fc9..c7a0fc12355 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 @@ -95,6 +95,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -121,7 +122,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 987c4ed4471..7488560d8d9 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -76,7 +77,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 6b1c97b1936..5aebaae32fa 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -83,7 +84,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9920f2af6dd..efb85e232b1 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 565e428b2b1..4fd305d3ce0 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9c208578ea0..a751f1b52de 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -72,7 +73,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 4738a3cfc3c..bd5f229906f 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -78,7 +79,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 62d65d08453..2298212d383 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f1e00d3102a..f9dd5befd2e 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -87,7 +88,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 344e4e22406..15c80f80eca 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -87,7 +88,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 a5efce93c2b..87fb560776c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -97,7 +98,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 49304c9457e..6a3c9d7be97 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -103,7 +104,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 ab9c46a064b..e743d17c05d 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -102,7 +103,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 71fe05e98fe..3dde448824c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -113,7 +114,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 7e20451084d..98ae842aa2d 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -95,7 +96,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d90263dd651..8fbee49074d 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -136,7 +137,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 70f7bfdbd34..86da92fe690 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -98,7 +99,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f92a9ec72a9..6d8fbf9be40 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -91,7 +92,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 47d05f02bb9..84f04139d51 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -115,7 +116,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 59edf720373..3596c8533d1 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -69,7 +70,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 69fcf002216..cd49b90d400 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -82,7 +83,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 9d0e272f6cf..7bdea47cd8c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -86,7 +87,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0a4a06107a9..f334d5e7080 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 18893bcf2e9..59b4f9f4ca8 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -83,7 +84,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 515d6354feb..f0491f38b65 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d675fe39f33..445649d393b 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 64afbecd280..d6cb209d2c1 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 @@ -48,6 +48,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -67,7 +68,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.math.FractionParser import org.oppia.android.util.math.FractionParser.FractionParsingError import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule 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 08017b58dca..73ab39d434f 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -69,7 +70,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0816deead35..1c875e82863 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -78,7 +79,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule 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 b5546e67338..345397ec99d 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -150,7 +151,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 4775f782cca..df5ab8f58d0 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 7a1d45f9946..5d9cc5e3e75 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -72,7 +73,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5bf245855f6..86a05a175dc 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0dd2bd01bbf..83e920a77bd 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 076f747ab71..fc6c6aff74e 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -74,7 +75,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 ecae6265e67..5d30677deb7 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterController import org.oppia.android.domain.platformparameter.PlatformParameterModule @@ -93,7 +94,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 d2af5a02165..ac18c7ff49f 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 97b1ca6c557..7b515278346 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -73,7 +74,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 a1c2f699e9a..4571ab23451 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -78,7 +79,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 896af5e4a70..9ea7e810383 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -72,7 +73,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 3343b496b9e..bb510bd60c1 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 @@ -50,6 +50,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -69,7 +70,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 35afe0435a1..1f95d05540e 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -80,7 +81,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 7ace1afc8a9..3ebe6f52678 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -81,7 +82,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 caba0fe543d..a7d14d4a6c2 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 40bbcf13064..a344b0ebdef 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -83,7 +84,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 0cb01a6031b..68b9da3603a 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5c90311d36c..cd09a71eb8b 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -69,7 +70,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 2301bb9cbe4..ee94ac397bb 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -102,7 +103,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 681d0995402..510f56bd197 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -71,7 +72,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 f90ef13477b..d742b20a586 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 @@ -67,6 +67,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -96,7 +97,6 @@ import org.oppia.android.util.locale.testing.LocaleTestModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.util.logging.performancemetrics.MetricLogSchedulerModule import org.oppia.android.util.math.MathExpressionParser import org.oppia.android.util.math.MathExpressionParser.Companion.ErrorCheckingMode import org.oppia.android.util.math.MathExpressionParser.Companion.ErrorCheckingMode.ALL_ERRORS diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt similarity index 86% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt index bb93e31a8dc..bb7962338e6 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt @@ -1,4 +1,4 @@ -package org.oppia.android.util.logging.performancemetrics +package org.oppia.android.domain.oppialogger.logscheduler import dagger.Module import dagger.Provides diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogScheduler.kt similarity index 96% rename from utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogScheduler.kt index 0f019389ef3..de82dc42dfa 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogScheduler.kt @@ -1,4 +1,4 @@ -package org.oppia.android.util.logging.performancemetrics +package org.oppia.android.domain.oppialogger.logscheduler import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest 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 a9170621d0d..df198f52b8b 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 @@ -27,6 +27,7 @@ import org.oppia.android.domain.oppialogger.EventLogStorageCacheSize 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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.testing.FakePerformanceMetricsEventLogger @@ -45,7 +46,6 @@ 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.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModuleTest.kt similarity index 97% rename from utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt rename to domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModuleTest.kt index c040cbb70c3..ac65b6d1c92 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/MetricLogSchedulerModuleTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModuleTest.kt @@ -1,4 +1,4 @@ -package org.oppia.android.util.logging.performancemetrics +package org.oppia.android.domain.oppialogger.logscheduler import android.app.Application import android.content.Context 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 new file mode 100644 index 00000000000..c1fe4f18ac2 --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/logscheduler/PerformanceMetricsLogSchedulerTest.kt @@ -0,0 +1,205 @@ +package org.oppia.android.domain.oppialogger.logscheduler + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import androidx.work.Configuration +import androidx.work.Data +import androidx.work.PeriodicWorkRequest +import androidx.work.WorkInfo +import androidx.work.WorkManager +import androidx.work.testing.SynchronousExecutor +import androidx.work.testing.WorkManagerTestInitHelper +import com.google.common.truth.Truth.assertThat +import dagger.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.domain.oppialogger.LoggingIdentifierModule +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule +import org.oppia.android.domain.platformparameter.PlatformParameterModule +import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule +import org.oppia.android.testing.logging.SyncStatusTestModule +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.FakeOppiaClockModule +import org.oppia.android.util.caching.AssetModule +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.LoggerModule +import org.oppia.android.util.logging.firebase.LogReportingModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +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 [PerformanceMetricsLogScheduler]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsLogSchedulerTest.TestApplication::class) +class PerformanceMetricsLogSchedulerTest { + + @Inject + lateinit var performanceMetricsLogScheduler: PerformanceMetricsLogScheduler + + @Inject + lateinit var metricLogSchedulingWorkerFactory: MetricLogSchedulingWorkerFactory + + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + + private lateinit var workManager: WorkManager + + private lateinit var context: Context + + private val workerCaseForSchedulingPeriodicBackgroundMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_BACKGROUND_METRIC_WORKER + ) + .build() + + private val workerCaseForSchedulingStorageUsageMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER + ) + .build() + + private val workerCaseForSchedulingPeriodicUiMetricLogs: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_UI_METRIC_WORKER + ) + .build() + + @Before + fun setUp() { + setUpTestApplicationComponent() + context = InstrumentationRegistry.getInstrumentation().targetContext + val config = Configuration.Builder() + .setExecutor(SynchronousExecutor()) + .setWorkerFactory(metricLogSchedulingWorkerFactory) + .build() + WorkManagerTestInitHelper.initializeTestWorkManager(context, config) + workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + } + + @Test + fun testScheduler_enqueueRequestForPeriodicBackgroundMetrics_workRequestGetsEnqueued() { + val request = PeriodicWorkRequest + .Builder(MetricLogSchedulingWorker::class.java, 15, TimeUnit.MINUTES) + .setInputData(workerCaseForSchedulingPeriodicBackgroundMetricLogs) + .build() + + performanceMetricsLogScheduler.enqueueWorkRequestForPeriodicBackgroundMetrics( + workManager, + request + ) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.ENQUEUED) + } + + @Test + fun testScheduler_enqueueRequestForPeriodicUiMetric_workRequestGetsEnqueued() { + val request = PeriodicWorkRequest + .Builder(MetricLogSchedulingWorker::class.java, 15, TimeUnit.MINUTES) + .setInputData(workerCaseForSchedulingPeriodicUiMetricLogs) + .build() + + performanceMetricsLogScheduler.enqueueWorkRequestForPeriodicUiMetrics( + workManager, + request + ) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.ENQUEUED) + } + + @Test + fun testScheduler_enqueueRequestForStorageMetric_workRequestGetsEnqueued() { + val request = PeriodicWorkRequest + .Builder(MetricLogSchedulingWorker::class.java, 15, TimeUnit.MINUTES) + .setInputData(workerCaseForSchedulingStorageUsageMetricLogs) + .build() + + performanceMetricsLogScheduler.enqueueWorkRequestForStorageUsage( + workManager, + request + ) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.ENQUEUED) + } + + private fun setUpTestApplicationComponent() { + DaggerPerformanceMetricsLogSchedulerTest_TestApplicationComponent.builder() + .setApplication(ApplicationProvider.getApplicationContext()) + .build() + .inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + } + + // TODO(#89): Move this to a common test application component. + @Singleton + @Component( + modules = [ + TestModule::class, MetricLogSchedulerModule::class, LoggerModule::class, + RobolectricModule::class, LocaleProdModule::class, FakeOppiaClockModule::class, + TestDispatcherModule::class, LogReportWorkerModule::class, FakeOppiaClockModule::class, + NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, + AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, + LoggingIdentifierModule::class, SyncStatusTestModule::class, + PerformanceMetricsAssessorModule::class, ApplicationLifecycleModule::class, + LogReportingModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + + fun build(): TestApplicationComponent + } + + fun inject(performanceMetricsLogSchedulerTest: PerformanceMetricsLogSchedulerTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsLogSchedulerTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(performanceMetricsLogSchedulerTest: PerformanceMetricsLogSchedulerTest) { + component.inject(performanceMetricsLogSchedulerTest) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From 149cbd6080b249b7b1ef0461f2927f1b192aff40 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 13 Aug 2022 05:26:24 +0530 Subject: [PATCH 114/149] exemption removal --- scripts/assets/test_file_exemptions.textproto | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index 519fa5002e0..6fb84cf6c53 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -812,5 +812,4 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/perfor 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: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsLogScheduler.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulingWorkerFactory.kt" From 3a8b24837e717b21d93568a0ac4f8ff5505de957 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 13 Aug 2022 05:27:47 +0530 Subject: [PATCH 115/149] nits --- .../android/app/profileprogress/ProfilePictureActivityTest.kt | 2 +- .../android/app/profileprogress/ProfileProgressActivityTest.kt | 2 +- .../android/app/profileprogress/ProfileProgressFragmentTest.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 fe7e91d8139..f1e9541bb3c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -79,7 +80,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 00938b60667..4716612c00e 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -70,7 +71,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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule 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 5bbb41337ed..3593c3a83b7 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -119,7 +120,6 @@ 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.logging.firebase.FirebaseLogUploaderModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule From a4bfb65a8b3b2cfac41e53b1527a2b04559be132 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 17 Aug 2022 04:39:45 +0530 Subject: [PATCH 116/149] updates. --- .../PerformanceMetricsLoggerModule.kt | 10 ++--- .../logscheduler/MetricLogSchedulerModule.kt | 12 ++--- .../PerformanceMetricsLogSchedulerTest.kt | 7 ++- .../robolectric/OppiaShadowActivityManager.kt | 7 +-- .../OppiaShadowActivityManagerTest.kt | 13 +++++- .../OppiaShadowTrafficStatsTest.kt | 19 ++++---- .../PerformanceMetricsAssessorImpl.kt | 17 ++++--- .../PerformanceMetricsAssessorImplTest.kt | 45 +++++++++---------- 8 files changed, 71 insertions(+), 59 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt index ee7481194df..e8cf37beac6 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsLoggerModule.kt @@ -1,16 +1,16 @@ package org.oppia.android.domain.oppialogger.analytics +import dagger.Binds import dagger.Module -import dagger.Provides import dagger.multibindings.IntoSet import org.oppia.android.domain.oppialogger.ApplicationStartupListener /** Binds [PerformanceMetricsLogger] as an [ApplicationStartupListener] */ @Module -class PerformanceMetricsLoggerModule { - @Provides +abstract class PerformanceMetricsLoggerModule { + @Binds @IntoSet - fun providePerformanceMetricsLogger( + abstract fun providePerformanceMetricsLogger( performanceMetricsLogger: PerformanceMetricsLogger - ): ApplicationStartupListener = performanceMetricsLogger + ): ApplicationStartupListener } diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt index bb7962338e6..7594d6460ec 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/MetricLogSchedulerModule.kt @@ -1,14 +1,14 @@ package org.oppia.android.domain.oppialogger.logscheduler +import dagger.Binds import dagger.Module -import dagger.Provides import org.oppia.android.util.logging.MetricLogScheduler -/** Provides Log Generator related dependencies. */ +/** Provides metric log scheduler related dependencies. */ @Module -class MetricLogSchedulerModule { - @Provides - fun provideMetricLogScheduler( +abstract class MetricLogSchedulerModule { + @Binds + abstract fun provideMetricLogScheduler( performanceMetricLogScheduler: PerformanceMetricsLogScheduler - ): MetricLogScheduler = performanceMetricLogScheduler + ): MetricLogScheduler } 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 c1fe4f18ac2..8677bb89264 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 @@ -4,7 +4,6 @@ import android.app.Application import android.content.Context import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry import androidx.work.Configuration import androidx.work.Data import androidx.work.PeriodicWorkRequest @@ -61,9 +60,10 @@ class PerformanceMetricsLogSchedulerTest { @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - private lateinit var workManager: WorkManager + @Inject + lateinit var context: Context - private lateinit var context: Context + private lateinit var workManager: WorkManager private val workerCaseForSchedulingPeriodicBackgroundMetricLogs: Data = Data.Builder() .putString( @@ -89,7 +89,6 @@ class PerformanceMetricsLogSchedulerTest { @Before fun setUp() { setUpTestApplicationComponent() - context = InstrumentationRegistry.getInstrumentation().targetContext val config = Configuration.Builder() .setExecutor(SynchronousExecutor()) .setWorkerFactory(metricLogSchedulingWorkerFactory) diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt index e203bbce1dd..b2aedb35be0 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManager.kt @@ -4,6 +4,7 @@ import android.app.ActivityManager import android.os.Debug import org.robolectric.annotation.Implementation import org.robolectric.annotation.Implements +import org.robolectric.shadows.ShadowActivityManager /** * Shadows the Activity Manager to extend its testing capabilities. @@ -12,7 +13,7 @@ import org.robolectric.annotation.Implements * control over Debug.MemoryInfo and hence memory usage can't be tested using that. */ @Implements(ActivityManager::class) -class OppiaShadowActivityManager { +class OppiaShadowActivityManager : ShadowActivityManager() { private var processMemoryInfo: Array? = arrayOf(Debug.MemoryInfo()) @@ -27,7 +28,7 @@ class OppiaShadowActivityManager { } /** Sets [memoryInfo] as equal to [memoryInfoValue]. */ - fun setMemoryInfo(memoryInfoValue: ActivityManager.MemoryInfo) { + override fun setMemoryInfo(memoryInfoValue: ActivityManager.MemoryInfo) { this.memoryInfo = memoryInfoValue } @@ -42,7 +43,7 @@ class OppiaShadowActivityManager { /** Robolectric shadow override of [ActivityManager.getMemoryInfo]. */ @Implementation - fun getMemoryInfo(outInfo: ActivityManager.MemoryInfo) { + public override fun getMemoryInfo(outInfo: ActivityManager.MemoryInfo) { outInfo.apply { availMem = memoryInfo.availMem outInfo.lowMemory = memoryInfo.lowMemory diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt index 22e9bd554a5..463a0aa23de 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt @@ -15,12 +15,12 @@ import dagger.Provides import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject import javax.inject.Singleton -private val oppiaShadowActivityManager by lazy { OppiaShadowActivityManager() } - /** Tests for [OppiaShadowActivityManager]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @@ -32,6 +32,15 @@ private val oppiaShadowActivityManager by lazy { OppiaShadowActivityManager() } shadows = [OppiaShadowActivityManager::class] ) class OppiaShadowActivityManagerTest { + @Inject + lateinit var context: Context + + private val oppiaShadowActivityManager: OppiaShadowActivityManager by lazy { + shadowOf( + context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + ) as OppiaShadowActivityManager + } + @Before fun setUp() { setUpTestApplicationComponent() diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt index 24f9c6bbde6..e06cbb97cfb 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt @@ -2,6 +2,7 @@ package org.oppia.android.testing.robolectric import android.app.Application import android.content.Context +import android.net.TrafficStats import android.os.Build import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -16,10 +17,10 @@ import org.junit.Test import org.junit.runner.RunWith import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import org.robolectric.shadow.api.Shadow +import javax.inject.Inject import javax.inject.Singleton -private val oppiaShadowTrafficStats by lazy { OppiaShadowTrafficStats() } - /** Tests for [OppiaShadowTrafficStats]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @@ -31,6 +32,14 @@ private val oppiaShadowTrafficStats by lazy { OppiaShadowTrafficStats() } shadows = [OppiaShadowTrafficStats::class] ) class OppiaShadowTrafficStatsTest { + + @Inject + lateinit var context: Context + + private val oppiaShadowTrafficStats by lazy { + Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats + } + @Before fun setUp() { setUpTestApplicationComponent() @@ -46,24 +55,18 @@ class OppiaShadowTrafficStatsTest { fun testCustomShadow_initialState_returnsDefaultValuesForTxAndRxBytes() { assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(0L) assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(0L) - - OppiaShadowTrafficStats.reset() } @Test fun testCustomShadow_setUidTxBytes_returnsCorrectTxBytesValue() { oppiaShadowTrafficStats.setUidTxBytes(9) assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(9L) - - OppiaShadowTrafficStats.reset() } @Test fun testCustomShadow_setUidRxBytes_returnsCorrectTxBytesValue() { oppiaShadowTrafficStats.setUidRxBytes(9) assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(9L) - - OppiaShadowTrafficStats.reset() } private fun setUpTestApplicationComponent() { 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 862262f7dd8..d8a0818c60c 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 @@ -51,19 +51,22 @@ class PerformanceMetricsAssessorImpl @Inject constructor( return processMemoryInfo?.map { it.totalPss }?.sum()?.toLong() ?: 0L } - override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier = - when (getUsedStorage()) { - in 0L until lowStorageTierUpperBound -> LOW_STORAGE - in lowStorageTierUpperBound..mediumStorageTierUpperBound -> MEDIUM_STORAGE + override fun getDeviceStorageTier(): OppiaMetricLog.StorageTier { + val usedStorage = getUsedStorage() + return when { + usedStorage <= lowStorageTierUpperBound -> LOW_STORAGE + usedStorage <= mediumStorageTierUpperBound -> MEDIUM_STORAGE else -> HIGH_STORAGE } + } override fun getDeviceMemoryTier(): OppiaMetricLog.MemoryTier { val memoryInfo = ActivityManager.MemoryInfo() activityManager.getMemoryInfo(memoryInfo) - return when (memoryInfo.totalMem) { - in 0L until lowMemoryTierUpperBound -> LOW_MEMORY_TIER - in lowMemoryTierUpperBound..mediumMemoryTierUpperBound -> MEDIUM_MEMORY_TIER + val totalMemory = memoryInfo.totalMem + return when { + totalMemory <= lowMemoryTierUpperBound -> LOW_MEMORY_TIER + totalMemory <= mediumMemoryTierUpperBound -> MEDIUM_MEMORY_TIER else -> HIGH_MEMORY_TIER } } 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 52616203ef7..5fa25e5b23c 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 @@ -53,6 +53,7 @@ private const val TEST_FILE_NAME = "TEST_FILE_NAME" private const val ONE_KILOBYTE = 1024 private const val ONE_MEGABYTE = ONE_KILOBYTE * 1024 private const val TWO_MEGABYTES = ONE_MEGABYTE * 2L +private const val TWO_AND_HALF_MEGABYTES = ONE_MEGABYTE * 2.5 private const val THREE_MEGABYTES = ONE_MEGABYTE * 3L private const val ONE_GIGABYTE = ONE_MEGABYTE * 1024 private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L @@ -79,8 +80,10 @@ class PerformanceMetricsAssessorImplTest { @Inject lateinit var context: Context - private val activityManager by lazy { - context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + private val shadowActivityManager by lazy { + shadowOf( + context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + ) as OppiaShadowActivityManager } @Before @@ -114,7 +117,7 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_writeBytesLowerThanLowTierHigherBound_retsLowStorageUsageTier() { + fun testAssessor_writeBytesLowerThanLowTierHigherBound_retsLowStorageUsageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) .write(ByteArray(ONE_KILOBYTE)) assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) @@ -122,7 +125,7 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_writeBytesEqualToLowTierHigherBound_retsLowStorageUsageTier() { + fun testAssessor_writeBytesEqualToLowTierHigherBound_retsLowStorageUsageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) .write(ByteArray(ONE_MEGABYTE)) assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) @@ -130,15 +133,15 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_writeBytesEqualToMedTierLowerBound_retsMediumStorageUsageTier() { + fun testAssessor_writeBytesGreaterThanMediumTierLowerBound_retsMediumStorageUsageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) - .write(ByteArray(TWO_MEGABYTES.toInt())) + .write(ByteArray(TWO_AND_HALF_MEGABYTES.toInt())) assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) .isEqualTo(OppiaMetricLog.StorageTier.MEDIUM_STORAGE) } @Test - fun testPerformanceMetricsUtils_writeBytesEqualToMedTierHigherBound_retsMediumStorageUsageTier() { + fun testAssessor_writeBytesEqualToMedTierHigherBound_retsMediumStorageUsageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) .write(ByteArray(THREE_MEGABYTES.toInt())) assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) @@ -146,7 +149,7 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_writeBytesGreaterThanHighTierLowerBound_retsHighStorageTier() { + fun testAssessor_writeBytesGreaterThanHighTierLowerBound_retsHighStorageTier() { context.openFileOutput(TEST_APP_PATH, Context.MODE_PRIVATE) .write(ByteArray(TWO_MEGABYTES.toInt() * 2)) assertThat(performanceMetricsAssessorImpl.getDeviceStorageTier()) @@ -154,27 +157,24 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { + fun testAssessor_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats shadow.setUidTxBytes(20L) - assertThat(performanceMetricsAssessorImpl.getTotalSentBytes()) - .isEqualTo(20L) + assertThat(performanceMetricsAssessorImpl.getTotalSentBytes()).isEqualTo(20L) } @Test - fun testPerformanceMetricsUtils_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { + fun testAssessor_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats shadow.setUidRxBytes(20L) - assertThat(performanceMetricsAssessorImpl.getTotalReceivedBytes()) - .isEqualTo(20L) + assertThat(performanceMetricsAssessorImpl.getTotalReceivedBytes()).isEqualTo(20L) } @Test fun testAssessor_setProcessMemoryInfo_setTotalPss_returnsCorrectMemoryUsage() { - val shadow = Shadow.extract(activityManager) as OppiaShadowActivityManager - shadow.setProcessMemoryInfo( + shadowActivityManager.setProcessMemoryInfo( Debug.MemoryInfo().apply { this.nativePss = 2 this.dalvikPss = 1 @@ -186,7 +186,7 @@ class PerformanceMetricsAssessorImplTest { } @Test - fun testPerformanceMetricsUtils_removeCurrentApp_installTestApp_returnsCorrectApkSize() { + fun testAssessor_removeCurrentApp_installTestApp_returnsCorrectApkSize() { val shadowPackageManager = shadowOf(context.packageManager) File(TEST_APP_PATH).writeBytes(ByteArray(ONE_MEGABYTE)) val applicationInfo = context.applicationInfo.apply { @@ -209,8 +209,7 @@ class PerformanceMetricsAssessorImplTest { OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=1147483648"), OppiaParameterizedTestRunner.Iteration("memoryJustBelowUpperBound", "totalMemory=2147483647") ) - fun testPerformanceMetricsUtils_setTotalMemoryForLowMemoryRange_returnsCorrectLowMemoryTier() { - val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager + fun testAssessor_setTotalMemoryForLowMemoryRange_returnsCorrectLowMemoryTier() { val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) @@ -221,12 +220,11 @@ class PerformanceMetricsAssessorImplTest { @Test @RunParameterized( - OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=2147483648"), + OppiaParameterizedTestRunner.Iteration("memoryEqualToLowerBound", "totalMemory=2147483649"), OppiaParameterizedTestRunner.Iteration("memoryInRange", "totalMemory=2684354560"), OppiaParameterizedTestRunner.Iteration("memoryEqualToUpperBound", "totalMemory=3221225472") ) - fun testPerformanceMetricsUtils_setTotalMemoryForMediumMemoryRange_retsCorrectMediumMemoryTier() { - val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager + fun testAssessor_setTotalMemoryForMediumMemoryRange_retsCorrectMediumMemoryTier() { val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) @@ -244,8 +242,7 @@ class PerformanceMetricsAssessorImplTest { "totalMemory=9223372036854775807" ) ) - fun testPerformanceMetricsUtils_setTotalMemoryForHighMemoryRange_retsCorrectHighMemoryTier() { - val shadowActivityManager = Shadow.extract(activityManager) as OppiaShadowActivityManager + fun testAssessor_setTotalMemoryForHighMemoryRange_retsCorrectHighMemoryTier() { val memoryInfo = ActivityManager.MemoryInfo() memoryInfo.totalMem = totalMemory shadowActivityManager.setMemoryInfo(memoryInfo) From 4442ebd4a3749260c58b7a11f1323ddd8cadd08b Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 23 Aug 2022 04:38:52 +0530 Subject: [PATCH 117/149] variable nits + parameterized test exemption --- scripts/assets/file_content_validation_checks.textproto | 1 + .../testing/robolectric/OppiaShadowActivityManagerTest.kt | 5 ++--- .../testing/robolectric/OppiaShadowTrafficStatsTest.kt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/assets/file_content_validation_checks.textproto b/scripts/assets/file_content_validation_checks.textproto index 4588b4552ed..99c34c15071 100644 --- a/scripts/assets/file_content_validation_checks.textproto +++ b/scripts/assets/file_content_validation_checks.textproto @@ -306,6 +306,7 @@ file_content_checks { exempted_file_name: "utility/src/test/java/org/oppia/android/util/math/MathTokenizerTest.kt" exempted_file_name: "utility/src/test/java/org/oppia/android/util/math/PolynomialExtensionsTest.kt" exempted_file_name: "utility/src/test/java/org/oppia/android/util/math/RealExtensionsTest.kt" + exempted_file_name: "utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImplTest.kt" exempted_file_patterns: "testing/src/main/java/org/oppia/android/testing/junit/.+?\\.kt" } file_content_checks { diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt index 463a0aa23de..68b4ab18cc3 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt @@ -35,11 +35,10 @@ class OppiaShadowActivityManagerTest { @Inject lateinit var context: Context - private val oppiaShadowActivityManager: OppiaShadowActivityManager by lazy { - shadowOf( + private val oppiaShadowActivityManager: OppiaShadowActivityManager + get() = shadowOf( context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager ) as OppiaShadowActivityManager - } @Before fun setUp() { diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt index e06cbb97cfb..a5b537636c2 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt @@ -36,9 +36,9 @@ class OppiaShadowTrafficStatsTest { @Inject lateinit var context: Context - private val oppiaShadowTrafficStats by lazy { - Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats - } + private val oppiaShadowTrafficStats: OppiaShadowTrafficStats + get() = + Shadow.extract(Shadow.newInstanceOf(TrafficStats::class.java)) as OppiaShadowTrafficStats @Before fun setUp() { From 3b1ee7ddcdd684c0e3987f3ecb73ad19972faffb Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 23 Aug 2022 04:58:05 +0530 Subject: [PATCH 118/149] app component dependencies. --- .../application/alpha/AlphaApplicationComponent.kt | 10 +++++++--- .../alphakenya/AlphaKenyaApplicationComponent.kt | 10 +++++++--- .../application/dev/DeveloperApplicationComponent.kt | 11 ++++++++--- 3 files changed, 22 insertions(+), 9 deletions(-) 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 8aa2c20f6bd..85f6e734325 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 @@ -34,7 +34,6 @@ 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.exceptions.UncaughtExceptionLoggerModule -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -58,6 +57,10 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for alpha versions of the application. @@ -77,7 +80,7 @@ import javax.inject.Singleton LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, RatioInputModule::class, UncaughtExceptionLoggerModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, @@ -89,7 +92,8 @@ import javax.inject.Singleton LoggingIdentifierModule::class, ApplicationLifecycleModule::class, NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, - HintsAndSolutionProdModule::class + HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::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 5a31d7f8f4d..859d9e501af 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 @@ -34,7 +34,6 @@ 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.exceptions.UncaughtExceptionLoggerModule -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterAlphaKenyaModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -58,6 +57,10 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for the alpha version of the application specific to a user study in Kenya. @@ -77,7 +80,7 @@ import javax.inject.Singleton LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, RatioInputModule::class, UncaughtExceptionLoggerModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigAlphaKenyaModule::class, FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class, PlatformParameterAlphaKenyaModule::class, PlatformParameterSingletonModule::class, @@ -89,7 +92,8 @@ import javax.inject.Singleton LoggingIdentifierModule::class, ApplicationLifecycleModule::class, NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, - HintsAndSolutionProdModule::class + HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, + PerformanceMetricsAssessorModule::class ] ) interface AlphaKenyaApplicationComponent : 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 aee630025d2..a0494d68a17 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 @@ -35,7 +35,6 @@ 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.exceptions.UncaughtExceptionLoggerModule -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -59,6 +58,10 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for developer versions of the application. @@ -79,7 +82,7 @@ import javax.inject.Singleton ViewBindingShimModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, RatioInputModule::class, UncaughtExceptionLoggerModule::class, ApplicationStartupListenerModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionDebugModule::class, FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, @@ -90,7 +93,9 @@ import javax.inject.Singleton NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class + NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, + MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, + PerformanceMetricsAssessorModule::class ] ) interface DeveloperApplicationComponent : ApplicationComponent { From 4c1a3515bb216880afadd14228ea98e669f9369d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 23 Aug 2022 05:01:34 +0530 Subject: [PATCH 119/149] nits --- .../application/alpha/AlphaApplicationComponent.kt | 12 ++++++------ .../alphakenya/AlphaKenyaApplicationComponent.kt | 12 ++++++------ .../application/dev/DeveloperApplicationComponent.kt | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) 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 85f6e734325..0a9049866ae 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 @@ -33,7 +33,10 @@ 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.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -49,6 +52,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.firebase.LogReportingModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilProdModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -57,10 +61,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule -import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for alpha versions of the application. @@ -92,8 +92,8 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAsses LoggingIdentifierModule::class, ApplicationLifecycleModule::class, NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, - HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, - PerformanceMetricsAssessorModule::class + HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, + PerformanceMetricsLoggerModule::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 859d9e501af..e501520e80c 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,7 +33,10 @@ 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.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterAlphaKenyaModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -49,6 +52,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.firebase.LogReportingModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilProdModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -57,10 +61,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule -import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for the alpha version of the application specific to a user study in Kenya. @@ -92,8 +92,8 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAsses LoggingIdentifierModule::class, ApplicationLifecycleModule::class, NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, - HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, - PerformanceMetricsAssessorModule::class + HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, + PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class ] ) interface AlphaKenyaApplicationComponent : 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 a0494d68a17..e1ef44f0d37 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 @@ -34,7 +34,10 @@ 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.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -50,6 +53,7 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -58,10 +62,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule -import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule /** * Root Dagger component for developer versions of the application. @@ -93,8 +93,8 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAsses NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, - MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, + NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, + SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class ] ) From 4efd9e6c794321cfa497b0e2440dc7c7c18d8032 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 03:21:58 +0530 Subject: [PATCH 120/149] logging module bazel build, config module creation --- .../alpha/AlphaApplicationComponent.kt | 4 +- .../AlphaKenyaApplicationComponent.kt | 4 +- .../dev/DeveloperApplicationComponent.kt | 3 +- .../devoptions/ViewEventLogsActivityTest.kt | 3 +- .../devoptions/ViewEventLogsFragmentTest.kt | 4 +- .../MetricLogSchedulingWorkerTest.kt | 4 +- .../PerformanceMetricsLogSchedulerTest.kt | 3 +- model/src/main/proto/BUILD.bazel | 11 +++ .../oppia/android/util/logging/BUILD.bazel | 12 ++++ .../android/util/logging/firebase/BUILD.bazel | 2 + .../logging/performancemetrics/BUILD.bazel | 71 +++++++++++++++++++ .../PerformanceMetricsAssessorModule.kt | 37 ---------- .../PerformanceMetricsConfigurationsModule.kt | 48 +++++++++++++ 13 files changed, 162 insertions(+), 44 deletions(-) create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel create mode 100644 utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt 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 0a9049866ae..526767919ff 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 @@ -61,6 +61,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for alpha versions of the application. @@ -93,7 +94,8 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class + PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class, + PerformanceMetricsConfigurationsModule::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 e501520e80c..b69f19b21d3 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 @@ -61,6 +61,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for the alpha version of the application specific to a user study in Kenya. @@ -93,7 +94,8 @@ import javax.inject.Singleton NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class, HintsAndSolutionProdModule::class, MetricLogSchedulerModule::class, - PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class + PerformanceMetricsLoggerModule::class, PerformanceMetricsAssessorModule::class, + PerformanceMetricsConfigurationsModule::class ] ) interface AlphaKenyaApplicationComponent : 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 e1ef44f0d37..c0945a1e650 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 @@ -62,6 +62,7 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for developer versions of the application. @@ -95,7 +96,7 @@ import javax.inject.Singleton LoggingIdentifierModule::class, ApplicationLifecycleModule::class, NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, - PerformanceMetricsAssessorModule::class + PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class ] ) interface DeveloperApplicationComponent : 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 c844d062074..2e693606c82 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 @@ -88,6 +88,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) @@ -177,7 +178,7 @@ class ViewEventLogsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, - PerformanceMetricsAssessorModule::class + PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::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 4aadecec4e1..29ec5aa24f5 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 @@ -95,6 +95,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" @@ -576,7 +577,8 @@ class ViewEventLogsFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, - MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class + MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, + PerformanceMetricsConfigurationsModule::class ] ) 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 8e6ef1fd294..8d7cdaf8126 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 @@ -59,6 +59,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. @@ -237,7 +238,8 @@ class MetricLogSchedulingWorkerTest { NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, - PerformanceMetricsAssessorModule::class, ApplicationLifecycleModule::class + PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, + ApplicationLifecycleModule::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 8677bb89264..368c76bc3c4 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 @@ -42,6 +42,7 @@ import org.robolectric.annotation.LooperMode import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [PerformanceMetricsLogScheduler]. */ // FunctionName: test names are conventionally named with underscores. @@ -173,7 +174,7 @@ class PerformanceMetricsLogSchedulerTest { AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, PerformanceMetricsAssessorModule::class, ApplicationLifecycleModule::class, - LogReportingModule::class + LogReportingModule::class, PerformanceMetricsConfigurationsModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/model/src/main/proto/BUILD.bazel b/model/src/main/proto/BUILD.bazel index 02838f1c01c..c6d19966e44 100644 --- a/model/src/main/proto/BUILD.bazel +++ b/model/src/main/proto/BUILD.bazel @@ -50,6 +50,17 @@ java_lite_proto_library( deps = [":event_logger_proto"], ) +oppia_proto_library( + name = "performance_metrics_event_logger_proto", + srcs = ["performance_metrics.proto"], +) + +java_lite_proto_library( + name = "performance_metrics_event_logger_java_proto_lite", + visibility = ["//:oppia_api_visibility"], + deps = [":performance_metrics_event_logger_proto"], +) + oppia_proto_library( name = "exploration_checkpoint_proto", srcs = ["exploration_checkpoint.proto"], diff --git a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel index 0354a058096..a96279e3f68 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel @@ -126,6 +126,18 @@ kt_android_library( ], ) +kt_android_library( + name = "metric_log_scheduler", + srcs = [ + "MetricLogScheduler.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//third_party:androidx_work_work-runtime", + "//third_party:androidx_work_work-runtime-ktx", + ], +) + kt_android_library( name = "sync_status_manager", srcs = [ diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel index 66454426511..ce150bb33b7 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel @@ -24,12 +24,14 @@ kt_android_library( ], deps = [ "//model/src/main/proto:event_logger_java_proto_lite", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:androidx_work_work-runtime", "//third_party:androidx_work_work-runtime-ktx", "//third_party:com_google_firebase_firebase-analytics", "//third_party:javax_inject_javax_inject", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", "//utility/src/main/java/org/oppia/android/util/logging:sync_status_manager", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", 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 new file mode 100644 index 00000000000..893287b3f05 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/BUILD.bazel @@ -0,0 +1,71 @@ +""" +General purpose utilities for logging. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "performance_metrics_event_logger", + srcs = [ + "PerformanceMetricsEventLogger.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + ], +) + +kt_android_library( + name = "performance_metrics_assessor", + srcs = [ + "PerformanceMetricsAssessor.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + ], +) + +kt_android_library( + name = "performance_metrics_assessor_module", + srcs = [ + "PerformanceMetricsAssessorModule.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//third_party:javax_inject_javax_inject", + ":dagger", + ":performance_metrics_assessor_impl" + ], +) + +kt_android_library( + name = "performance_metrics_assessor_impl", + srcs = [ + "PerformanceMetricsAssessorImpl.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//third_party:javax_inject_javax_inject", + ":performance_metrics_assessor", + ":performance_metrics_configurations_module" + ], +) + +kt_android_library( + name = "performance_metrics_configurations_module", + srcs = [ + "PerformanceMetricsConfigurationsModule.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//third_party:javax_inject_javax_inject", + ":dagger" + ], +) + +dagger_rules() diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt index 8e166caa9e9..603ff9fe14b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt @@ -2,27 +2,6 @@ package org.oppia.android.util.logging.performancemetrics import dagger.Module import dagger.Provides -import org.oppia.android.app.model.OppiaMetricLog.MemoryTier -import org.oppia.android.app.model.OppiaMetricLog.StorageTier -import javax.inject.Qualifier - -private const val ONE_GIGABYTE = 1024L * 1024L * 1024L -private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L -private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L -private const val THIRTY_TWO_GIGABYTES = ONE_GIGABYTE * 36L -private const val SIXTY_FOUR_GIGABYTES = ONE_GIGABYTE * 64L - -/** Corresponds to a long value that denotes the non-inclusive upper bound of [StorageTier.LOW_STORAGE]. */ -@Qualifier annotation class LowStorageTierUpperBound - -/** Corresponds to a long value that denotes the inclusive upper bound of [StorageTier.MEDIUM_STORAGE]. */ -@Qualifier annotation class MediumStorageTierUpperBound - -/** Corresponds to a long value that denotes the non-inclusive upper bound of [MemoryTier.LOW_MEMORY_TIER]. */ -@Qualifier annotation class LowMemoryTierUpperBound - -/** Corresponds to a long value that denotes the inclusive upper bound of [MemoryTier.MEDIUM_MEMORY_TIER]. */ -@Qualifier annotation class MediumMemoryTierUpperBound /** Provides production-specific performance metrics utilities related dependencies. */ @Module @@ -32,20 +11,4 @@ class PerformanceMetricsAssessorModule { fun providePerformanceMetricsAssessor( performanceMetricsAssessorImpl: PerformanceMetricsAssessorImpl ): PerformanceMetricsAssessor = performanceMetricsAssessorImpl - - @Provides - @LowStorageTierUpperBound - fun provideLowStorageTierUpperBound(): Long = THIRTY_TWO_GIGABYTES - - @Provides - @MediumStorageTierUpperBound - fun provideMediumStorageTierUpperBound(): Long = SIXTY_FOUR_GIGABYTES - - @Provides - @LowMemoryTierUpperBound - fun provideLowMemoryTierUpperBound(): Long = TWO_GIGABYTES - - @Provides - @MediumMemoryTierUpperBound - fun provideMediumMemoryTierUpperBound(): Long = THREE_GIGABYTES } diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt new file mode 100644 index 00000000000..5adbc82824b --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt @@ -0,0 +1,48 @@ +package org.oppia.android.util.logging.performancemetrics + +import dagger.Module +import dagger.Provides +import javax.inject.Qualifier +import org.oppia.android.app.model.OppiaMetricLog.MemoryTier +import org.oppia.android.app.model.OppiaMetricLog.StorageTier + +private const val ONE_GIGABYTE = 1024L * 1024L * 1024L +private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L +private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L +private const val THIRTY_TWO_GIGABYTES = ONE_GIGABYTE * 36L +private const val SIXTY_FOUR_GIGABYTES = ONE_GIGABYTE * 64L + +/** Corresponds to a long value that denotes the non-inclusive upper bound of [StorageTier.LOW_STORAGE]. */ +@Qualifier +annotation class LowStorageTierUpperBound + +/** Corresponds to a long value that denotes the inclusive upper bound of [StorageTier.MEDIUM_STORAGE]. */ +@Qualifier +annotation class MediumStorageTierUpperBound + +/** Corresponds to a long value that denotes the non-inclusive upper bound of [MemoryTier.LOW_MEMORY_TIER]. */ +@Qualifier +annotation class LowMemoryTierUpperBound + +/** Corresponds to a long value that denotes the inclusive upper bound of [MemoryTier.MEDIUM_MEMORY_TIER]. */ +@Qualifier +annotation class MediumMemoryTierUpperBound + +@Module +class PerformanceMetricsConfigurationsModule { + @Provides + @LowStorageTierUpperBound + fun provideLowStorageTierUpperBound(): Long = THIRTY_TWO_GIGABYTES + + @Provides + @MediumStorageTierUpperBound + fun provideMediumStorageTierUpperBound(): Long = SIXTY_FOUR_GIGABYTES + + @Provides + @LowMemoryTierUpperBound + fun provideLowMemoryTierUpperBound(): Long = TWO_GIGABYTES + + @Provides + @MediumMemoryTierUpperBound + fun provideMediumMemoryTierUpperBound(): Long = THREE_GIGABYTES +} \ No newline at end of file From 1d011bc4b04f7fb87c8cf05e0dfd018fd48c9ff6 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 03:44:31 +0530 Subject: [PATCH 121/149] testing robolectric bazel module update --- .../android/testing/robolectric/BUILD.bazel | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel index 89c998daa24..a26d582a191 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel @@ -50,4 +50,36 @@ kt_android_library( ], ) +kt_android_library( + name = "oppia_shadow_activity_manager", + testonly = True, + srcs = [ + "OppiaShadowActivityManager.kt", + ], + visibility = [ + "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", + "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", + "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", + ], + deps = [ + "//third_party:org_robolectric_robolectric", + ], +) + +kt_android_library( + name = "oppia_shadow_traffic_stats", + testonly = True, + srcs = [ + "OppiaShadowTrafficStats.kt", + ], + visibility = [ + "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", + "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", + "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", + ], + deps = [ + "//third_party:org_robolectric_robolectric", + ], +) + dagger_rules() From b79853d59ed15c3b7a4ce91aa9d00f358cb7b630 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 04:30:36 +0530 Subject: [PATCH 122/149] domain bazel build fixes --- .../domain/oppialogger/analytics/BUILD.bazel | 53 ++++++++++++++++ .../oppialogger/logscheduler/BUILD.bazel | 60 +++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel 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 5616ff68418..e7e75a41052 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 @@ -24,6 +24,26 @@ kt_android_library( ], ) +kt_android_library( + name = "performance_metrics_controller", + srcs = [ + "PerformanceMetricsController.kt", + ], + visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], + deps = [ + ":dagger", + "//data/src/main/java/org/oppia/android/data/persistence:cache_store", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/data:data_provider", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", + "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", + ], +) + kt_android_library( name = "learner_analytics_logger", srcs = [ @@ -39,6 +59,38 @@ kt_android_library( ], ) +kt_android_library( + name = "performance_metrics_logger", + srcs = [ + "PerformanceMetricsLogger.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + ":dagger", + ":performance_metrics_controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", + ], +) + +kt_android_library( + name = "performance_metrics_logger_module", + srcs = [ + "PerformanceMetricsLoggerModule.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + ":dagger", + ":performance_metrics_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + + ], +) + kt_android_library( name = "learner_analytics_inactivity_limit_millis", srcs = [ @@ -59,6 +111,7 @@ kt_android_library( deps = [ ":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/profile:profile_management_controller", 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 new file mode 100644 index 00000000000..ac16d4e1c07 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler/BUILD.bazel @@ -0,0 +1,60 @@ +""" +Library for providing log scheduling functionality to the Oppia android app. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "performance_metrics_log_scheduler", + srcs = [ + "PerformanceMetricsLogScheduler.kt", + ], + deps = [ + ":metric_log_scheduling_worker", + "//third_party:androidx_work_work-runtime-ktx", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", + ], +) + +kt_android_library( + name = "metric_log_scheduling_worker", + srcs = [ + "MetricLogSchedulingWorker.kt", + ], + deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", + "//domain/src/main/java/org/oppia/android/domain/util:extensions", + "//third_party:androidx_work_work-runtime-ktx", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/threading:annotations", + ], +) + +kt_android_library( + name = "metric_log_scheduling_worker_factory", + srcs = [ + "MetricLogSchedulingWorkerFactory.kt", + ], + visibility = ["//domain:__pkg__"], + deps = [ + ":metric_log_scheduling_worker", + "//third_party:androidx_work_work-runtime-ktx", + ], +) + +kt_android_library( + name = "metric_log_scheduler_module", + srcs = [ + "MetricLogSchedulerModule.kt", + ], + visibility = ["//:oppia_prod_module_visibility"], + deps = [ + ":dagger", + ":performance_metrics_log_scheduler", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + ], +) + +dagger_rules() From ba19784f5df9bf4c24e2836443e79ed2aa60f79e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 05:31:27 +0530 Subject: [PATCH 123/149] working oppia bazel build --- .../oppia/android/app/application/BUILD.bazel | 4 ++++ domain/BUILD.bazel | 1 + .../oppialogger/logscheduler/BUILD.bazel | 1 + .../oppialogger/loguploader/BUILD.bazel | 6 ++++-- .../oppialogger/logscheduler/BUILD.bazel | 21 +++++++++++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel 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 9b2927ff303..196c6c95caa 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,8 +115,10 @@ 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: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", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_module", "//utility/src/main/java/org/oppia/android/util/accessibility:prod_module", "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", @@ -129,6 +131,8 @@ android_library( "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_module", "//utility/src/main/java/org/oppia/android/util/parser/image:repository_glide_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/domain/BUILD.bazel b/domain/BUILD.bazel index 396d1f7e97b..37c5abd899d 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -116,6 +116,7 @@ kt_android_library( "//domain/src/main/java/org/oppia/android/domain/util:asset", "//domain/src/main/java/org/oppia/android/domain/util:extensions", "//domain/src/main/java/org/oppia/android/domain/util:retriever", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker_factory", "//model/src/main/proto:exploration_checkpoint_java_proto_lite", "//model/src/main/proto:onboarding_java_proto_lite", "//model/src/main/proto:platform_parameter_java_proto_lite", 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 ac16d4e1c07..85f0b74bbd5 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 @@ -22,6 +22,7 @@ kt_android_library( srcs = [ "MetricLogSchedulingWorker.kt", ], + visibility = ["//:oppia_api_visibility"], deps = [ "//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/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel index dceb88ec499..c19776e970e 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -8,13 +8,15 @@ load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") kt_android_library( name = "initializer", srcs = [ - "LogUploadWorkManagerInitializer.kt", + "LogReportWorkManagerInitializer.kt", ], deps = [ ":worker", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker" ], ) @@ -50,7 +52,7 @@ kt_android_library( kt_android_library( name = "worker_module", srcs = [ - "LogUploadWorkerModule.kt", + "LogReportWorkerModule.kt", ], visibility = ["//:oppia_prod_module_visibility"], deps = [ diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel new file mode 100644 index 00000000000..5a331327056 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel @@ -0,0 +1,21 @@ +""" +Package for testing utilities for log uploading functionality. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "fake_log_scheduler", + testonly = True, + srcs = [ + "FakeLogScheduler.kt", + ], + visibility = ["//:oppia_testing_visibility"], + deps = [ + ":dagger", + "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", + ], +) + +dagger_rules() From 650f272e02bbd6a2deb79a82127bbb807a9405e6 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 05:37:15 +0530 Subject: [PATCH 124/149] nits. --- .../app/application/alpha/AlphaApplicationComponent.kt | 2 +- .../application/alphakenya/AlphaKenyaApplicationComponent.kt | 2 +- .../app/application/dev/DeveloperApplicationComponent.kt | 2 +- .../oppia/android/app/devoptions/ViewEventLogsActivityTest.kt | 2 +- .../oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt | 2 +- .../oppialogger/logscheduler/MetricLogSchedulingWorkerTest.kt | 2 +- .../logscheduler/PerformanceMetricsLogSchedulerTest.kt | 2 +- .../PerformanceMetricsConfigurationsModule.kt | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) 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 526767919ff..997ff520abf 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 @@ -53,6 +53,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.firebase.LogReportingModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilProdModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -61,7 +62,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for alpha versions of the application. 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 b69f19b21d3..2d20f037a76 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 @@ -53,6 +53,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.firebase.LogReportingModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilProdModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -61,7 +62,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for the alpha version of the application specific to a user study in Kenya. 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 c0945a1e650..9d2bd782568 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 @@ -54,6 +54,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -62,7 +63,6 @@ import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** * Root Dagger component for developer versions of the application. 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 2e693606c82..2104922adec 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 @@ -79,6 +79,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -88,7 +89,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [ViewEventLogsActivity]. */ @RunWith(AndroidJUnit4::class) 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 29ec5aa24f5..e10ba410943 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 @@ -86,6 +86,7 @@ import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -95,7 +96,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule private const val TEST_TIMESTAMP = 1624902815000 private const val TEST_TOPIC_ID = "test_topicId" 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 8d7cdaf8126..0dec4bb0a2a 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 @@ -52,6 +52,7 @@ import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.LogUploader import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -59,7 +60,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. 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 368c76bc3c4..7d8985f71b2 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 @@ -36,13 +36,13 @@ import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.firebase.LogReportingModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule 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 -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule /** Tests for [PerformanceMetricsLogScheduler]. */ // FunctionName: test names are conventionally named with underscores. diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt index 5adbc82824b..205758e81e2 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt @@ -2,9 +2,9 @@ package org.oppia.android.util.logging.performancemetrics import dagger.Module import dagger.Provides -import javax.inject.Qualifier import org.oppia.android.app.model.OppiaMetricLog.MemoryTier import org.oppia.android.app.model.OppiaMetricLog.StorageTier +import javax.inject.Qualifier private const val ONE_GIGABYTE = 1024L * 1024L * 1024L private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L @@ -45,4 +45,4 @@ class PerformanceMetricsConfigurationsModule { @Provides @MediumMemoryTierUpperBound fun provideMediumMemoryTierUpperBound(): Long = THREE_GIGABYTES -} \ No newline at end of file +} From f519ea1d97956c9295acfab969c4837b4c1cc3bf Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 07:32:16 +0530 Subject: [PATCH 125/149] nits. --- .../oppia/android/app/application/BUILD.bazel | 4 +-- domain/BUILD.bazel | 8 +++--- .../domain/oppialogger/analytics/BUILD.bazel | 25 +++++++++---------- .../oppialogger/logscheduler/BUILD.bazel | 8 +++--- .../oppialogger/loguploader/BUILD.bazel | 8 +++--- .../android/util/logging/firebase/BUILD.bazel | 10 ++++---- .../logging/performancemetrics/BUILD.bazel | 2 +- .../PerformanceMetricsConfigurationsModule.kt | 3 +++ 8 files changed, 35 insertions(+), 33 deletions(-) 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 196c6c95caa..d3a45ca59bf 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 @@ -124,6 +124,8 @@ android_library( "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching:caching_prod_module", "//utility/src/main/java/org/oppia/android/util/locale: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", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -131,8 +133,6 @@ android_library( "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_module", "//utility/src/main/java/org/oppia/android/util/parser/image:repository_glide_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/domain/BUILD.bazel b/domain/BUILD.bazel index 37c5abd899d..1a5498226ba 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -99,15 +99,15 @@ kt_android_library( manifest = "src/main/AndroidManifest.xml", visibility = ["//visibility:public"], deps = [ - ":dagger", "//data/src/main/java/org/oppia/android/data/backends/gae/api", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/classify:answer_classification_controller", "//domain/src/main/java/org/oppia/android/domain/classify:classification_result", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker_factory", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", "//domain/src/main/java/org/oppia/android/domain/state:state_deck", "//domain/src/main/java/org/oppia/android/domain/state:state_graph", @@ -116,7 +116,6 @@ kt_android_library( "//domain/src/main/java/org/oppia/android/domain/util:asset", "//domain/src/main/java/org/oppia/android/domain/util:extensions", "//domain/src/main/java/org/oppia/android/domain/util:retriever", - "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker_factory", "//model/src/main/proto:exploration_checkpoint_java_proto_lite", "//model/src/main/proto:onboarding_java_proto_lite", "//model/src/main/proto:platform_parameter_java_proto_lite", @@ -136,6 +135,7 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/parser/html:exploration_html_parser_entity_type", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_annonations", "//utility/src/main/java/org/oppia/android/util/profile:directory_management_util", + ":dagger", ], ) 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 e7e75a41052..6f0ae4b3168 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 @@ -12,7 +12,6 @@ kt_android_library( ], visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], deps = [ - ":dagger", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:event_logger_java_proto_lite", @@ -21,6 +20,7 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/logging:event_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", + ":dagger" ], ) @@ -31,16 +31,16 @@ kt_android_library( ], visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], deps = [ - ":dagger", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//utility/src/main/java/org/oppia/android/util/data:data_provider", - "//utility/src/main/java/org/oppia/android/util/logging:console_logger", - "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", + ":dagger" ], ) @@ -51,11 +51,11 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ - ":dagger", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", "//model/src/main/proto:event_logger_java_proto_lite", "//model/src/main/proto:exploration_checkpoint_java_proto_lite", + ":dagger" ], ) @@ -66,14 +66,14 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ - ":dagger", - ":performance_metrics_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", - "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", + ":dagger", + ":performance_metrics_controller" ], ) @@ -84,10 +84,9 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ":dagger", ":performance_metrics_logger", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", - ], ) @@ -109,14 +108,14 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ - ":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/profile:profile_management_controller", "//third_party:androidx_lifecycle_lifecycle-extensions", "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", + ":dagger", + ":learner_analytics_inactivity_limit_millis", + ":performance_metrics_controller", ], ) 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 85f0b74bbd5..9e2e473d323 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 @@ -11,9 +11,9 @@ kt_android_library( "PerformanceMetricsLogScheduler.kt", ], deps = [ - ":metric_log_scheduling_worker", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", + ":metric_log_scheduling_worker", ], ) @@ -39,8 +39,8 @@ kt_android_library( ], visibility = ["//domain:__pkg__"], deps = [ - ":metric_log_scheduling_worker", "//third_party:androidx_work_work-runtime-ktx", + ":metric_log_scheduling_worker", ], ) @@ -51,10 +51,10 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", ":dagger", ":performance_metrics_log_scheduler", - "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ], ) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel index c19776e970e..f0feac3bbd9 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -11,12 +11,12 @@ kt_android_library( "LogReportWorkManagerInitializer.kt", ], deps = [ - ":worker", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker" "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", - "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker" + ":worker", ], ) @@ -44,8 +44,8 @@ kt_android_library( ], visibility = ["//domain:__pkg__"], deps = [ - ":worker", "//third_party:androidx_work_work-runtime-ktx", + ":worker", ], ) @@ -56,9 +56,9 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ":dagger", ":initializer", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ], ) diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel index ce150bb33b7..38a92e184ae 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel @@ -29,9 +29,9 @@ kt_android_library( "//third_party:androidx_work_work-runtime-ktx", "//third_party:com_google_firebase_firebase-analytics", "//third_party:javax_inject_javax_inject", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", "//utility/src/main/java/org/oppia/android/util/logging:sync_status_manager", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", @@ -46,14 +46,14 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ - ":dagger", - ":firebase_exception_logger", - ":prod_impl", "//third_party:com_google_firebase_firebase-analytics", "//third_party:com_google_firebase_firebase-crashlytics", "//third_party:javax_inject_javax_inject", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", + ":dagger", + ":firebase_exception_logger", + ":prod_impl", ], ) @@ -66,10 +66,10 @@ kt_android_library( "//app:__pkg__", ], deps = [ - ":prod_impl", "//model/src/main/proto:event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", + ":prod_impl", ], ) 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 893287b3f05..b1a979c3ed0 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 @@ -1,5 +1,5 @@ """ -General purpose utilities for logging. +General purpose utilities for performance metrics logging. """ load("@dagger//:workspace_defs.bzl", "dagger_rules") diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt index 205758e81e2..a64aa23e903 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt @@ -28,6 +28,9 @@ annotation class LowMemoryTierUpperBound @Qualifier annotation class MediumMemoryTierUpperBound +/** + * Provides production-specific metrics-related storage and memory configuration values. + */ @Module class PerformanceMetricsConfigurationsModule { @Provides From d4961e3655d8594aa1206242aef531efd58d268e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 24 Aug 2022 23:45:27 +0530 Subject: [PATCH 126/149] nit for bazel building --- .../oppia/android/domain/oppialogger/loguploader/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel index f0feac3bbd9..6628419a7ef 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -11,7 +11,7 @@ kt_android_library( "LogReportWorkManagerInitializer.kt", ], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker" + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", From d9e7d917abca951d71cff7872439e4ee917be711 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 01:07:36 +0530 Subject: [PATCH 127/149] addition of test file for module --- scripts/assets/test_file_exemptions.textproto | 2 +- .../PerformanceMetricsAssessorModuleTest.kt | 91 +++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index 120acce68de..6ded6f61cce 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -817,7 +817,7 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/Conc exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjector.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjectorProvider.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherModule.kt" -exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModule.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt" 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" 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 new file mode 100644 index 00000000000..6a88d8522a2 --- /dev/null +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorModuleTest.kt @@ -0,0 +1,91 @@ +package org.oppia.android.util.logging.performancemetrics + +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.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +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.logging.LoggerModule +import org.oppia.android.util.logging.firebase.LogReportingModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton + +/** Tests for [PerformanceMetricsAssessorModule]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsAssessorModuleTest.TestApplication::class) +class PerformanceMetricsAssessorModuleTest { + + @Inject + lateinit var performanceMetricsAssessor: PerformanceMetricsAssessor + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testInjectAssessor_injectsPerformanceMetricsAssessorImpl() { + assertThat(performanceMetricsAssessor).isInstanceOf(PerformanceMetricsAssessorImpl::class.java) + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + } + + // 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 + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(test: PerformanceMetricsAssessorModuleTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsAssessorModuleTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(test: PerformanceMetricsAssessorModuleTest) { + component.inject(test) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From 8dc315f46e5f4b9cb003b0261a2dcb1401f4ce72 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 04:53:21 +0530 Subject: [PATCH 128/149] bazel tests fixes --- domain/BUILD.bazel | 5 +++++ .../domain/testing/oppialogger/logscheduler/BUILD.bazel | 1 + testing/BUILD.bazel | 6 ++++++ .../org/oppia/android/testing/TestLogReportingModule.kt | 2 +- .../org/oppia/android/testing/robolectric/BUILD.bazel | 2 ++ utility/BUILD.bazel | 8 ++++++++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index 1a5498226ba..72d8687b0d6 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -197,8 +197,10 @@ TEST_DEPS = [ "//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/exceptions:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduler_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_module", + "//domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler:fake_log_scheduler", "//domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader:fake_log_uploader", "//testing", "//testing/src/main/java/org/oppia/android/testing/data:async_result_subject", @@ -225,6 +227,9 @@ TEST_DEPS = [ "//utility/src/main/java/org/oppia/android/util/extensions:context_extensions", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/logging: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", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", "//utility/src/main/java/org/oppia/android/util/system:prod_module", diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel index 5a331327056..a92a8aa723a 100644 --- a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel @@ -15,6 +15,7 @@ kt_android_library( deps = [ ":dagger", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", ], ) diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 49cee29f1c1..28cea371239 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -65,6 +65,9 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/parser/image:image_loader", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_module", "//utility/src/main/java/org/oppia/android/util/parser/image:test_glide_image_loader", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" ], ) @@ -111,6 +114,9 @@ TEST_DEPS = [ "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/system:prod_module", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" ] # Qualified file paths for test classes that have been migrated over to their own packages & diff --git a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt index 4c5011946d5..4d8c7f37753 100644 --- a/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/TestLogReportingModule.kt @@ -23,7 +23,7 @@ interface TestLogReportingModule { ): PerformanceMetricsEventLogger @Binds - fun bindFakePerformanceMetricsUtils( + fun bindFakePerformanceMetricsAssessor( fakePerformanceMetricAssessor: FakePerformanceMetricAssessor ): PerformanceMetricsAssessor } diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel index a26d582a191..800b2596ad7 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel @@ -57,6 +57,7 @@ kt_android_library( "OppiaShadowActivityManager.kt", ], visibility = [ + "//:oppia_testing_visibility", "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", @@ -73,6 +74,7 @@ kt_android_library( "OppiaShadowTrafficStats.kt", ], visibility = [ + "//:oppia_testing_visibility", "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", diff --git a/utility/BUILD.bazel b/utility/BUILD.bazel index fba2af1f42f..26e884e345b 100644 --- a/utility/BUILD.bazel +++ b/utility/BUILD.bazel @@ -97,6 +97,8 @@ TEST_DEPS = [ "//testing/src/main/java/org/oppia/android/testing/data:data_provider_test_monitor", "//testing/src/main/java/org/oppia/android/testing/mockito", "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", + "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_activity_manager", + "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_traffic_stats", "//testing/src/main/java/org/oppia/android/testing/threading:test_module", "//testing/src/main/java/org/oppia/android/testing/time:test_module", "//third_party:androidx_test_ext_junit", @@ -116,6 +118,12 @@ TEST_DEPS = [ "//utility/src/main/java/org/oppia/android/util/parser/html:tag_handlers", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader", "//utility/src/main/java/org/oppia/android/util/parser/image:url_image_parser", + "//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", + "//testing/src/main/java/org/oppia/android/testing/junit:oppia_parameterized_test_runner", + "//testing/src/main/java/org/oppia/android/testing/junit:parameterized_robolectric_test_runner", + "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module" ] # Qualified file paths for test classes that have been migrated over to their own packages & From 99e99270b6cffdb2c4a1ac93958139e60e8e94ef Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 06:32:30 +0530 Subject: [PATCH 129/149] more fixes. --- .../android/app/translation/AppLanguageResourceHandlerTest.kt | 3 ++- .../android/app/translation/AppLanguageWatcherMixinTest.kt | 3 ++- .../junit/InitializeDefaultLocaleRuleCustomContextTest.kt | 3 ++- .../testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt | 3 ++- .../android/testing/junit/InitializeDefaultLocaleRuleTest.kt | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) 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 0ad3e2ed6fa..b895179b5b8 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 @@ -88,6 +88,7 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [AppLanguageResourceHandler]. @@ -556,7 +557,7 @@ class AppLanguageResourceHandlerTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 caf58633774..bda220e4d4e 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 @@ -92,6 +92,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** Tests for [AppLanguageWatcherMixin]. */ // FunctionName: test names are conventionally named with underscores. @@ -271,7 +272,7 @@ class AppLanguageWatcherMixinTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { 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 d69d9dd7945..6128aa446d1 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 @@ -77,6 +77,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [InitializeDefaultLocaleRule]. @@ -264,7 +265,7 @@ class InitializeDefaultLocaleRuleCustomContextTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 1f855c35610..4a9bb0b0168 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 @@ -75,6 +75,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [InitializeDefaultLocaleRule]. @@ -140,7 +141,7 @@ class InitializeDefaultLocaleRuleOmissionTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 c389bd48a8b..d7ac3a4518f 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 @@ -78,6 +78,7 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** Tests for [InitializeDefaultLocaleRule]. */ // FunctionName: test names are conventionally named with underscores. @@ -144,7 +145,7 @@ class InitializeDefaultLocaleRuleTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { From 17017809d18deadec332cfa300beea22dc33e423 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 07:09:58 +0530 Subject: [PATCH 130/149] reformatting --- .../oppia/android/app/application/BUILD.bazel | 4 ++-- .../android/domain/oppialogger/BUILD.bazel | 2 +- .../domain/oppialogger/analytics/BUILD.bazel | 18 +++++++++--------- .../oppialogger/logscheduler/BUILD.bazel | 8 ++++---- testing/BUILD.bazel | 16 ++++++++-------- utility/BUILD.bazel | 16 ++++++++-------- .../android/util/logging/firebase/BUILD.bazel | 8 ++++---- .../logging/performancemetrics/BUILD.bazel | 10 +++++----- 8 files changed, 41 insertions(+), 41 deletions(-) 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 d3a45ca59bf..3c34b5364a8 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 @@ -100,7 +100,6 @@ android_library( "//app/src/main/java/org/oppia/android/app/translation:prod_module", "//data/src/main/java/org/oppia/android/data/backends/gae:network_config_prod_module", "//data/src/main/java/org/oppia/android/data/backends/gae:prod_module", - "//domain/src/main/java/org/oppia/android/domain/classify:interactions_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/algebraicexpressioninput:algebraic_expression_input_rule_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/continueinteraction:continue_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput:drag_and_drop_sort_input_module", @@ -114,6 +113,7 @@ android_library( "//domain/src/main/java/org/oppia/android/domain/classify/rules/numericinput:numeric_input_rule_module", "//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/classify:interactions_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:prod_module", @@ -124,10 +124,10 @@ android_library( "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching:caching_prod_module", "//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", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", "//utility/src/main/java/org/oppia/android/util/parser/html:html_parser_entity_type_module", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel index b59a8992ace..d6ea6af76aa 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel @@ -62,8 +62,8 @@ kt_android_library( "LoggingIdentifierModule.kt", ], visibility = [ - "//:oppia_prod_module_visibility", "//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__", + "//:oppia_prod_module_visibility", ], deps = [ ":application_id_seed", 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 6f0ae4b3168..7c7544012f4 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 @@ -12,6 +12,7 @@ kt_android_library( ], visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], deps = [ + ":dagger", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:event_logger_java_proto_lite", @@ -20,7 +21,6 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/logging:event_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", - ":dagger" ], ) @@ -31,6 +31,7 @@ kt_android_library( ], visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], deps = [ + ":dagger", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", @@ -40,7 +41,6 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/logging:console_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", - ":dagger" ], ) @@ -51,11 +51,11 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":dagger", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", "//model/src/main/proto:event_logger_java_proto_lite", "//model/src/main/proto:exploration_checkpoint_java_proto_lite", - ":dagger" ], ) @@ -66,14 +66,14 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":dagger", + ":performance_metrics_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", - ":dagger", - ":performance_metrics_controller" ], ) @@ -84,9 +84,9 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ":dagger", ":performance_metrics_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ], ) @@ -108,14 +108,14 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":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/profile:profile_management_controller", "//third_party:androidx_lifecycle_lifecycle-extensions", "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", - ":dagger", - ":learner_analytics_inactivity_limit_millis", - ":performance_metrics_controller", ], ) 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 9e2e473d323..66c38ba23a2 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 @@ -11,9 +11,9 @@ kt_android_library( "PerformanceMetricsLogScheduler.kt", ], deps = [ + ":metric_log_scheduling_worker", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", - ":metric_log_scheduling_worker", ], ) @@ -39,8 +39,8 @@ kt_android_library( ], visibility = ["//domain:__pkg__"], deps = [ - "//third_party:androidx_work_work-runtime-ktx", ":metric_log_scheduling_worker", + "//third_party:androidx_work_work-runtime-ktx", ], ) @@ -51,10 +51,10 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", - "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", ":dagger", ":performance_metrics_log_scheduler", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", ], ) diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 28cea371239..dbd3c79b157 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -37,6 +37,7 @@ kt_android_library( "//domain", "//domain/src/main/java/org/oppia/android/domain/classify:interactions_module", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//testing/src/main/java/org/oppia/android/testing/data:async_result_subject", "//testing/src/main/java/org/oppia/android/testing/threading:test_coroutine_dispatchers", "//testing/src/main/java/org/oppia/android/testing/time:fake_oppia_clock", @@ -61,13 +62,12 @@ kt_android_library( "//third_party:org_mockito_mockito-core", "//third_party:org_robolectric_robolectric", "//utility", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", "//utility/src/main/java/org/oppia/android/util/parser/image:image_loader", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_module", "//utility/src/main/java/org/oppia/android/util/parser/image:test_glide_image_loader", - "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" ], ) @@ -79,9 +79,10 @@ TEST_DEPS = [ "//data/src/main/java/org/oppia/android/data/backends/gae:network_config_prod_module", "//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:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//testing/src/main/java/org/oppia/android/testing/data:async_result_subject", "//testing/src/main/java/org/oppia/android/testing/data:data_provider_test_monitor", "//testing/src/main/java/org/oppia/android/testing/espresso:text_input_action", @@ -108,15 +109,14 @@ TEST_DEPS = [ "//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-test", "//third_party:org_mockito_mockito-core", "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", + "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/system:prod_module", - "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" ] # Qualified file paths for test classes that have been migrated over to their own packages & diff --git a/utility/BUILD.bazel b/utility/BUILD.bazel index 26e884e345b..4427636efa6 100644 --- a/utility/BUILD.bazel +++ b/utility/BUILD.bazel @@ -95,10 +95,13 @@ TEST_DEPS = [ "//model/src/main/proto:test_models", "//testing", "//testing/src/main/java/org/oppia/android/testing/data:data_provider_test_monitor", + "//testing/src/main/java/org/oppia/android/testing/junit:oppia_parameterized_test_runner", + "//testing/src/main/java/org/oppia/android/testing/junit:parameterized_robolectric_test_runner", "//testing/src/main/java/org/oppia/android/testing/mockito", - "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", + "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module" "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_activity_manager", "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_traffic_stats", + "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", "//testing/src/main/java/org/oppia/android/testing/threading:test_module", "//testing/src/main/java/org/oppia/android/testing/time:test_module", "//third_party:androidx_test_ext_junit", @@ -109,21 +112,18 @@ TEST_DEPS = [ "//third_party:org_jetbrains_kotlin_kotlin-test-junit", "//third_party:org_mockito_mockito-core", "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", + "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions", "//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", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/parser/html:tag_handlers", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader", "//utility/src/main/java/org/oppia/android/util/parser/image:url_image_parser", - "//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", - "//testing/src/main/java/org/oppia/android/testing/junit:oppia_parameterized_test_runner", - "//testing/src/main/java/org/oppia/android/testing/junit:parameterized_robolectric_test_runner", - "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module" ] # Qualified file paths for test classes that have been migrated over to their own packages & diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel index 38a92e184ae..550bff2f586 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel @@ -46,14 +46,14 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ + ":dagger", + ":firebase_exception_logger", + ":prod_impl", "//third_party:com_google_firebase_firebase-analytics", "//third_party:com_google_firebase_firebase-crashlytics", "//third_party:javax_inject_javax_inject", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", - ":dagger", - ":firebase_exception_logger", - ":prod_impl", ], ) @@ -66,10 +66,10 @@ kt_android_library( "//app:__pkg__", ], deps = [ + ":prod_impl", "//model/src/main/proto:event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", - ":prod_impl", ], ) 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 b1a979c3ed0..a7d42227c3d 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 @@ -34,10 +34,10 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":dagger", + ":performance_metrics_assessor_impl", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", - ":dagger", - ":performance_metrics_assessor_impl" ], ) @@ -48,10 +48,10 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":performance_metrics_assessor", + ":performance_metrics_configurations_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", - ":performance_metrics_assessor", - ":performance_metrics_configurations_module" ], ) @@ -62,9 +62,9 @@ kt_android_library( ], visibility = ["//:oppia_api_visibility"], deps = [ + ":dagger", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", - ":dagger" ], ) From 620dc1272590f9d053bfdbb2d6aa67828bfb713e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 07:13:08 +0530 Subject: [PATCH 131/149] nits --- .../android/app/translation/AppLanguageResourceHandlerTest.kt | 2 +- .../android/app/translation/AppLanguageWatcherMixinTest.kt | 2 +- .../junit/InitializeDefaultLocaleRuleCustomContextTest.kt | 2 +- .../testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt | 2 +- .../android/testing/junit/InitializeDefaultLocaleRuleTest.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 b895179b5b8..3ef2af12404 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -88,7 +89,6 @@ import org.robolectric.annotation.LooperMode import java.util.Locale import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [AppLanguageResourceHandler]. 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 bda220e4d4e..21ac94faac3 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 @@ -60,6 +60,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -92,7 +93,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** Tests for [AppLanguageWatcherMixin]. */ // FunctionName: test names are conventionally named with underscores. 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 6128aa446d1..51e520fb94b 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 @@ -50,6 +50,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -77,7 +78,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [InitializeDefaultLocaleRule]. 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 4a9bb0b0168..65b3bc82a08 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 @@ -47,6 +47,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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -75,7 +76,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** * Tests for [InitializeDefaultLocaleRule]. 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 d7ac3a4518f..a53e4b716e0 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -78,7 +79,6 @@ import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule /** Tests for [InitializeDefaultLocaleRule]. */ // FunctionName: test names are conventionally named with underscores. From 28d71ef43e079f8e4daf0f276275a9ef18443cd7 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 25 Aug 2022 07:18:50 +0530 Subject: [PATCH 132/149] nits --- testing/BUILD.bazel | 2 +- utility/BUILD.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index dbd3c79b157..7736e480d7d 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -63,7 +63,7 @@ kt_android_library( "//third_party:org_robolectric_robolectric", "//utility", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger" + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", "//utility/src/main/java/org/oppia/android/util/parser/image:image_loader", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_module", diff --git a/utility/BUILD.bazel b/utility/BUILD.bazel index 4427636efa6..9ea18e35e56 100644 --- a/utility/BUILD.bazel +++ b/utility/BUILD.bazel @@ -98,7 +98,7 @@ TEST_DEPS = [ "//testing/src/main/java/org/oppia/android/testing/junit:oppia_parameterized_test_runner", "//testing/src/main/java/org/oppia/android/testing/junit:parameterized_robolectric_test_runner", "//testing/src/main/java/org/oppia/android/testing/mockito", - "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module" + "//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module", "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_activity_manager", "//testing/src/main/java/org/oppia/android/testing/robolectric:oppia_shadow_traffic_stats", "//testing/src/main/java/org/oppia/android/testing/robolectric:test_module", From 2cc203edcf67f9225963e6bb435188fa46fbbb99 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 02:19:19 +0530 Subject: [PATCH 133/149] dep fix --- .../instrumentation/application/TestApplicationComponent.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 22bedb239cb..57a6270db6c 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -34,7 +34,7 @@ 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.exceptions.UncaughtExceptionLoggerModule -import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule @@ -79,7 +79,7 @@ import javax.inject.Singleton ViewBindingShimModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, RatioInputModule::class, UncaughtExceptionLoggerModule::class, ApplicationStartupListenerModule::class, - LogUploadWorkerModule::class, WorkManagerConfigurationModule::class, + LogReportWorkerModule::class, WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, From 1e9018c79d667eafdf7a94e51a2f706d3b778c2e Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 02:57:17 +0530 Subject: [PATCH 134/149] deps fix --- .../instrumentation/application/TestApplicationComponent.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 57a6270db6c..44daddb2212 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -90,7 +90,9 @@ import javax.inject.Singleton NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class, NetworkConnectionDebugUtilModule::class + SyncStatusModule::class, NetworkConnectionDebugUtilModule::class, + MetricLogSchedulerModule::class, PerformanceMetricsLoggerModule::class, + PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class ] ) interface TestApplicationComponent : ApplicationComponent { From e6d0209992139fe7c006c8e0e36af74c99d80878 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 04:52:37 +0530 Subject: [PATCH 135/149] deps fix --- .../instrumentation/application/TestApplicationComponent.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 44daddb2212..71a9c59ad53 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -56,6 +56,10 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule /** * Root Dagger component for the test application. All application-scoped modules should be included From 1525c6854b35d4fe80b2dc24ec49ba9442a8dfef Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 04:54:41 +0530 Subject: [PATCH 136/149] nit --- .../application/TestApplicationComponent.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 71a9c59ad53..b8f2ba6422a 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -33,7 +33,9 @@ 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.PerformanceMetricsLoggerModule import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -49,6 +51,8 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule @@ -56,10 +60,6 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.system.OppiaClockModule import org.oppia.android.util.threading.DispatcherModule import javax.inject.Singleton -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule -import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule -import org.oppia.android.domain.oppialogger.analytics.PerformanceMetricsLoggerModule /** * Root Dagger component for the test application. All application-scoped modules should be included From 66c864c6edd700e7f1c8ac47ca71c363b1ef055c Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 06:01:46 +0530 Subject: [PATCH 137/149] nits --- .../java/org/oppia/android/app/application/BUILD.bazel | 4 ++-- domain/BUILD.bazel | 4 ++-- .../java/org/oppia/android/domain/oppialogger/BUILD.bazel | 2 +- .../android/domain/oppialogger/analytics/BUILD.bazel | 4 ++-- .../android/domain/oppialogger/loguploader/BUILD.bazel | 8 ++++---- testing/BUILD.bazel | 6 +++--- utility/BUILD.bazel | 4 ++-- .../org/oppia/android/util/logging/firebase/BUILD.bazel | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) 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 3c34b5364a8..593be4f261a 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 @@ -100,6 +100,7 @@ android_library( "//app/src/main/java/org/oppia/android/app/translation:prod_module", "//data/src/main/java/org/oppia/android/data/backends/gae:network_config_prod_module", "//data/src/main/java/org/oppia/android/data/backends/gae:prod_module", + "//domain/src/main/java/org/oppia/android/domain/classify:interactions_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/algebraicexpressioninput:algebraic_expression_input_rule_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/continueinteraction:continue_module", "//domain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput:drag_and_drop_sort_input_module", @@ -113,7 +114,6 @@ android_library( "//domain/src/main/java/org/oppia/android/domain/classify/rules/numericinput:numeric_input_rule_module", "//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/classify:interactions_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:prod_module", @@ -124,10 +124,10 @@ android_library( "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching:caching_prod_module", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", + "//utility/src/main/java/org/oppia/android/util/logging: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", - "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", "//utility/src/main/java/org/oppia/android/util/parser/html:html_parser_entity_type_module", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader_module", diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index 72d8687b0d6..ad1e34bd216 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -103,11 +103,11 @@ kt_android_library( "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/classify:answer_classification_controller", "//domain/src/main/java/org/oppia/android/domain/classify:classification_result", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker_factory", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", "//domain/src/main/java/org/oppia/android/domain/state:state_deck", "//domain/src/main/java/org/oppia/android/domain/state:state_graph", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel index d6ea6af76aa..b59a8992ace 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel @@ -62,8 +62,8 @@ kt_android_library( "LoggingIdentifierModule.kt", ], visibility = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__", "//:oppia_prod_module_visibility", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__", ], deps = [ ":application_id_seed", 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 7c7544012f4..cc39adc3c9a 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 @@ -36,10 +36,10 @@ kt_android_library( "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//utility/src/main/java/org/oppia/android/util/data:data_provider", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:console_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", ], ) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel index 6628419a7ef..5b8f53e4f17 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -11,12 +11,12 @@ kt_android_library( "LogReportWorkManagerInitializer.kt", ], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker", + ":worker", "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduling_worker", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", "//utility/src/main/java/org/oppia/android/util/logging:metric_log_scheduler", - ":worker", ], ) @@ -44,8 +44,8 @@ kt_android_library( ], visibility = ["//domain:__pkg__"], deps = [ - "//third_party:androidx_work_work-runtime-ktx", ":worker", + "//third_party:androidx_work_work-runtime-ktx", ], ) @@ -56,9 +56,9 @@ kt_android_library( ], visibility = ["//:oppia_prod_module_visibility"], deps = [ - "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ":dagger", ":initializer", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", ], ) diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 7736e480d7d..cfb0a7133a3 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -79,8 +79,8 @@ TEST_DEPS = [ "//data/src/main/java/org/oppia/android/data/backends/gae:network_config_prod_module", "//domain", "//domain/src/main/java/org/oppia/android/domain/onboarding/testing:retriever_test_module", - "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:prod_module", "//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//testing/src/main/java/org/oppia/android/testing/data:async_result_subject", @@ -109,12 +109,12 @@ TEST_DEPS = [ "//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-test", "//third_party:org_mockito_mockito-core", "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", + "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", + "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", - "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/system:prod_module", ] diff --git a/utility/BUILD.bazel b/utility/BUILD.bazel index 9ea18e35e56..99d923732b9 100644 --- a/utility/BUILD.bazel +++ b/utility/BUILD.bazel @@ -112,14 +112,14 @@ TEST_DEPS = [ "//third_party:org_jetbrains_kotlin_kotlin-test-junit", "//third_party:org_mockito_mockito-core", "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", + "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", + "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//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", - "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/parser/html:tag_handlers", "//utility/src/main/java/org/oppia/android/util/parser/image:glide_image_loader", diff --git a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel index 550bff2f586..b67cff7f82b 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/firebase/BUILD.bazel @@ -29,11 +29,11 @@ kt_android_library( "//third_party:androidx_work_work-runtime-ktx", "//third_party:com_google_firebase_firebase-analytics", "//third_party:javax_inject_javax_inject", - "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", "//utility/src/main/java/org/oppia/android/util/logging:sync_status_manager", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", ], ) From fa27f74fe03fdf2f1a3f6704038611f101ddf44a Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 06:05:59 +0530 Subject: [PATCH 138/149] nits --- domain/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index ad1e34bd216..116ac4f2f7d 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -99,6 +99,7 @@ kt_android_library( manifest = "src/main/AndroidManifest.xml", visibility = ["//visibility:public"], deps = [ + ":dagger", "//data/src/main/java/org/oppia/android/data/backends/gae/api", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/classify:answer_classification_controller", @@ -135,7 +136,6 @@ kt_android_library( "//utility/src/main/java/org/oppia/android/util/parser/html:exploration_html_parser_entity_type", "//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_annonations", "//utility/src/main/java/org/oppia/android/util/profile:directory_management_util", - ":dagger", ], ) From 0462b224720eeebe457bd838e70a3ab0b6516746 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 21:49:22 +0530 Subject: [PATCH 139/149] gradle test fix. --- .../domain/oppialogger/loguploader/LogUploadWorkerTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt index 091c882dc04..51ffe407e95 100644 --- a/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerTest.kt @@ -62,8 +62,9 @@ import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.DATA_UPLOADED import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.DATA_UPLOADING import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NETWORK_ERROR import org.oppia.android.util.logging.SyncStatusManager.SyncStatus.NO_CONNECTIVITY +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger -import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsUtilsModule import org.oppia.android.util.networking.NetworkConnectionDebugUtil import org.oppia.android.util.networking.NetworkConnectionUtil.ProdConnectionStatus.NONE import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule @@ -406,7 +407,8 @@ class LogUploadWorkerTest { NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, LoggerModule::class, AssetModule::class, PlatformParameterModule::class, PlatformParameterSingletonModule::class, LoggingIdentifierModule::class, SyncStatusTestModule::class, - PerformanceMetricsUtilsModule::class, ApplicationLifecycleModule::class + PerformanceMetricsAssessorModule::class, ApplicationLifecycleModule::class, + PerformanceMetricsConfigurationsModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { From 809decf0329214a774f80d61ffda1546ebee5c33 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 26 Aug 2022 23:07:08 +0530 Subject: [PATCH 140/149] bazel oppia build --- .../oppia/android/domain/oppialogger/loguploader/BUILD.bazel | 2 ++ .../src/main/java/org/oppia/android/util/logging/BUILD.bazel | 1 + 2 files changed, 3 insertions(+) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel index 5b8f53e4f17..01287999145 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -27,12 +27,14 @@ kt_android_library( ], deps = [ "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:performance_metrics_controller", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", "//domain/src/main/java/org/oppia/android/domain/util:extensions", "//third_party:androidx_work_work-runtime-ktx", "//utility/src/main/java/org/oppia/android/util/logging:console_logger", "//utility/src/main/java/org/oppia/android/util/logging:event_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_event_logger", "//utility/src/main/java/org/oppia/android/util/threading:annotations", ], ) diff --git a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel index a96279e3f68..77c82bb3bf7 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel @@ -66,6 +66,7 @@ kt_android_library( visibility = ["//:oppia_api_visibility"], deps = [ "//model/src/main/proto:event_logger_java_proto_lite", + "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//third_party:javax_inject_javax_inject", "//utility", ], From 68fa9117d943d82ac9c4565913bab59f9e2b5c25 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 27 Aug 2022 00:54:25 +0530 Subject: [PATCH 141/149] test fixes -- renaming. --- .../oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt | 4 ++-- .../org/oppia/android/app/policies/PoliciesActivityTest.kt | 4 ++-- .../org/oppia/android/app/policies/PoliciesFragmentTest.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt index ca6620e317e..2ad4c5e8c7f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt @@ -72,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -1095,7 +1095,7 @@ class ListItemLeadingMarginSpanTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 6e182dbb936..f2d3d34f031 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 @@ -51,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -173,7 +173,7 @@ class PoliciesActivityTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, 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 0fde4e38fa8..29f88efc361 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 @@ -74,7 +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.loguploader.LogUploadWorkerModule +import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule @@ -326,7 +326,7 @@ class PoliciesFragmentTest { AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class, ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, - ApplicationStartupListenerModule::class, LogUploadWorkerModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, PracticeTabModule::class, DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, From b59161298c1dfc1ba0ae1fba8f77ef7d8ec2c645 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 27 Aug 2022 03:20:40 +0530 Subject: [PATCH 142/149] deps addition --- .../oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt | 3 ++- .../org/oppia/android/app/policies/PoliciesActivityTest.kt | 3 ++- .../org/oppia/android/app/policies/PoliciesFragmentTest.kt | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt index 2ad4c5e8c7f..1ccba698308 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -1105,7 +1106,7 @@ class ListItemLeadingMarginSpanTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) 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 f2d3d34f031..40789301bbd 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -183,7 +184,7 @@ class PoliciesActivityTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::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 29f88efc361..f2ffe23dd5c 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 @@ -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.logscheduler.MetricLogSchedulerModule import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule @@ -336,7 +337,7 @@ class PoliciesFragmentTest { NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, - SyncStatusModule::class + SyncStatusModule::class, MetricLogSchedulerModule::class ] ) interface TestApplicationComponent : ApplicationComponent { From 8b33234e3a2daddf44c1eb98e97ff73f4ebb18a7 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Sat, 27 Aug 2022 04:27:54 +0530 Subject: [PATCH 143/149] previous merge correction --- .../java/org/oppia/android/app/parser/CustomBulletSpanTest.kt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/CustomBulletSpanTest.kt deleted file mode 100644 index e69de29bb2d..00000000000 From ea8784631c6a7588783d0004085cd9b5273607bd Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Tue, 30 Aug 2022 04:49:56 +0530 Subject: [PATCH 144/149] nits --- .../robolectric/OppiaShadowActivityManagerTest.kt | 2 +- .../robolectric/OppiaShadowTrafficStatsTest.kt | 12 ++++++++---- .../PerformanceMetricsAssessorImplTest.kt | 13 ++++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt index 68b4ab18cc3..b6b6df2c20c 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowActivityManagerTest.kt @@ -118,7 +118,7 @@ class OppiaShadowActivityManagerTest { oppiaShadowActivityManager.getMemoryInfo(outInfo) assertThat(outInfo.totalMem).isEqualTo(2) assertThat(outInfo.availMem).isEqualTo(1) - assertThat(outInfo.lowMemory).isEqualTo(true) + assertThat(outInfo.lowMemory).isTrue() assertThat(outInfo.threshold).isEqualTo(10) } diff --git a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt index a5b537636c2..4532c593db4 100644 --- a/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/robolectric/OppiaShadowTrafficStatsTest.kt @@ -21,6 +21,8 @@ import org.robolectric.shadow.api.Shadow import javax.inject.Inject import javax.inject.Singleton +private const val ARBITRARY_UID = 0 + /** Tests for [OppiaShadowTrafficStats]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @@ -53,20 +55,22 @@ class OppiaShadowTrafficStatsTest { @Test fun testCustomShadow_initialState_returnsDefaultValuesForTxAndRxBytes() { - assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(0L) - assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(0L) + assertThat(OppiaShadowTrafficStats.getUidRxBytes(ARBITRARY_UID)).isEqualTo(0L) + assertThat(OppiaShadowTrafficStats.getUidTxBytes(ARBITRARY_UID)).isEqualTo(0L) } @Test fun testCustomShadow_setUidTxBytes_returnsCorrectTxBytesValue() { oppiaShadowTrafficStats.setUidTxBytes(9) - assertThat(OppiaShadowTrafficStats.getUidTxBytes(0)).isEqualTo(9L) + assertThat(OppiaShadowTrafficStats.getUidTxBytes(ARBITRARY_UID)).isEqualTo(9L) + assertThat(OppiaShadowTrafficStats.getUidRxBytes(ARBITRARY_UID)).isEqualTo(0) } @Test fun testCustomShadow_setUidRxBytes_returnsCorrectTxBytesValue() { oppiaShadowTrafficStats.setUidRxBytes(9) - assertThat(OppiaShadowTrafficStats.getUidRxBytes(0)).isEqualTo(9L) + assertThat(OppiaShadowTrafficStats.getUidRxBytes(ARBITRARY_UID)).isEqualTo(9L) + assertThat(OppiaShadowTrafficStats.getUidTxBytes(ARBITRARY_UID)).isEqualTo(0) } private fun setUpTestApplicationComponent() { 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 5fa25e5b23c..d6b3cb6185e 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 @@ -40,7 +40,8 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode -import org.robolectric.shadow.api.Shadow +import org.robolectric.shadow.api.Shadow.extract +import org.robolectric.shadow.api.Shadow.newInstanceOf import java.io.File import javax.inject.Inject import javax.inject.Singleton @@ -86,6 +87,10 @@ class PerformanceMetricsAssessorImplTest { ) as OppiaShadowActivityManager } + private val shadowTrafficStats by lazy { + extract(newInstanceOf(TrafficStats::class.java)) as OppiaShadowTrafficStats + } + @Before fun setUp() { setUpTestApplicationComponent() @@ -158,16 +163,14 @@ class PerformanceMetricsAssessorImplTest { @Test fun testAssessor_getBytesSent_returnsCorrectAmountOfNetworkBytesSent() { - val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats - shadow.setUidTxBytes(20L) + shadowTrafficStats.setUidTxBytes(20L) assertThat(performanceMetricsAssessorImpl.getTotalSentBytes()).isEqualTo(20L) } @Test fun testAssessor_getBytesReceived_returnsCorrectAmountOfNetworkBytesReceived() { - val shadow = Shadow.extract(TrafficStats()) as OppiaShadowTrafficStats - shadow.setUidRxBytes(20L) + shadowTrafficStats.setUidRxBytes(20L) assertThat(performanceMetricsAssessorImpl.getTotalReceivedBytes()).isEqualTo(20L) } From aa2992c7bb822bbc06ad5d6464320dc19f29d0f8 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 31 Aug 2022 05:41:26 +0530 Subject: [PATCH 145/149] updates. --- domain/BUILD.bazel | 2 +- .../domain/oppialogger/analytics/BUILD.bazel | 10 +- .../analytics/testing}/BUILD.bazel | 0 .../analytics/testing}/FakeLogScheduler.kt | 22 +-- .../analytics/testing/FakeLogSchedulerTest.kt | 182 ++++++++++++++++++ .../MetricLogSchedulingWorkerTest.kt | 26 +++ .../LogReportWorkManagerInitializerTest.kt | 6 +- scripts/assets/test_file_exemptions.textproto | 2 - .../android/testing/robolectric/BUILD.bazel | 5 +- .../logging/performancemetrics/BUILD.bazel | 10 +- .../PerformanceMetricsConfigurationsModule.kt | 2 +- ...formanceMetricsConfigurationsModuleTest.kt | 121 ++++++++++++ 12 files changed, 356 insertions(+), 32 deletions(-) rename domain/src/main/java/org/oppia/android/domain/{testing/oppialogger/logscheduler => oppialogger/analytics/testing}/BUILD.bazel (100%) rename domain/src/main/java/org/oppia/android/domain/{testing/oppialogger/logscheduler => oppialogger/analytics/testing}/FakeLogScheduler.kt (65%) create mode 100644 domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt create mode 100644 utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index 16066c8b898..e13cc36c9a6 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -183,12 +183,12 @@ TEST_DEPS = [ "//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: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", "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:startup_listener", "//domain/src/main/java/org/oppia/android/domain/oppialogger/logscheduler:metric_log_scheduler_module", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_module", - "//domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler:fake_log_scheduler", "//domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader:fake_log_uploader", "//testing", "//testing/src/main/java/org/oppia/android/testing/data:async_result_subject", 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 cc39adc3c9a..9da9ff791d5 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 @@ -49,7 +49,7 @@ kt_android_library( srcs = [ "LearnerAnalyticsLogger.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", @@ -64,7 +64,7 @@ kt_android_library( srcs = [ "PerformanceMetricsLogger.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", ":performance_metrics_controller", @@ -82,7 +82,7 @@ kt_android_library( srcs = [ "PerformanceMetricsLoggerModule.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", ":performance_metrics_logger", @@ -95,7 +95,7 @@ kt_android_library( srcs = [ "LearnerAnalyticsInactivityLimitMillis.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ "//third_party:javax_inject_javax_inject", ], @@ -106,7 +106,7 @@ kt_android_library( srcs = [ "ApplicationLifecycleObserver.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", ":learner_analytics_inactivity_limit_millis", diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing/BUILD.bazel similarity index 100% rename from domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/BUILD.bazel rename to domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing/BUILD.bazel diff --git a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogScheduler.kt similarity index 65% rename from domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt rename to domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogScheduler.kt index ac25dd88e99..12973e595fa 100644 --- a/domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogScheduler.kt @@ -1,4 +1,4 @@ -package org.oppia.android.domain.testing.oppialogger.logscheduler +package org.oppia.android.domain.oppialogger.analytics.testing import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager @@ -11,14 +11,14 @@ import javax.inject.Singleton @Singleton class FakeLogScheduler @Inject constructor() : MetricLogScheduler { private val schedulingStorageUsageMetricLoggingRequestIdList = mutableListOf() - private val schedulingMemoryUsageMetricLoggingRequestIdList = mutableListOf() - private val schedulingPeriodicPerformanceMetricLoggingRequestIdList = mutableListOf() + private val schedulingPeriodicUiMetricLoggingRequestIdList = mutableListOf() + private val schedulingPeriodicBackgroundMetricsLoggingRequestIdList = mutableListOf() override fun enqueueWorkRequestForPeriodicBackgroundMetrics( workManager: WorkManager, workRequest: PeriodicWorkRequest ) { - schedulingPeriodicPerformanceMetricLoggingRequestIdList.add(workRequest.id) + schedulingPeriodicBackgroundMetricsLoggingRequestIdList.add(workRequest.id) } override fun enqueueWorkRequestForStorageUsage( @@ -32,7 +32,7 @@ class FakeLogScheduler @Inject constructor() : MetricLogScheduler { workManager: WorkManager, workRequest: PeriodicWorkRequest ) { - schedulingMemoryUsageMetricLoggingRequestIdList.add(workRequest.id) + schedulingPeriodicUiMetricLoggingRequestIdList.add(workRequest.id) } /** @@ -44,15 +44,15 @@ class FakeLogScheduler @Inject constructor() : MetricLogScheduler { /** * Returns the most recent work request id that's stored in the - * [schedulingMemoryUsageMetricLoggingRequestIdList]. + * [schedulingPeriodicUiMetricLoggingRequestIdList]. */ - fun getMostRecentMemoryUsageMetricLoggingRequestId() = - schedulingMemoryUsageMetricLoggingRequestIdList.last() + fun getMostRecentPeriodicUiMetricLoggingRequestId() = + schedulingPeriodicUiMetricLoggingRequestIdList.last() /** * Returns the most recent work request id that's stored in the - * [schedulingPeriodicPerformanceMetricLoggingRequestIdList]. + * [schedulingPeriodicBackgroundMetricsLoggingRequestIdList]. */ - fun getMostRecentPeriodicPerformanceMetricLoggingRequestId() = - schedulingPeriodicPerformanceMetricLoggingRequestIdList.last() + fun getMostRecentPeriodicBackgroundMetricLoggingRequestId() = + schedulingPeriodicBackgroundMetricsLoggingRequestIdList.last() } 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 new file mode 100644 index 00000000000..cd2dcd5d2c1 --- /dev/null +++ b/domain/src/test/java/org/oppia/android/domain/oppialogger/analytics/testing/FakeLogSchedulerTest.kt @@ -0,0 +1,182 @@ +package org.oppia.android.domain.oppialogger.analytics.testing + +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.work.Configuration +import androidx.work.Data +import androidx.work.PeriodicWorkRequestBuilder +import androidx.work.WorkManager +import androidx.work.testing.SynchronousExecutor +import androidx.work.testing.WorkManagerTestInitHelper +import com.google.common.truth.Truth.assertThat +import dagger.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import java.util.concurrent.TimeUnit +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker +import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory +import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker +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.LoggerModule +import org.oppia.android.util.logging.MetricLogScheduler +import org.oppia.android.util.logging.firebase.LogReportingModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessorModule +import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfigurationsModule +import org.oppia.android.util.system.OppiaClockModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +/** Tests for [FakeLogScheduler]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = FakeLogSchedulerTest.TestApplication::class) +class FakeLogSchedulerTest { + + @Inject + lateinit var fakeLogScheduler: FakeLogScheduler + + @Inject + lateinit var workerFactory: MetricLogSchedulingWorkerFactory + + @Inject + lateinit var context: Context + + @Before + fun setUp() { + setUpTestApplicationComponent() + val config = Configuration.Builder() + .setExecutor(SynchronousExecutor()) + .setWorkerFactory(workerFactory) + .build() + WorkManagerTestInitHelper.initializeTestWorkManager(context, config) + } + + @Test + fun testFakeScheduler_scheduleStorageLogging_verifyScheduling() { + val workManager = WorkManager.getInstance(context) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.STORAGE_USAGE_WORKER + ).build() + + val request = PeriodicWorkRequestBuilder(10, TimeUnit.SECONDS) + .setInputData(inputData) + .build() + + fakeLogScheduler.enqueueWorkRequestForStorageUsage( + workManager, + request + ) + + assertThat(fakeLogScheduler.getMostRecentStorageUsageMetricLoggingRequestId()) + .isEqualTo(request.id) + } + + @Test + fun testFakeScheduler_schedulePeriodicBackgroundMetricsLogging_verifyScheduling() { + val workManager = WorkManager.getInstance(context) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_BACKGROUND_METRIC_WORKER + ).build() + + val request = PeriodicWorkRequestBuilder(10, TimeUnit.SECONDS) + .setInputData(inputData) + .build() + + fakeLogScheduler.enqueueWorkRequestForPeriodicBackgroundMetrics( + workManager, + request + ) + + assertThat(fakeLogScheduler.getMostRecentPeriodicBackgroundMetricLoggingRequestId()) + .isEqualTo(request.id) + } + + @Test + fun testFakeScheduler_schedulePeriodicUiMetricsLogging_verifyScheduling() { + val workManager = WorkManager.getInstance(context) + + val inputData = Data.Builder().putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + MetricLogSchedulingWorker.PERIODIC_UI_METRIC_WORKER + ).build() + + val request = PeriodicWorkRequestBuilder(10, TimeUnit.SECONDS) + .setInputData(inputData) + .build() + + fakeLogScheduler.enqueueWorkRequestForPeriodicUiMetrics( + workManager, + request + ) + + assertThat(fakeLogScheduler.getMostRecentPeriodicUiMetricLoggingRequestId()) + .isEqualTo(request.id) + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + + @Binds + fun bindMetricLogScheduler(fakeLogScheduler: FakeLogScheduler): MetricLogScheduler + } + + // 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, LocaleProdModule::class, + OppiaClockModule::class + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(test: FakeLogSchedulerTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerFakeLogSchedulerTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(test: FakeLogSchedulerTest) { + component.inject(test) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} 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 0dec4bb0a2a..36c7ef338e6 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 @@ -9,6 +9,7 @@ import androidx.work.Configuration import androidx.work.Data import androidx.work.OneTimeWorkRequest import androidx.work.OneTimeWorkRequestBuilder +import androidx.work.PeriodicWorkRequest import androidx.work.WorkInfo import androidx.work.WorkManager import androidx.work.testing.SynchronousExecutor @@ -19,6 +20,7 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides +import java.util.concurrent.TimeUnit import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -61,6 +63,9 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton +private const val INCORRECT_WORKER_CASE = "incorrect_worker_case" + + /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") @@ -180,6 +185,27 @@ class MetricLogSchedulingWorkerTest { assertThat(fakePerformanceMetricsEventLogger.noPerformanceMetricsEventsPresent()).isTrue() } + @Test + fun testScheduler_enqueueRequestForIncorrectWorkerCase_verifyWorkRequestReturnsFailureResult() { + val workManager = WorkManager.getInstance(ApplicationProvider.getApplicationContext()) + + val inputData: Data = Data.Builder() + .putString( + MetricLogSchedulingWorker.WORKER_CASE_KEY, + INCORRECT_WORKER_CASE + ).build() + + val request = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + val workInfo = workManager.getWorkInfoById(request.id) + + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) + } + private fun setUpTestApplicationComponent() { DaggerMetricLogSchedulingWorkerTest_TestApplicationComponent.builder() .setApplication(ApplicationProvider.getApplicationContext()) 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 38876a92bd9..6de9f298b1b 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 @@ -32,7 +32,7 @@ import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWork import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule -import org.oppia.android.domain.testing.oppialogger.logscheduler.FakeLogScheduler +import org.oppia.android.domain.oppialogger.analytics.testing.FakeLogScheduler import org.oppia.android.domain.testing.oppialogger.loguploader.FakeLogUploader import org.oppia.android.testing.FakeEventLogger import org.oppia.android.testing.FakeExceptionLogger @@ -137,10 +137,10 @@ class LogReportWorkManagerInitializerTest { assertThat(fakeLogScheduler.getMostRecentStorageUsageMetricLoggingRequestId()).isEqualTo( enqueuedSchedulingStorageUsageMetricWorkRequestId ) - assertThat(fakeLogScheduler.getMostRecentMemoryUsageMetricLoggingRequestId()).isEqualTo( + assertThat(fakeLogScheduler.getMostRecentPeriodicUiMetricLoggingRequestId()).isEqualTo( enqueuedSchedulingPeriodicUiMetricWorkRequestId ) - assertThat(fakeLogScheduler.getMostRecentPeriodicPerformanceMetricLoggingRequestId()).isEqualTo( + assertThat(fakeLogScheduler.getMostRecentPeriodicBackgroundMetricLoggingRequestId()).isEqualTo( enqueuedSchedulingPeriodicBackgroundPerformanceMetricWorkRequestId ) } diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index 063bc079398..24119196db3 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -652,7 +652,6 @@ exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateDe exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateGraph.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/state/StateList.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/testing/oppialogger/loguploader/FakeLogUploader.kt" -exempted_file_path: "domain/src/main/java/org/oppia/android/domain/testing/oppialogger/logscheduler/FakeLogScheduler.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/ConceptCardRetriever.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/PrimeTopicAssetsController.kt" exempted_file_path: "domain/src/main/java/org/oppia/android/domain/topic/PrimeTopicAssetsControllerImpl.kt" @@ -825,7 +824,6 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/Conc exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjector.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherInjectorProvider.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/threading/DispatcherModule.kt" -exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt" 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" diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel index 800b2596ad7..e1fb8915f92 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel @@ -57,10 +57,7 @@ kt_android_library( "OppiaShadowActivityManager.kt", ], visibility = [ - "//:oppia_testing_visibility", - "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", - "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", - "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", + "//:oppia_testing_visibility" ], deps = [ "//third_party:org_robolectric_robolectric", 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 a7d42227c3d..5a0e37cc86f 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 @@ -10,7 +10,7 @@ kt_android_library( srcs = [ "PerformanceMetricsEventLogger.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", ], @@ -21,7 +21,7 @@ kt_android_library( srcs = [ "PerformanceMetricsAssessor.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", ], @@ -32,7 +32,7 @@ kt_android_library( srcs = [ "PerformanceMetricsAssessorModule.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", ":performance_metrics_assessor_impl", @@ -46,7 +46,7 @@ kt_android_library( srcs = [ "PerformanceMetricsAssessorImpl.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":performance_metrics_assessor", ":performance_metrics_configurations_module", @@ -60,7 +60,7 @@ kt_android_library( srcs = [ "PerformanceMetricsConfigurationsModule.kt", ], - visibility = ["//:oppia_api_visibility"], + visibility = ["//:oppia_prod_module_visibility"], deps = [ ":dagger", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", diff --git a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt index a64aa23e903..33e0b408446 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModule.kt @@ -9,7 +9,7 @@ import javax.inject.Qualifier private const val ONE_GIGABYTE = 1024L * 1024L * 1024L private const val TWO_GIGABYTES = ONE_GIGABYTE * 2L private const val THREE_GIGABYTES = ONE_GIGABYTE * 3L -private const val THIRTY_TWO_GIGABYTES = ONE_GIGABYTE * 36L +private const val THIRTY_TWO_GIGABYTES = ONE_GIGABYTE * 32L private const val SIXTY_FOUR_GIGABYTES = ONE_GIGABYTE * 64L /** Corresponds to a long value that denotes the non-inclusive upper bound of [StorageTier.LOW_STORAGE]. */ diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt new file mode 100644 index 00000000000..94132f04a00 --- /dev/null +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt @@ -0,0 +1,121 @@ +package org.oppia.android.util.logging.performancemetrics + +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.Binds +import dagger.BindsInstance +import dagger.Component +import dagger.Module +import javax.inject.Inject +import javax.inject.Singleton +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +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.logging.LoggerModule +import org.oppia.android.util.logging.firebase.LogReportingModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode + +private const val ONE_GIGABYTES = 1024L * 1024L * 1024L + +/** Tests for [PerformanceMetricsConfigurationsModule]. */ +// FunctionName: test names are conventionally named with underscores. +@Suppress("FunctionName") +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config(application = PerformanceMetricsConfigurationsModuleTest.TestApplication::class) +class PerformanceMetricsConfigurationsModuleTest { + + @JvmField + @field:[Inject MediumMemoryTierUpperBound] + var mediumMemoryTierUpperBound: Long = 0L + + @JvmField + @field:[Inject LowMemoryTierUpperBound] + var lowMemoryTierUpperBound: Long = 0L + + @JvmField + @field:[Inject LowStorageTierUpperBound] + var lowStorageTierUpperBound: Long = 0L + + @JvmField + @field:[Inject MediumStorageTierUpperBound] + var mediumStorageTierUpperBound: Long = 0L + + @Before + fun setUp() { + setUpTestApplicationComponent() + } + + @Test + fun testConfigModule_verifyLowStorageTierUpperBound() { + assertThat(lowStorageTierUpperBound).isEqualTo(ONE_GIGABYTES * 32L) + } + + @Test + fun testConfigModule_verifyMediumStorageTierUpperBound() { + assertThat(mediumStorageTierUpperBound).isEqualTo(ONE_GIGABYTES * 64L) + } + + @Test + fun testConfigModule_verifyCorrectValueOfLowMemoryTierUpperBound() { + assertThat(lowMemoryTierUpperBound).isEqualTo(ONE_GIGABYTES * 2L) + } + + @Test + fun testConfigModule_verifyCorrectValueOfMediumMemoryTierUpperBound() { + assertThat(mediumMemoryTierUpperBound).isEqualTo(ONE_GIGABYTES * 3L) + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#89): Move this to a common test application component. + @Module + interface TestModule { + @Binds + fun provideContext(application: Application): Context + } + + // 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 + ] + ) + interface TestApplicationComponent : DataProvidersInjector { + @Component.Builder + interface Builder { + @BindsInstance + fun setApplication(application: Application): Builder + fun build(): TestApplicationComponent + } + + fun inject(test: PerformanceMetricsConfigurationsModuleTest) + } + + class TestApplication : Application(), DataProvidersInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerPerformanceMetricsConfigurationsModuleTest_TestApplicationComponent.builder() + .setApplication(this) + .build() + } + + fun inject(test: PerformanceMetricsConfigurationsModuleTest) { + component.inject(test) + } + + override fun getDataProvidersInjector(): DataProvidersInjector = component + } +} From 2e5f044ceefb5ecfa81c10fe51d25e15e1980bc0 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 31 Aug 2022 05:48:59 +0530 Subject: [PATCH 146/149] nits --- .../oppialogger/analytics/testing/FakeLogSchedulerTest.kt | 6 +++--- .../logscheduler/MetricLogSchedulingWorkerTest.kt | 3 --- .../loguploader/LogReportWorkManagerInitializerTest.kt | 2 +- .../PerformanceMetricsConfigurationsModuleTest.kt | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) 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 cd2dcd5d2c1..f0be27177ef 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 @@ -15,9 +15,6 @@ import dagger.Binds import dagger.BindsInstance import dagger.Component import dagger.Module -import java.util.concurrent.TimeUnit -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -37,6 +34,9 @@ import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsConfi import org.oppia.android.util.system.OppiaClockModule 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 [FakeLogScheduler]. */ // FunctionName: test names are conventionally named with underscores. 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 36c7ef338e6..57c32579979 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 @@ -9,7 +9,6 @@ import androidx.work.Configuration import androidx.work.Data import androidx.work.OneTimeWorkRequest import androidx.work.OneTimeWorkRequestBuilder -import androidx.work.PeriodicWorkRequest import androidx.work.WorkInfo import androidx.work.WorkManager import androidx.work.testing.SynchronousExecutor @@ -20,7 +19,6 @@ import dagger.BindsInstance import dagger.Component import dagger.Module import dagger.Provides -import java.util.concurrent.TimeUnit import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -65,7 +63,6 @@ import javax.inject.Singleton private const val INCORRECT_WORKER_CASE = "incorrect_worker_case" - /** Tests for [MetricLogSchedulingWorker]. */ // FunctionName: test names are conventionally named with underscores. @Suppress("FunctionName") 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 6de9f298b1b..50b92a0573e 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,12 +27,12 @@ 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.testing.FakeLogScheduler import org.oppia.android.domain.oppialogger.exceptions.ExceptionsController import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorker import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulingWorkerFactory import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule -import org.oppia.android.domain.oppialogger.analytics.testing.FakeLogScheduler import org.oppia.android.domain.testing.oppialogger.loguploader.FakeLogUploader import org.oppia.android.testing.FakeEventLogger import org.oppia.android.testing.FakeExceptionLogger diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt index 94132f04a00..2768df0e7bf 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt @@ -9,8 +9,6 @@ import dagger.Binds import dagger.BindsInstance import dagger.Component import dagger.Module -import javax.inject.Inject -import javax.inject.Singleton import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -22,6 +20,8 @@ import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.firebase.LogReportingModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton private const val ONE_GIGABYTES = 1024L * 1024L * 1024L From dc05e8bef93a1802292f53017eef572678d6577d Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Wed, 31 Aug 2022 06:23:03 +0530 Subject: [PATCH 147/149] bazel update. --- .../java/org/oppia/android/testing/robolectric/BUILD.bazel | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel index e1fb8915f92..0b51f2ebf0b 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel @@ -71,10 +71,7 @@ kt_android_library( "OppiaShadowTrafficStats.kt", ], visibility = [ - "//:oppia_testing_visibility", - "//testing/src/test/java/org/oppia/android/testing/robolectric:__pkg__", - "//utility/src/test/java/org/oppia/android/util/locale:__pkg__", - "//utility/src/test/java/org/oppia/android/util/locale/testing:__pkg__", + "//:oppia_testing_visibility" ], deps = [ "//third_party:org_robolectric_robolectric", From 3495a4f3dfa295d87854deaa722b1e93d441d113 Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Thu, 1 Sep 2022 00:18:24 +0530 Subject: [PATCH 148/149] nit --- .../org/oppia/android/testing/robolectric/BUILD.bazel | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel index 0b51f2ebf0b..15870e33871 100644 --- a/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/robolectric/BUILD.bazel @@ -56,9 +56,7 @@ kt_android_library( srcs = [ "OppiaShadowActivityManager.kt", ], - visibility = [ - "//:oppia_testing_visibility" - ], + visibility = ["//:oppia_testing_visibility"], deps = [ "//third_party:org_robolectric_robolectric", ], @@ -70,9 +68,7 @@ kt_android_library( srcs = [ "OppiaShadowTrafficStats.kt", ], - visibility = [ - "//:oppia_testing_visibility" - ], + visibility = ["//:oppia_testing_visibility"], deps = [ "//third_party:org_robolectric_robolectric", ], From e5f9e5bb63536b48e762477d90e5635d88342cef Mon Sep 17 00:00:00 2001 From: Sarthak Agarwal Date: Fri, 2 Sep 2022 04:02:33 +0530 Subject: [PATCH 149/149] nits. --- .../domain/oppialogger/analytics/BUILD.bazel | 8 ++++---- .../logging/performancemetrics/BUILD.bazel | 6 +++--- ...rformanceMetricsConfigurationsModuleTest.kt | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) 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 9da9ff791d5..f1f3915e280 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 @@ -49,7 +49,7 @@ kt_android_library( srcs = [ "LearnerAnalyticsLogger.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ ":dagger", "//domain/src/main/java/org/oppia/android/domain/oppialogger:logging_identifier_controller", @@ -64,7 +64,7 @@ kt_android_library( srcs = [ "PerformanceMetricsLogger.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ ":dagger", ":performance_metrics_controller", @@ -95,7 +95,7 @@ kt_android_library( srcs = [ "LearnerAnalyticsInactivityLimitMillis.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ "//third_party:javax_inject_javax_inject", ], @@ -106,7 +106,7 @@ kt_android_library( srcs = [ "ApplicationLifecycleObserver.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ ":dagger", ":learner_analytics_inactivity_limit_millis", 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 5a0e37cc86f..3e83fdcdb06 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 @@ -10,7 +10,7 @@ kt_android_library( srcs = [ "PerformanceMetricsEventLogger.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", ], @@ -21,7 +21,7 @@ kt_android_library( srcs = [ "PerformanceMetricsAssessor.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", ], @@ -46,7 +46,7 @@ kt_android_library( srcs = [ "PerformanceMetricsAssessorImpl.kt", ], - visibility = ["//:oppia_prod_module_visibility"], + visibility = ["//:oppia_api_visibility"], deps = [ ":performance_metrics_assessor", ":performance_metrics_configurations_module", diff --git a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt index 2768df0e7bf..dde7045ad67 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsConfigurationsModuleTest.kt @@ -23,7 +23,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -private const val ONE_GIGABYTES = 1024L * 1024L * 1024L +private const val ONE_GIGABYTE = 1024L * 1024L * 1024L /** Tests for [PerformanceMetricsConfigurationsModule]. */ // FunctionName: test names are conventionally named with underscores. @@ -55,23 +55,23 @@ class PerformanceMetricsConfigurationsModuleTest { } @Test - fun testConfigModule_verifyLowStorageTierUpperBound() { - assertThat(lowStorageTierUpperBound).isEqualTo(ONE_GIGABYTES * 32L) + fun testLowStorageTierUpperBound_isThirtyTwoGigabytes() { + assertThat(lowStorageTierUpperBound).isEqualTo(ONE_GIGABYTE * 32L) } @Test - fun testConfigModule_verifyMediumStorageTierUpperBound() { - assertThat(mediumStorageTierUpperBound).isEqualTo(ONE_GIGABYTES * 64L) + fun testMediumStorageTierUpperBound_isSixtyFourGigabytes() { + assertThat(mediumStorageTierUpperBound).isEqualTo(ONE_GIGABYTE * 64L) } @Test - fun testConfigModule_verifyCorrectValueOfLowMemoryTierUpperBound() { - assertThat(lowMemoryTierUpperBound).isEqualTo(ONE_GIGABYTES * 2L) + fun testLowMemoryTierUpperBound_isTwoGigabytes() { + assertThat(lowMemoryTierUpperBound).isEqualTo(ONE_GIGABYTE * 2L) } @Test - fun testConfigModule_verifyCorrectValueOfMediumMemoryTierUpperBound() { - assertThat(mediumMemoryTierUpperBound).isEqualTo(ONE_GIGABYTES * 3L) + fun testLowMemoryTierUpperBound_isThreeGigabytes() { + assertThat(mediumMemoryTierUpperBound).isEqualTo(ONE_GIGABYTE * 3L) } private fun setUpTestApplicationComponent() {