Merge "am compat reset --no-kill shouldn't kill the process" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-08 16:34:41 +00:00
committed by Android (Google) Code Review
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