Show device admin warning dialog if force stop is not allowed

Test: manual
Test: atest AppButtonsPreferenceControllerTest
Bug: 192082470
Change-Id: I2c0028b4ff4578221a7686a3fe4511c70e1eed7d
This commit is contained in:
Yanli Wan
2021-07-01 13:44:17 -07:00
parent 35e1f0d189
commit 796ce5ee10

View File

@@ -272,6 +272,11 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
mMetricsFeatureProvider.action( mMetricsFeatureProvider.action(
mActivity, SettingsEnums.ACTION_APP_INFO_FORCE_STOP); mActivity, SettingsEnums.ACTION_APP_INFO_FORCE_STOP);
// force stop // force stop
if (mPm.isPackageStateProtected(mAppEntry.info.packageName, mUserId)) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mActivity,
RestrictedLockUtilsInternal.getDeviceOwner(mActivity));
return;
}
if (mAppsControlDisallowedAdmin != null && !mAppsControlDisallowedBySystem) { if (mAppsControlDisallowedAdmin != null && !mAppsControlDisallowedBySystem) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent( RestrictedLockUtils.sendShowAdminSupportDetailsIntent(
mActivity, mAppsControlDisallowedAdmin); mActivity, mAppsControlDisallowedAdmin);