Fix MenuViewLayerTest on AAOS
**Root cause**
On AAOS system user and real user is different. We need to differenciate
that in the test.
Bug: 345134377
Bug: 348124412
Test: atest MenuViewLayerTest
Flag: TEST_ONLY
Change-Id: I8348880b59f542e8e29d174e95c721ad10c09c8b
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayerTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayerTest.java
index 38095c8..c30bedd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayerTest.java
@@ -258,8 +258,9 @@
setupEnabledAccessibilityServiceList();
mMenuViewLayer.mDismissMenuAction.run();
- final String value = Settings.Secure.getString(mSpyContext.getContentResolver(),
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ final String value = Settings.Secure.getStringForUser(mSpyContext.getContentResolver(),
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ mSecureSettings.getRealUserHandle(UserHandle.USER_CURRENT));
assertThat(value).isEqualTo("");
}
@@ -274,8 +275,9 @@
ShortcutConstants.UserShortcutType.HARDWARE)).thenReturn(stubShortcutTargets);
mMenuViewLayer.mDismissMenuAction.run();
- final String value = Settings.Secure.getString(mSpyContext.getContentResolver(),
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ final String value = Settings.Secure.getStringForUser(mSpyContext.getContentResolver(),
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ mSecureSettings.getRealUserHandle(UserHandle.USER_CURRENT));
assertThat(value).isEqualTo(TEST_SELECT_TO_SPEAK_COMPONENT_NAME.flattenToString());
}
@@ -445,9 +447,11 @@
}
private void setupEnabledAccessibilityServiceList() {
- Settings.Secure.putString(mSpyContext.getContentResolver(),
+ Settings.Secure.putStringForUser(mSpyContext.getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
- TEST_SELECT_TO_SPEAK_COMPONENT_NAME.flattenToString());
+ TEST_SELECT_TO_SPEAK_COMPONENT_NAME.flattenToString(),
+ mSecureSettings.getRealUserHandle(UserHandle.USER_CURRENT)
+ );
final ResolveInfo resolveInfo = new ResolveInfo();
final ServiceInfo serviceInfo = new ServiceInfo();