From 5a3be2874e77082967d3ac6e78f4c0f0e1ead97e Mon Sep 17 00:00:00 2001 From: jackqdyulei Date: Wed, 19 Jul 2017 10:46:21 -0700 Subject: [PATCH] Turn off some anomaly detectors by default 1. Wakeup alarm detector Because we cannot distinguish it between foreground and background 2. Bluetooth unoptimized scanning detector There is a bug in framework that may undercount the scanning time Bug: 63390581 Bug: 63964363 Test: RunSettingsRoboTests Change-Id: Ia762f580462823e8eddccbeb12dec3876b0ef47a --- .../settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java | 4 ++-- .../settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java b/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java index 4829ca01d3..23c70bb48b 100644 --- a/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java +++ b/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java @@ -122,9 +122,9 @@ public class AnomalyDetectionPolicy { anomalyDetectionEnabled = mParserWrapper.getBoolean(KEY_ANOMALY_DETECTION_ENABLED, true); wakeLockDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKELOCK_DETECTION_ENABLED, true); wakeupAlarmDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKEUP_ALARM_DETECTION_ENABLED, - true); + false); bluetoothScanDetectionEnabled = mParserWrapper.getBoolean( - KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, true); + KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, false); wakeLockThreshold = mParserWrapper.getLong(KEY_WAKELOCK_THRESHOLD, DateUtils.HOUR_IN_MILLIS); wakeupAlarmThreshold = mParserWrapper.getLong(KEY_WAKEUP_ALARM_THRESHOLD, 60); diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java index 169cba8e9b..07727c326d 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java @@ -84,9 +84,9 @@ public class AnomalyDetectionPolicyTest { assertThat(anomalyDetectionPolicy.anomalyDetectionEnabled).isTrue(); assertThat(anomalyDetectionPolicy.wakeLockDetectionEnabled).isTrue(); assertThat(anomalyDetectionPolicy.wakeLockThreshold).isEqualTo(DateUtils.HOUR_IN_MILLIS); - assertThat(anomalyDetectionPolicy.wakeupAlarmDetectionEnabled).isTrue(); + assertThat(anomalyDetectionPolicy.wakeupAlarmDetectionEnabled).isFalse(); assertThat(anomalyDetectionPolicy.wakeupAlarmThreshold).isEqualTo(60); - assertThat(anomalyDetectionPolicy.bluetoothScanDetectionEnabled).isTrue(); + assertThat(anomalyDetectionPolicy.bluetoothScanDetectionEnabled).isFalse(); assertThat(anomalyDetectionPolicy.bluetoothScanThreshold).isEqualTo( 30 * DateUtils.MINUTE_IN_MILLIS); } @@ -112,9 +112,9 @@ public class AnomalyDetectionPolicyTest { doReturn(false).when(mKeyValueListParserWrapper).getBoolean( AnomalyDetectionPolicy.KEY_WAKELOCK_DETECTION_ENABLED, true); doReturn(true).when(mKeyValueListParserWrapper).getBoolean( - AnomalyDetectionPolicy.KEY_WAKEUP_ALARM_DETECTION_ENABLED, true); + AnomalyDetectionPolicy.KEY_WAKEUP_ALARM_DETECTION_ENABLED, false); doReturn(true).when(mKeyValueListParserWrapper).getBoolean( - AnomalyDetectionPolicy.KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, true); + AnomalyDetectionPolicy.KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, false); return new AnomalyDetectionPolicy(mContext, mKeyValueListParserWrapper); } -- 2.11.0