Notifies ServiceState changes to the observer for UserAll.
The ServiceStateProvider notified to User0, USER_SYSTEM, However,
the ServiceState change was not notified to registered content
observers with other users.
Bug: 330220829
Test: atest android.telephonyprovider.cts.ServiceStateTest
in cf_x86_64_tablet_hsum-trunk_staging-userdebug
Test: atest ServiceStateProviderTest
Change-Id: I7c76cc18a905131b44b902cbb27c55a7f4192029
diff --git a/src/com/android/phone/ServiceStateProvider.java b/src/com/android/phone/ServiceStateProvider.java
index 3fa1e58..894d1c7 100644
--- a/src/com/android/phone/ServiceStateProvider.java
+++ b/src/com/android/phone/ServiceStateProvider.java
@@ -41,6 +41,7 @@
import android.os.Binder;
import android.os.Build;
import android.os.Parcel;
+import android.os.UserHandle;
import android.telephony.LocationAccessPolicy;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
@@ -577,27 +578,31 @@
ServiceState newSS, int subId) {
final boolean firstUpdate = (oldSS == null) ? true : false;
- // for every field, if the field has changed values, notify via the provider
+ // For every field, if the field has changed values, notify via the provider to all users
if (firstUpdate || voiceRegStateChanged(oldSS, newSS)) {
context.getContentResolver().notifyChange(
getUriForSubscriptionIdAndField(subId, VOICE_REG_STATE),
- /* observer= */ null, /* syncToNetwork= */ false);
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
if (firstUpdate || dataRegStateChanged(oldSS, newSS)) {
context.getContentResolver().notifyChange(
- getUriForSubscriptionIdAndField(subId, DATA_REG_STATE), null, false);
+ getUriForSubscriptionIdAndField(subId, DATA_REG_STATE),
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
if (firstUpdate || voiceRoamingTypeChanged(oldSS, newSS)) {
context.getContentResolver().notifyChange(
- getUriForSubscriptionIdAndField(subId, VOICE_ROAMING_TYPE), null, false);
+ getUriForSubscriptionIdAndField(subId, VOICE_ROAMING_TYPE),
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
if (firstUpdate || dataRoamingTypeChanged(oldSS, newSS)) {
context.getContentResolver().notifyChange(
- getUriForSubscriptionIdAndField(subId, DATA_ROAMING_TYPE), null, false);
+ getUriForSubscriptionIdAndField(subId, DATA_ROAMING_TYPE),
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
if (firstUpdate || dataNetworkTypeChanged(oldSS, newSS)) {
context.getContentResolver().notifyChange(
- getUriForSubscriptionIdAndField(subId, DATA_NETWORK_TYPE), null, false);
+ getUriForSubscriptionIdAndField(subId, DATA_NETWORK_TYPE),
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
}
@@ -635,14 +640,15 @@
@VisibleForTesting
public static void notifyChangeForSubId(Context context, ServiceState oldSS, ServiceState newSS,
int subId) {
- // if the voice or data registration or roaming state field has changed values, notify via
- // the provider.
+ // If the voice or data registration or roaming state field has changed values, notify via
+ // the provider to all users.
// If oldSS is null and newSS is not (e.g. first update of service state) this will also
- // notify
+ // notify to all users.
if (oldSS == null || voiceRegStateChanged(oldSS, newSS) || dataRegStateChanged(oldSS, newSS)
|| voiceRoamingTypeChanged(oldSS, newSS) || dataRoamingTypeChanged(oldSS, newSS)
|| dataNetworkTypeChanged(oldSS, newSS)) {
- context.getContentResolver().notifyChange(getUriForSubscriptionId(subId), null, false);
+ context.getContentResolver().notifyChange(getUriForSubscriptionId(subId),
+ /* observer= */ null, /* syncToNetwork= */ false, UserHandle.USER_ALL);
}
}