From 796ce5ee10dab06fdea3c1b3e0af3f299a4eba24 Mon Sep 17 00:00:00 2001 From: Yanli Wan Date: Thu, 1 Jul 2021 13:44:17 -0700 Subject: [PATCH] Show device admin warning dialog if force stop is not allowed Test: manual Test: atest AppButtonsPreferenceControllerTest Bug: 192082470 Change-Id: I2c0028b4ff4578221a7686a3fe4511c70e1eed7d --- .../applications/appinfo/AppButtonsPreferenceController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java index ea34faf9ff6..09bf86a8120 100644 --- a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java +++ b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java @@ -272,6 +272,11 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp mMetricsFeatureProvider.action( mActivity, SettingsEnums.ACTION_APP_INFO_FORCE_STOP); // force stop + if (mPm.isPackageStateProtected(mAppEntry.info.packageName, mUserId)) { + RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mActivity, + RestrictedLockUtilsInternal.getDeviceOwner(mActivity)); + return; + } if (mAppsControlDisallowedAdmin != null && !mAppsControlDisallowedBySystem) { RestrictedLockUtils.sendShowAdminSupportDetailsIntent( mActivity, mAppsControlDisallowedAdmin);