From b333640501d4410d858ed0850c3752edb817ed6f Mon Sep 17 00:00:00 2001 From: Danesh M Date: Tue, 5 Apr 2016 10:39:46 -0700 Subject: Lockscreen : Fix bottom area visibility NIGHTLIES-2754 CYNGNOS-2349 Change-Id: I93ebd95fb15effed83659fadb92f76bf37b39f37 --- .../systemui/statusbar/phone/KeyguardBottomAreaView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 8ce84ba..5303377 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -129,6 +129,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private boolean mBottomAreaAttached; private final WindowManager.LayoutParams mWindowLayoutParams; private OnInterceptTouchEventListener mInterceptTouchListener; + private BroadcastReceiver mDevicePolicyReceiver; private final ServiceConnection mPrewarmConnection = new ServiceConnection() { @@ -179,7 +180,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private void removeKeyguardBottomArea() { if (mBottomAreaAttached) { try { - mWindowManager.removeViewImmediate(this); + mWindowManager.removeView(this); } catch (IllegalArgumentException e) { Log.e(TAG, e.getMessage()); } @@ -477,6 +478,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private void watchForCameraPolicyChanges() { final IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); + mDevicePolicyReceiver = new DevicePolicyBroadcastReceiver(); getContext().registerReceiverAsUser(mDevicePolicyReceiver, UserHandle.ALL, filter, null, null); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback); @@ -774,7 +776,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL .setDuration(DOZE_ANIMATION_ELEMENT_DURATION); } - private final BroadcastReceiver mDevicePolicyReceiver = new BroadcastReceiver() { + private final class DevicePolicyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { post(new Runnable() { @@ -898,7 +900,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAccessibilityController.removeStateChangedCallback(this); - mContext.unregisterReceiver(mDevicePolicyReceiver); + if (mDevicePolicyReceiver != null) { + mContext.unregisterReceiver(mDevicePolicyReceiver); + mDevicePolicyReceiver = null; + } mShortcutHelper.cleanup(); mUnlockMethodCache.removeListener(this); } -- cgit v1.1