diff options
author | Jim Miller <jaggies@google.com> | 2012-09-21 15:21:33 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-21 15:21:33 -0700 |
commit | 1ed9fa10de3e94678ddb2929936caa3ff4164cf8 (patch) | |
tree | a69e340cbfdd0969d3b1498b9fcf5251860abbee /policy | |
parent | 059aedf808c8b9b3da1457eef52f3d477878d50b (diff) | |
parent | 48b9b0d068844af9eb37c215484831c4d6b831b0 (diff) | |
download | frameworks_base-1ed9fa10de3e94678ddb2929936caa3ff4164cf8.zip frameworks_base-1ed9fa10de3e94678ddb2929936caa3ff4164cf8.tar.gz frameworks_base-1ed9fa10de3e94678ddb2929936caa3ff4164cf8.tar.bz2 |
Merge "Make DPM API for disabling keyguard widgets more generic" into jb-mr1-dev
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java | 11 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index e6d6e36..1a4eeb2 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -684,10 +684,13 @@ public class KeyguardHostView extends KeyguardViewBase { private void maybePopulateWidgets() { DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); - if (dpm != null && dpm.getKeyguardWidgetsDisabled(null, mLockPatternUtils.getCurrentUser()) - != DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_NONE) { - Log.v(TAG, "Keyguard widgets disabled because of device policy admin"); - return; + if (dpm != null) { + final int currentUser = mLockPatternUtils.getCurrentUser(); + final int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUser); + if ((disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL) != 0) { + Log.v(TAG, "Keyguard widgets disabled because of device policy admin"); + return; + } } inflateAndAddUserSelectorWidgetIfNecessary(); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java index 01d3a10..f99765d 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java @@ -18,6 +18,7 @@ package com.android.internal.policy.impl.keyguard; import android.animation.ObjectAnimator; import android.app.ActivityManagerNative; import android.app.SearchManager; +import android.app.admin.DevicePolicyManager; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; @@ -150,8 +151,12 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri private void updateTargets() { int currentUserHandle = mLockPatternUtils.getCurrentUser(); - boolean disabledByAdmin = mLockPatternUtils.getDevicePolicyManager() - .getCameraDisabled(null, currentUserHandle); + DevicePolicyManager dpm = mLockPatternUtils.getDevicePolicyManager(); + int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUserHandle); + boolean secureCameraDisabled = mLockPatternUtils.isSecure() + && (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0; + boolean cameraDisabledByAdmin = dpm.getCameraDisabled(null, currentUserHandle) + || secureCameraDisabled; final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(getContext()); boolean disabledBySimState = monitor.isSimLocked(); boolean cameraTargetPresent = @@ -159,7 +164,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri boolean searchTargetPresent = isTargetPresent(com.android.internal.R.drawable.ic_action_assist_generic); - if (disabledByAdmin) { + if (cameraDisabledByAdmin) { Log.v(TAG, "Camera disabled by Device Policy"); } else if (disabledBySimState) { Log.v(TAG, "Camera disabled by Sim State"); @@ -167,7 +172,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri boolean searchActionAvailable = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) .getAssistIntent(mContext, UserHandle.USER_CURRENT) != null; - mCameraDisabled = disabledByAdmin || disabledBySimState || !cameraTargetPresent; + mCameraDisabled = cameraDisabledByAdmin || disabledBySimState || !cameraTargetPresent; mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent; updateResources(); } |