summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-01-21 16:44:53 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-01-21 16:44:53 -0800
commitab489cabedbabe80fb8d04ee4e562123723c3d33 (patch)
tree7d1e065e604c5b594415e7da9c4da28062f210ca
parent6e6393c27941a44c2bfd0b4e82cc75c06e30bc18 (diff)
parent4141d035c7d41f39f023d7a051568dff87c7cd32 (diff)
downloadframeworks_base-ab489cabedbabe80fb8d04ee4e562123723c3d33.zip
frameworks_base-ab489cabedbabe80fb8d04ee4e562123723c3d33.tar.gz
frameworks_base-ab489cabedbabe80fb8d04ee4e562123723c3d33.tar.bz2
Merge "Don't crash when there is no admin."
-rw-r--r--services/java/com/android/server/DevicePolicyManagerService.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index fd42538..36da4eb 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -28,7 +28,6 @@ import android.app.DeviceAdminInfo;
import android.app.DevicePolicyManager;
import android.app.IDevicePolicyManager;
import android.content.ComponentName;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -36,11 +35,9 @@ import android.content.pm.ResolveInfo;
import android.os.Binder;
import android.os.IBinder;
import android.os.IPowerManager;
-import android.os.PowerManager;
import android.os.RecoverySystem;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.provider.Settings;
import android.util.Log;
import android.util.Xml;
@@ -114,6 +111,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
mContext.sendBroadcast(intent);
}
+ void sendAdminCommandLocked(String action) {
+ if (mActiveAdmin != null) {
+ sendAdminCommandLocked(mActiveAdmin, action);
+ }
+ }
+
ComponentName getActiveAdminLocked() {
if (mActiveAdmin != null) {
return mActiveAdmin.info.getComponent();
@@ -498,8 +501,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
mActivePasswordMode = mode;
mActivePasswordLength = length;
mFailedPasswordAttempts = 0;
- sendAdminCommandLocked(mActiveAdmin,
- DeviceAdmin.ACTION_PASSWORD_CHANGED);
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_CHANGED);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -515,8 +517,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
long ident = Binder.clearCallingIdentity();
try {
mFailedPasswordAttempts++;
- sendAdminCommandLocked(mActiveAdmin,
- DeviceAdmin.ACTION_PASSWORD_FAILED);
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_FAILED);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -532,8 +533,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
long ident = Binder.clearCallingIdentity();
try {
mFailedPasswordAttempts = 0;
- sendAdminCommandLocked(mActiveAdmin,
- DeviceAdmin.ACTION_PASSWORD_SUCCEEDED);
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_SUCCEEDED);
} finally {
Binder.restoreCallingIdentity(ident);
}