diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-02-22 12:51:42 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-02-22 20:39:17 -0800 |
commit | 3e04288198bc9bf8f97b9f30e0dbcd9bbb27d837 (patch) | |
tree | b910330f1658a8b03e795a585dea74a982f33fb8 /src | |
parent | a110a718bac811c014b80c123a447e45ab1b1dd9 (diff) | |
download | packages_apps_settings-3e04288198bc9bf8f97b9f30e0dbcd9bbb27d837.zip packages_apps_settings-3e04288198bc9bf8f97b9f30e0dbcd9bbb27d837.tar.gz packages_apps_settings-3e04288198bc9bf8f97b9f30e0dbcd9bbb27d837.tar.bz2 |
Fix issue #2396296: An admin is already set
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DeviceAdminAdd.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java index 126af6b..26ad70c 100644 --- a/src/com/android/settings/DeviceAdminAdd.java +++ b/src/com/android/settings/DeviceAdminAdd.java @@ -137,8 +137,18 @@ public class DeviceAdminAdd extends Activity { mActionButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (mAdding) { - mDPM.setActiveAdmin(mDeviceAdmin.getComponent()); - setResult(Activity.RESULT_OK); + try { + mDPM.setActiveAdmin(mDeviceAdmin.getComponent()); + setResult(Activity.RESULT_OK); + } catch (RuntimeException e) { + // Something bad happened... could be that it was + // already set, though. + Log.w(TAG, "Exception trying to activate admin " + + mDeviceAdmin.getComponent(), e); + if (mDPM.isAdminActive(mDeviceAdmin.getComponent())) { + setResult(Activity.RESULT_OK); + } + } finish(); } else { mDPM.getRemoveWarning(mDeviceAdmin.getComponent(), |