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

Commit 7fce3802 authored by Brian Colonna's avatar Brian Colonna
Browse files

Fix 10550373: Stopping FUL when emergency dialer opens

Face Unlock wasn't being stopped when the emergency dialer opened,
causing FUL to flash briefly after the emergency dialer appeared.
This was most noticeable on Hammerhead devices.

This change allows EmergencyButton to stop FUL by way of
KeyguardUpdateMonitor.  Note that it must stop FUL immediately rather
than going through a handler.  If going through a handler FUL is not
stopped in time to prevent the issue.

Change-Id: I3985969a19e909e2633d7876a3fb2d34c70e2cc1
parent 463850e0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@ public class EmergencyButton extends Button {
                == TelephonyManager.CALL_STATE_OFFHOOK) {
            mLockPatternUtils.resumeCall();
        } else {
            final boolean bypassHandler = true;
            KeyguardUpdateMonitor.getInstance(mContext).reportEmergencyCallAction(bypassHandler);
            Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+7 −0
Original line number Diff line number Diff line
@@ -295,6 +295,13 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
                }
            }
        }

        @Override
        public void onEmergencyCallAction() {
            if (mBiometricUnlock != null) {
                mBiometricUnlock.stop();
            }
        }
    };

    @Override
+32 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class KeyguardUpdateMonitor {
    private static final int MSG_SET_CURRENT_CLIENT_ID = 315;
    protected static final int MSG_SET_PLAYBACK_STATE = 316;
    protected static final int MSG_USER_INFO_CHANGED = 317;
    protected static final int MSG_REPORT_EMERGENCY_CALL_ACTION = 318;


    private static KeyguardUpdateMonitor sInstance;
@@ -181,6 +182,9 @@ public class KeyguardUpdateMonitor {
                case MSG_USER_INFO_CHANGED:
                    handleUserInfoChanged(msg.arg1);
                    break;
                case MSG_REPORT_EMERGENCY_CALL_ACTION:
                    handleReportEmergencyCallAction();
                    break;
            }
        }
    };
@@ -758,6 +762,18 @@ public class KeyguardUpdateMonitor {
        }
    }

    /**
     * Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION}
     */
    private void handleReportEmergencyCallAction() {
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onEmergencyCallAction();
            }
        }
    }

    public boolean isKeyguardVisible() {
        return mKeyguardIsVisible;
    }
@@ -902,6 +918,22 @@ public class KeyguardUpdateMonitor {
        handleSimStateChange(new SimArgs(IccCardConstants.State.READY));
    }

    /**
     * Report that the emergency call button has been pressed and the emergency dialer is
     * about to be displayed.
     *
     * @param bypassHandler runs immediately.
     *
     * NOTE: Must be called from UI thread if bypassHandler == true.
     */
    public void reportEmergencyCallAction(boolean bypassHandler) {
        if (!bypassHandler) {
            mHandler.obtainMessage(MSG_REPORT_EMERGENCY_CALL_ACTION).sendToTarget();
        } else {
            handleReportEmergencyCallAction();
        }
    }

    public CharSequence getTelephonyPlmn() {
        return mTelephonyPlmn;
    }
+4 −0
Original line number Diff line number Diff line
@@ -131,4 +131,8 @@ class KeyguardUpdateMonitorCallback {
     */
    public void onMusicPlaybackStateChanged(int playbackState, long eventTime) { }

    /**
     * Called when the emergency call button is pressed.
     */
    void onEmergencyCallAction() { }
}