Loading packages/Keyguard/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -38,4 +38,7 @@ <!-- monitor locale change --> <bool name="config_monitor_locale_change">false</bool> <bool name="config_showEmergencyCallOnlyInLockScreen">false</bool> <!-- display airplane mode in lock sreen when phone is in APM mode --> <bool name="config_display_APM">false</bool> </resources> packages/Keyguard/src/com/android/keyguard/CarrierText.java +20 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ public class CarrierText extends TextView { private LockPatternUtils mLockPatternUtils; protected boolean mAirplaneMode; protected boolean showAPM; private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { private CharSequence mPlmn; private CharSequence mSpn; Loading @@ -55,6 +58,12 @@ public class CarrierText extends TextView { updateCarrierText(mSimState, mPlmn, mSpn); } @Override void onAirplaneModeChanged(boolean on) { mAirplaneMode = on; updateCarrierText(mSimState, mPlmn, mSpn); } public void onScreenTurnedOff(int why) { setSelected(false); }; Loading Loading @@ -88,10 +97,20 @@ public class CarrierText extends TextView { mLockPatternUtils = new LockPatternUtils(mContext); boolean useAllCaps = mContext.getResources().getBoolean(R.bool.kg_use_all_caps); setTransformationMethod(new CarrierTextTransformationMethod(mContext, useAllCaps)); showAPM = context.getResources().getBoolean(R.bool.config_display_APM); } protected void updateCarrierText(State simState, CharSequence plmn, CharSequence spn) { setText(getCarrierTextForSimState(simState, plmn, spn)); CharSequence text = ""; if (mAirplaneMode && showAPM) { // if airplane mode is on, show "airplane mode" text = getContext().getText(com.android.internal.R.string.lockscreen_airplane_mode_on); } else { text = getCarrierTextForSimState(simState, plmn, spn); } setText(text); } @Override Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +20 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class KeyguardUpdateMonitor { protected static final int MSG_REPORT_EMERGENCY_CALL_ACTION = 318; private static final int MSG_SCREEN_TURNED_ON = 319; private static final int MSG_SCREEN_TURNED_OFF = 320; private static final int MSG_AIRPLANE_MODE_CHANGED = 321; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -206,6 +207,9 @@ public class KeyguardUpdateMonitor { case MSG_SCREEN_TURNED_ON: handleScreenTurnedOn(); break; case MSG_AIRPLANE_MODE_CHANGED: handleAirplaneModeChanged((Boolean) msg.obj); break; } } }; Loading Loading @@ -318,6 +322,9 @@ public class KeyguardUpdateMonitor { } else if (Intent.ACTION_USER_REMOVED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_REMOVED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0)); } else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { boolean state = intent.getBooleanExtra("state", false); mHandler.sendMessage(mHandler.obtainMessage(MSG_AIRPLANE_MODE_CHANGED, state)); } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { dispatchBootCompleted(); } else if (TelephonyIntents.ACTION_SERVICE_STATE_CHANGED.equals(action)) { Loading Loading @@ -596,6 +603,15 @@ public class KeyguardUpdateMonitor { } } private void handleAirplaneModeChanged(boolean on) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onAirplaneModeChanged(on); } } } private void handleUserInfoChanged(int userId) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); Loading Loading @@ -647,6 +663,7 @@ public class KeyguardUpdateMonitor { filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(Intent.ACTION_USER_REMOVED); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); filter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); context.registerReceiver(mBroadcastReceiver, filter); Loading Loading @@ -1101,6 +1118,9 @@ public class KeyguardUpdateMonitor { mDisplayClientState.intent); callback.onMusicPlaybackStateChanged(mDisplayClientState.playbackState, mDisplayClientState.playbackEventTime); boolean airplaneModeOn = Settings.System.getInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; callback.onAirplaneModeChanged(airplaneModeOn); } public void sendKeyguardVisibilityChanged(boolean showing) { Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +7 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,11 @@ class KeyguardUpdateMonitorCallback { * @param subscription The subscription for which onRefreshCarrierInfo is meant */ void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn, int subscription) { } /** * Called when the airplane mode changes. * * @param on Indicates if the airplane mode is now enable. */ void onAirplaneModeChanged(boolean on) { } } packages/Keyguard/src/com/android/keyguard/msim/MSimCarrierText.java +18 −7 Original line number Diff line number Diff line Loading @@ -51,6 +51,12 @@ public class MSimCarrierText extends CarrierText { mSimState[sub] = simState; updateCarrierText(mSimState, mPlmn, mSpn); } @Override void onAirplaneModeChanged(boolean on) { mAirplaneMode = on; updateCarrierText(mSimState, mPlmn, mSpn); } }; private void initialize() { Loading @@ -71,14 +77,19 @@ public class MSimCarrierText extends CarrierText { protected void updateCarrierText(State []simState, CharSequence []plmn, CharSequence []spn) { CharSequence text = ""; if (mAirplaneMode && showAPM) { text = getContext().getText(com.android.internal.R.string.lockscreen_airplane_mode_on); } else { for (int i = 0; i < simState.length; i++) { CharSequence displayText = getCarrierTextForSimState(simState[i], plmn[i], spn[i]); if (mContext.getResources().getBoolean(R.bool.kg_use_all_caps)) { displayText = (displayText != null ? displayText.toString().toUpperCase() : ""); displayText = (displayText != null ? displayText.toString().toUpperCase() : ""); } text = (TextUtils.isEmpty(text) ? displayText : getContext().getString( R.string.msim_carrier_text_format, text, displayText)); } text = (TextUtils.isEmpty(text) ? displayText : getContext().getString(R.string.msim_carrier_text_format, text, displayText)); } Log.d(TAG, "updateCarrierText: text = " + text); setText(text); Loading Loading
packages/Keyguard/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -38,4 +38,7 @@ <!-- monitor locale change --> <bool name="config_monitor_locale_change">false</bool> <bool name="config_showEmergencyCallOnlyInLockScreen">false</bool> <!-- display airplane mode in lock sreen when phone is in APM mode --> <bool name="config_display_APM">false</bool> </resources>
packages/Keyguard/src/com/android/keyguard/CarrierText.java +20 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ public class CarrierText extends TextView { private LockPatternUtils mLockPatternUtils; protected boolean mAirplaneMode; protected boolean showAPM; private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { private CharSequence mPlmn; private CharSequence mSpn; Loading @@ -55,6 +58,12 @@ public class CarrierText extends TextView { updateCarrierText(mSimState, mPlmn, mSpn); } @Override void onAirplaneModeChanged(boolean on) { mAirplaneMode = on; updateCarrierText(mSimState, mPlmn, mSpn); } public void onScreenTurnedOff(int why) { setSelected(false); }; Loading Loading @@ -88,10 +97,20 @@ public class CarrierText extends TextView { mLockPatternUtils = new LockPatternUtils(mContext); boolean useAllCaps = mContext.getResources().getBoolean(R.bool.kg_use_all_caps); setTransformationMethod(new CarrierTextTransformationMethod(mContext, useAllCaps)); showAPM = context.getResources().getBoolean(R.bool.config_display_APM); } protected void updateCarrierText(State simState, CharSequence plmn, CharSequence spn) { setText(getCarrierTextForSimState(simState, plmn, spn)); CharSequence text = ""; if (mAirplaneMode && showAPM) { // if airplane mode is on, show "airplane mode" text = getContext().getText(com.android.internal.R.string.lockscreen_airplane_mode_on); } else { text = getCarrierTextForSimState(simState, plmn, spn); } setText(text); } @Override Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +20 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class KeyguardUpdateMonitor { protected static final int MSG_REPORT_EMERGENCY_CALL_ACTION = 318; private static final int MSG_SCREEN_TURNED_ON = 319; private static final int MSG_SCREEN_TURNED_OFF = 320; private static final int MSG_AIRPLANE_MODE_CHANGED = 321; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -206,6 +207,9 @@ public class KeyguardUpdateMonitor { case MSG_SCREEN_TURNED_ON: handleScreenTurnedOn(); break; case MSG_AIRPLANE_MODE_CHANGED: handleAirplaneModeChanged((Boolean) msg.obj); break; } } }; Loading Loading @@ -318,6 +322,9 @@ public class KeyguardUpdateMonitor { } else if (Intent.ACTION_USER_REMOVED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_REMOVED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0)); } else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { boolean state = intent.getBooleanExtra("state", false); mHandler.sendMessage(mHandler.obtainMessage(MSG_AIRPLANE_MODE_CHANGED, state)); } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { dispatchBootCompleted(); } else if (TelephonyIntents.ACTION_SERVICE_STATE_CHANGED.equals(action)) { Loading Loading @@ -596,6 +603,15 @@ public class KeyguardUpdateMonitor { } } private void handleAirplaneModeChanged(boolean on) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onAirplaneModeChanged(on); } } } private void handleUserInfoChanged(int userId) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); Loading Loading @@ -647,6 +663,7 @@ public class KeyguardUpdateMonitor { filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(Intent.ACTION_USER_REMOVED); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); filter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); context.registerReceiver(mBroadcastReceiver, filter); Loading Loading @@ -1101,6 +1118,9 @@ public class KeyguardUpdateMonitor { mDisplayClientState.intent); callback.onMusicPlaybackStateChanged(mDisplayClientState.playbackState, mDisplayClientState.playbackEventTime); boolean airplaneModeOn = Settings.System.getInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; callback.onAirplaneModeChanged(airplaneModeOn); } public void sendKeyguardVisibilityChanged(boolean showing) { Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +7 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,11 @@ class KeyguardUpdateMonitorCallback { * @param subscription The subscription for which onRefreshCarrierInfo is meant */ void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn, int subscription) { } /** * Called when the airplane mode changes. * * @param on Indicates if the airplane mode is now enable. */ void onAirplaneModeChanged(boolean on) { } }
packages/Keyguard/src/com/android/keyguard/msim/MSimCarrierText.java +18 −7 Original line number Diff line number Diff line Loading @@ -51,6 +51,12 @@ public class MSimCarrierText extends CarrierText { mSimState[sub] = simState; updateCarrierText(mSimState, mPlmn, mSpn); } @Override void onAirplaneModeChanged(boolean on) { mAirplaneMode = on; updateCarrierText(mSimState, mPlmn, mSpn); } }; private void initialize() { Loading @@ -71,14 +77,19 @@ public class MSimCarrierText extends CarrierText { protected void updateCarrierText(State []simState, CharSequence []plmn, CharSequence []spn) { CharSequence text = ""; if (mAirplaneMode && showAPM) { text = getContext().getText(com.android.internal.R.string.lockscreen_airplane_mode_on); } else { for (int i = 0; i < simState.length; i++) { CharSequence displayText = getCarrierTextForSimState(simState[i], plmn[i], spn[i]); if (mContext.getResources().getBoolean(R.bool.kg_use_all_caps)) { displayText = (displayText != null ? displayText.toString().toUpperCase() : ""); displayText = (displayText != null ? displayText.toString().toUpperCase() : ""); } text = (TextUtils.isEmpty(text) ? displayText : getContext().getString( R.string.msim_carrier_text_format, text, displayText)); } text = (TextUtils.isEmpty(text) ? displayText : getContext().getString(R.string.msim_carrier_text_format, text, displayText)); } Log.d(TAG, "updateCarrierText: text = " + text); setText(text); Loading