Disable "disable" button for the device provision app in the Settings app

Bug: 29116229
Change-Id: I41076238f34f497c48cfd98a2466ac10cca6e989
This commit is contained in:
Steven Ng
2016-06-21 22:43:54 +01:00
parent 018444ab61
commit 54ce1da49d

View File

@@ -102,7 +102,6 @@ import com.android.settingslib.net.ChartDataLoader;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@@ -231,6 +230,11 @@ public class InstalledAppDetails extends AppInfoBase
enabled = false; 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 the uninstall intent is already queued, disable the uninstall button
if (mDpm.isUninstallInQueue(mPackageName)) { if (mDpm.isUninstallInQueue(mPackageName)) {
enabled = false; enabled = false;
@@ -298,6 +302,16 @@ public class InstalledAppDetails extends AppInfoBase
return false; 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. */ /** Called when the activity is first created. */
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {