[pm] skip sending PACKAGE_CHANGED broadcast if package has been deleted
ag/15926042 introduced a regression when the broadcast could still be sent if the package has been deleted. It's unlikely that this caused b/231318806 (where the broadcast has already been sent out before the package was deleted), but this still needs to be fixed. + Also remove an unnessary handler.post() because it is already inside the post. BUG: 233612768 Test: presubmit Change-Id: I25d906575a61d051df87a8985a5bb754642cc92b
This commit is contained in:
@@ -3951,6 +3951,11 @@ public class PackageManagerService implements PackageSender, TestUtilityService
|
||||
|
||||
void sendPackageChangedBroadcast(@NonNull Computer snapshot, String packageName,
|
||||
boolean dontKillApp, ArrayList<String> componentNames, int packageUid, String reason) {
|
||||
PackageStateInternal setting = snapshot.getPackageStateInternal(packageName,
|
||||
Process.SYSTEM_UID);
|
||||
if (setting == null) {
|
||||
return;
|
||||
}
|
||||
final int userId = UserHandle.getUserId(packageUid);
|
||||
final boolean isInstantApp =
|
||||
snapshot.isInstantAppInternal(packageName, userId, Process.SYSTEM_UID);
|
||||
|
||||
@@ -680,9 +680,9 @@ public final class SuspendPackageHelper {
|
||||
} else {
|
||||
intentExtras = null;
|
||||
}
|
||||
handler.post(() -> mBroadcastHelper.doSendBroadcast(action, null, intentExtras,
|
||||
mBroadcastHelper.doSendBroadcast(action, null, intentExtras,
|
||||
Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, packageName, null,
|
||||
targetUserIds, false, null, null));
|
||||
targetUserIds, false, null, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user