Return DISABLED_FOR_USER in deviceinfo/simstatus availability if not admin user

The correct return when checking for the SIM status field availability
for non-admin users is DISABLED_FOR_USER.

UNSUPPORTED_ON_DEVICE should only be used when the setting is
unconditionally hidden as the device does not support the feature.

Bug: 395714454
Flag: EXEMPT bugfix
Test: atest SimStatusPreferenceControllerTest

Change-Id: I9bd290f1bdd73909be383a24f2c762d295089ff6
This commit is contained in:
Aleksander Morgado
2025-02-12 16:57:45 +00:00
parent d58d0be2e1
commit 22c8840526
2 changed files with 2 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ public class SimStatusPreferenceController extends BasePreferenceController {
return UNSUPPORTED_ON_DEVICE;
}
if (!mContext.getSystemService(UserManager.class).isAdminUser()) {
return CONDITIONALLY_UNAVAILABLE;
return DISABLED_FOR_USER;
}
return AVAILABLE;
}

View File

@@ -251,7 +251,7 @@ public class SimStatusPreferenceControllerTest {
when(mUserManager.isAdminUser()).thenReturn(false);
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
BasePreferenceController.DISABLED_FOR_USER);
}
private <T> void mockService(String serviceName, Class<T> serviceClass, T service) {