diff options
| author | 2019-10-05 00:10:26 +0000 | |
|---|---|---|
| committer | 2019-10-05 00:10:26 +0000 | |
| commit | 338823320c6307150c317c5bc20a1c64f11bc1a7 (patch) | |
| tree | bec68552daa498d5440f85a76154388a0f584db5 | |
| parent | 3b7a0b5adfa9e7bc23753c9ee6af950f8971279c (diff) | |
| parent | f8e04bc1a93ab21cd3bc800b56253ebcf9991952 (diff) | |
Merge "Abort earlier when icons are hidden"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java | 25 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | 26 |
2 files changed, 28 insertions, 23 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 68eca8d68d90..cac33044ea13 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -117,6 +117,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private static final int DOZE_ANIMATION_STAGGER_DELAY = 48; private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250; + private final boolean mShowLeftAffordance; + private final boolean mShowCameraAffordance; + private KeyguardAffordanceView mRightAffordanceView; private KeyguardAffordanceView mLeftAffordanceView; private ViewGroup mIndicationArea; @@ -184,6 +187,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); + mShowLeftAffordance = getResources().getBoolean(R.bool.config_keyguardShowLeftAffordance); + mShowCameraAffordance = getResources() + .getBoolean(R.bool.config_keyguardShowCameraAffordance); } private AccessibilityDelegate mAccessibilityDelegate = new AccessibilityDelegate() { @@ -371,8 +377,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL // Things are not set up yet; reply hazy, ask again later return; } - mRightAffordanceView.setVisibility(!mDozing && mRightButton.getIcon().isVisible - ? View.VISIBLE : View.GONE); + mRightAffordanceView.setVisibility(!mDozing && mShowCameraAffordance + && mRightButton.getIcon().isVisible ? View.VISIBLE : View.GONE); } /** @@ -384,8 +390,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } private void updateLeftAffordanceIcon() { + if (!mShowLeftAffordance || mDozing) { + mLeftAffordanceView.setVisibility(GONE); + return; + } IconState state = mLeftButton.getIcon(); - mLeftAffordanceView.setVisibility(!mDozing && state.isVisible ? View.VISIBLE : View.GONE); + mLeftAffordanceView.setVisibility(state.isVisible ? View.VISIBLE : View.GONE); if (state.drawable != mLeftAffordanceView.getDrawable() || state.tint != mLeftAffordanceView.shouldTint()) { mLeftAffordanceView.setImageDrawable(state.drawable, state.tint); @@ -767,10 +777,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public IconState getIcon() { mLeftIsVoiceAssist = canLaunchVoiceAssist(); - final boolean showAffordance = - getResources().getBoolean(R.bool.config_keyguardShowLeftAffordance); if (mLeftIsVoiceAssist) { - mIconState.isVisible = mUserSetupComplete && showAffordance; + mIconState.isVisible = mUserSetupComplete && mShowLeftAffordance; if (mLeftAssistIcon == null) { mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp); } else { @@ -779,7 +787,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mIconState.contentDescription = mContext.getString( R.string.accessibility_voice_assist_button); } else { - mIconState.isVisible = mUserSetupComplete && showAffordance && isPhoneVisible(); + mIconState.isVisible = mUserSetupComplete && mShowLeftAffordance + && isPhoneVisible(); mIconState.drawable = mContext.getDrawable( com.android.internal.R.drawable.ic_phone); mIconState.contentDescription = mContext.getString( @@ -802,7 +811,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public IconState getIcon() { boolean isCameraDisabled = (mStatusBar != null) && !mStatusBar.isCameraAllowedByAdmin(); mIconState.isVisible = !isCameraDisabled - && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) + && mShowCameraAffordance && mUserSetupComplete && resolveCameraIntent() != null; mIconState.drawable = mContext.getDrawable(R.drawable.ic_camera_alt_24dp); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index da5931a50ba8..b1825c8ce667 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -25,7 +25,6 @@ import static android.app.StatusBarManager.WindowVisibleState; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY; -import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; import static com.android.systemui.Dependency.BG_HANDLER; import static com.android.systemui.Dependency.MAIN_HANDLER; @@ -3936,20 +3935,17 @@ public class StatusBar extends SystemUI implements DemoMode, } boolean isCameraAllowedByAdmin() { - // TODO(b/140060745) - return whitelistIpcs(() -> { - if (mDevicePolicyManager.getCameraDisabled(null, - mLockscreenUserManager.getCurrentUserId())) { - return false; - } else if (mStatusBarKeyguardViewManager == null - || (isKeyguardShowing() && isKeyguardSecure())) { - // Check if the admin has disabled the camera specifically for the keyguard - return (mDevicePolicyManager.getKeyguardDisabledFeatures(null, - mLockscreenUserManager.getCurrentUserId()) - & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0; - } - return true; - }); + if (mDevicePolicyManager.getCameraDisabled(null, + mLockscreenUserManager.getCurrentUserId())) { + return false; + } else if (mStatusBarKeyguardViewManager == null + || (isKeyguardShowing() && isKeyguardSecure())) { + // Check if the admin has disabled the camera specifically for the keyguard + return (mDevicePolicyManager.getKeyguardDisabledFeatures(null, + mLockscreenUserManager.getCurrentUserId()) + & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0; + } + return true; } private boolean isGoingToSleep() { |