Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54ce1da4 authored by Steven Ng's avatar Steven Ng
Browse files

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

Bug: 29116229
Change-Id: I41076238f34f497c48cfd98a2466ac10cca6e989
parent 018444ab
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ import com.android.settingslib.net.ChartDataLoader;

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 @@ public class InstalledAppDetails extends AppInfoBase
            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 @@ public class InstalledAppDetails extends AppInfoBase
        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) {