Merge "Fixed an issue where the lock icon could be invisible" into oc-dr1-dev

This commit is contained in:
Selim Cinek
2017-07-24 20:19:30 +00:00
committed by Android (Google) Code Review

View File

@@ -238,10 +238,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mEnterpriseDisclosure = findViewById( mEnterpriseDisclosure = findViewById(
R.id.keyguard_indication_enterprise_disclosure); R.id.keyguard_indication_enterprise_disclosure);
mIndicationText = findViewById(R.id.keyguard_indication_text); mIndicationText = findViewById(R.id.keyguard_indication_text);
watchForCameraPolicyChanges();
updateCameraVisibility(); updateCameraVisibility();
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
mUnlockMethodCache.addListener(this); mUnlockMethodCache.addListener(this);
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
mLockIcon.setScreenOn(updateMonitor.isScreenOn());
mLockIcon.setDeviceInteractive(updateMonitor.isDeviceInteractive());
mLockIcon.update(); mLockIcon.update();
setClipChildren(false); setClipChildren(false);
setClipToPadding(false); setClipToPadding(false);
@@ -278,6 +280,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
.withDefault(() -> new DefaultLeftButton()) .withDefault(() -> new DefaultLeftButton())
.withCallback(button -> setLeftButton(button)) .withCallback(button -> setLeftButton(button))
.build(); .build();
final IntentFilter filter = new IntentFilter();
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
getContext().registerReceiverAsUser(mDevicePolicyReceiver,
UserHandle.ALL, filter, null, null);
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
} }
@Override @Override
@@ -286,6 +293,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mAccessibilityController.removeStateChangedCallback(this); mAccessibilityController.removeStateChangedCallback(this);
mRightExtension.destroy(); mRightExtension.destroy();
mLeftExtension.destroy(); mLeftExtension.destroy();
getContext().unregisterReceiver(mDevicePolicyReceiver);
KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallback);
} }
private void initAccessibility() { private void initAccessibility() {
@@ -401,14 +410,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
&& pm.resolveActivity(PHONE_INTENT, 0) != null; && pm.resolveActivity(PHONE_INTENT, 0) != null;
} }
private void watchForCameraPolicyChanges() {
final IntentFilter filter = new IntentFilter();
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
getContext().registerReceiverAsUser(mDevicePolicyReceiver,
UserHandle.ALL, filter, null, null);
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
}
@Override @Override
public void onStateChanged(boolean accessibilityEnabled, boolean touchExplorationEnabled) { public void onStateChanged(boolean accessibilityEnabled, boolean touchExplorationEnabled) {
mRightAffordanceView.setClickable(touchExplorationEnabled); mRightAffordanceView.setClickable(touchExplorationEnabled);