From bdaf16e72aedf06f007c1a8b288c68ee470277d1 Mon Sep 17 00:00:00 2001 From: Marco Ballesio Date: Thu, 23 Jan 2020 13:57:00 -0800 Subject: Add support for freezing cached apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Freeze apps when cached and unfreeze them once removed from the cache or killed. Frozen apps will not use any CPU cycles, reducing power consumption for misbehaving processes which might attempt to run while cached. Change-Id: Ib055352062825db62927015c33ee0a285aa4630c Depends-On: pa/1495867, ag/9976279, ag/9981529, ag/9987868¬ Bug: 143308662 Test: manual, atest CachedAppOptimizerTest --- core/java/android/os/Process.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/java/android/os/Process.java') diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index c7a8474c8038..0f11d48b595a 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -855,6 +855,17 @@ public class Process { public static final native void setProcessGroup(int pid, int group) throws IllegalArgumentException, SecurityException; + /** + * Freeze or unfreeze the specified process. + * + * @param pid Identifier of the process to freeze or unfreeze. + * @param uid Identifier of the user the process is running under. + * @param frozen Specify whether to free (true) or unfreeze (false). + * + * @hide + */ + public static final native void setProcessFrozen(int pid, int uid, boolean frozen); + /** * Return the scheduling group of requested process. * -- cgit v1.2.3