Skip to content

Commit f73fbf7

Browse files
author
Jim Miller
committed
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
1 parent 0b5a4a1 commit f73fbf7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ private void addWidget(int appId) {
582582
}
583583

584584
private void maybePopulateWidgets() {
585-
if (mLockPatternUtils.getDevicePolicyManager().getKeyguardWidgetsDisabled(null)
585+
DevicePolicyManager dpm =
586+
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
587+
if (dpm != null && dpm.getKeyguardWidgetsDisabled(null)
586588
!= DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_NONE) {
587589
Log.v(TAG, "Keyguard widgets disabled because of device policy admin");
588590
return;

0 commit comments

Comments
 (0)