Loading packages/Keyguard/res/values/bools.xml 100644 → 100755 +1 −0 Original line number Diff line number Diff line Loading @@ -17,4 +17,5 @@ <resources> <bool name="kg_show_ime_at_screen_on">true</bool> <bool name="kg_use_all_caps">true</bool> <bool name="kg_hide_emgcy_btn_when_oos">false</bool> </resources> packages/Keyguard/src/com/android/keyguard/EmergencyButton.java 100644 → 100755 +11 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.telecom.TelecomManager; import android.telephony.ServiceState; import android.util.AttributeSet; import android.util.Slog; import android.view.View; Loading Loading @@ -64,6 +65,11 @@ public class EmergencyButton extends Button { public void onPhoneStateChanged(int phoneState) { updateEmergencyCallButton(); } @Override public void onServiceStateChanged(int subId, ServiceState state) { updateEmergencyCallButton(); } }; public interface EmergencyButtonCallback { Loading Loading @@ -168,6 +174,11 @@ public class EmergencyButton extends Button { visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()) || mContext.getResources().getBoolean(R.bool.config_showEmergencyButton); } if (mContext.getResources().getBoolean(R.bool.kg_hide_emgcy_btn_when_oos)) { KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext); visible = visible && !monitor.isOOS(); } } } if (visible) { Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +31 −0 Original line number Diff line number Diff line Loading @@ -1411,6 +1411,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { KeyguardUpdateMonitorCallback cb = mCallbacks.get(j).get(); if (cb != null) { cb.onRefreshCarrierInfo(); cb.onServiceStateChanged(subId, serviceState); } } } Loading Loading @@ -1639,6 +1640,36 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } public boolean isOOS() { boolean ret = true; int phoneCount = TelephonyManager.getDefault().getPhoneCount(); for (int phoneId = 0; phoneId < phoneCount; phoneId++) { int[] subId = SubscriptionManager.getSubId(phoneId); if (subId != null && subId.length >= 1) { if (DEBUG) Log.d(TAG, "slot id:" + phoneId + " subId:" + subId[0]); ServiceState state = mServiceStates.get(subId[0]); if (state != null) { if (state.isEmergencyOnly()) ret = false; if ((state.getVoiceRegState() != ServiceState.STATE_OUT_OF_SERVICE) && (state.getVoiceRegState() != ServiceState.STATE_POWER_OFF)) ret = false; if (DEBUG) { Log.d(TAG, "is emergency: " + state.isEmergencyOnly()); Log.d(TAG, "voice state: " + state.getVoiceRegState()); } } else { if (DEBUG) Log.d(TAG, "state is NULL"); } } } if (DEBUG) Log.d(TAG, "is Emergency supported: " + ret); return ret; } /** * @return true if and only if the state has changed for the specified {@code slotId} */ Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java 100644 → 100755 +8 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.graphics.Bitmap; import android.media.AudioManager; import android.os.SystemClock; import android.hardware.fingerprint.FingerprintManager; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.view.WindowManagerPolicy; Loading Loading @@ -122,6 +123,13 @@ public class KeyguardUpdateMonitorCallback { */ public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { } /** * Called when the sevice state changes. * @param subId * @param serviceState */ public void onServiceStateChanged(int subId, ServiceState state) { } /** * Called when the user's info changed. */ Loading Loading
packages/Keyguard/res/values/bools.xml 100644 → 100755 +1 −0 Original line number Diff line number Diff line Loading @@ -17,4 +17,5 @@ <resources> <bool name="kg_show_ime_at_screen_on">true</bool> <bool name="kg_use_all_caps">true</bool> <bool name="kg_hide_emgcy_btn_when_oos">false</bool> </resources>
packages/Keyguard/src/com/android/keyguard/EmergencyButton.java 100644 → 100755 +11 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.telecom.TelecomManager; import android.telephony.ServiceState; import android.util.AttributeSet; import android.util.Slog; import android.view.View; Loading Loading @@ -64,6 +65,11 @@ public class EmergencyButton extends Button { public void onPhoneStateChanged(int phoneState) { updateEmergencyCallButton(); } @Override public void onServiceStateChanged(int subId, ServiceState state) { updateEmergencyCallButton(); } }; public interface EmergencyButtonCallback { Loading Loading @@ -168,6 +174,11 @@ public class EmergencyButton extends Button { visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()) || mContext.getResources().getBoolean(R.bool.config_showEmergencyButton); } if (mContext.getResources().getBoolean(R.bool.kg_hide_emgcy_btn_when_oos)) { KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext); visible = visible && !monitor.isOOS(); } } } if (visible) { Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +31 −0 Original line number Diff line number Diff line Loading @@ -1411,6 +1411,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { KeyguardUpdateMonitorCallback cb = mCallbacks.get(j).get(); if (cb != null) { cb.onRefreshCarrierInfo(); cb.onServiceStateChanged(subId, serviceState); } } } Loading Loading @@ -1639,6 +1640,36 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } public boolean isOOS() { boolean ret = true; int phoneCount = TelephonyManager.getDefault().getPhoneCount(); for (int phoneId = 0; phoneId < phoneCount; phoneId++) { int[] subId = SubscriptionManager.getSubId(phoneId); if (subId != null && subId.length >= 1) { if (DEBUG) Log.d(TAG, "slot id:" + phoneId + " subId:" + subId[0]); ServiceState state = mServiceStates.get(subId[0]); if (state != null) { if (state.isEmergencyOnly()) ret = false; if ((state.getVoiceRegState() != ServiceState.STATE_OUT_OF_SERVICE) && (state.getVoiceRegState() != ServiceState.STATE_POWER_OFF)) ret = false; if (DEBUG) { Log.d(TAG, "is emergency: " + state.isEmergencyOnly()); Log.d(TAG, "voice state: " + state.getVoiceRegState()); } } else { if (DEBUG) Log.d(TAG, "state is NULL"); } } } if (DEBUG) Log.d(TAG, "is Emergency supported: " + ret); return ret; } /** * @return true if and only if the state has changed for the specified {@code slotId} */ Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java 100644 → 100755 +8 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.graphics.Bitmap; import android.media.AudioManager; import android.os.SystemClock; import android.hardware.fingerprint.FingerprintManager; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.view.WindowManagerPolicy; Loading Loading @@ -122,6 +123,13 @@ public class KeyguardUpdateMonitorCallback { */ public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { } /** * Called when the sevice state changes. * @param subId * @param serviceState */ public void onServiceStateChanged(int subId, ServiceState state) { } /** * Called when the user's info changed. */ Loading