summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorAlexandra Gherghina <alexgherghina@google.com>2014-04-24 17:55:30 +0100
committerAlexandra Gherghina <alexgherghina@google.com>2014-04-24 17:55:30 +0100
commita4fcb4403304192e2a4889c43c4d089d76cd1252 (patch)
tree8f75480a467ea0975e4794890f7186c0ee2a7d1c /services/devicepolicy
parente255d7399f46de4b4e3d94b95b26df3408274394 (diff)
downloadframeworks_base-a4fcb4403304192e2a4889c43c4d089d76cd1252.zip
frameworks_base-a4fcb4403304192e2a4889c43c4d089d76cd1252.tar.gz
frameworks_base-a4fcb4403304192e2a4889c43c4d089d76cd1252.tar.bz2
Fix two potential NPEs in DeviceInfo
Change-Id: Ic4b5b203af25cda9ae65b477c92c1fb5f31ab093
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java4
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java2
2 files changed, 3 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
index 3186527..629dea2 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
@@ -110,11 +110,11 @@ public class DeviceOwner {
}
String getDeviceOwnerPackageName() {
- return mDeviceOwner.packageName;
+ return mDeviceOwner != null ? mDeviceOwner.packageName : null;
}
String getDeviceOwnerName() {
- return mDeviceOwner.name;
+ return mDeviceOwner != null ? mDeviceOwner.name : null;
}
void setDeviceOwner(String packageName, String ownerName) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index cf45149..b82a126 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2828,7 +2828,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
return null;
}
synchronized (this) {
- if (mDeviceOwner != null) {
+ if (mDeviceOwner != null && mDeviceOwner.hasDeviceOwner()) {
return mDeviceOwner.getDeviceOwnerPackageName();
}
}