Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33882332 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Abort earlier when icons are hidden"

parents 3b7a0b5a f8e04bc1
Loading
Loading
Loading
Loading
+17 −8
Original line number Original line Diff line number Diff line
@@ -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_STAGGER_DELAY = 48;
    private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250;
    private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250;


    private final boolean mShowLeftAffordance;
    private final boolean mShowCameraAffordance;

    private KeyguardAffordanceView mRightAffordanceView;
    private KeyguardAffordanceView mRightAffordanceView;
    private KeyguardAffordanceView mLeftAffordanceView;
    private KeyguardAffordanceView mLeftAffordanceView;
    private ViewGroup mIndicationArea;
    private ViewGroup mIndicationArea;
@@ -184,6 +187,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
    public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
            int defStyleRes) {
        super(context, attrs, defStyleAttr, 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() {
    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
            // Things are not set up yet; reply hazy, ask again later
            return;
            return;
        }
        }
        mRightAffordanceView.setVisibility(!mDozing && mRightButton.getIcon().isVisible
        mRightAffordanceView.setVisibility(!mDozing && mShowCameraAffordance
                ? View.VISIBLE : View.GONE);
                && mRightButton.getIcon().isVisible ? View.VISIBLE : View.GONE);
    }
    }


    /**
    /**
@@ -384,8 +390,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    }
    }


    private void updateLeftAffordanceIcon() {
    private void updateLeftAffordanceIcon() {
        if (!mShowLeftAffordance || mDozing) {
            mLeftAffordanceView.setVisibility(GONE);
            return;
        }
        IconState state = mLeftButton.getIcon();
        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()
        if (state.drawable != mLeftAffordanceView.getDrawable()
                || state.tint != mLeftAffordanceView.shouldTint()) {
                || state.tint != mLeftAffordanceView.shouldTint()) {
            mLeftAffordanceView.setImageDrawable(state.drawable, state.tint);
            mLeftAffordanceView.setImageDrawable(state.drawable, state.tint);
@@ -767,10 +777,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        @Override
        @Override
        public IconState getIcon() {
        public IconState getIcon() {
            mLeftIsVoiceAssist = canLaunchVoiceAssist();
            mLeftIsVoiceAssist = canLaunchVoiceAssist();
            final boolean showAffordance =
                    getResources().getBoolean(R.bool.config_keyguardShowLeftAffordance);
            if (mLeftIsVoiceAssist) {
            if (mLeftIsVoiceAssist) {
                mIconState.isVisible = mUserSetupComplete && showAffordance;
                mIconState.isVisible = mUserSetupComplete && mShowLeftAffordance;
                if (mLeftAssistIcon == null) {
                if (mLeftAssistIcon == null) {
                    mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp);
                    mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp);
                } else {
                } else {
@@ -779,7 +787,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
                mIconState.contentDescription = mContext.getString(
                mIconState.contentDescription = mContext.getString(
                        R.string.accessibility_voice_assist_button);
                        R.string.accessibility_voice_assist_button);
            } else {
            } else {
                mIconState.isVisible = mUserSetupComplete && showAffordance && isPhoneVisible();
                mIconState.isVisible = mUserSetupComplete && mShowLeftAffordance
                        && isPhoneVisible();
                mIconState.drawable = mContext.getDrawable(
                mIconState.drawable = mContext.getDrawable(
                        com.android.internal.R.drawable.ic_phone);
                        com.android.internal.R.drawable.ic_phone);
                mIconState.contentDescription = mContext.getString(
                mIconState.contentDescription = mContext.getString(
@@ -802,7 +811,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        public IconState getIcon() {
        public IconState getIcon() {
            boolean isCameraDisabled = (mStatusBar != null) && !mStatusBar.isCameraAllowedByAdmin();
            boolean isCameraDisabled = (mStatusBar != null) && !mStatusBar.isCameraAllowedByAdmin();
            mIconState.isVisible = !isCameraDisabled
            mIconState.isVisible = !isCameraDisabled
                    && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance)
                    && mShowCameraAffordance
                    && mUserSetupComplete
                    && mUserSetupComplete
                    && resolveCameraIntent() != null;
                    && resolveCameraIntent() != null;
            mIconState.drawable = mContext.getDrawable(R.drawable.ic_camera_alt_24dp);
            mIconState.drawable = mContext.getDrawable(R.drawable.ic_camera_alt_24dp);
+11 −15
Original line number Original line Diff line number Diff line
@@ -25,7 +25,6 @@ import static android.app.StatusBarManager.WindowVisibleState;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
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.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.Dependency.BG_HANDLER;
import static com.android.systemui.Dependency.BG_HANDLER;
import static com.android.systemui.Dependency.MAIN_HANDLER;
import static com.android.systemui.Dependency.MAIN_HANDLER;
@@ -3936,8 +3935,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    }
    }


    boolean isCameraAllowedByAdmin() {
    boolean isCameraAllowedByAdmin() {
        // TODO(b/140060745)
        return whitelistIpcs(() -> {
        if (mDevicePolicyManager.getCameraDisabled(null,
        if (mDevicePolicyManager.getCameraDisabled(null,
                mLockscreenUserManager.getCurrentUserId())) {
                mLockscreenUserManager.getCurrentUserId())) {
            return false;
            return false;
@@ -3949,7 +3946,6 @@ public class StatusBar extends SystemUI implements DemoMode,
                    & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0;
                    & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0;
        }
        }
        return true;
        return true;
        });
    }
    }


    private boolean isGoingToSleep() {
    private boolean isGoingToSleep() {