Hide Device Lock settings screen if device lock manager is not available

Bug: 285999016
Test: atest DeviceLockPreferenceControllerTest
Change-Id: Ice9e8c27d3e6171306e0ad4e6bc58d9454ce0c60
This commit is contained in:
Yanli Wan
2023-06-13 18:43:00 +00:00
parent 3c06cd86dd
commit 1c4f3eea09
2 changed files with 18 additions and 0 deletions

View File

@@ -47,6 +47,11 @@ public final class DeviceLockPreferenceController extends BasePreferenceControll
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (mDeviceLockManager == null) {
Log.w(TAG, "DeviceLockManager is not available");
preference.setVisible(false);
return;
}
mDeviceLockManager.getKioskApps(mContext.getMainExecutor(),
result -> {
// if kiosk apps present on the device, the device is provisioned by Device Lock