Fix NPE in DevicePolicyManagerService

Bug: 15015897
Change-Id: Id9f6ae8b5abf96d35f799b150210813fb52da54c
This commit is contained in:
Jason Monk
2014-05-16 14:56:17 -04:00
parent 9d08a93b2d
commit 9fcff5aadd

View File

@@ -1214,18 +1214,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
mAppOpsService = IAppOpsService.Stub.asInterface(
ServiceManager.getService(Context.APP_OPS_SERVICE));
if (mDeviceOwner.hasDeviceOwner()) {
try {
mAppOpsService.setDeviceOwner(mDeviceOwner.getDeviceOwnerPackageName());
} catch (RemoteException e) {
Log.w(LOG_TAG, "Unable to notify AppOpsService of DeviceOwner", e);
if (mDeviceOwner != null) {
if (mDeviceOwner.hasDeviceOwner()) {
try {
mAppOpsService.setDeviceOwner(mDeviceOwner.getDeviceOwnerPackageName());
} catch (RemoteException e) {
Log.w(LOG_TAG, "Unable to notify AppOpsService of DeviceOwner", e);
}
}
}
for (Integer i : mDeviceOwner.getProfileOwnerKeys()) {
try {
mAppOpsService.setProfileOwner(mDeviceOwner.getProfileOwnerName(i), i);
} catch (RemoteException e) {
Log.w(LOG_TAG, "Unable to notify AppOpsService of ProfileOwner", e);
for (Integer i : mDeviceOwner.getProfileOwnerKeys()) {
try {
mAppOpsService.setProfileOwner(mDeviceOwner.getProfileOwnerName(i), i);
} catch (RemoteException e) {
Log.w(LOG_TAG, "Unable to notify AppOpsService of ProfileOwner", e);
}
}
}
}