Disable "disable" button for the device provision app in the Settings app
Bug: 29116229
Change-Id: I41076238f34f497c48cfd98a2466ac10cca6e989
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 0964abe..d374f6b 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -102,7 +102,6 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -231,6 +230,11 @@
enabled = false;
}
+ // Don't allow uninstalling the device provisioning package.
+ if (isDeviceProvisioningPackage(mAppEntry.info.packageName)) {
+ enabled = false;
+ }
+
// If the uninstall intent is already queued, disable the uninstall button
if (mDpm.isUninstallInQueue(mPackageName)) {
enabled = false;
@@ -298,6 +302,16 @@
return false;
}
+ /**
+ * Returns {@code true} if the supplied package is the device provisioning app. Otherwise,
+ * returns {@code false}.
+ */
+ private boolean isDeviceProvisioningPackage(String packageName) {
+ String deviceProvisioningPackage = getResources().getString(
+ com.android.internal.R.string.config_deviceProvisioningPackage);
+ return deviceProvisioningPackage != null && deviceProvisioningPackage.equals(packageName);
+ }
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {