Add method to disable "disable" button in installed app UI
OEMs can now force grey out the "disable" button for important apps on device. Change-Id: I8ea431b52e50e424be55946f70175db5412e2f4a Merged-In: Ic075a07ad12592bd60238c7b1c9ab84932c8db3c Fix: 38250742 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.settings.applications;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
import android.Manifest.permission;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
@@ -117,6 +115,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
/**
|
||||
* Activity to display application information from Settings. This activity presents
|
||||
* extended information associated with a package like code, data, total size, permissions
|
||||
@@ -232,7 +232,8 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
}
|
||||
};
|
||||
|
||||
private boolean handleDisableable(Button button) {
|
||||
@VisibleForTesting
|
||||
boolean handleDisableable(Button button) {
|
||||
boolean disableable = false;
|
||||
// Try to prevent the user from bricking their phone
|
||||
// by not allowing disabling of apps signed with the
|
||||
@@ -243,7 +244,8 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
button.setText(R.string.disable_text);
|
||||
} else if (mAppEntry.info.enabled && !isDisabledUntilUsed()) {
|
||||
button.setText(R.string.disable_text);
|
||||
disableable = true;
|
||||
disableable = !mApplicationFeatureProvider.getKeepEnabledPackages()
|
||||
.contains(mAppEntry.info.packageName);
|
||||
} else {
|
||||
button.setText(R.string.enable_text);
|
||||
disableable = true;
|
||||
@@ -1221,9 +1223,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
void maybeAddInstantAppButtons() {
|
||||
if (AppUtils.isInstant(mPackageInfo.applicationInfo)) {
|
||||
LayoutPreference buttons = (LayoutPreference) findPreference(KEY_INSTANT_APP_BUTTONS);
|
||||
final Activity activity = getActivity();
|
||||
mInstantAppButtonsController = FeatureFactory.getFactory(activity)
|
||||
.getApplicationFeatureProvider(activity)
|
||||
mInstantAppButtonsController = mApplicationFeatureProvider
|
||||
.newInstantAppButtonsController(this,
|
||||
buttons.findViewById(R.id.instant_app_button_container),
|
||||
id -> showDialogInner(id, 0))
|
||||
|
Reference in New Issue
Block a user