Use explicit APIs to get device owner information

Bug 24676413

Change-Id: Id346c2f01658173c9671edcfd34bc33f1b25faa4
This commit is contained in:
Makoto Onuki
2015-11-19 13:47:55 -08:00
parent 03e1bee786
commit 4cfe39f539
5 changed files with 18 additions and 12 deletions

View File

@@ -206,6 +206,9 @@ public class InstalledAppDetails extends AppInfoBase
enabled = false;
}
// We don't allow uninstalling DO/PO on *any* users, because if it's a system app,
// "uninstall" is actually "downgrade to the system version + disable", and "downgrade"
// will clear data on all users.
if (isProfileOrDeviceOwner(mPackageInfo.packageName)) {
enabled = false;
}
@@ -250,7 +253,7 @@ public class InstalledAppDetails extends AppInfoBase
List<UserInfo> userInfos = mUserManager.getUsers();
DevicePolicyManager dpm = (DevicePolicyManager)
getContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
if (packageName.equals(dpm.getDeviceOwner())) {
if (dpm.isDeviceOwnerAppOnAnyUser(packageName)) {
return true;
}
for (UserInfo userInfo : userInfos) {