Loading packages/SystemUI/res-keyguard/values/attrs.xml +0 −4 Original line number Original line Diff line number Diff line Loading @@ -38,9 +38,5 @@ <attr name="android:textColor" format="color" /> <attr name="android:textColor" format="color" /> </declare-styleable> </declare-styleable> <declare-styleable name="CarrierText"> <attr name="allCaps" format="boolean" /> </declare-styleable> <attr name="passwordStyle" format="reference" /> <attr name="passwordStyle" format="reference" /> </resources> </resources> packages/SystemUI/res/layout/keyguard_status_bar.xml +4 −2 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,7 @@ <!-- Extends RelativeLayout --> <!-- Extends RelativeLayout --> <com.android.systemui.statusbar.phone.KeyguardStatusBarView <com.android.systemui.statusbar.phone.KeyguardStatusBarView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_header" android:id="@+id/keyguard_header" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/status_bar_header_height_keyguard" android:layout_height="@dimen/status_bar_header_height_keyguard" Loading Loading @@ -73,6 +73,8 @@ android:textDirection="locale" android:textDirection="locale" android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?attr/wallpaperTextColorSecondary" android:textColor="?attr/wallpaperTextColorSecondary" android:singleLine="true" /> android:singleLine="true" systemui:showMissingSim="true" systemui:showAirplaneMode="true" /> </com.android.systemui.statusbar.phone.KeyguardStatusBarView> </com.android.systemui.statusbar.phone.KeyguardStatusBarView> packages/SystemUI/res/values/attrs.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -146,5 +146,12 @@ <!-- Used to style charging animation AVD animation --> <!-- Used to style charging animation AVD animation --> <attr name="chargingAnimColor" format="color" /> <attr name="chargingAnimColor" format="color" /> <!-- Used display CarrierText in Keyguard or QS Footer --> <declare-styleable name="CarrierText"> <attr name="allCaps" format="boolean" /> <attr name="showMissingSim" format="boolean" /> <attr name="showAirplaneMode" format="boolean" /> </declare-styleable> </resources> </resources> packages/SystemUI/src/com/android/keyguard/CarrierText.java +31 −19 Original line number Original line Diff line number Diff line Loading @@ -43,11 +43,6 @@ import com.android.settingslib.WirelessUtils; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; public class CarrierText extends TextView { public class CarrierText extends TextView { /** Do not show missing sim message. */ public static final int FLAG_HIDE_MISSING_SIM = 1 << 0; /** Do not show airplane mode message. */ public static final int FLAG_HIDE_AIRPLANE_MODE = 1 << 1; private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final String TAG = "CarrierText"; private static final String TAG = "CarrierText"; Loading @@ -55,17 +50,23 @@ public class CarrierText extends TextView { private final boolean mIsEmergencyCallCapable; private final boolean mIsEmergencyCallCapable; private boolean mTelephonyCapable; private boolean mShowMissingSim; private boolean mShowAirplaneMode; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private WifiManager mWifiManager; private WifiManager mWifiManager; private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; private int mFlags; private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override @Override public void onRefreshCarrierInfo() { public void onRefreshCarrierInfo() { if (DEBUG) Log.d(TAG, "onRefreshCarrierInfo(), mTelephonyCapable: " + Boolean.toString(mTelephonyCapable)); updateCarrierText(); updateCarrierText(); } } Loading @@ -77,9 +78,18 @@ public class CarrierText extends TextView { setSelected(true); setSelected(true); }; }; @Override public void onTelephonyCapable(boolean capable) { if (DEBUG) Log.d(TAG, "onTelephonyCapable() mTelephonyCapable: " + Boolean.toString(capable)); mTelephonyCapable = capable; updateCarrierText(); } public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { if (slotId < 0) { if (slotId < 0) { Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId); Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId + " mTelephonyCapable: " + Boolean.toString(mTelephonyCapable)); return; return; } } Loading @@ -91,12 +101,8 @@ public class CarrierText extends TextView { mSimErrorState[slotId] = false; mSimErrorState[slotId] = false; updateCarrierText(); updateCarrierText(); } } }; }; public void setDisplayFlags(int flags) { mFlags = flags; } } }; /** /** * The status of this lock screen. Primarily used for widgets on LockScreen. * The status of this lock screen. Primarily used for widgets on LockScreen. Loading @@ -110,7 +116,8 @@ public class CarrierText extends TextView { SimLocked, // SIM card is currently locked SimLocked, // SIM card is currently locked SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM. SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM. SimIoError; // SIM card is faulty SimIoError, // SIM card is faulty SimUnknown // SIM card is unknown } } public CarrierText(Context context) { public CarrierText(Context context) { Loading @@ -126,6 +133,8 @@ public class CarrierText extends TextView { attrs, R.styleable.CarrierText, 0, 0); attrs, R.styleable.CarrierText, 0, 0); try { try { useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false); useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false); mShowAirplaneMode = a.getBoolean(R.styleable.CarrierText_showAirplaneMode, false); mShowMissingSim = a.getBoolean(R.styleable.CarrierText_showMissingSim, false); } finally { } finally { a.recycle(); a.recycle(); } } Loading Loading @@ -249,12 +258,12 @@ public class CarrierText extends TextView { } } private String getMissingSimMessage() { private String getMissingSimMessage() { return (mFlags & FLAG_HIDE_MISSING_SIM) == 0 return mShowMissingSim && mTelephonyCapable ? getContext().getString(R.string.keyguard_missing_sim_message_short) : ""; ? getContext().getString(R.string.keyguard_missing_sim_message_short) : ""; } } private String getAirplaneModeMessage() { private String getAirplaneModeMessage() { return (mFlags & FLAG_HIDE_AIRPLANE_MODE) == 0 return mShowAirplaneMode ? getContext().getString(R.string.airplane_mode) : ""; ? getContext().getString(R.string.airplane_mode) : ""; } } Loading Loading @@ -360,6 +369,9 @@ public class CarrierText extends TextView { getContext().getText(R.string.keyguard_sim_error_message_short), getContext().getText(R.string.keyguard_sim_error_message_short), text); text); break; break; case SimUnknown: carrierText = null; break; } } return carrierText; return carrierText; Loading Loading @@ -408,11 +420,11 @@ public class CarrierText extends TextView { case PERM_DISABLED: case PERM_DISABLED: return StatusMode.SimPermDisabled; return StatusMode.SimPermDisabled; case UNKNOWN: case UNKNOWN: return StatusMode.SimMissing; return StatusMode.SimUnknown; case CARD_IO_ERROR: case CARD_IO_ERROR: return StatusMode.SimIoError; return StatusMode.SimIoError; } } return StatusMode.SimMissing; return StatusMode.SimUnknown; } } private static CharSequence concatenate(CharSequence plmn, CharSequence spn) { private static CharSequence concatenate(CharSequence plmn, CharSequence spn) { Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +48 −2 Original line number Original line Diff line number Diff line Loading @@ -84,6 +84,7 @@ import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; import com.android.systemui.recents.misc.SysUiTaskStackChangeListener; import com.android.systemui.recents.misc.SysUiTaskStackChangeListener; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityManagerWrapper; Loading Loading @@ -148,6 +149,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_ASSISTANT_STACK_CHANGED = 335; private static final int MSG_ASSISTANT_STACK_CHANGED = 335; private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_TELEPHONY_CAPABLE = 338; /** Biometric authentication state: Not listening. */ /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -204,6 +206,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private boolean mHasLockscreenWallpaper; private boolean mHasLockscreenWallpaper; private boolean mAssistantVisible; private boolean mAssistantVisible; private boolean mKeyguardOccluded; private boolean mKeyguardOccluded; @VisibleForTesting protected boolean mTelephonyCapable; // Device provisioning state // Device provisioning state private boolean mDeviceProvisioned; private boolean mDeviceProvisioned; Loading Loading @@ -344,6 +348,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED: case MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED: updateLogoutEnabled(); updateLogoutEnabled(); break; break; case MSG_TELEPHONY_CAPABLE: updateTelephonyCapable((boolean)msg.obj); break; default: default: super.handleMessage(msg); super.handleMessage(msg); break; break; Loading Loading @@ -962,14 +969,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { maxChargingMicroWatt)); maxChargingMicroWatt)); mHandler.sendMessage(msg); mHandler.sendMessage(msg); } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { SimData args = SimData.fromIntent(intent); // ACTION_SIM_STATE_CHANGED is rebroadcast after unlocking the device to // ACTION_SIM_STATE_CHANGED is rebroadcast after unlocking the device to // keep compatibility with apps that aren't direct boot aware. // keep compatibility with apps that aren't direct boot aware. // SysUI should just ignore this broadcast because it was already received // SysUI should just ignore this broadcast because it was already received // and processed previously. // and processed previously. if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) { if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) { // Guarantee mTelephonyCapable state after SysUI crash and restart if (args.simState == State.ABSENT) { mHandler.obtainMessage(MSG_TELEPHONY_CAPABLE, true).sendToTarget(); } return; return; } } SimData args = SimData.fromIntent(intent); if (DEBUG_SIM_STATES) { if (DEBUG_SIM_STATES) { Log.v(TAG, "action " + action Log.v(TAG, "action " + action + " state: " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " state: " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) Loading Loading @@ -1467,6 +1478,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { mUserManager = context.getSystemService(UserManager.class); mUserManager = context.getSystemService(UserManager.class); mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class); mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class); mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled(); mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled(); updateAirplaneModeState(); } private void updateAirplaneModeState() { // ACTION_AIRPLANE_MODE_CHANGED do not broadcast if device set AirplaneMode ON and boot if (!WirelessUtils.isAirplaneModeOn(mContext) || mHandler.hasMessages(MSG_AIRPLANE_MODE_CHANGED)) { return; } mHandler.sendEmptyMessage(MSG_AIRPLANE_MODE_CHANGED); } } private void updateBiometricListeningState() { private void updateBiometricListeningState() { Loading Loading @@ -1822,6 +1843,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } } } /** * Handle Telephony status during Boot for CarrierText display policy */ @VisibleForTesting void updateTelephonyCapable(boolean capable){ if (capable == mTelephonyCapable) { return; } mTelephonyCapable = capable; for (WeakReference<KeyguardUpdateMonitorCallback> ref : mCallbacks) { KeyguardUpdateMonitorCallback cb = ref.get(); if (cb != null) { cb.onTelephonyCapable(mTelephonyCapable); } } } /** /** * Handle {@link #MSG_SIM_STATE_CHANGE} * Handle {@link #MSG_SIM_STATE_CHANGE} */ */ Loading @@ -1835,6 +1873,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (!SubscriptionManager.isValidSubscriptionId(subId)) { if (!SubscriptionManager.isValidSubscriptionId(subId)) { Log.w(TAG, "invalid subId in handleSimStateChange()"); Log.w(TAG, "invalid subId in handleSimStateChange()"); /* Only handle No SIM(ABSENT) due to handleServiceStateChange() handle other case */ if (state == State.ABSENT) { updateTelephonyCapable(true); } return; return; } } Loading Loading @@ -1863,7 +1905,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { /** /** * Handle {@link #MSG_SERVICE_STATE_CHANGE} * Handle {@link #MSG_SERVICE_STATE_CHANGE} */ */ private void handleServiceStateChange(int subId, ServiceState serviceState) { @VisibleForTesting void handleServiceStateChange(int subId, ServiceState serviceState) { if (DEBUG) { if (DEBUG) { Log.d(TAG, Log.d(TAG, "handleServiceStateChange(subId=" + subId + ", serviceState=" + serviceState); "handleServiceStateChange(subId=" + subId + ", serviceState=" + serviceState); Loading @@ -1872,6 +1915,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (!SubscriptionManager.isValidSubscriptionId(subId)) { if (!SubscriptionManager.isValidSubscriptionId(subId)) { Log.w(TAG, "invalid subId in handleServiceStateChange()"); Log.w(TAG, "invalid subId in handleServiceStateChange()"); return; return; } else { updateTelephonyCapable(true); } } mServiceStates.put(subId, serviceState); mServiceStates.put(subId, serviceState); Loading Loading @@ -2035,6 +2080,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { callback.onRefreshCarrierInfo(); callback.onRefreshCarrierInfo(); callback.onClockVisibilityChanged(); callback.onClockVisibilityChanged(); callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible); callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible); callback.onTelephonyCapable(mTelephonyCapable); for (Entry<Integer, SimData> data : mSimDatas.entrySet()) { for (Entry<Integer, SimData> data : mSimDatas.entrySet()) { final SimData state = data.getValue(); final SimData state = data.getValue(); callback.onSimStateChanged(state.subId, state.slotId, state.simState); callback.onSimStateChanged(state.subId, state.slotId, state.simState); Loading Loading
packages/SystemUI/res-keyguard/values/attrs.xml +0 −4 Original line number Original line Diff line number Diff line Loading @@ -38,9 +38,5 @@ <attr name="android:textColor" format="color" /> <attr name="android:textColor" format="color" /> </declare-styleable> </declare-styleable> <declare-styleable name="CarrierText"> <attr name="allCaps" format="boolean" /> </declare-styleable> <attr name="passwordStyle" format="reference" /> <attr name="passwordStyle" format="reference" /> </resources> </resources>
packages/SystemUI/res/layout/keyguard_status_bar.xml +4 −2 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,7 @@ <!-- Extends RelativeLayout --> <!-- Extends RelativeLayout --> <com.android.systemui.statusbar.phone.KeyguardStatusBarView <com.android.systemui.statusbar.phone.KeyguardStatusBarView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_header" android:id="@+id/keyguard_header" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/status_bar_header_height_keyguard" android:layout_height="@dimen/status_bar_header_height_keyguard" Loading Loading @@ -73,6 +73,8 @@ android:textDirection="locale" android:textDirection="locale" android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?attr/wallpaperTextColorSecondary" android:textColor="?attr/wallpaperTextColorSecondary" android:singleLine="true" /> android:singleLine="true" systemui:showMissingSim="true" systemui:showAirplaneMode="true" /> </com.android.systemui.statusbar.phone.KeyguardStatusBarView> </com.android.systemui.statusbar.phone.KeyguardStatusBarView>
packages/SystemUI/res/values/attrs.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -146,5 +146,12 @@ <!-- Used to style charging animation AVD animation --> <!-- Used to style charging animation AVD animation --> <attr name="chargingAnimColor" format="color" /> <attr name="chargingAnimColor" format="color" /> <!-- Used display CarrierText in Keyguard or QS Footer --> <declare-styleable name="CarrierText"> <attr name="allCaps" format="boolean" /> <attr name="showMissingSim" format="boolean" /> <attr name="showAirplaneMode" format="boolean" /> </declare-styleable> </resources> </resources>
packages/SystemUI/src/com/android/keyguard/CarrierText.java +31 −19 Original line number Original line Diff line number Diff line Loading @@ -43,11 +43,6 @@ import com.android.settingslib.WirelessUtils; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; public class CarrierText extends TextView { public class CarrierText extends TextView { /** Do not show missing sim message. */ public static final int FLAG_HIDE_MISSING_SIM = 1 << 0; /** Do not show airplane mode message. */ public static final int FLAG_HIDE_AIRPLANE_MODE = 1 << 1; private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final String TAG = "CarrierText"; private static final String TAG = "CarrierText"; Loading @@ -55,17 +50,23 @@ public class CarrierText extends TextView { private final boolean mIsEmergencyCallCapable; private final boolean mIsEmergencyCallCapable; private boolean mTelephonyCapable; private boolean mShowMissingSim; private boolean mShowAirplaneMode; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private WifiManager mWifiManager; private WifiManager mWifiManager; private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; private int mFlags; private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override @Override public void onRefreshCarrierInfo() { public void onRefreshCarrierInfo() { if (DEBUG) Log.d(TAG, "onRefreshCarrierInfo(), mTelephonyCapable: " + Boolean.toString(mTelephonyCapable)); updateCarrierText(); updateCarrierText(); } } Loading @@ -77,9 +78,18 @@ public class CarrierText extends TextView { setSelected(true); setSelected(true); }; }; @Override public void onTelephonyCapable(boolean capable) { if (DEBUG) Log.d(TAG, "onTelephonyCapable() mTelephonyCapable: " + Boolean.toString(capable)); mTelephonyCapable = capable; updateCarrierText(); } public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { if (slotId < 0) { if (slotId < 0) { Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId); Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId + " mTelephonyCapable: " + Boolean.toString(mTelephonyCapable)); return; return; } } Loading @@ -91,12 +101,8 @@ public class CarrierText extends TextView { mSimErrorState[slotId] = false; mSimErrorState[slotId] = false; updateCarrierText(); updateCarrierText(); } } }; }; public void setDisplayFlags(int flags) { mFlags = flags; } } }; /** /** * The status of this lock screen. Primarily used for widgets on LockScreen. * The status of this lock screen. Primarily used for widgets on LockScreen. Loading @@ -110,7 +116,8 @@ public class CarrierText extends TextView { SimLocked, // SIM card is currently locked SimLocked, // SIM card is currently locked SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM. SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM. SimIoError; // SIM card is faulty SimIoError, // SIM card is faulty SimUnknown // SIM card is unknown } } public CarrierText(Context context) { public CarrierText(Context context) { Loading @@ -126,6 +133,8 @@ public class CarrierText extends TextView { attrs, R.styleable.CarrierText, 0, 0); attrs, R.styleable.CarrierText, 0, 0); try { try { useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false); useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false); mShowAirplaneMode = a.getBoolean(R.styleable.CarrierText_showAirplaneMode, false); mShowMissingSim = a.getBoolean(R.styleable.CarrierText_showMissingSim, false); } finally { } finally { a.recycle(); a.recycle(); } } Loading Loading @@ -249,12 +258,12 @@ public class CarrierText extends TextView { } } private String getMissingSimMessage() { private String getMissingSimMessage() { return (mFlags & FLAG_HIDE_MISSING_SIM) == 0 return mShowMissingSim && mTelephonyCapable ? getContext().getString(R.string.keyguard_missing_sim_message_short) : ""; ? getContext().getString(R.string.keyguard_missing_sim_message_short) : ""; } } private String getAirplaneModeMessage() { private String getAirplaneModeMessage() { return (mFlags & FLAG_HIDE_AIRPLANE_MODE) == 0 return mShowAirplaneMode ? getContext().getString(R.string.airplane_mode) : ""; ? getContext().getString(R.string.airplane_mode) : ""; } } Loading Loading @@ -360,6 +369,9 @@ public class CarrierText extends TextView { getContext().getText(R.string.keyguard_sim_error_message_short), getContext().getText(R.string.keyguard_sim_error_message_short), text); text); break; break; case SimUnknown: carrierText = null; break; } } return carrierText; return carrierText; Loading Loading @@ -408,11 +420,11 @@ public class CarrierText extends TextView { case PERM_DISABLED: case PERM_DISABLED: return StatusMode.SimPermDisabled; return StatusMode.SimPermDisabled; case UNKNOWN: case UNKNOWN: return StatusMode.SimMissing; return StatusMode.SimUnknown; case CARD_IO_ERROR: case CARD_IO_ERROR: return StatusMode.SimIoError; return StatusMode.SimIoError; } } return StatusMode.SimMissing; return StatusMode.SimUnknown; } } private static CharSequence concatenate(CharSequence plmn, CharSequence spn) { private static CharSequence concatenate(CharSequence plmn, CharSequence spn) { Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +48 −2 Original line number Original line Diff line number Diff line Loading @@ -84,6 +84,7 @@ import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; import com.android.systemui.recents.misc.SysUiTaskStackChangeListener; import com.android.systemui.recents.misc.SysUiTaskStackChangeListener; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityManagerWrapper; Loading Loading @@ -148,6 +149,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_ASSISTANT_STACK_CHANGED = 335; private static final int MSG_ASSISTANT_STACK_CHANGED = 335; private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_TELEPHONY_CAPABLE = 338; /** Biometric authentication state: Not listening. */ /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -204,6 +206,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private boolean mHasLockscreenWallpaper; private boolean mHasLockscreenWallpaper; private boolean mAssistantVisible; private boolean mAssistantVisible; private boolean mKeyguardOccluded; private boolean mKeyguardOccluded; @VisibleForTesting protected boolean mTelephonyCapable; // Device provisioning state // Device provisioning state private boolean mDeviceProvisioned; private boolean mDeviceProvisioned; Loading Loading @@ -344,6 +348,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED: case MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED: updateLogoutEnabled(); updateLogoutEnabled(); break; break; case MSG_TELEPHONY_CAPABLE: updateTelephonyCapable((boolean)msg.obj); break; default: default: super.handleMessage(msg); super.handleMessage(msg); break; break; Loading Loading @@ -962,14 +969,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { maxChargingMicroWatt)); maxChargingMicroWatt)); mHandler.sendMessage(msg); mHandler.sendMessage(msg); } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) { SimData args = SimData.fromIntent(intent); // ACTION_SIM_STATE_CHANGED is rebroadcast after unlocking the device to // ACTION_SIM_STATE_CHANGED is rebroadcast after unlocking the device to // keep compatibility with apps that aren't direct boot aware. // keep compatibility with apps that aren't direct boot aware. // SysUI should just ignore this broadcast because it was already received // SysUI should just ignore this broadcast because it was already received // and processed previously. // and processed previously. if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) { if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) { // Guarantee mTelephonyCapable state after SysUI crash and restart if (args.simState == State.ABSENT) { mHandler.obtainMessage(MSG_TELEPHONY_CAPABLE, true).sendToTarget(); } return; return; } } SimData args = SimData.fromIntent(intent); if (DEBUG_SIM_STATES) { if (DEBUG_SIM_STATES) { Log.v(TAG, "action " + action Log.v(TAG, "action " + action + " state: " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " state: " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) Loading Loading @@ -1467,6 +1478,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { mUserManager = context.getSystemService(UserManager.class); mUserManager = context.getSystemService(UserManager.class); mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class); mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class); mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled(); mLogoutEnabled = mDevicePolicyManager.isLogoutEnabled(); updateAirplaneModeState(); } private void updateAirplaneModeState() { // ACTION_AIRPLANE_MODE_CHANGED do not broadcast if device set AirplaneMode ON and boot if (!WirelessUtils.isAirplaneModeOn(mContext) || mHandler.hasMessages(MSG_AIRPLANE_MODE_CHANGED)) { return; } mHandler.sendEmptyMessage(MSG_AIRPLANE_MODE_CHANGED); } } private void updateBiometricListeningState() { private void updateBiometricListeningState() { Loading Loading @@ -1822,6 +1843,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } } } /** * Handle Telephony status during Boot for CarrierText display policy */ @VisibleForTesting void updateTelephonyCapable(boolean capable){ if (capable == mTelephonyCapable) { return; } mTelephonyCapable = capable; for (WeakReference<KeyguardUpdateMonitorCallback> ref : mCallbacks) { KeyguardUpdateMonitorCallback cb = ref.get(); if (cb != null) { cb.onTelephonyCapable(mTelephonyCapable); } } } /** /** * Handle {@link #MSG_SIM_STATE_CHANGE} * Handle {@link #MSG_SIM_STATE_CHANGE} */ */ Loading @@ -1835,6 +1873,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (!SubscriptionManager.isValidSubscriptionId(subId)) { if (!SubscriptionManager.isValidSubscriptionId(subId)) { Log.w(TAG, "invalid subId in handleSimStateChange()"); Log.w(TAG, "invalid subId in handleSimStateChange()"); /* Only handle No SIM(ABSENT) due to handleServiceStateChange() handle other case */ if (state == State.ABSENT) { updateTelephonyCapable(true); } return; return; } } Loading Loading @@ -1863,7 +1905,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { /** /** * Handle {@link #MSG_SERVICE_STATE_CHANGE} * Handle {@link #MSG_SERVICE_STATE_CHANGE} */ */ private void handleServiceStateChange(int subId, ServiceState serviceState) { @VisibleForTesting void handleServiceStateChange(int subId, ServiceState serviceState) { if (DEBUG) { if (DEBUG) { Log.d(TAG, Log.d(TAG, "handleServiceStateChange(subId=" + subId + ", serviceState=" + serviceState); "handleServiceStateChange(subId=" + subId + ", serviceState=" + serviceState); Loading @@ -1872,6 +1915,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (!SubscriptionManager.isValidSubscriptionId(subId)) { if (!SubscriptionManager.isValidSubscriptionId(subId)) { Log.w(TAG, "invalid subId in handleServiceStateChange()"); Log.w(TAG, "invalid subId in handleServiceStateChange()"); return; return; } else { updateTelephonyCapable(true); } } mServiceStates.put(subId, serviceState); mServiceStates.put(subId, serviceState); Loading Loading @@ -2035,6 +2080,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { callback.onRefreshCarrierInfo(); callback.onRefreshCarrierInfo(); callback.onClockVisibilityChanged(); callback.onClockVisibilityChanged(); callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible); callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible); callback.onTelephonyCapable(mTelephonyCapable); for (Entry<Integer, SimData> data : mSimDatas.entrySet()) { for (Entry<Integer, SimData> data : mSimDatas.entrySet()) { final SimData state = data.getValue(); final SimData state = data.getValue(); callback.onSimStateChanged(state.subId, state.slotId, state.simState); callback.onSimStateChanged(state.subId, state.slotId, state.simState); Loading