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

@@ -108,10 +108,10 @@ public class DeviceAdminSettings extends ListFragment {
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
getActivity().registerReceiverAsUser(
mBroadcastReceiver, UserHandle.ALL, filter, null, null);
mDeviceOwnerPkg = mDPM.getDeviceOwner();
if (mDeviceOwnerPkg != null && !mDPM.isDeviceOwner(mDeviceOwnerPkg)) {
mDeviceOwnerPkg = null;
}
final ComponentName deviceOwnerComponent = mDPM.getDeviceOwnerComponentOnAnyUser();
mDeviceOwnerPkg =
deviceOwnerComponent != null ? deviceOwnerComponent.getPackageName() : null;
mProfileOwnerComponents.clear();
final List<UserHandle> profiles = mUm.getUserProfiles();
final int profilesSize = profiles.size();