diff options
3 files changed, 37 insertions, 40 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 9bba2aab782d..fb7a269863a2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -92,7 +92,6 @@ import android.util.Log; import android.util.SparseBooleanArray; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.widget.LockPatternUtils; @@ -1060,7 +1059,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab if (DEBUG_SIM_STATES) { Log.v(TAG, "action " + action + " state: " + intent.getStringExtra( - IccCardConstants.INTENT_KEY_ICC_STATE) + Intent.EXTRA_SIM_STATE) + " slotId: " + args.slotId + " subid: " + args.subId); } mHandler.obtainMessage(MSG_SIM_STATE_CHANGE, args.subId, args.slotId, args.simState) @@ -1236,38 +1235,38 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) { throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED"); } - String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); + String stateExtra = intent.getStringExtra(Intent.EXTRA_SIM_STATE); int slotId = intent.getIntExtra(PhoneConstants.PHONE_KEY, 0); int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); - if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) { + if (Intent.SIM_STATE_ABSENT.equals(stateExtra)) { final String absentReason = intent - .getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON); + .getStringExtra(Intent.EXTRA_SIM_LOCKED_REASON); - if (IccCardConstants.INTENT_VALUE_ABSENT_ON_PERM_DISABLED.equals( + if (Intent.SIM_ABSENT_ON_PERM_DISABLED.equals( absentReason)) { state = TelephonyManager.SIM_STATE_PERM_DISABLED; } else { state = TelephonyManager.SIM_STATE_ABSENT; } - } else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) { + } else if (Intent.SIM_STATE_READY.equals(stateExtra)) { state = TelephonyManager.SIM_STATE_READY; - } else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) { + } else if (Intent.SIM_STATE_LOCKED.equals(stateExtra)) { final String lockedReason = intent - .getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON); - if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { + .getStringExtra(Intent.EXTRA_SIM_LOCKED_REASON); + if (Intent.SIM_LOCKED_ON_PIN.equals(lockedReason)) { state = TelephonyManager.SIM_STATE_PIN_REQUIRED; - } else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { + } else if (Intent.SIM_LOCKED_ON_PUK.equals(lockedReason)) { state = TelephonyManager.SIM_STATE_PUK_REQUIRED; } else { state = TelephonyManager.SIM_STATE_UNKNOWN; } - } else if (IccCardConstants.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) { + } else if (Intent.SIM_LOCKED_NETWORK.equals(stateExtra)) { state = TelephonyManager.SIM_STATE_NETWORK_LOCKED; - } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) { + } else if (Intent.SIM_STATE_CARD_IO_ERROR.equals(stateExtra)) { state = TelephonyManager.SIM_STATE_CARD_IO_ERROR; - } else if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra) - || IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)) { + } else if (Intent.SIM_STATE_LOADED.equals(stateExtra) + || Intent.SIM_STATE_IMSI.equals(stateExtra)) { // This is required because telephony doesn't return to "READY" after // these state transitions. See bug 7197471. state = TelephonyManager.SIM_STATE_READY; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index 3ee5d3138fb2..2f39c138bce1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -37,7 +37,6 @@ import android.telephony.TelephonyManager; import android.text.format.DateFormat; import android.util.Log; -import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.systemui.Dependency; import com.android.systemui.R; @@ -289,21 +288,21 @@ public class PhoneStatusBarPolicy } private final void updateSimState(Intent intent) { - String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); - if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) { + String stateExtra = intent.getStringExtra(Intent.EXTRA_SIM_STATE); + if (Intent.SIM_STATE_ABSENT.equals(stateExtra)) { mSimState = TelephonyManager.SIM_STATE_READY; - } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) { + } else if (Intent.SIM_STATE_CARD_IO_ERROR.equals(stateExtra)) { mSimState = TelephonyManager.SIM_STATE_CARD_IO_ERROR; - } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_RESTRICTED.equals(stateExtra)) { + } else if (Intent.SIM_STATE_CARD_RESTRICTED.equals(stateExtra)) { mSimState = TelephonyManager.SIM_STATE_CARD_RESTRICTED; - } else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) { + } else if (Intent.SIM_STATE_READY.equals(stateExtra)) { mSimState = TelephonyManager.SIM_STATE_READY; - } else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) { + } else if (Intent.SIM_STATE_LOCKED.equals(stateExtra)) { final String lockedReason = - intent.getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON); - if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { + intent.getStringExtra(Intent.EXTRA_SIM_LOCKED_REASON); + if (Intent.SIM_LOCKED_ON_PIN.equals(lockedReason)) { mSimState = TelephonyManager.SIM_STATE_PIN_REQUIRED; - } else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { + } else if (Intent.SIM_LOCKED_ON_PUK.equals(lockedReason)) { mSimState = TelephonyManager.SIM_STATE_PUK_REQUIRED; } else { mSimState = TelephonyManager.SIM_STATE_NETWORK_LOCKED; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 7be3e2b28489..4bf1e1c0920d 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -57,7 +57,6 @@ import android.testing.AndroidTestingRunner; import android.testing.TestableContext; import android.testing.TestableLooper; -import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.systemui.DumpController; @@ -183,8 +182,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { @Test public void testTelephonyCapable_SimState_Absent() { Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, - IccCardConstants.INTENT_VALUE_ICC_ABSENT); + intent.putExtra(Intent.EXTRA_SIM_STATE, + Intent.SIM_STATE_ABSENT); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), putPhoneInfo(intent, null, false)); mTestableLooper.processAllMessages(); @@ -194,8 +193,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { @Test public void testTelephonyCapable_SimState_CardIOError() { Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, - IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR); + intent.putExtra(Intent.EXTRA_SIM_STATE, + Intent.SIM_STATE_CARD_IO_ERROR); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext(), putPhoneInfo(intent, null, false)); mTestableLooper.processAllMessages(); @@ -221,8 +220,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { // Simulate AirplaneMode case, SERVICE_STATE - POWER_OFF, check TelephonyCapable False // Only receive ServiceState callback IN_SERVICE -> OUT_OF_SERVICE -> POWER_OFF Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE - , IccCardConstants.INTENT_VALUE_ICC_LOADED); + intent.putExtra(Intent.EXTRA_SIM_STATE + , Intent.SIM_STATE_LOADED); Bundle data = new Bundle(); ServiceState state = new ServiceState(); state.setState(ServiceState.STATE_POWER_OFF); @@ -261,8 +260,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { state.setState(ServiceState.STATE_OUT_OF_SERVICE); state.fillInNotifierBundle(data); Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE - , IccCardConstants.INTENT_VALUE_ICC_NOT_READY); + intent.putExtra(Intent.EXTRA_SIM_STATE + , Intent.SIM_STATE_NOT_READY); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext() , putPhoneInfo(intent, data, false)); mTestableLooper.processAllMessages(); @@ -276,8 +275,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { state.setState(ServiceState.STATE_OUT_OF_SERVICE); state.fillInNotifierBundle(data); Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE - , IccCardConstants.INTENT_VALUE_ICC_READY); + intent.putExtra(Intent.EXTRA_SIM_STATE + , Intent.SIM_STATE_READY); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext() , putPhoneInfo(intent, data, false)); mTestableLooper.processAllMessages(); @@ -317,8 +316,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { state.setState(ServiceState.STATE_IN_SERVICE); state.fillInNotifierBundle(data); Intent intentSimState = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intentSimState.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE - , IccCardConstants.INTENT_VALUE_ICC_LOADED); + intentSimState.putExtra(Intent.EXTRA_SIM_STATE + , Intent.SIM_STATE_LOADED); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext() , putPhoneInfo(intentSimState, data, true)); mTestableLooper.processAllMessages(); @@ -326,8 +325,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.mTelephonyCapable).isFalse(); Intent intentServiceState = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); - intentSimState.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE - , IccCardConstants.INTENT_VALUE_ICC_LOADED); + intentSimState.putExtra(Intent.EXTRA_SIM_STATE + , Intent.SIM_STATE_LOADED); mKeyguardUpdateMonitor.mBroadcastReceiver.onReceive(getContext() , putPhoneInfo(intentServiceState, data, true)); mTestableLooper.processAllMessages(); |