Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 045951b1 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Wire test API to reset the state of AppErrors

Bug: 159443507
Test: Built and flashed onto local adt-3 device
Test: Ran tests from ag/12034683
Test: Attempted to execute resetAppErrors via
  adb shell service call activity 219
Change-Id: I3723d9aae18679b4292c6efb8549563063d64b98
parent 729a220f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -82,6 +82,7 @@ package android.app {
    method public static boolean isHighEndGfx();
    method public static boolean isHighEndGfx();
    method @RequiresPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) public void killProcessesWhenImperceptible(@NonNull int[], @NonNull String);
    method @RequiresPermission(android.Manifest.permission.FORCE_STOP_PACKAGES) public void killProcessesWhenImperceptible(@NonNull int[], @NonNull String);
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
    method @RequiresPermission(android.Manifest.permission.RESET_APP_ERRORS) public void resetAppErrors();
    method public static void resumeAppSwitches() throws android.os.RemoteException;
    method public static void resumeAppSwitches() throws android.os.RemoteException;
    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
    method @RequiresPermission("android.permission.MANAGE_USERS") public boolean switchUser(@NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.MANAGE_USERS") public boolean switchUser(@NonNull android.os.UserHandle);
+15 −0
Original line number Original line Diff line number Diff line
@@ -4941,4 +4941,19 @@ public class ActivityManager {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
    }
    }

    /**
     * Resets the state of the {@link com.android.server.am.AppErrors} instance.
     * This is intended for use with CTS only.
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.RESET_APP_ERRORS)
    public void resetAppErrors() {
        try {
            getService().resetAppErrors();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -686,4 +686,11 @@ interface IActivityManager {
     * Kills uid with the reason of permission change.
     * Kills uid with the reason of permission change.
     */
     */
    void killUidForPermissionChange(int appId, int userId, String reason);
    void killUidForPermissionChange(int appId, int userId, String reason);

    /**
     * Resets the state of the {@link com.android.server.am.AppErrors} instance.
     * This is intended for testing within the CTS only and is protected by
     * android.permission.RESET_APP_ERRORS.
     */
    void resetAppErrors();
}
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -58,4 +58,8 @@ public class ProcessMap<E> {
    public int size() {
    public int size() {
        return mMap.size();
        return mMap.size();
    }
    }

    public void clear() {
        mMap.clear();
    }
}
}
+13 −0
Original line number Original line Diff line number Diff line
@@ -20517,4 +20517,17 @@ public class ActivityManagerService extends IActivityManager.Stub
            Binder.restoreCallingIdentity(token);
            Binder.restoreCallingIdentity(token);
        }
        }
    }
    }
    /**
     * Resets the state of the {@link com.android.server.am.AppErrors} instance.
     * This is intended for testing within the CTS only and is protected by
     * android.permission.RESET_APP_ERRORS.
     */
    @Override
    public void resetAppErrors() {
        enforceCallingPermission(Manifest.permission.RESET_APP_ERRORS, "resetAppErrors");
        synchronized (this) {
            mAppErrors.resetStateLocked();
        }
    }
}
}
Loading