summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2022-04-29 18:51:59 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-29 18:51:59 +0000
commitcbbe3e92dfa68e8aea2d43fcab026314b455ab96 (patch)
treeeb0c3dd6276f5791af48d899e88f3708b331e256
parentc3a88b4334beb1e202be319630e1fd80bac3e985 (diff)
parent1b99c0c4893aa05c223e2f837ad68718e36ff9a0 (diff)
downloadUwb-cbbe3e92dfa68e8aea2d43fcab026314b455ab96.tar.gz
Merge "Revert "uwb(service): Cleanup any ongoing sessions when country code changes"" into tm-dev am: 9c17b30ea0 am: 1b99c0c489
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Uwb/+/18054093 Change-Id: Ieda04d624f0602114f1fba68fc57e2422b94d8e9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--service/java/com/android/server/uwb/UwbServiceCore.java12
-rw-r--r--service/tests/src/com/android/server/uwb/UwbServiceCoreTest.java21
2 files changed, 2 insertions, 31 deletions
diff --git a/service/java/com/android/server/uwb/UwbServiceCore.java b/service/java/com/android/server/uwb/UwbServiceCore.java
index 54abc54b..c199cd5a 100644
--- a/service/java/com/android/server/uwb/UwbServiceCore.java
+++ b/service/java/com/android/server/uwb/UwbServiceCore.java
@@ -78,7 +78,6 @@ public class UwbServiceCore implements INativeUwbManager.DeviceNotification,
private static final int TASK_ENABLE = 1;
private static final int TASK_DISABLE = 2;
- private static final int TASK_DEINIT_ALL_SESSIONS = 3;
private static final int WATCHDOG_MS = 10000;
private static final int SEND_VENDOR_CMD_TIMEOUT_MS = 10000;
@@ -174,7 +173,7 @@ public class UwbServiceCore implements INativeUwbManager.DeviceNotification,
@Override
public void onDeviceStatusNotificationReceived(int deviceState) {
- // If error state is received, toggle UWB off to reset stack state.
+ // If error status is received, toggle UWB off to reset stack state.
// TODO(b/227488208): Should we try to restart (like wifi) instead?
if ((byte) deviceState == UwbUciConstants.DEVICE_STATE_ERROR) {
Log.e(TAG, "Error device status received. Disabling...");
@@ -221,10 +220,6 @@ public class UwbServiceCore implements INativeUwbManager.DeviceNotification,
@Override
public void onCountryCodeChanged(@Nullable String countryCode) {
- // If there are ongoing sessions, then we should use this trigger to close all of them
- // and send notifications to apps.
- Log.v(TAG, "Closing ongoing sessions on country code change");
- mEnableDisableTask.execute(TASK_DEINIT_ALL_SESSIONS);
// Clear the cached capabilities on country code changes.
Log.v(TAG, "Clearing cached specification params on country code change");
mSpecificationParams = null;
@@ -490,11 +485,6 @@ public class UwbServiceCore implements INativeUwbManager.DeviceNotification,
mSessionManager.deinitAllSession();
disableInternal();
break;
-
- case TASK_DEINIT_ALL_SESSIONS:
- mSessionManager.deinitAllSession();
- break;
-
default:
Log.d(TAG, "EnableDisableTask : Undefined Task");
break;
diff --git a/service/tests/src/com/android/server/uwb/UwbServiceCoreTest.java b/service/tests/src/com/android/server/uwb/UwbServiceCoreTest.java
index 5c22ae83..c17e91c8 100644
--- a/service/tests/src/com/android/server/uwb/UwbServiceCoreTest.java
+++ b/service/tests/src/com/android/server/uwb/UwbServiceCoreTest.java
@@ -296,7 +296,6 @@ public class UwbServiceCoreTest {
disableUwb();
- verify(mUwbSessionManager).deinitAllSession();
verify(mNativeUwbManager).doDeinitialize();
verify(cb).onAdapterStateChanged(UwbManager.AdapterStateCallback.STATE_DISABLED,
StateChangeReason.SYSTEM_POLICY);
@@ -318,7 +317,6 @@ public class UwbServiceCoreTest {
disableUwb();
- verify(mUwbSessionManager).deinitAllSession();
verify(mNativeUwbManager).doDeinitialize();
verify(cb).onAdapterStateChanged(UwbManager.AdapterStateCallback.STATE_DISABLED,
StateChangeReason.SYSTEM_POLICY);
@@ -655,7 +653,7 @@ public class UwbServiceCoreTest {
}
@Test
- public void testToggleOffOnDeviceStateErrorCallback() throws Exception {
+ public void testToggleOfOnDeviceStateErrorCallback() throws Exception {
IUwbAdapterStateCallbacks cb = mock(IUwbAdapterStateCallbacks.class);
when(cb.asBinder()).thenReturn(mock(IBinder.class));
mUwbServiceCore.registerAdapterStateCallbacks(cb);
@@ -669,29 +667,12 @@ public class UwbServiceCoreTest {
mUwbServiceCore.onDeviceStatusNotificationReceived(UwbUciConstants.DEVICE_STATE_ERROR);
mTestLooper.dispatchAll();
// Verify UWB toggle off.
- verify(mUwbSessionManager).deinitAllSession();
verify(mNativeUwbManager).doDeinitialize();
verify(cb).onAdapterStateChanged(UwbManager.AdapterStateCallback.STATE_DISABLED,
StateChangeReason.SYSTEM_POLICY);
}
@Test
- public void testDeinitAllSessionsOnCountryCodeChange() throws Exception {
- IUwbAdapterStateCallbacks cb = mock(IUwbAdapterStateCallbacks.class);
- when(cb.asBinder()).thenReturn(mock(IBinder.class));
- mUwbServiceCore.registerAdapterStateCallbacks(cb);
-
- enableUwb();
- verify(cb).onAdapterStateChanged(UwbManager.AdapterStateCallback.STATE_ENABLED_INACTIVE,
- StateChangeReason.SYSTEM_POLICY);
-
- mUwbServiceCore.onCountryCodeChanged("US");
- mTestLooper.dispatchAll();
- // Verify on session cleanup
- verify(mUwbSessionManager).deinitAllSession();
- }
-
- @Test
public void testVendorUciNotificationCallback() throws Exception {
enableUwb();