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

Commit 0284e5e4 authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Add multi-sim support to keyguard" into lmp-mr1-dev

parents 26750711 52a6133f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -240,12 +240,16 @@
    <string name="kg_pattern_instructions">Draw your pattern</string>
    <!-- Instructions for using the SIM PIN unlock screen -->
    <string name="kg_sim_pin_instructions">Enter SIM PIN</string>
    <!-- Instructions for using the SIM PIN unlock screen when there's more than one SIM -->
    <string name="kg_sim_pin_instructions_multi">Enter SIM PIN for \"<xliff:g id="carrier" example="CARD 1">%1$s</xliff:g>\"</string>
    <!-- Instructions for using the PIN unlock screen -->
    <string name="kg_pin_instructions">Enter PIN</string>
    <!-- Instructions for using the password unlock screen -->
    <string name="kg_password_instructions">Enter Password</string>
    <!-- Hint shown in the PUK screen that asks the user to enter the PUK code given to them by their provider -->
    <string name="kg_puk_enter_puk_hint">SIM is now disabled. Enter PUK code to continue. Contact carrier for details.</string>
    <!-- Hint shown when there are multiple SIMs in the device to ask the user to enter the PUK code given to them by their provider -->
    <string name="kg_puk_enter_puk_hint_multi">SIM \"<xliff:g id="carrier" example="CARD 1">%1$s</xliff:g>\" is now disabled. Enter PUK code to continue. Contact carrier for details.</string>
    <!-- Hint shown in the PUK unlock screen PIN TextView -->
    <string name="kg_puk_enter_pin_hint">Enter desired PIN code</string>
    <!-- Message shown when the user needs to confirm the PIN they just entered in the PUK screen -->
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public class CarrierText extends TextView {
        }

        @Override
        public void onSimStateChanged(IccCardConstants.State simState) {
        public void onSimStateChanged(int subId, int slotId, State simState) {
            mSimState = simState;
            updateCarrierText(mSimState, mPlmn, mSpn);
        }
+6 −12
Original line number Diff line number Diff line
@@ -36,22 +36,18 @@ import com.android.internal.widget.LockPatternUtils;
 * allows the user to return to the call.
 */
public class EmergencyButton extends Button {

    private static final int EMERGENCY_CALL_TIMEOUT = 10000; // screen timeout after starting e.d.
    private static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";

    KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {

        @Override
        public void onSimStateChanged(State simState) {
            int phoneState = KeyguardUpdateMonitor.getInstance(mContext).getPhoneState();
            updateEmergencyCallButton(simState, phoneState);
        public void onSimStateChanged(int subId, int slotId, State simState) {
            updateEmergencyCallButton();
        }

        @Override
        public void onPhoneStateChanged(int phoneState) {
            State simState = KeyguardUpdateMonitor.getInstance(mContext).getSimState();
            updateEmergencyCallButton(simState, phoneState);
            updateEmergencyCallButton();
        }
    };
    private LockPatternUtils mLockPatternUtils;
@@ -87,9 +83,7 @@ public class EmergencyButton extends Button {
                takeEmergencyCallAction();
            }
        });
        int phoneState = KeyguardUpdateMonitor.getInstance(mContext).getPhoneState();
        State simState = KeyguardUpdateMonitor.getInstance(mContext).getSimState();
        updateEmergencyCallButton(simState, phoneState);
        updateEmergencyCallButton();
    }

    /**
@@ -112,12 +106,12 @@ public class EmergencyButton extends Button {
        }
    }

    private void updateEmergencyCallButton(State simState, int phoneState) {
    private void updateEmergencyCallButton() {
        boolean enabled = false;
        if (mLockPatternUtils.isInCall()) {
            enabled = true; // always show "return to call" if phone is off-hook
        } else if (mLockPatternUtils.isEmergencyCallCapable()) {
            boolean simLocked = KeyguardUpdateMonitor.getInstance(mContext).isSimLocked();
            final boolean simLocked = KeyguardUpdateMonitor.getInstance(mContext).isSimPinVoiceSecure();
            if (simLocked) {
                // Some countries can't handle emergency calls while SIM is locked.
                enabled = mLockPatternUtils.isEmergencyCallEnabledWhileSimLocked();
+2 −1
Original line number Diff line number Diff line
@@ -25,5 +25,6 @@ public class KeyguardConstants {
     * Turns on debugging information for the whole Keyguard. This is very verbose and should only
     * be used temporarily for debugging.
     */
    public static final boolean DEBUG = false;
    public static final boolean DEBUG = true;
    public static final boolean DEBUG_SIM_STATES = true;
}
+9 −4
Original line number Diff line number Diff line
@@ -17,11 +17,15 @@ package com.android.keyguard;

import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.widget.LockPatternUtils;

import java.util.List;

public class KeyguardSecurityModel {

    /**
@@ -75,12 +79,13 @@ public class KeyguardSecurityModel {
    }

    SecurityMode getSecurityMode() {
        KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
        final IccCardConstants.State simState = updateMonitor.getSimState();
        KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
        SecurityMode mode = SecurityMode.None;
        if (simState == IccCardConstants.State.PIN_REQUIRED) {
        if (monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED)
                != SubscriptionManager.INVALID_SUB_ID) {
            mode = SecurityMode.SimPin;
        } else if (simState == IccCardConstants.State.PUK_REQUIRED
        } else if (monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED)
                != SubscriptionManager.INVALID_SUB_ID
                && mLockPatternUtils.isPukUnlockScreenEnable()) {
            mode = SecurityMode.SimPuk;
        } else {
Loading