[RESTRICT AUTOMERGE] Correct the behavior of ACTION_PACKAGE_DATA_CLEARED
This action should be only broadcasted when the user data is cleared
successfully. Broadcasting this action when failed case may result in
unexpected result.
Bug: 240267890
Test: manually using the PoC in the buganizer to ensure the symptom
no longer exists.
Change-Id: I478494f3c63d1a3bbaa2f5efa104ef5f7ca9e8e7
This commit is contained in:
@@ -3544,20 +3544,25 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
finishForceStopPackageLocked(packageName, appInfo.uid);
|
||||
}
|
||||
}
|
||||
final Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
|
||||
Uri.fromParts("package", packageName, null));
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
||||
intent.putExtra(Intent.EXTRA_UID, (appInfo != null) ? appInfo.uid : -1);
|
||||
intent.putExtra(Intent.EXTRA_USER_HANDLE, resolvedUserId);
|
||||
if (isInstantApp) {
|
||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
|
||||
broadcastIntentInPackage("android", null, SYSTEM_UID, uid, pid, intent,
|
||||
null, null, 0, null, null, permission.ACCESS_INSTANT_APPS, null,
|
||||
false, false, resolvedUserId, false, null);
|
||||
} else {
|
||||
broadcastIntentInPackage("android", null, SYSTEM_UID, uid, pid, intent,
|
||||
null, null, 0, null, null, null, null, false, false, resolvedUserId,
|
||||
false, null);
|
||||
|
||||
if (succeeded) {
|
||||
final Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
|
||||
Uri.fromParts("package", packageName, null /* fragment */));
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
||||
intent.putExtra(Intent.EXTRA_UID,
|
||||
(appInfo != null) ? appInfo.uid : INVALID_UID);
|
||||
intent.putExtra(Intent.EXTRA_USER_HANDLE, resolvedUserId);
|
||||
if (isInstantApp) {
|
||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
|
||||
}
|
||||
|
||||
broadcastIntentInPackage("android", null /* featureId */, SYSTEM_UID,
|
||||
uid, pid, intent, null /* resolvedType */, null /* resultTo */,
|
||||
0 /* resultCode */, null /* resultData */, null /* resultExtras */,
|
||||
isInstantApp ? permission.ACCESS_INSTANT_APPS : null,
|
||||
null /* bOptions */, false /* serialized */, false /* sticky */,
|
||||
resolvedUserId, false /* allowBackgroundActivityStarts */,
|
||||
null /* backgroundActivityStartsToken */);
|
||||
}
|
||||
|
||||
if (observer != null) {
|
||||
|
||||
Reference in New Issue
Block a user