DivestOS/Patches/LineageOS-15.1/android_packages_apps_Settings/0004-PDB_Fixes.patch
Tad 33c2725946 More patch refreshing
Signed-off-by: Tad <tad@spotco.us>
2021-10-29 16:08:27 -04:00

65 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Mon, 23 Apr 2018 15:40:11 -0400
Subject: [PATCH] Fix crashes when the PersistentDataBlockManager service isn't
available
Change-Id: I58b82270ed052526004889deb8a2ede072e2da3b
---
.../android/settings/MasterClearConfirm.java | 17 ++++++++++++-----
.../development/DevelopmentSettings.java | 5 ++++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index 39bf01a0d9..8be58e8c85 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -22,6 +22,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.oemlock.OemLockManager;
@@ -65,12 +66,18 @@ public class MasterClearConfirm extends OptionsMenuFragment {
return;
}
- final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
- getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
- final OemLockManager oemLockManager = (OemLockManager)
- getActivity().getSystemService(Context.OEM_LOCK_SERVICE);
+ PersistentDataBlockManager pdbManagerTmp = null;
+ OemLockManager oemLockManager = null;
+ if (!SystemProperties.get("ro.frp.pst").equals("")) {
+ pdbManagerTmp = (PersistentDataBlockManager)
+ getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ oemLockManager = (OemLockManager)
+ getActivity().getSystemService(Context.OEM_LOCK_SERVICE);
+ }
+
+ final PersistentDataBlockManager pdbManager = pdbManagerTmp;
- if (pdbManager != null && !oemLockManager.isOemUnlockAllowed() &&
+ if (pdbManager != null && oemLockManager != null && !oemLockManager.isOemUnlockAllowed() &&
Utils.isDeviceProvisioned(getActivity())) {
// if OEM unlock is allowed, the persistent data block will be wiped during FR
// process. If disabled, it will be wiped here, unless the device is still being
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index c66cf4c8d1..0ba99e42c2 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -420,7 +420,10 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mBackupManager = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
mWebViewUpdateService = WebViewFactory.getUpdateService();
- mOemLockManager = (OemLockManager) getSystemService(Context.OEM_LOCK_SERVICE);
+ mOemLockManager = null;
+ if(SystemProperties.getBoolean("ro.oem_unlock_supported", false)) {
+ mOemLockManager = (OemLockManager) getSystemService(Context.OEM_LOCK_SERVICE);
+ }
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);