OSDN Git Service

using the correct intent extra for subId
authorchen xu <fionaxu@google.com>
Fri, 28 Sep 2018 22:53:43 +0000 (15:53 -0700)
committerchen xu <fionaxu@google.com>
Mon, 1 Oct 2018 21:44:19 +0000 (14:44 -0700)
Some telephony subscription related intent uses hidden extra
PhoneConstants.SUBSCRIPTION_KEY. We should sent the public extra
SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX instead.

Bug: 116754807
Test: telephony unit test
Change-Id: I842df9b3fa7c0c8efed2db6ac5cd6a8c34ab3ee4

services/core/java/com/android/server/TelephonyRegistry.java
telephony/java/com/android/internal/telephony/PhoneConstants.java

index 0955bed..0f9fe83 100644 (file)
@@ -1644,6 +1644,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
         intent.putExtras(data);
         // Pass the subscription along with the intent.
         intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
+        intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId);
         intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
         mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
     }
@@ -1698,6 +1699,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
         if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
             intent.setAction(PhoneConstants.ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED);
             intent.putExtra(PhoneConstants.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) {
index f9de776..21f3b92 100644 (file)
@@ -176,6 +176,10 @@ public class PhoneConstants {
 
     // 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 ...?
+    /**
+     * @Deprecated use {@link android.telephony.SubscriptionManager#EXTRA_SUBSCRIPTION_INDEX}
+     * instead.
+     */
     public static final String SUBSCRIPTION_KEY  = "subscription";
 
     public static final String SUB_SETTING  = "subSettings";