From 9d78df0d301e54fe26fdcd363ddbe70915da8ada Mon Sep 17 00:00:00 2001 From: jackqdyulei Date: Tue, 15 Aug 2017 10:12:14 -0700 Subject: [PATCH] Add bt anomaly action in testing app This cl adds the action to start bluttooth unoptimized scanning. With this action we could test whether bt anomaly detector is effective. Bug: 62602318 Test: make -j40 AnomalyTester Change-Id: I7f41dbb07384fbf3c5a81e460a3629306bc33f59 --- tests/anomaly-tester/AndroidManifest.xml | 11 ++- .../res/layout/bluetooth_anomaly.xml | 9 +- .../settings/anomaly/tester/AnomalyActivity.java | 76 ++++++++++++++++- .../anomaly/tester/service/AnomalyService.java | 49 +++++++++++ .../anomaly/tester/utils/AnomalyActions.java | 96 ++++++++++++++++++++++ .../anomaly/tester/utils/AnomalyPolicyBuilder.java | 72 ++++++++++++++++ 6 files changed, 309 insertions(+), 4 deletions(-) create mode 100644 tests/anomaly-tester/src/com/android/settings/anomaly/tester/service/AnomalyService.java create mode 100644 tests/anomaly-tester/src/com/android/settings/anomaly/tester/utils/AnomalyActions.java create mode 100644 tests/anomaly-tester/src/com/android/settings/anomaly/tester/utils/AnomalyPolicyBuilder.java diff --git a/tests/anomaly-tester/AndroidManifest.xml b/tests/anomaly-tester/AndroidManifest.xml index b5f50c4573..c057a66ec4 100644 --- a/tests/anomaly-tester/AndroidManifest.xml +++ b/tests/anomaly-tester/AndroidManifest.xml @@ -14,8 +14,13 @@ limitations under the License. --> + package="com.android.settings.anomaly.tester"> + + + + + + + \ No newline at end of file diff --git a/tests/anomaly-tester/res/layout/bluetooth_anomaly.xml b/tests/anomaly-tester/res/layout/bluetooth_anomaly.xml index 7de558e29b..87e61b0d78 100644 --- a/tests/anomaly-tester/res/layout/bluetooth_anomaly.xml +++ b/tests/anomaly-tester/res/layout/bluetooth_anomaly.xml @@ -35,16 +35,21 @@ android:layout_width="0dp" android:layout_weight="3" android:layout_height="wrap_content" - android:hint="Threshold(ms)"/> + android:hint="Threshold(ms)" + android:text="3000" + android:inputType="number"/> + android:hint="Run time(ms)" + android:text="6000" + android:inputType="number"/>