Loading cmds/am/src/com/android/commands/am/Am.java +1 −2 Original line number Diff line number Diff line Loading @@ -2523,8 +2523,7 @@ public class Am extends BaseCommand { return; } if (!mAm.setProcessMemoryTrimLevel(proc, userId, level)) { System.err.println("Error: Failure to set the level - probably Unknown Process: " + proc); System.err.println("Unknown error: failed to set trim level"); } } Loading services/core/java/com/android/server/am/ActivityManagerService.java +17 −13 Original line number Diff line number Diff line Loading @@ -4068,26 +4068,30 @@ public final class ActivityManagerService extends ActivityManagerNative } @Override public boolean setProcessMemoryTrimLevel(String process, int userId, int level) { public boolean setProcessMemoryTrimLevel(String process, int userId, int level) throws RemoteException { synchronized (this) { final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel"); if (app == null) { return false; throw new IllegalArgumentException("Unknown process: " + process); } if (app.thread == null) { throw new IllegalArgumentException("Process has no app thread"); } if (app.trimMemoryLevel >= level) { throw new IllegalArgumentException( "Unable to set a higher trim level than current level"); } if (app.trimMemoryLevel < level && app.thread != null && (level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN || if (!(level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN || app.curProcState >= ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND)) { try { throw new IllegalArgumentException("Unable to set a background trim level " + "on a foreground process"); } app.thread.scheduleTrimMemory(level); app.trimMemoryLevel = level; return true; } catch (RemoteException e) { // Fallthrough to failure case. } } } return false; } private void dispatchProcessesChanged() { int N; Loading Loading
cmds/am/src/com/android/commands/am/Am.java +1 −2 Original line number Diff line number Diff line Loading @@ -2523,8 +2523,7 @@ public class Am extends BaseCommand { return; } if (!mAm.setProcessMemoryTrimLevel(proc, userId, level)) { System.err.println("Error: Failure to set the level - probably Unknown Process: " + proc); System.err.println("Unknown error: failed to set trim level"); } } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +17 −13 Original line number Diff line number Diff line Loading @@ -4068,26 +4068,30 @@ public final class ActivityManagerService extends ActivityManagerNative } @Override public boolean setProcessMemoryTrimLevel(String process, int userId, int level) { public boolean setProcessMemoryTrimLevel(String process, int userId, int level) throws RemoteException { synchronized (this) { final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel"); if (app == null) { return false; throw new IllegalArgumentException("Unknown process: " + process); } if (app.thread == null) { throw new IllegalArgumentException("Process has no app thread"); } if (app.trimMemoryLevel >= level) { throw new IllegalArgumentException( "Unable to set a higher trim level than current level"); } if (app.trimMemoryLevel < level && app.thread != null && (level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN || if (!(level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN || app.curProcState >= ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND)) { try { throw new IllegalArgumentException("Unable to set a background trim level " + "on a foreground process"); } app.thread.scheduleTrimMemory(level); app.trimMemoryLevel = level; return true; } catch (RemoteException e) { // Fallthrough to failure case. } } } return false; } private void dispatchProcessesChanged() { int N; Loading