Don't depend on LockPatternUtils to get DevicePolicyManager

This fixes a crash where LockPatternUtils hasn't been set yet and
keyguard attempts to get the device policy for widgets.

This change breaks the dependency by getting a handle to DPM directly.

Bug:7109723

Change-Id: Iecae91474358821ebd30456648377253864c35cf
This commit is contained in:
Jim Miller
2012-09-05 12:17:55 -07:00
parent 0b5a4a1513
commit f73fbf79a1

View File

@@ -582,7 +582,9 @@ public class KeyguardHostView extends KeyguardViewBase {
}
private void maybePopulateWidgets() {
if (mLockPatternUtils.getDevicePolicyManager().getKeyguardWidgetsDisabled(null)
DevicePolicyManager dpm =
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null && dpm.getKeyguardWidgetsDisabled(null)
!= DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_NONE) {
Log.v(TAG, "Keyguard widgets disabled because of device policy admin");
return;