Loading src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp // We don't allow uninstalling DO/PO on *any* users if it's a system app, because // "uninstall" is actually "downgrade to the system version + disable", and "downgrade" // will clear data on all users. if (Utils.isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) { if (isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) { if (Utils.isProfileOrDeviceOwner(mUserManager, mDpm, mPackageInfo.packageName)) { enabled = false; } Loading tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isSystemAndIsProfileOrDeviceOwner_setButtonDisable() { mAppInfo.flags |= ApplicationInfo.FLAG_SYSTEM; doReturn(true).when(mController).isSystemPackage(any(), any(), any()); doReturn(true).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString()); mController.updateUninstallButton(); Loading @@ -285,7 +285,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() { mAppInfo.flags |= ApplicationInfo.FLAG_SYSTEM; doReturn(true).when(mController).isSystemPackage(any(), any(), any()); doReturn(false).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString()); mController.updateUninstallButton(); Loading @@ -295,6 +295,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isNotSystemAndIsProfileOrDeviceOwner_setButtonDisable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(0).when(mDpm).getDeviceOwnerUserId(); doReturn(true).when(mDpm).isDeviceOwnerApp(anyString()); Loading @@ -305,6 +306,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isNotSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(10).when(mDpm).getDeviceOwnerUserId(); doReturn(false).when(mDpm).isDeviceOwnerApp(anyString()); Loading Loading
src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp // We don't allow uninstalling DO/PO on *any* users if it's a system app, because // "uninstall" is actually "downgrade to the system version + disable", and "downgrade" // will clear data on all users. if (Utils.isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) { if (isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) { if (Utils.isProfileOrDeviceOwner(mUserManager, mDpm, mPackageInfo.packageName)) { enabled = false; } Loading
tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isSystemAndIsProfileOrDeviceOwner_setButtonDisable() { mAppInfo.flags |= ApplicationInfo.FLAG_SYSTEM; doReturn(true).when(mController).isSystemPackage(any(), any(), any()); doReturn(true).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString()); mController.updateUninstallButton(); Loading @@ -285,7 +285,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() { mAppInfo.flags |= ApplicationInfo.FLAG_SYSTEM; doReturn(true).when(mController).isSystemPackage(any(), any(), any()); doReturn(false).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString()); mController.updateUninstallButton(); Loading @@ -295,6 +295,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isNotSystemAndIsProfileOrDeviceOwner_setButtonDisable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(0).when(mDpm).getDeviceOwnerUserId(); doReturn(true).when(mDpm).isDeviceOwnerApp(anyString()); Loading @@ -305,6 +306,7 @@ public class AppButtonsPreferenceControllerTest { @Test public void updateUninstallButton_isNotSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(10).when(mDpm).getDeviceOwnerUserId(); doReturn(false).when(mDpm).isDeviceOwnerApp(anyString()); Loading