am compat reset --no-kill shouldn't kill the process

Bug: 179499460
Test: manual test with:
`adb shell am compat reset --no-kill FGS_START_EXCEPTION_CHANGE_ID com.google.android.keep`

Change-Id: I604ff9d04967082e464c721263c6c0695af22c94
This commit is contained in:
Makoto Onuki
2021-02-05 11:16:28 -08:00
parent 26737223a1
commit 4aa9369c5c
3 changed files with 11 additions and 4 deletions

View File

@@ -179,9 +179,10 @@ interface IPlatformCompat {
*
* @param changeId the ID of the change that was overridden
* @param packageName the app package name that was overridden
* @return {@code true} if an override existed
* @throws SecurityException if overriding changes is not permitted
*/
void clearOverrideForTest(long changeId, String packageName);
boolean clearOverrideForTest(long changeId, String packageName);
/**
* Enables all compatibility changes that have enabledSinceTargetSdk ==

View File

@@ -2984,7 +2984,13 @@ final class ActivityManagerShellCommand extends ShellCommand {
pw.println("Reset all changes for " + packageName + " to default value.");
return 0;
}
if (platformCompat.clearOverride(changeId, packageName)) {
boolean existed;
if (killPackage) {
existed = platformCompat.clearOverride(changeId, packageName);
} else {
existed = platformCompat.clearOverrideForTest(changeId, packageName);
}
if (existed) {
pw.println("Reset change " + changeId + " for " + packageName
+ " to default value.");
} else {

View File

@@ -211,9 +211,9 @@ public class PlatformCompat extends IPlatformCompat.Stub {
}
@Override
public void clearOverrideForTest(long changeId, String packageName) {
public boolean clearOverrideForTest(long changeId, String packageName) {
checkCompatChangeOverridePermission();
mCompatConfig.removeOverride(changeId, packageName);
return mCompatConfig.removeOverride(changeId, packageName);
}
@Override