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

Commit ebcd6bb1 authored by Adam Cohen's avatar Adam Cohen
Browse files

Fixing emergency dialer flicker on lock screen (issue 5314293)

Change-Id: Ia9bf4acb84923e200b89ee55fc53bc92877001cf
parent 22aa7805
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -936,9 +936,11 @@ public class LockPatternUtils {
     *
     *
     * If there's currently a call in progress, the button will take them to the call
     * If there's currently a call in progress, the button will take them to the call
     * @param button the button to update
     * @param button the button to update
     * @param showIfCapable indicates whether the button should be shown if emergency calls are
     *                      possible on the device
     */
     */
    public void updateEmergencyCallButtonState(Button button) {
    public void updateEmergencyCallButtonState(Button button, boolean showIfCapable) {
        if (isEmergencyCallCapable()) {
        if (isEmergencyCallCapable() && showIfCapable) {
            button.setVisibility(View.VISIBLE);
            button.setVisibility(View.VISIBLE);
        } else {
        } else {
            button.setVisibility(View.GONE);
            button.setVisibility(View.GONE);
+2 −1
Original line number Original line Diff line number Diff line
@@ -80,7 +80,8 @@
            android:layout_alignParentBottom="true"
            android:layout_alignParentBottom="true"
            android:drawableLeft="@drawable/ic_emergency"
            android:drawableLeft="@drawable/ic_emergency"
            style="@style/Widget.Button.Transparent"
            style="@style/Widget.Button.Transparent"
            android:drawablePadding="8dip"/>
            android:drawablePadding="8dip"
            android:visibility="gone"/>


    </RelativeLayout>>
    </RelativeLayout>>


+1 −1
Original line number Original line Diff line number Diff line
@@ -112,7 +112,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mUpdateMonitor = updateMonitor;
        mUpdateMonitor = updateMonitor;


        mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
        mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
                lockPatternUtils, callback);
                lockPatternUtils, callback, true);
    }
    }


    public void afterTextChanged(Editable s) {
    public void afterTextChanged(Editable s) {
+11 −20
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ class KeyguardStatusViewManager implements OnClickListener {
    private LockPatternUtils mLockPatternUtils;
    private LockPatternUtils mLockPatternUtils;
    private KeyguardUpdateMonitor mUpdateMonitor;
    private KeyguardUpdateMonitor mUpdateMonitor;
    private Button mEmergencyCallButton;
    private Button mEmergencyCallButton;
    private boolean mShouldEnableUnlock;
    private boolean mUnlockDisabledDueToSimState;


    // Shadowed text values
    // Shadowed text values
    private CharSequence mCarrierText;
    private CharSequence mCarrierText;
@@ -97,7 +97,7 @@ class KeyguardStatusViewManager implements OnClickListener {
    private CharSequence mOwnerInfoText;
    private CharSequence mOwnerInfoText;
    private boolean mShowingStatus;
    private boolean mShowingStatus;
    private KeyguardScreenCallback mCallback;
    private KeyguardScreenCallback mCallback;
    private boolean mHideEmergencyCallButton = false;
    private final boolean mShowEmergencyButtonByDefault;


    private class TransientTextManager {
    private class TransientTextManager {
        private TextView mTextView;
        private TextView mTextView;
@@ -149,7 +149,8 @@ class KeyguardStatusViewManager implements OnClickListener {
    };
    };


    public KeyguardStatusViewManager(View view, KeyguardUpdateMonitor updateMonitor,
    public KeyguardStatusViewManager(View view, KeyguardUpdateMonitor updateMonitor,
                LockPatternUtils lockPatternUtils, KeyguardScreenCallback callback) {
                LockPatternUtils lockPatternUtils, KeyguardScreenCallback callback,
                boolean showEmergencyButtonByDefault) {
        mContainer = view;
        mContainer = view;
        mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
        mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
        mLockPatternUtils = lockPatternUtils;
        mLockPatternUtils = lockPatternUtils;
@@ -163,6 +164,7 @@ class KeyguardStatusViewManager implements OnClickListener {
        mOwnerInfoView = (TextView) findViewById(R.id.propertyOf);
        mOwnerInfoView = (TextView) findViewById(R.id.propertyOf);
        mTransportView = (TransportControlView) findViewById(R.id.transport);
        mTransportView = (TransportControlView) findViewById(R.id.transport);
        mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
        mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
        mShowEmergencyButtonByDefault = showEmergencyButtonByDefault;
        if (mEmergencyCallButton != null) {
        if (mEmergencyCallButton != null) {
            mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
            mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
            mEmergencyCallButton.setOnClickListener(this);
            mEmergencyCallButton.setOnClickListener(this);
@@ -393,10 +395,6 @@ class KeyguardStatusViewManager implements OnClickListener {
        }
        }
    }
    }


    boolean shouldEnableUnlock() {
        return mShouldEnableUnlock;
    }

    /**
    /**
     * Determine the current status of the lock screen given the sim state and other stuff.
     * Determine the current status of the lock screen given the sim state and other stuff.
     */
     */
@@ -443,9 +441,8 @@ class KeyguardStatusViewManager implements OnClickListener {


        CharSequence carrierText = null;
        CharSequence carrierText = null;
        int carrierHelpTextId = 0;
        int carrierHelpTextId = 0;
        mShouldEnableUnlock = true;
        mUnlockDisabledDueToSimState = false;
        mStatus = getStatusForIccState(simState);
        mStatus = getStatusForIccState(simState);

        switch (mStatus) {
        switch (mStatus) {
            case Normal:
            case Normal:
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
@@ -466,13 +463,14 @@ class KeyguardStatusViewManager implements OnClickListener {
            case SimPermDisabled:
            case SimPermDisabled:
                carrierText = getContext().getText(R.string.lockscreen_missing_sim_message_short);
                carrierText = getContext().getText(R.string.lockscreen_missing_sim_message_short);
                carrierHelpTextId = R.string.lockscreen_permanent_disabled_sim_instructions;
                carrierHelpTextId = R.string.lockscreen_permanent_disabled_sim_instructions;
                mUnlockDisabledDueToSimState = true;
                break;
                break;


            case SimMissingLocked:
            case SimMissingLocked:
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
                        getContext().getText(R.string.lockscreen_missing_sim_message_short));
                        getContext().getText(R.string.lockscreen_missing_sim_message_short));
                carrierHelpTextId = R.string.lockscreen_missing_sim_instructions;
                carrierHelpTextId = R.string.lockscreen_missing_sim_instructions;
                mShouldEnableUnlock = false;
                mUnlockDisabledDueToSimState = true;
                break;
                break;


            case SimLocked:
            case SimLocked:
@@ -484,7 +482,7 @@ class KeyguardStatusViewManager implements OnClickListener {
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
                carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
                        getContext().getText(R.string.lockscreen_sim_puk_locked_message));
                        getContext().getText(R.string.lockscreen_sim_puk_locked_message));
                if (!mLockPatternUtils.isPukUnlockScreenEnable()) {
                if (!mLockPatternUtils.isPukUnlockScreenEnable()) {
                    mShouldEnableUnlock = false;
                    mUnlockDisabledDueToSimState = true;
                }
                }
                break;
                break;
        }
        }
@@ -556,10 +554,8 @@ class KeyguardStatusViewManager implements OnClickListener {


    private void updateEmergencyCallButtonState() {
    private void updateEmergencyCallButtonState() {
        if (mEmergencyCallButton != null) {
        if (mEmergencyCallButton != null) {
            mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
            boolean showIfCapable = mShowEmergencyButtonByDefault || mUnlockDisabledDueToSimState;
            if (mHideEmergencyCallButton) {
            mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton, showIfCapable);
                mEmergencyCallButton.setVisibility(View.GONE);
            }
        }
        }
    }
    }


@@ -608,9 +604,4 @@ class KeyguardStatusViewManager implements OnClickListener {
            mCallback.takeEmergencyCallAction();
            mCallback.takeEmergencyCallAction();
        }
        }
    }
    }

    public void hideEmergencyCallButton() {
        mHideEmergencyCallButton = true;
    }

}
}
+1 −4
Original line number Original line Diff line number Diff line
@@ -336,10 +336,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
        }
        }


        mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils,
        mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils,
                mCallback);
                mCallback, false);

        // LockScreen doesn't show the emergency call button by default
        mStatusViewManager.hideEmergencyCallButton();


        setFocusable(true);
        setFocusable(true);
        setFocusableInTouchMode(true);
        setFocusableInTouchMode(true);
Loading