Merge "Fixed UID mismatch in telephony registry" into udc-dev
This commit is contained in:
@@ -1672,18 +1672,20 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long callingIdentity = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
String str = "notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId
|
String str = "notifyServiceStateForSubscriber: subId=" + subId + " phoneId="
|
||||||
+ " state=" + state;
|
+ phoneId + " state=" + state;
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log(str);
|
log(str);
|
||||||
}
|
}
|
||||||
mLocalLog.log(str);
|
mLocalLog.log(str);
|
||||||
// for service state updates, don't notify clients when subId is invalid. This prevents
|
// for service state updates, don't notify clients when subId is invalid. This
|
||||||
// us from sending incorrect notifications like b/133140128
|
// prevents us from sending incorrect notifications like b/133140128
|
||||||
// In the future, we can remove this logic for every notification here and add a
|
// In the future, we can remove this logic for every notification here and add a
|
||||||
// callback so listeners know when their PhoneStateListener's subId becomes invalid, but
|
// callback so listeners know when their PhoneStateListener's subId becomes invalid,
|
||||||
// for now we use the simplest fix.
|
// but for now we use the simplest fix.
|
||||||
if (validatePhoneId(phoneId) && SubscriptionManager.isValidSubscriptionId(subId)) {
|
if (validatePhoneId(phoneId) && SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||||
mServiceState[phoneId] = state;
|
mServiceState[phoneId] = state;
|
||||||
|
|
||||||
@@ -1723,6 +1725,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
handleRemoveListLocked();
|
handleRemoveListLocked();
|
||||||
}
|
}
|
||||||
broadcastServiceStateChanged(state, phoneId, subId);
|
broadcastServiceStateChanged(state, phoneId, subId);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(callingIdentity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifySimActivationStateChangedForPhoneId(int phoneId, int subId,
|
public void notifySimActivationStateChangedForPhoneId(int phoneId, int subId,
|
||||||
@@ -3508,13 +3513,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
public static final String ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR";
|
public static final String ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR";
|
||||||
|
|
||||||
private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) {
|
private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) {
|
||||||
final long ident = Binder.clearCallingIdentity();
|
|
||||||
try {
|
try {
|
||||||
mBatteryStats.notePhoneState(state.getState());
|
mBatteryStats.notePhoneState(state.getState());
|
||||||
} catch (RemoteException re) {
|
} catch (RemoteException re) {
|
||||||
// Can't do much
|
// Can't do much
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the broadcast exactly once to all possible disjoint sets of apps.
|
// Send the broadcast exactly once to all possible disjoint sets of apps.
|
||||||
@@ -3531,8 +3533,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
// - Sanitized ServiceState sent to all other apps with READ_PHONE_STATE
|
// - Sanitized ServiceState sent to all other apps with READ_PHONE_STATE
|
||||||
// - Sanitized ServiceState sent to all other apps with READ_PRIVILEGED_PHONE_STATE but not
|
// - Sanitized ServiceState sent to all other apps with READ_PRIVILEGED_PHONE_STATE but not
|
||||||
// READ_PHONE_STATE
|
// READ_PHONE_STATE
|
||||||
if (Binder.withCleanCallingIdentity(() ->
|
if (LocationAccessPolicy.isLocationModeEnabled(mContext, mContext.getUserId())) {
|
||||||
LocationAccessPolicy.isLocationModeEnabled(mContext, mContext.getUserId()))) {
|
|
||||||
Intent fullIntent = createServiceStateIntent(state, subId, phoneId, false);
|
Intent fullIntent = createServiceStateIntent(state, subId, phoneId, false);
|
||||||
mContext.createContextAsUser(UserHandle.ALL, 0).sendBroadcastMultiplePermissions(
|
mContext.createContextAsUser(UserHandle.ALL, 0).sendBroadcastMultiplePermissions(
|
||||||
fullIntent,
|
fullIntent,
|
||||||
|
|||||||
Reference in New Issue
Block a user