Fix AppButtonPreferenceControllerTest

* isSystem was not being mocked.
* The tests where isSystem should return true
  were not being tested properly.

Bug: 151569506
Test: atest com.android.settings.applications.appinfo.AppButtonsPreferenceControllerTest
Change-Id: Ib4249bca8f3c0321d0b64b4dbd4c4e5fc29586e1
This commit is contained in:
Alex Johnston
2020-03-16 09:31:39 +00:00
parent 59b3974433
commit 8d430de5d5
2 changed files with 5 additions and 3 deletions

View File

@@ -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;
}