summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSharvil Nanavati <sharvil@google.com>2015-04-23 13:57:24 -0700
committerSharvil Nanavati <sharvil@google.com>2015-04-27 19:00:13 +0000
commit61a3ab090f4b1edf0cb2c4ceae585a54ab613337 (patch)
tree380e8f7a125ffbd32378c5d3409ef68fdf1c15f3
parenta5b55a017a984608eacdf414bc1cbcd7615f1c13 (diff)
downloadframeworks_base-61a3ab090f4b1edf0cb2c4ceae585a54ab613337.zip
frameworks_base-61a3ab090f4b1edf0cb2c4ceae585a54ab613337.tar.gz
frameworks_base-61a3ab090f4b1edf0cb2c4ceae585a54ab613337.tar.bz2
Use a separate intent action for subscription phone state changes.
Global phone state changes and subscription phone state changes are aliased to the same intent. As a result, apps can't distinguish between the two types of updates. This change teases the two apart by using a different intent action for each type of phone state change. This will break carrier apps that depend on subscription phone state changes, but will fix state inconsistencies in non-carrier apps. Bug: 20309009 Change-Id: Ie81c37247917573a3ef5d957fda1087c16736e85
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java17
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java4
2 files changed, 19 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 4ee6657..ac87377 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -678,7 +678,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
handleRemoveListLocked();
}
broadcastCallStateChanged(state, incomingNumber,
- SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID);
}
public void notifyCallStateForSubscriber(int subId, int state, String incomingNumber) {
@@ -1372,6 +1372,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
}
+ /**
+ * Broadcasts an intent notifying apps of a phone state change. {@code subId} can be
+ * a valid subId, in which case this function fires a subId-specific intent, or it
+ * can be {@code SubscriptionManager.INVALID_SUBSCRIPTION_ID}, in which case we send
+ * a global state change broadcast ({@code TelephonyManager.ACTION_PHONE_STATE_CHANGED}).
+ */
private void broadcastCallStateChanged(int state, String incomingNumber, int subId) {
long ident = Binder.clearCallingIdentity();
try {
@@ -1392,7 +1398,14 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (!TextUtils.isEmpty(incomingNumber)) {
intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, incomingNumber);
}
- intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
+
+ // 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);
+ }
+
mContext.sendBroadcastAsUser(intent, UserHandle.ALL,
android.Manifest.permission.READ_PHONE_STATE,
AppOpsManager.OP_READ_PHONE_STATE);
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 0ebd719..2a4032c 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -150,6 +150,10 @@ 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 ...?
public static final String SUBSCRIPTION_KEY = "subscription";