1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 12:06:19 +00:00
treble_evolution/patches/trebledroid/platform_packages_apps_Settings/0003-Don-t-crash-when-we-get-no-DeviceLockManager.patch
2024-03-10 06:48:11 +00:00

41 lines
2.2 KiB
Diff

From dc41a1ccf6fa8391e9d87c003f66fd9746664c9b Mon Sep 17 00:00:00 2001
From: Alberto Ponces <ponces26@gmail.com>
Date: Sun, 29 Oct 2023 18:34:01 +0000
Subject: [PATCH 3/5] Don't crash when we get no DeviceLockManager
Change-Id: I8f87cdb00e0950ee6528598b8dff2cafff0309e7
---
.../DeviceLockPreferenceController.java | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/com/android/settings/devicelock/DeviceLockPreferenceController.java b/src/com/android/settings/devicelock/DeviceLockPreferenceController.java
index 4b6fe88f66..0f65b1f725 100644
--- a/src/com/android/settings/devicelock/DeviceLockPreferenceController.java
+++ b/src/com/android/settings/devicelock/DeviceLockPreferenceController.java
@@ -47,13 +47,14 @@ public final class DeviceLockPreferenceController extends BasePreferenceControll
@Override
public void updateState(Preference preference) {
super.updateState(preference);
- mDeviceLockManager.getKioskApps(mContext.getMainExecutor(),
- result -> {
- // if kiosk apps present on the device, the device is provisioned by Device Lock
- boolean isDeviceProvisionedByDeviceLock = result != null && !result.isEmpty();
- Log.d(TAG, "Set preference visibility to " + isDeviceProvisionedByDeviceLock);
- // TODO(b/282179089): find alternatives instead of calling setVisible
- preference.setVisible(isDeviceProvisionedByDeviceLock);
- });
+ if (mDeviceLockManager != null)
+ mDeviceLockManager.getKioskApps(mContext.getMainExecutor(),
+ result -> {
+ // if kiosk apps present on the device, the device is provisioned by Device Lock
+ boolean isDeviceProvisionedByDeviceLock = result != null && !result.isEmpty();
+ Log.d(TAG, "Set preference visibility to " + isDeviceProvisionedByDeviceLock);
+ // TODO(b/282179089): find alternatives instead of calling setVisible
+ preference.setVisible(isDeviceProvisionedByDeviceLock);
+ });
}
}
--
2.25.1