Loading core/java/android/app/ActivityManagerInternal.java +12 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.IBinder; import android.os.SystemClock; import android.service.voice.IVoiceInteractionSession; import android.util.SparseIntArray; import android.view.RemoteAnimationAdapter; import com.android.internal.app.IVoiceInteractor; Loading Loading @@ -263,6 +264,17 @@ public abstract class ActivityManagerInternal { */ public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi); /** * Sets if the given pid is currently running a remote animation, which is taken a signal for * determining oom adjustment and scheduling behavior. * * @param pid The pid we are setting overlay UI for. * @param runningRemoteAnimation True if the process is running a remote animation, false * otherwise. * @see RemoteAnimationAdapter */ public abstract void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation); /** * Called after the network policy rules are updated by * {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} and Loading core/java/android/view/RemoteAnimationAdapter.java +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class RemoteAnimationAdapter implements Parcelable { private final long mDuration; private final long mStatusBarTransitionDelay; /** @see #getCallingPid */ private int mCallingPid; /** * @param runner The interface that gets notified when we actually need to start the animation. * @param duration The duration of the animation. Loading Loading @@ -83,6 +86,20 @@ public class RemoteAnimationAdapter implements Parcelable { return mStatusBarTransitionDelay; } /** * To be called by system_server to keep track which pid is running this animation. */ public void setCallingPid(int pid) { mCallingPid = pid; } /** * @return The pid of the process running the animation. */ public int getCallingPid() { return mCallingPid; } @Override public int describeContents() { return 0; Loading core/java/android/view/RemoteAnimationDefinition.java +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ public class RemoteAnimationDefinition implements Parcelable { mTransitionAnimationMap = in.readSparseArray(null /* loader */); } /** * To be called by system_server to keep track which pid is running the remote animations inside * this definition. */ public void setCallingPid(int pid) { for (int i = mTransitionAnimationMap.size() - 1; i >= 0; i--) { mTransitionAnimationMap.valueAt(i).setCallingPid(pid); } } @Override public int describeContents() { return 0; Loading services/core/java/com/android/server/am/ActivityManagerService.java +42 −3 Original line number Diff line number Diff line Loading @@ -5140,6 +5140,7 @@ public class ActivityManagerService extends IActivityManager.Stub public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver, IRecentsAnimationRunner recentsAnimationRunner) { enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "startRecentsActivity()"); final int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (this) { Loading @@ -5165,7 +5166,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Start a new recents animation final RecentsAnimation anim = new RecentsAnimation(this, mStackSupervisor, mActivityStartController, mWindowManager, mUserController); mActivityStartController, mWindowManager, mUserController, callingPid); anim.startRecentsActivity(intent, recentsAnimationRunner, recentsComponent, recentsUid); } Loading Loading @@ -14309,6 +14310,28 @@ public class ActivityManagerService extends IActivityManager.Stub } } void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) { synchronized (ActivityManagerService.this) { final ProcessRecord pr; synchronized (mPidsSelfLocked) { pr = mPidsSelfLocked.get(pid); if (pr == null) { Slog.w(TAG, "setRunningRemoteAnimation called on unknown pid: " + pid); return; } } if (pr.runningRemoteAnimation == runningRemoteAnimation) { return; } pr.runningRemoteAnimation = runningRemoteAnimation; if (DEBUG_OOM_ADJ) { Slog.i(TAG, "Setting runningRemoteAnimation=" + pr.runningRemoteAnimation + " for pid=" + pid); } updateOomAdjLocked(pr, true); } } public final void enterSafeMode() { synchronized(this) { // It only makes sense to do this before the system is ready Loading Loading @@ -22686,6 +22709,12 @@ public class ActivityManagerService extends IActivityManager.Stub foregroundActivities = true; procState = PROCESS_STATE_CUR_TOP; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making top: " + app); } else if (app.runningRemoteAnimation) { adj = ProcessList.VISIBLE_APP_ADJ; schedGroup = ProcessList.SCHED_GROUP_TOP_APP; app.adjType = "running-remote-anim"; procState = PROCESS_STATE_CUR_TOP; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making running remote anim: " + app); } else if (app.instr != null) { // Don't want to kill running instrumentation. adj = ProcessList.FOREGROUND_APP_ADJ; Loading Loading @@ -22761,7 +22790,9 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "vis-activity"; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to vis-activity: " + app); } if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) { schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } app.cached = false; app.empty = false; foregroundActivities = true; Loading @@ -22784,7 +22815,9 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "pause-activity"; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to pause-activity: " + app); } if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) { schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } app.cached = false; app.empty = false; foregroundActivities = true; Loading Loading @@ -25925,6 +25958,11 @@ public class ActivityManagerService extends IActivityManager.Stub } } @Override public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) { ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation); } /** * Called after the network policy rules are updated by * {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} Loading Loading @@ -26470,6 +26508,7 @@ public class ActivityManagerService extends IActivityManager.Stub throws RemoteException { enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS, "registerRemoteAnimations"); definition.setCallingPid(Binder.getCallingPid()); synchronized (this) { final ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) { services/core/java/com/android/server/am/ProcessRecord.java +9 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,12 @@ final class ProcessRecord { // When true the process will oom adj score will be set to // ProcessList#PERCEPTIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean runningRemoteAnimation; // Is the process currently running a RemoteAnimation? When true // the process will be set to use the // ProcessList#SCHED_GROUP_TOP_APP scheduling group to boost // performance, as well as oom adj score will be set to // ProcessList#VISIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean pendingUiClean; // Want to clean up resources from showing UI? boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY Loading Loading @@ -336,9 +342,10 @@ final class ProcessRecord { pw.print(" hasAboveClient="); pw.print(hasAboveClient); pw.print(" treatLikeActivity="); pw.println(treatLikeActivity); } if (hasTopUi || hasOverlayUi) { if (hasTopUi || hasOverlayUi || runningRemoteAnimation) { pw.print(prefix); pw.print("hasTopUi="); pw.print(hasTopUi); pw.print(" hasOverlayUi="); pw.println(hasOverlayUi); pw.print(" hasOverlayUi="); pw.print(hasOverlayUi); pw.print(" runningRemoteAnimation="); pw.println(runningRemoteAnimation); } if (foregroundServices || forcingToImportant != null) { pw.print(prefix); pw.print("foregroundServices="); pw.print(foregroundServices); Loading Loading
core/java/android/app/ActivityManagerInternal.java +12 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.IBinder; import android.os.SystemClock; import android.service.voice.IVoiceInteractionSession; import android.util.SparseIntArray; import android.view.RemoteAnimationAdapter; import com.android.internal.app.IVoiceInteractor; Loading Loading @@ -263,6 +264,17 @@ public abstract class ActivityManagerInternal { */ public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi); /** * Sets if the given pid is currently running a remote animation, which is taken a signal for * determining oom adjustment and scheduling behavior. * * @param pid The pid we are setting overlay UI for. * @param runningRemoteAnimation True if the process is running a remote animation, false * otherwise. * @see RemoteAnimationAdapter */ public abstract void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation); /** * Called after the network policy rules are updated by * {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} and Loading
core/java/android/view/RemoteAnimationAdapter.java +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class RemoteAnimationAdapter implements Parcelable { private final long mDuration; private final long mStatusBarTransitionDelay; /** @see #getCallingPid */ private int mCallingPid; /** * @param runner The interface that gets notified when we actually need to start the animation. * @param duration The duration of the animation. Loading Loading @@ -83,6 +86,20 @@ public class RemoteAnimationAdapter implements Parcelable { return mStatusBarTransitionDelay; } /** * To be called by system_server to keep track which pid is running this animation. */ public void setCallingPid(int pid) { mCallingPid = pid; } /** * @return The pid of the process running the animation. */ public int getCallingPid() { return mCallingPid; } @Override public int describeContents() { return 0; Loading
core/java/android/view/RemoteAnimationDefinition.java +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,16 @@ public class RemoteAnimationDefinition implements Parcelable { mTransitionAnimationMap = in.readSparseArray(null /* loader */); } /** * To be called by system_server to keep track which pid is running the remote animations inside * this definition. */ public void setCallingPid(int pid) { for (int i = mTransitionAnimationMap.size() - 1; i >= 0; i--) { mTransitionAnimationMap.valueAt(i).setCallingPid(pid); } } @Override public int describeContents() { return 0; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +42 −3 Original line number Diff line number Diff line Loading @@ -5140,6 +5140,7 @@ public class ActivityManagerService extends IActivityManager.Stub public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver, IRecentsAnimationRunner recentsAnimationRunner) { enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "startRecentsActivity()"); final int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity(); try { synchronized (this) { Loading @@ -5165,7 +5166,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Start a new recents animation final RecentsAnimation anim = new RecentsAnimation(this, mStackSupervisor, mActivityStartController, mWindowManager, mUserController); mActivityStartController, mWindowManager, mUserController, callingPid); anim.startRecentsActivity(intent, recentsAnimationRunner, recentsComponent, recentsUid); } Loading Loading @@ -14309,6 +14310,28 @@ public class ActivityManagerService extends IActivityManager.Stub } } void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) { synchronized (ActivityManagerService.this) { final ProcessRecord pr; synchronized (mPidsSelfLocked) { pr = mPidsSelfLocked.get(pid); if (pr == null) { Slog.w(TAG, "setRunningRemoteAnimation called on unknown pid: " + pid); return; } } if (pr.runningRemoteAnimation == runningRemoteAnimation) { return; } pr.runningRemoteAnimation = runningRemoteAnimation; if (DEBUG_OOM_ADJ) { Slog.i(TAG, "Setting runningRemoteAnimation=" + pr.runningRemoteAnimation + " for pid=" + pid); } updateOomAdjLocked(pr, true); } } public final void enterSafeMode() { synchronized(this) { // It only makes sense to do this before the system is ready Loading Loading @@ -22686,6 +22709,12 @@ public class ActivityManagerService extends IActivityManager.Stub foregroundActivities = true; procState = PROCESS_STATE_CUR_TOP; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making top: " + app); } else if (app.runningRemoteAnimation) { adj = ProcessList.VISIBLE_APP_ADJ; schedGroup = ProcessList.SCHED_GROUP_TOP_APP; app.adjType = "running-remote-anim"; procState = PROCESS_STATE_CUR_TOP; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making running remote anim: " + app); } else if (app.instr != null) { // Don't want to kill running instrumentation. adj = ProcessList.FOREGROUND_APP_ADJ; Loading Loading @@ -22761,7 +22790,9 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "vis-activity"; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to vis-activity: " + app); } if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) { schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } app.cached = false; app.empty = false; foregroundActivities = true; Loading @@ -22784,7 +22815,9 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "pause-activity"; if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to pause-activity: " + app); } if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) { schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } app.cached = false; app.empty = false; foregroundActivities = true; Loading Loading @@ -25925,6 +25958,11 @@ public class ActivityManagerService extends IActivityManager.Stub } } @Override public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) { ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation); } /** * Called after the network policy rules are updated by * {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} Loading Loading @@ -26470,6 +26508,7 @@ public class ActivityManagerService extends IActivityManager.Stub throws RemoteException { enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS, "registerRemoteAnimations"); definition.setCallingPid(Binder.getCallingPid()); synchronized (this) { final ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) {
services/core/java/com/android/server/am/ProcessRecord.java +9 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,12 @@ final class ProcessRecord { // When true the process will oom adj score will be set to // ProcessList#PERCEPTIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean runningRemoteAnimation; // Is the process currently running a RemoteAnimation? When true // the process will be set to use the // ProcessList#SCHED_GROUP_TOP_APP scheduling group to boost // performance, as well as oom adj score will be set to // ProcessList#VISIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean pendingUiClean; // Want to clean up resources from showing UI? boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY Loading Loading @@ -336,9 +342,10 @@ final class ProcessRecord { pw.print(" hasAboveClient="); pw.print(hasAboveClient); pw.print(" treatLikeActivity="); pw.println(treatLikeActivity); } if (hasTopUi || hasOverlayUi) { if (hasTopUi || hasOverlayUi || runningRemoteAnimation) { pw.print(prefix); pw.print("hasTopUi="); pw.print(hasTopUi); pw.print(" hasOverlayUi="); pw.println(hasOverlayUi); pw.print(" hasOverlayUi="); pw.print(hasOverlayUi); pw.print(" runningRemoteAnimation="); pw.println(runningRemoteAnimation); } if (foregroundServices || forcingToImportant != null) { pw.print(prefix); pw.print("foregroundServices="); pw.print(foregroundServices); Loading