Merge "Adding slotId to certain Telephony broadcasts." into nyc-dev
am: 3f6e211 * commit '3f6e211d7306bb7a4d5abc01a966e06294a48988': Adding slotId to certain Telephony broadcasts. Change-Id: If4b3ca0500b43137bd33d22449fb362bdf30c1d1
This commit is contained in:
@@ -714,20 +714,24 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
handleRemoveListLocked();
|
handleRemoveListLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called only by Telecomm to communicate call state across different phone accounts. So
|
||||||
|
// there is no need to add a valid subId or slotId.
|
||||||
broadcastCallStateChanged(state, incomingNumber,
|
broadcastCallStateChanged(state, incomingNumber,
|
||||||
|
SubscriptionManager.INVALID_PHONE_INDEX,
|
||||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyCallStateForSubscriber(int subId, int state, String incomingNumber) {
|
public void notifyCallStateForPhoneId(int phoneId, int subId, int state,
|
||||||
|
String incomingNumber) {
|
||||||
if (!checkNotifyPermission("notifyCallState()")) {
|
if (!checkNotifyPermission("notifyCallState()")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("notifyCallStateForSubscriber: subId=" + subId
|
log("notifyCallStateForPhoneId: subId=" + subId
|
||||||
+ " state=" + state + " incomingNumber=" + incomingNumber);
|
+ " state=" + state + " incomingNumber=" + incomingNumber);
|
||||||
}
|
}
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
int phoneId = SubscriptionManager.getPhoneId(subId);
|
|
||||||
if (validatePhoneId(phoneId)) {
|
if (validatePhoneId(phoneId)) {
|
||||||
mCallState[phoneId] = state;
|
mCallState[phoneId] = state;
|
||||||
mCallIncomingNumber[phoneId] = incomingNumber;
|
mCallIncomingNumber[phoneId] = incomingNumber;
|
||||||
@@ -746,7 +750,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
handleRemoveListLocked();
|
handleRemoveListLocked();
|
||||||
}
|
}
|
||||||
broadcastCallStateChanged(state, incomingNumber, subId);
|
broadcastCallStateChanged(state, incomingNumber, phoneId, subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyServiceStateForPhoneId(int phoneId, int subId, ServiceState state) {
|
public void notifyServiceStateForPhoneId(int phoneId, int subId, ServiceState state) {
|
||||||
@@ -788,31 +792,27 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
handleRemoveListLocked();
|
handleRemoveListLocked();
|
||||||
}
|
}
|
||||||
broadcastServiceStateChanged(state, subId);
|
broadcastServiceStateChanged(state, phoneId, subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifySignalStrength(SignalStrength signalStrength) {
|
public void notifySignalStrengthForPhoneId(int phoneId, int subId,
|
||||||
notifySignalStrengthForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
|
SignalStrength signalStrength) {
|
||||||
signalStrength);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void notifySignalStrengthForSubscriber(int subId, SignalStrength signalStrength) {
|
|
||||||
if (!checkNotifyPermission("notifySignalStrength()")) {
|
if (!checkNotifyPermission("notifySignalStrength()")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("notifySignalStrengthForSubscriber: subId=" + subId
|
log("notifySignalStrengthForPhoneId: subId=" + subId
|
||||||
+ " signalStrength=" + signalStrength);
|
+" phoneId=" + phoneId + " signalStrength=" + signalStrength);
|
||||||
toStringLogSSC("notifySignalStrengthForSubscriber");
|
toStringLogSSC("notifySignalStrengthForPhoneId");
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
int phoneId = SubscriptionManager.getPhoneId(subId);
|
|
||||||
if (validatePhoneId(phoneId)) {
|
if (validatePhoneId(phoneId)) {
|
||||||
if (VDBG) log("notifySignalStrengthForSubscriber: valid phoneId=" + phoneId);
|
if (VDBG) log("notifySignalStrengthForPhoneId: valid phoneId=" + phoneId);
|
||||||
mSignalStrength[phoneId] = signalStrength;
|
mSignalStrength[phoneId] = signalStrength;
|
||||||
for (Record r : mRecords) {
|
for (Record r : mRecords) {
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("notifySignalStrengthForSubscriber: r=" + r + " subId=" + subId
|
log("notifySignalStrengthForPhoneId: r=" + r + " subId=" + subId
|
||||||
+ " phoneId=" + phoneId + " ss=" + signalStrength);
|
+ " phoneId=" + phoneId + " ss=" + signalStrength);
|
||||||
}
|
}
|
||||||
if (r.matchPhoneStateListenerEvent(
|
if (r.matchPhoneStateListenerEvent(
|
||||||
@@ -820,7 +820,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
idMatch(r.subId, subId, phoneId)) {
|
idMatch(r.subId, subId, phoneId)) {
|
||||||
try {
|
try {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("notifySignalStrengthForSubscriber: callback.onSsS r=" + r
|
log("notifySignalStrengthForPhoneId: callback.onSsS r=" + r
|
||||||
+ " subId=" + subId + " phoneId=" + phoneId
|
+ " subId=" + subId + " phoneId=" + phoneId
|
||||||
+ " ss=" + signalStrength);
|
+ " ss=" + signalStrength);
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
int gsmSignalStrength = signalStrength.getGsmSignalStrength();
|
int gsmSignalStrength = signalStrength.getGsmSignalStrength();
|
||||||
int ss = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
|
int ss = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("notifySignalStrengthForSubscriber: callback.onSS r=" + r
|
log("notifySignalStrengthForPhoneId: callback.onSS r=" + r
|
||||||
+ " subId=" + subId + " phoneId=" + phoneId
|
+ " subId=" + subId + " phoneId=" + phoneId
|
||||||
+ " gsmSS=" + gsmSignalStrength + " ss=" + ss);
|
+ " gsmSS=" + gsmSignalStrength + " ss=" + ss);
|
||||||
}
|
}
|
||||||
@@ -846,11 +846,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log("notifySignalStrengthForSubscriber: invalid phoneId=" + phoneId);
|
log("notifySignalStrengthForPhoneId: invalid phoneId=" + phoneId);
|
||||||
}
|
}
|
||||||
handleRemoveListLocked();
|
handleRemoveListLocked();
|
||||||
}
|
}
|
||||||
broadcastSignalStrengthChanged(signalStrength, subId);
|
broadcastSignalStrengthChanged(signalStrength, phoneId, subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1347,7 +1347,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
// the legacy intent broadcasting
|
// the legacy intent broadcasting
|
||||||
//
|
//
|
||||||
|
|
||||||
private void broadcastServiceStateChanged(ServiceState state, int subId) {
|
private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) {
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mBatteryStats.notePhoneState(state.getState());
|
mBatteryStats.notePhoneState(state.getState());
|
||||||
@@ -1363,10 +1363,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
intent.putExtras(data);
|
intent.putExtras(data);
|
||||||
// Pass the subscription along with the intent.
|
// Pass the subscription along with the intent.
|
||||||
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
|
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
|
||||||
|
intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
|
||||||
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
|
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastSignalStrengthChanged(SignalStrength signalStrength, int subId) {
|
private void broadcastSignalStrengthChanged(SignalStrength signalStrength, int phoneId,
|
||||||
|
int subId) {
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mBatteryStats.notePhoneSignalStrength(signalStrength);
|
mBatteryStats.notePhoneSignalStrength(signalStrength);
|
||||||
@@ -1382,6 +1384,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
signalStrength.fillInNotifierBundle(data);
|
signalStrength.fillInNotifierBundle(data);
|
||||||
intent.putExtras(data);
|
intent.putExtras(data);
|
||||||
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
|
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
|
||||||
|
intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
|
||||||
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
|
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,7 +1394,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
* can be {@code SubscriptionManager.INVALID_SUBSCRIPTION_ID}, in which case we send
|
* can be {@code SubscriptionManager.INVALID_SUBSCRIPTION_ID}, in which case we send
|
||||||
* a global state change broadcast ({@code TelephonyManager.ACTION_PHONE_STATE_CHANGED}).
|
* a global state change broadcast ({@code TelephonyManager.ACTION_PHONE_STATE_CHANGED}).
|
||||||
*/
|
*/
|
||||||
private void broadcastCallStateChanged(int state, String incomingNumber, int subId) {
|
private void broadcastCallStateChanged(int state, String incomingNumber, int phoneId,
|
||||||
|
int subId) {
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
if (state == TelephonyManager.CALL_STATE_IDLE) {
|
if (state == TelephonyManager.CALL_STATE_IDLE) {
|
||||||
@@ -1418,6 +1422,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
intent.setAction(PhoneConstants.ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED);
|
intent.setAction(PhoneConstants.ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED);
|
||||||
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
|
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, 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);
|
||||||
|
}
|
||||||
|
|
||||||
// Send broadcast twice, once for apps that have PRIVILEGED permission and once for those
|
// Send broadcast twice, once for apps that have PRIVILEGED permission and once for those
|
||||||
// that have the runtime one
|
// that have the runtime one
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ interface ITelephonyRegistry {
|
|||||||
void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
|
void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
|
||||||
boolean notifyNow);
|
boolean notifyNow);
|
||||||
void notifyCallState(int state, String incomingNumber);
|
void notifyCallState(int state, String incomingNumber);
|
||||||
void notifyCallStateForSubscriber(in int subId, int state, String incomingNumber);
|
void notifyCallStateForPhoneId(in int phoneId, in int subId, int state, String incomingNumber);
|
||||||
void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
|
void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
|
||||||
void notifySignalStrength(in SignalStrength signalStrength);
|
void notifySignalStrengthForPhoneId(in int phoneId, in int subId,
|
||||||
void notifySignalStrengthForSubscriber(in int subId, in SignalStrength signalStrength);
|
in SignalStrength signalStrength);
|
||||||
void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi);
|
void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi);
|
||||||
void notifyCallForwardingChanged(boolean cfi);
|
void notifyCallForwardingChanged(boolean cfi);
|
||||||
void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
|
void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
|
||||||
|
|||||||
Reference in New Issue
Block a user