Revert "Replace Context#sendStickyBroadcastAsUser()"

This reverts commit e2664cb6ce.

Reason for revert: DroidMonitor: Potential culprit for Bug http://b/178367782 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I7fd74bf481febf1cba8b6c8fbf01c4908f847606
This commit is contained in:
Will Osborn
2021-01-25 14:34:30 +00:00
parent e2664cb6ce
commit d930f01c14

View File

@@ -314,8 +314,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
private boolean mRestrictBackground;
private final Context mContext;
// The Context is created for UserHandle.ALL.
private final Context mUserAllContext;
private final Dependencies mDeps;
// 0 is full bad, 100 is full good
private int mDefaultInetConditionPublished = 0;
@@ -1090,8 +1088,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
intentFilter.addAction(Intent.ACTION_USER_REMOVED);
intentFilter.addAction(Intent.ACTION_USER_UNLOCKED);
mUserAllContext = mContext.createContextAsUser(UserHandle.ALL, 0 /* flags */);
mUserAllContext.registerReceiver(
final Context userAllContext = mContext.createContextAsUser(UserHandle.ALL, 0 /* flags */);
userAllContext.registerReceiver(
mIntentReceiver,
intentFilter,
null /* broadcastPermission */,
@@ -1107,7 +1105,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
intentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intentFilter.addDataScheme("package");
mUserAllContext.registerReceiver(
userAllContext.registerReceiver(
mIntentReceiver,
intentFilter,
null /* broadcastPermission */,
@@ -1116,7 +1114,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
// Listen to lockdown VPN reset.
intentFilter = new IntentFilter();
intentFilter.addAction(LockdownVpnTracker.ACTION_LOCKDOWN_RESET);
mUserAllContext.registerReceiver(
userAllContext.registerReceiver(
mIntentReceiver, intentFilter, NETWORK_STACK, mHandler);
try {
@@ -2322,7 +2320,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
intent.addFlags(Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
}
try {
mUserAllContext.sendStickyBroadcast(intent, options);
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL, options);
} finally {
Binder.restoreCallingIdentity(ident);
}