diff options
author | Alex Salo <asalo@google.com> | 2022-07-19 17:29:52 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-07-19 17:29:52 +0000 |
commit | b4e245fdee262983994845f517e86d0a3f233ec8 (patch) | |
tree | 73d229cb76f73c33e019720373b513ebce515a82 | |
parent | 43b5772991abc835cd798a1b765d8f10ea04c8e6 (diff) | |
parent | 26d542fde83d4b55911e4ede4a0e375f555e978f (diff) | |
download | cts-b4e245fdee262983994845f517e86d0a3f233ec8.tar.gz |
Merge "Remove Presence Tests from CTS-V" into stage-aosp-tm-ts-dev am: 26d542fde8
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/19332048
Change-Id: Id452015e6e4c38efdfb4abc92297d6a6c451de31
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
15 files changed, 0 insertions, 1367 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml index 94264779344..aa9032f9a41 100644 --- a/apps/CtsVerifier/AndroidManifest.xml +++ b/apps/CtsVerifier/AndroidManifest.xml @@ -3920,174 +3920,6 @@ android:value="single_display_mode" /> </activity> - <!-- CTS Verifier Presence Test Top Screen --> - <activity - android:name=".presence.PresenceTestActivity" - android:configChanges="keyboardHidden|orientation|screenSize" - android:exported="true" - android:label="@string/presence_test" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/test_category_networking" /> - <meta-data android:name="display_mode" - android:value="single_display_mode" /> - </activity> - - <!-- - CTS Verifier Uwb Precision Test Screen - test category : uwb - test parent : PresenceTestActivity - --> - <activity - android:name=".presence.UwbPrecisionActivity" - android:configChanges="keyboardHidden|orientation|screenSize" - android:exported="true" - android:label="@string/uwb_precision" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/uwb" /> - <meta-data - android:name="test_parent" - android:value="com.android.cts.verifier.presence.PresenceTestActivity" /> - <meta-data android:name="display_mode" - android:value="single_display_mode" /> - <meta-data android:name="CddTest" - android:value="7.4.9/C-1-1" /> - </activity> - - <!-- - CTS Verifier Uwb Short Range Test Screen - test category : uwb - test parent : PresenceTestActivity - --> - <activity - android:name=".presence.UwbShortRangeActivity" - android:configChanges="keyboardHidden|orientation|screenSize" - android:exported="true" - android:label="@string/uwb_short_range" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/uwb" /> - <meta-data - android:name="test_parent" - android:value="com.android.cts.verifier.presence.PresenceTestActivity" /> - <meta-data - android:name="display_mode" - android:value="single_display_mode" /> - <meta-data - android:name="CddTest" - android:value="7.4.9/C-1-2" /> - </activity> - - <!-- - CTS Verifier BLE RSSI Precision Test Screen - test category : BLE - test parent : PresenceTestActivity - --> - <activity - android:name=".presence.BleRssiPrecisionActivity" - android:exported="true" - android:label="@string/ble_rssi_precision_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/ble" /> - <meta-data - android:name="test_parent" - android:value="com.android.cts.verifier.presence.PresenceTestActivity" /> - <meta-data - android:name="test_required_features" - android:value="android.hardware.bluetooth_le" /> - <meta-data - android:name="display_mode" - android:value="single_display_mode" /> - <meta-data - android:name="CddText" - android:value="7.4.3/C-7-1" /> - </activity> - - <!-- - CTS Verifier BLE Rx/Tx Calibration Test Screen - test category : BLE - test parent : PresenceTestActivity - --> - <activity - android:name=".presence.BleRxTxCalibrationActivity" - android:exported="true" - android:label="@string/ble_rx_tx_calibration_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/ble" /> - <meta-data - android:name="test_parent" - android:value="com.android.cts.verifier.presence.PresenceTestActivity" /> - <meta-data - android:name="test_required_features" - android:value="android.hardware.bluetooth_le" /> - <meta-data - android:name="display_mode" - android:value="single_display_mode" /> - <meta-data - android:name="CddText" - android:value="7.4.3/C-7-2" /> - </activity> - - <!-- CTS Verifier Nan Precision and Bias Test Screen - test category : wifi_nan - test parent : PresenceTestActivity - --> - <activity - android:name=".presence.NanPrecisionTestActivity" - android:configChanges="keyboardHidden|orientation|screenSize" - android:exported="true" - android:label="@string/nan_precision" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - - <meta-data - android:name="test_category" - android:value="@string/wifi_nan" /> - <meta-data - android:name="test_parent" - android:value="com.android.cts.verifier.presence.PresenceTestActivity" /> - <meta-data android:name="display_mode" - android:value="single_display_mode" /> - <meta-data android:name="CddTest" - android:value="7.4.2.5/H-1-1|7.4.2.5/H-1-2" /> - </activity> - <activity-alias android:name=".CtsVerifierActivity" android:label="@string/app_name" diff --git a/apps/CtsVerifier/res/layout/ble_rssi_precision.xml b/apps/CtsVerifier/res/layout/ble_rssi_precision.xml deleted file mode 100644 index 5f01e1fc442..00000000000 --- a/apps/CtsVerifier/res/layout/ble_rssi_precision.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - style="@style/RootLayoutPadding" - tools:ignore="Autofill"> - - <ScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:text="@string/ble_rssi_precision_test_instructions" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scrollbars="vertical" /> - - <EditText - android:id="@+id/report_rssi_range" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_ble_rssi_range" - android:inputType="number" /> - - <EditText - android:id="@+id/report_reference_device" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_reference_device" - android:inputType="text" /> - - <include - android:layout_width="match_parent" - android:layout_height="wrap_content" - layout="@layout/pass_fail_buttons" /> - </LinearLayout> - </ScrollView> -</RelativeLayout> diff --git a/apps/CtsVerifier/res/layout/ble_rx_tx_calibration.xml b/apps/CtsVerifier/res/layout/ble_rx_tx_calibration.xml deleted file mode 100644 index 3ca955b7e30..00000000000 --- a/apps/CtsVerifier/res/layout/ble_rx_tx_calibration.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - style="@style/RootLayoutPadding" - tools:ignore="Autofill"> - - <ScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:text="@string/ble_rx_tx_calibration_test_instructions" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scrollbars="vertical" /> - - <EditText - android:id="@+id/report_channels_rssi_range" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_channels_ble_rssi_range" - android:inputType="number" /> - - <EditText - android:id="@+id/report_cores_rssi_range" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_cores_ble_rssi_range" - android:inputType="number" /> - - <EditText - android:id="@+id/report_reference_device" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_reference_device" - android:inputType="text" /> - - <include - android:layout_width="match_parent" - android:layout_height="wrap_content" - layout="@layout/pass_fail_buttons" /> - </LinearLayout> - </ScrollView> -</RelativeLayout> diff --git a/apps/CtsVerifier/res/layout/nan_precision.xml b/apps/CtsVerifier/res/layout/nan_precision.xml deleted file mode 100644 index c81a9c4f120..00000000000 --- a/apps/CtsVerifier/res/layout/nan_precision.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - style="@style/RootLayoutPadding"> - <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <TextView android:text="@string/nan_precision_instruction" - android:id="@+id/nan_precision_instruction" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scrollbars="vertical"/> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <EditText android:id="@+id/nan_bandwidth" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="number" - android:hint="@string/report_nan_bandwidth_mhz"/> - <EditText android:id="@+id/distance_range_10cm_gt_68p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_10cm_gt_68p"/> - <EditText android:id="@+id/distance_range_1m_gt_68p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_1m_gt_68p"/> - <EditText android:id="@+id/distance_range_3m_gt_68p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_3m_gt_68p"/> - <EditText android:id="@+id/distance_range_5m_gt_68p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_5m_gt_68p"/> - <EditText android:id="@+id/distance_range_10cm_gt_90p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_10cm_gt_90p"/> - <EditText android:id="@+id/distance_range_1m_gt_90p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_1m_gt_90p"/> - <EditText android:id="@+id/distance_range_3m_gt_90p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_3m_gt_90p"/> - <EditText android:id="@+id/distance_range_5m_gt_90p" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_5m_gt_90p"/> - <EditText android:id="@+id/reference_device" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_reference_device"/> - </LinearLayout> - - <include android:layout_width="match_parent" - android:layout_height="wrap_content" - layout="@layout/pass_fail_buttons"/> - </LinearLayout> - </ScrollView> -</RelativeLayout> diff --git a/apps/CtsVerifier/res/layout/uwb_precision.xml b/apps/CtsVerifier/res/layout/uwb_precision.xml deleted file mode 100644 index 14e996d6f5f..00000000000 --- a/apps/CtsVerifier/res/layout/uwb_precision.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2022 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - style="@style/RootLayoutPadding"> - <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <TextView android:text="@string/uwb_precision_instruction" - android:id="@+id/uwb_precision_instruction" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scrollbars="vertical"/> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <EditText android:id="@+id/distance_range_cm" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:inputType="numberDecimal" - android:hint="@string/report_distance_range_cm"/> - <EditText android:id="@+id/reference_device" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_reference_device"/> - </LinearLayout> - - <include android:layout_width="match_parent" - android:layout_height="wrap_content" - layout="@layout/pass_fail_buttons"/> - </LinearLayout> - </ScrollView> -</RelativeLayout> diff --git a/apps/CtsVerifier/res/layout/uwb_short_range.xml b/apps/CtsVerifier/res/layout/uwb_short_range.xml deleted file mode 100644 index 9afc6e5a6b4..00000000000 --- a/apps/CtsVerifier/res/layout/uwb_short_range.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2022 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - style="@style/RootLayoutPadding"> - <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <TextView android:text="@string/uwb_short_range_instruction" - android:id="@+id/uwb_short_range_instruction" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scrollbars="vertical"/> - <LinearLayout android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <EditText android:id="@+id/distance_median_meters" - android:layout_width="wrap_content" - android:inputType="numberDecimal" - android:layout_height="wrap_content" - android:hint="@string/report_distance_median_meters"/> - <EditText android:id="@+id/reference_device" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:hint="@string/report_reference_device"/> - </LinearLayout> - - <include android:layout_width="match_parent" - android:layout_height="wrap_content" - layout="@layout/pass_fail_buttons"/> - </LinearLayout> - </ScrollView> -</RelativeLayout> diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRssiPrecisionActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRssiPrecisionActivity.java deleted file mode 100644 index 1548910093a..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRssiPrecisionActivity.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.cts.verifier.presence; - -import android.app.AlertDialog; -import android.bluetooth.BluetoothAdapter; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.Editable; -import android.util.Log; -import android.widget.EditText; - -import com.android.compatibility.common.util.ResultType; -import com.android.compatibility.common.util.ResultUnit; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -/** Tests the precision of the device's RSSI measurement wtfdelet */ -public class BleRssiPrecisionActivity extends PassFailButtons.Activity { - private static final String TAG = BleRssiPrecisionActivity.class.getName(); - - // Report log schema - private static final String KEY_RSSI_RANGE_DBM = "rssi_range_dbm"; - private static final String KEY_REFERENCE_DEVICE = "reference_device"; - - // Thresholds - private static final int MAX_RSSI_RANGE_DBM = 18; - - private EditText reportRssiRangeEditText; - private EditText reportReferenceDeviceEditText; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.ble_rssi_precision); - setPassFailButtonClickListeners(); - getPassButton().setEnabled(false); - - reportRssiRangeEditText = findViewById(R.id.report_rssi_range); - reportReferenceDeviceEditText = findViewById(R.id.report_reference_device); - - DeviceFeatureChecker.checkFeatureSupported(this, getPassButton(), - PackageManager.FEATURE_BLUETOOTH_LE); - - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - - if (!adapter.isEnabled()) { - new AlertDialog.Builder(this) - .setTitle(R.string.ble_bluetooth_disable_title) - .setMessage(R.string.ble_bluetooth_disable_message) - .setOnCancelListener(dialog -> finish()) - .create().show(); - } - - reportRssiRangeEditText.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - reportReferenceDeviceEditText.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - } - - private void checkTestInputs() { - getPassButton().setEnabled(checkDistanceRangeInput() && checkReferenceDeviceInput()); - } - - private boolean checkDistanceRangeInput() { - String rssiRangeInput = reportRssiRangeEditText.getText().toString(); - - if (!rssiRangeInput.isEmpty()) { - int rssiRange = Integer.parseInt(rssiRangeInput); - // RSSI range must be inputted and within acceptable range before test can be passed - return rssiRange <= MAX_RSSI_RANGE_DBM; - } - return false; - } - - private boolean checkReferenceDeviceInput() { - // Reference device must be inputted before test can be passed - return !reportReferenceDeviceEditText.getText().toString().isEmpty(); - } - - @Override - public void recordTestResults() { - String rssiRange = reportRssiRangeEditText.getText().toString(); - String referenceDevice = reportReferenceDeviceEditText.getText().toString(); - - if (!rssiRange.isEmpty()) { - Log.i(TAG, "BLE RSSI Range (dBm): " + rssiRange); - getReportLog().addValue(KEY_RSSI_RANGE_DBM, Integer.parseInt(rssiRange), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!referenceDevice.isEmpty()) { - Log.i(TAG, "BLE Reference Device: " + referenceDevice); - getReportLog().addValue(KEY_REFERENCE_DEVICE, referenceDevice, - ResultType.NEUTRAL, ResultUnit.NONE); - } - getReportLog().submit(); - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRxTxCalibrationActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRxTxCalibrationActivity.java deleted file mode 100644 index 2de7edffe7c..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/BleRxTxCalibrationActivity.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.cts.verifier.presence; - -import android.app.AlertDialog; -import android.bluetooth.BluetoothAdapter; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.Editable; -import android.util.Log; -import android.widget.EditText; - -import com.android.compatibility.common.util.ResultType; -import com.android.compatibility.common.util.ResultUnit; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -/** - * Tests that the device's Rx/Tx calibration results in a median range (cm) within the specified - * bounds - */ -public class BleRxTxCalibrationActivity extends PassFailButtons.Activity { - private static final String TAG = BleRxTxCalibrationActivity.class.getName(); - - // Report log schema - private static final String KEY_CHANNEL_RSSI_RANGE = "channel_rssi_range"; - private static final String KEY_CORE_RSSI_RANGE = "core_rssi_range"; - private static final String KEY_REFERENCE_DEVICE = "reference_device"; - - // Thresholds - private static final int MAX_RSSI_RANGE = 6; - - private EditText reportChannelsRssiRangeEditText; - private EditText reportCoresRssiRangeEditText; - private EditText reportReferenceDeviceEditText; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.ble_rx_tx_calibration); - setPassFailButtonClickListeners(); - getPassButton().setEnabled(false); - - reportChannelsRssiRangeEditText = findViewById(R.id.report_channels_rssi_range); - reportCoresRssiRangeEditText = findViewById(R.id.report_cores_rssi_range); - reportReferenceDeviceEditText = findViewById(R.id.report_reference_device); - - DeviceFeatureChecker.checkFeatureSupported(this, getPassButton(), - PackageManager.FEATURE_BLUETOOTH_LE); - - BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); - - if (!adapter.isEnabled()) { - new AlertDialog.Builder(this) - .setTitle(R.string.ble_bluetooth_disable_title) - .setMessage(R.string.ble_bluetooth_disable_message) - .setOnCancelListener(dialog -> finish()) - .create().show(); - } - - reportChannelsRssiRangeEditText.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - reportCoresRssiRangeEditText.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - reportReferenceDeviceEditText.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - } - - private void checkTestInputs() { - getPassButton().setEnabled( - checkChannelRssiInput() && checkCoreRssiInput() && checkReferenceDeviceInput()); - } - - private boolean checkChannelRssiInput() { - String channelsRssiRangeInput = reportChannelsRssiRangeEditText.getText().toString(); - if (!channelsRssiRangeInput.isEmpty()) { - int channelsRssiRange = Integer.parseInt(channelsRssiRangeInput); - // RSSI range must be inputted and within acceptable range before test can be passed - return channelsRssiRange <= MAX_RSSI_RANGE; - } - return false; - } - - private boolean checkCoreRssiInput() { - String coresRssiRangeInput = reportCoresRssiRangeEditText.getText().toString(); - if (!coresRssiRangeInput.isEmpty()) { - int coresRssiRange = Integer.parseInt(coresRssiRangeInput); - // RSSI range must be inputted and within acceptable range before test can be passed - return coresRssiRange <= MAX_RSSI_RANGE; - } - // This field is optional, so return true even if the user has not inputted anything - return true; - } - - private boolean checkReferenceDeviceInput() { - // Reference device must be inputted before test can be passed - return !reportReferenceDeviceEditText.getText().toString().isEmpty(); - } - - @Override - public void recordTestResults() { - String channelRssiRange = reportChannelsRssiRangeEditText.getText().toString(); - String coreRssiRange = reportCoresRssiRangeEditText.getText().toString(); - String referenceDevice = reportReferenceDeviceEditText.getText().toString(); - - if (!channelRssiRange.isEmpty()) { - Log.i(TAG, "BLE RSSI Range Across Channels (dBm): " + channelRssiRange); - getReportLog().addValue(KEY_CHANNEL_RSSI_RANGE, Integer.parseInt(channelRssiRange), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!coreRssiRange.isEmpty()) { - Log.i(TAG, "BLE RSSI Range Across Cores (dBm): " + coreRssiRange); - getReportLog().addValue(KEY_CORE_RSSI_RANGE, Integer.parseInt(coreRssiRange), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!referenceDevice.isEmpty()) { - Log.i(TAG, "BLE Reference Device: " + referenceDevice); - getReportLog().addValue(KEY_REFERENCE_DEVICE, referenceDevice, - ResultType.NEUTRAL, ResultUnit.NONE); - } - - getReportLog().submit(); - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/DeviceFeatureChecker.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/DeviceFeatureChecker.java deleted file mode 100644 index 256fe3a078d..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/DeviceFeatureChecker.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.cts.verifier.presence; -import android.app.Activity; -import android.content.Context; -import android.util.Log; -import android.view.View; -import android.widget.Toast; - -/** - * Checks if a device supports a hardware feature needed for a test, and passes the test - * automatically otherwise. - */ -public class DeviceFeatureChecker { - - /** Checks if a feature is supported. - * - * @param feature must be a string defined in PackageManager - */ - public static void checkFeatureSupported(Context context, View passButton, String feature) { - if (!context.getPackageManager().hasSystemFeature(feature)) { - String message = String.format("Device does not support %s, automatically passing test", - feature); - Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); - Log.e(context.getClass().getName(), message); - passButton.performClick(); - Activity activity = (Activity) (context); - activity.finish(); - } - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/InputTextHandler.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/InputTextHandler.java deleted file mode 100644 index 2de68a5a78e..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/InputTextHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package com.android.cts.verifier.presence; - -import android.text.Editable; -import android.text.TextWatcher; - -/** - * Handles editable text inputted into test activities. - */ -public class InputTextHandler { - - /** Callback that is executed when text is changed. Takes modified text as input. */ - public interface OnTextChanged { - void run(Editable s); - } - - /** - * Generic text changed handler that will execute the provided callback when text is modified. - * - * @param callback called when text is changed, and passed the modified text - */ - public static TextWatcher getOnTextChangedHandler(OnTextChanged callback) { - return new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) {} - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) {} - - @Override - public void afterTextChanged(Editable s) { - callback.run(s); - } - }; - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/NanPrecisionTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/NanPrecisionTestActivity.java deleted file mode 100644 index 458d1920eca..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/NanPrecisionTestActivity.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.cts.verifier.presence; - -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.Editable; -import android.util.Log; -import android.widget.EditText; - -import com.android.compatibility.common.util.ResultType; -import com.android.compatibility.common.util.ResultUnit; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -import com.google.common.collect.ImmutableMap; - -import java.util.Arrays; -import java.util.List; - -/** - * Activity for testing that NAN measurements are within the acceptable ranges - */ -public class NanPrecisionTestActivity extends PassFailButtons.Activity { - private static final String TAG = NanPrecisionTestActivity.class.getName(); - - // Report log schema - private static final String KEY_BANDWIDTH = "nan_bandwidth"; - private static final String KEY_MEASUREMENT_RANGE_10CM_AT_68P = "measurement_range_10cm_68p"; - private static final String KEY_MEASUREMENT_RANGE_1M_AT_68P = "measurement_range_1m_68p"; - private static final String KEY_MEASUREMENT_RANGE_3M_AT_68p = "measurement_range_3m_68p"; - private static final String KEY_MEASUREMENT_RANGE_5M_AT_68p = "measurement_range_5m_68p"; - private static final String KEY_MEASUREMENT_RANGE_10CM_AT_90P = "measurement_range_10cm_90p"; - private static final String KEY_MEASUREMENT_RANGE_1M_AT_90P = "measurement_range_1m_90p"; - private static final String KEY_MEASUREMENT_RANGE_3M_AT_90p = "measurement_range_3m_90p"; - private static final String KEY_MEASUREMENT_RANGE_5M_AT_90p = "measurement_range_5m_90p"; - private static final String KEY_REFERENCE_DEVICE = "reference_device"; - - // Thresholds - private static final int MAX_DISTANCE_RANGE_METERS_160MHZ = 2; - private static final int MAX_DISTANCE_RANGE_METERS_80MHZ = 4; - private static final int MAX_DISTANCE_RANGE_METERS_40MHZ = 8; - private static final int MAX_DISTANCE_RANGE_METERS_20MHZ = 16; - - // Maps NAN bandwidths to acceptable range thresholds - private static final ImmutableMap<Integer, Integer> BANDWIDTH_TO_THRESHOLD_MAP = - ImmutableMap.of(160, MAX_DISTANCE_RANGE_METERS_160MHZ, 80, - MAX_DISTANCE_RANGE_METERS_80MHZ, 40, MAX_DISTANCE_RANGE_METERS_40MHZ, 20, - MAX_DISTANCE_RANGE_METERS_20MHZ); - - private EditText mBandwidthMhz; - private EditText mMeasurementRange10cmGt68p; - private EditText mMeasurementRange1mGt68p; - private EditText mMeasurementRange3mGt68p; - private EditText mMeasurementRange5mGt68p; - private EditText mMeasurementRange10cmGt90p; - private EditText mMeasurementRange1mGt90p; - private EditText mMeasurementRange3mGt90p; - private EditText mMeasurementRange5mGt90p; - private EditText mReferenceDeviceInput; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.nan_precision); - setPassFailButtonClickListeners(); - getPassButton().setEnabled(false); - - mBandwidthMhz = (EditText) findViewById(R.id.nan_bandwidth); - mMeasurementRange10cmGt68p = (EditText) findViewById(R.id.distance_range_10cm_gt_68p); - mMeasurementRange1mGt68p = (EditText) findViewById(R.id.distance_range_1m_gt_68p); - mMeasurementRange3mGt68p = (EditText) findViewById(R.id.distance_range_3m_gt_68p); - mMeasurementRange5mGt68p = (EditText) findViewById(R.id.distance_range_5m_gt_68p); - mMeasurementRange10cmGt90p = (EditText) findViewById(R.id.distance_range_10cm_gt_90p); - mMeasurementRange1mGt90p = (EditText) findViewById(R.id.distance_range_1m_gt_90p); - mMeasurementRange3mGt90p = (EditText) findViewById(R.id.distance_range_3m_gt_90p); - mMeasurementRange5mGt90p = (EditText) findViewById(R.id.distance_range_5m_gt_90p); - mReferenceDeviceInput = (EditText) findViewById(R.id.reference_device); - - DeviceFeatureChecker.checkFeatureSupported(this, getPassButton(), - PackageManager.FEATURE_WIFI_AWARE); - - mBandwidthMhz.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange10cmGt68p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange1mGt68p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange3mGt68p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange5mGt68p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange10cmGt90p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange1mGt90p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange3mGt90p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mMeasurementRange5mGt90p.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mReferenceDeviceInput.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - } - - private void checkTestInputs() { - getPassButton().setEnabled(checkMeasurementRange68thPercentileInput() - && checkMeasurementRange90thPercentileInput() - && checkReferenceDeviceInput()); - } - - private boolean checkMeasurementRange68thPercentileInput() { - return checkRequiredMeasurementRangeInput(mMeasurementRange10cmGt68p, - mMeasurementRange1mGt68p, mMeasurementRange3mGt68p, mMeasurementRange5mGt68p); - } - - private boolean checkMeasurementRange90thPercentileInput() { - String measurementRangeInput10cmGt90p = mMeasurementRange10cmGt90p.getText().toString(); - String measurementRangeInput1mGt90p = mMeasurementRange1mGt90p.getText().toString(); - String measurementRangeInput3mGt90p = mMeasurementRange3mGt90p.getText().toString(); - String measurementRangeInput5mGt90p = mMeasurementRange5mGt90p.getText().toString(); - List<String> optionalMeasurementRangeList = Arrays.asList(measurementRangeInput10cmGt90p, - measurementRangeInput1mGt90p, - measurementRangeInput3mGt90p, measurementRangeInput5mGt90p); - - boolean inputted = false; - for (String input : optionalMeasurementRangeList) { - if (!input.isEmpty()) { - inputted = true; - break; - } - } - // If one of the ranges is inputted for one of the distances, then it becomes required - // that the ranges are inputted for all the distances and for tests to pass, must be - // acceptable values - return !inputted || checkRequiredMeasurementRangeInput(mMeasurementRange10cmGt90p, - mMeasurementRange1mGt90p, mMeasurementRange3mGt90p, mMeasurementRange5mGt90p); - } - - private boolean checkRequiredMeasurementRangeInput(EditText rangeInput10cm, - EditText rangeInput1m, EditText rangeInput3m, EditText rangeInput5m) { - String bandwidthInputMhz = mBandwidthMhz.getText().toString(); - String measurementRangeInput10cmGt = rangeInput10cm.getText().toString(); - String measurementRangeInput1mGt = rangeInput1m.getText().toString(); - String measurementRangeInput3mGt = rangeInput3m.getText().toString(); - String measurementRangeInput5mGt = rangeInput5m.getText().toString(); - List<String> requiredMeasurementRangeList = Arrays.asList(measurementRangeInput10cmGt, - measurementRangeInput1mGt, - measurementRangeInput3mGt, measurementRangeInput5mGt); - - for (String input : requiredMeasurementRangeList) { - if (bandwidthInputMhz.isEmpty() || input.isEmpty()) { - // Distance range must be inputted for all fields so fail early otherwise - return false; - } - if (!BANDWIDTH_TO_THRESHOLD_MAP.containsKey(Integer.parseInt(bandwidthInputMhz))) { - // bandwidth must be one of the expected thresholds - return false; - } - double distanceRange = Double.parseDouble(input); - int bandwidth = Integer.parseInt(bandwidthInputMhz); - if (distanceRange > BANDWIDTH_TO_THRESHOLD_MAP.get(bandwidth)) { - // All inputs must be in acceptable range so fail early otherwise - return false; - } - } - return true; - } - - private boolean checkReferenceDeviceInput() { - // Reference device used must be inputted before test can be passed. - return !mReferenceDeviceInput.getText().toString().isEmpty(); - } - - @Override - public void recordTestResults() { - String nanBandwidthMhz = mBandwidthMhz.getText().toString(); - String measurementRange10cmGt68p = mMeasurementRange10cmGt68p.getText().toString(); - String measurementRange1mGt68p = mMeasurementRange1mGt68p.getText().toString(); - String measurementRange3mGt68p = mMeasurementRange3mGt68p.getText().toString(); - String measurementRange5mGt68p = mMeasurementRange5mGt68p.getText().toString(); - String measurementRange10cmGt90p = mMeasurementRange10cmGt90p.getText().toString(); - String measurementRange1mGt90p = mMeasurementRange1mGt90p.getText().toString(); - String measurementRange3mGt90p = mMeasurementRange3mGt90p.getText().toString(); - String measurementRange5mGt90p = mMeasurementRange5mGt90p.getText().toString(); - String referenceDevice = mReferenceDeviceInput.getText().toString(); - - if (!nanBandwidthMhz.isEmpty()) { - Log.i(TAG, "NAN Bandwidth at which data was collected: " + nanBandwidthMhz); - getReportLog().addValue(KEY_BANDWIDTH, - Integer.parseInt(nanBandwidthMhz), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange10cmGt68p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 10cm: " + measurementRange10cmGt68p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_10CM_AT_68P, - Double.parseDouble(measurementRange10cmGt68p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange1mGt68p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 1m: " + measurementRange1mGt68p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_1M_AT_68P, - Double.parseDouble(measurementRange1mGt68p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange3mGt68p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 3m: " + measurementRange3mGt68p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_3M_AT_68p, - Double.parseDouble(measurementRange3mGt68p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange5mGt68p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 5m: " + measurementRange5mGt68p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_5M_AT_68p, - Double.parseDouble(measurementRange5mGt68p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange10cmGt90p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 10cm: " + measurementRange10cmGt68p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_10CM_AT_90P, - Double.parseDouble(measurementRange10cmGt90p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange1mGt90p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 1m: " + measurementRange1mGt90p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_1M_AT_90P, - Double.parseDouble(measurementRange1mGt90p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange3mGt90p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 3m: " + measurementRange3mGt90p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_3M_AT_90p, - Double.parseDouble(measurementRange3mGt90p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!measurementRange5mGt90p.isEmpty()) { - Log.i(TAG, "NAN Measurement Range at 5m: " + measurementRange5mGt90p); - getReportLog().addValue(KEY_MEASUREMENT_RANGE_5M_AT_90p, - Double.parseDouble(measurementRange5mGt90p), - ResultType.NEUTRAL, ResultUnit.NONE); - } - - if (!referenceDevice.isEmpty()) { - Log.i(TAG, "NAN Reference Device: " + referenceDevice); - getReportLog().addValue(KEY_REFERENCE_DEVICE, referenceDevice, - ResultType.NEUTRAL, ResultUnit.NONE); - } - getReportLog().submit(); - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/presence/OWNERS deleted file mode 100644 index e8744995b6c..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -# Bug component: 1106357 -asalo@google.com -jbabs@google.com -christinatao@google.com
\ No newline at end of file diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/PresenceTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/PresenceTestActivity.java deleted file mode 100644 index 67766931591..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/PresenceTestActivity.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.cts.verifier.presence; - -import android.content.pm.PackageManager; -import android.os.Build; -import android.os.Bundle; -import android.os.SystemProperties; - -import com.android.cts.verifier.ManifestTestListAdapter; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -import java.util.ArrayList; -import java.util.List; - -public class PresenceTestActivity extends PassFailButtons.TestListActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.pass_fail_list); - setPassFailButtonClickListeners(); - - List<String> disabledTest = new ArrayList<String>(); - boolean isTv = getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); - if (isTv) { - setInfoResources(R.string.presence_test, R.string.presence_test_tv_info, -1); - int firstSdk = SystemProperties.getInt("ro.product.first_api_level", 0); - if (firstSdk < Build.VERSION_CODES.TIRAMISU) { - disabledTest.add("com.android.cts.verifier.presence.UwbPrecisionActivity"); - disabledTest.add("com.android.cts.verifier.presence.UwbShortRangeActivity"); - disabledTest.add("com.android.cts.verifier.presence.BleRssiPrecisionActivity"); - disabledTest.add("com.android.cts.verifier.presence.BleRxTxCalibrationActivity"); - disabledTest.add("com.android.cts.verifier.presence.BleRxOffsetActivity"); - disabledTest.add("com.android.cts.verifier.presence.BleTxOffsetActivity"); - disabledTest.add("com.android.cts.verifier.presence.NanPrecisionTestActivity"); - } - } else { - setInfoResources(R.string.presence_test, R.string.presence_test_info, -1); - } - - setTestListAdapter(new ManifestTestListAdapter(this, PresenceTestActivity.class.getName(), - disabledTest.toArray(new String[disabledTest.size()]))); - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbPrecisionActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbPrecisionActivity.java deleted file mode 100644 index 5d1ff8628dd..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbPrecisionActivity.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.cts.verifier.presence; - -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.Editable; -import android.util.Log; -import android.widget.EditText; - -import com.android.compatibility.common.util.ResultType; -import com.android.compatibility.common.util.ResultUnit; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -/** - * Activity for testing that UWB distance and angle of arrival measurements are within the right - * range. - */ -public class UwbPrecisionActivity extends PassFailButtons.Activity { - private static final String TAG = UwbPrecisionActivity.class.getName(); - // Report log schema - private static final String KEY_DISTANCE_RANGE_CM = "distance_range_cm"; - private static final String KEY_REFERENCE_DEVICE = "reference_device"; - // Thresholds - private static final int MAX_DISTANCE_RANGE_CM = 30; - - private EditText mDistanceRangeInput; - private EditText mReferenceDeviceInput; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.uwb_precision); - setPassFailButtonClickListeners(); - getPassButton().setEnabled(false); - - mDistanceRangeInput = (EditText) findViewById(R.id.distance_range_cm); - mReferenceDeviceInput = (EditText) findViewById(R.id.reference_device); - - DeviceFeatureChecker.checkFeatureSupported(this, getPassButton(), - PackageManager.FEATURE_UWB); - - mDistanceRangeInput.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mReferenceDeviceInput.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - } - - private void checkTestInputs() { - getPassButton().setEnabled( - checkDistanceRangeInput() && checkReferenceDeviceInput()); - } - - private boolean checkDistanceRangeInput() { - String distanceRangeInput = mDistanceRangeInput.getText().toString(); - if (!distanceRangeInput.isEmpty()) { - double distanceRange = Double.parseDouble(distanceRangeInput); - // Distance range must be inputted and within acceptable range before test can be - // passed. - return distanceRange <= MAX_DISTANCE_RANGE_CM; - } - return false; - } - - private boolean checkReferenceDeviceInput() { - // Reference device must be inputted before test can be passed. - return !mReferenceDeviceInput.getText().toString().isEmpty(); - } - - @Override - public void recordTestResults() { - String distanceRange = mDistanceRangeInput.getText().toString(); - String referenceDevice = mReferenceDeviceInput.getText().toString(); - if (!distanceRange.isEmpty()) { - Log.i(TAG, "UWB Distance Range: " + distanceRange); - getReportLog().addValue(KEY_DISTANCE_RANGE_CM, Double.parseDouble(distanceRange), - ResultType.NEUTRAL, ResultUnit.NONE); - } - if (!referenceDevice.isEmpty()) { - Log.i(TAG, "UWB Reference Device: " + referenceDevice); - getReportLog().addValue(KEY_REFERENCE_DEVICE, referenceDevice, - ResultType.NEUTRAL, ResultUnit.NONE); - } - getReportLog().submit(); - } -} diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbShortRangeActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbShortRangeActivity.java deleted file mode 100644 index 7f14800b68c..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/presence/UwbShortRangeActivity.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.cts.verifier.presence; - -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.Editable; -import android.util.Log; -import android.widget.EditText; - -import com.android.compatibility.common.util.ResultType; -import com.android.compatibility.common.util.ResultUnit; -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -/** - * Activity for testing that UWB distance measurements are within the acceptable median. - */ -public class UwbShortRangeActivity extends PassFailButtons.Activity { - private static final String TAG = UwbShortRangeActivity.class.getName(); - // Report log schema - private static final String KEY_DISTANCE_MEDIAN_CM = "distance_median_cm"; - private static final String KEY_REFERENCE_DEVICE = "reference_device"; - // Median Thresholds - private static final double MIN_MEDIAN = 0.75; - private static final double MAX_MEDIAN = 1.25; - private EditText mMedianInput; - private EditText mReferenceDeviceInput; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.uwb_short_range); - setPassFailButtonClickListeners(); - getPassButton().setEnabled(false); - - mMedianInput = (EditText) findViewById(R.id.distance_median_meters); - mReferenceDeviceInput = (EditText) findViewById(R.id.reference_device); - - DeviceFeatureChecker.checkFeatureSupported(this, getPassButton(), - PackageManager.FEATURE_UWB); - - mMedianInput.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - mReferenceDeviceInput.addTextChangedListener( - InputTextHandler.getOnTextChangedHandler((Editable s) -> checkTestInputs())); - } - - private void checkTestInputs() { - getPassButton().setEnabled(checkMedianInput() && checkReferenceDeviceInput()); - } - - private boolean checkMedianInput() { - String medianInput = mMedianInput.getText().toString(); - if (!medianInput.isEmpty()) { - double median = Double.parseDouble(medianInput); - return median >= MIN_MEDIAN && median <= MAX_MEDIAN; - } - return false; - } - - private boolean checkReferenceDeviceInput() { - return !mReferenceDeviceInput.getText().toString().isEmpty(); - } - - @Override - public void recordTestResults() { - String medianInput = mMedianInput.getText().toString(); - String referenceDeviceInput = mReferenceDeviceInput.getText().toString(); - if (!medianInput.isEmpty()) { - Log.i(TAG, "UWB Distance Median: " + medianInput); - getReportLog().addValue(KEY_DISTANCE_MEDIAN_CM, Double.parseDouble(medianInput), - ResultType.NEUTRAL, ResultUnit.NONE); - } - if (!referenceDeviceInput.isEmpty()) { - Log.i(TAG, "UWB Reference Device: " + referenceDeviceInput); - getReportLog().addValue(KEY_REFERENCE_DEVICE, referenceDeviceInput, ResultType.NEUTRAL, - ResultUnit.NONE); - } - getReportLog().submit(); - } -} |