diff options
| -rw-r--r-- | services/core/java/com/android/server/TelephonyRegistry.java | 30 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/PhoneConstants.java | 4 |
2 files changed, 21 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 40bde9a35e8a..48e8e964f41c 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -2185,6 +2185,16 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { // the legacy intent broadcasting // + // Legacy intent action. + /** Fired when a subscription's phone state changes. */ + private static final String ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED = + "android.intent.action.SUBSCRIPTION_PHONE_STATE"; + + // Legacy intent extra keys, copied from PhoneConstants. + // Used in legacy intents sent here, for backward compatibility. + private static final String PHONE_CONSTANTS_SLOT_KEY = "slot"; + private static final String PHONE_CONSTANTS_SUBSCRIPTION_KEY = "subscription"; + private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) { long ident = Binder.clearCallingIdentity(); try { @@ -2201,9 +2211,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { state.fillInNotifierBundle(data); intent.putExtras(data); // Pass the subscription along with the intent. - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); - intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); + intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId); + intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, phoneId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } @@ -2222,8 +2233,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { Bundle data = new Bundle(); signalStrength.fillInNotifierBundle(data); intent.putExtras(data); - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); - intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); + intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId); + intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } @@ -2258,13 +2269,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { // If a valid subId was specified, we should fire off a subId-specific state // change intent and include the subId. if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { - intent.setAction(PhoneConstants.ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED); - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + intent.setAction(ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED); + intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); } // If the phoneId is invalid, the broadcast is for overall call state. if (phoneId != SubscriptionManager.INVALID_PHONE_INDEX) { - intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); + intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId); + intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, phoneId); } // Wakeup apps for the (SUBSCRIPTION_)PHONE_STATE broadcast. @@ -2324,14 +2336,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { intent.putExtra(PhoneConstants.DATA_APN_KEY, apn); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } private void broadcastDataConnectionFailed(String apnType, int subId) { Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); - intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index e4397cdf1254..05e2ed9acb33 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -189,10 +189,6 @@ public class PhoneConstants { public static final String SLOT_KEY = "slot"; - /** Fired when a subscriptions phone state changes. */ - public static final String ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED = - "android.intent.action.SUBSCRIPTION_PHONE_STATE"; - // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is // FIXME: extensive, and see if this should be an array of all active subId's or ...? /** |