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

Commit b248a034 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Fix overlapping remote and recents animations" into qt-r1-dev

parents 3633c30c 589c5ba0
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -119,17 +119,6 @@ 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
+11 −2
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public class RemoteAnimationAdapter implements Parcelable {

    /** @see #getCallingPid */
    private int mCallingPid;
    private int mCallingUid;

    /**
     * @param runner The interface that gets notified when we actually need to start the animation.
@@ -103,10 +104,11 @@ public class RemoteAnimationAdapter implements Parcelable {
    }

    /**
     * To be called by system_server to keep track which pid is running this animation.
     * To be called by system_server to keep track which pid and uid is running this animation.
     */
    public void setCallingPid(int pid) {
    public void setCallingPidUid(int pid, int uid) {
        mCallingPid = pid;
        mCallingUid = uid;
    }

    /**
@@ -116,6 +118,13 @@ public class RemoteAnimationAdapter implements Parcelable {
        return mCallingPid;
    }

    /**
     * @return The uid of the process running the animation.
     */
    public int getCallingUid() {
        return mCallingUid;
    }

    @Override
    public int describeContents() {
        return 0;
+2 −2
Original line number Diff line number Diff line
@@ -118,9 +118,9 @@ public class RemoteAnimationDefinition implements Parcelable {
     * To be called by system_server to keep track which pid is running the remote animations inside
     * this definition.
     */
    public void setCallingPid(int pid) {
    public void setCallingPidUid(int pid, int uid) {
        for (int i = mTransitionAnimationMap.size() - 1; i >= 0; i--) {
            mTransitionAnimationMap.valueAt(i).adapter.setCallingPid(pid);
            mTransitionAnimationMap.valueAt(i).adapter.setCallingPidUid(pid, uid);
        }
    }

+0 −31
Original line number Diff line number Diff line
@@ -8467,32 +8467,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
        if (pid == Process.myPid()) {
            Slog.wtf(TAG, "system can't run remote animation");
            return;
        }
        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, OomAdjuster.OOM_ADJ_REASON_UI_VISIBILITY);
        }
    }
    public final void enterSafeMode() {
        synchronized(this) {
            // It only makes sense to do this before the system is ready
@@ -17970,11 +17944,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
        @Override
        public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
            ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation);
        }
        @Override
        public List<ProcessMemoryState> getMemoryStateForProcesses() {
            List<ProcessMemoryState> processMemoryStates = new ArrayList<>();
+20 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;

import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ANR;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.ActivityManagerService.MY_PID;
@@ -1348,6 +1349,25 @@ class ProcessRecord implements WindowProcessListener {
        }
    }

    @Override
    public void setRunningRemoteAnimation(boolean runningRemoteAnimation) {
        if (pid == Process.myPid()) {
            Slog.wtf(TAG, "system can't run remote animation");
            return;
        }
        synchronized (mService) {
            if (this.runningRemoteAnimation == runningRemoteAnimation) {
                return;
            }
            this.runningRemoteAnimation = runningRemoteAnimation;
            if (DEBUG_OOM_ADJ) {
                Slog.i(TAG, "Setting runningRemoteAnimation=" + runningRemoteAnimation
                        + " for pid=" + pid);
            }
            mService.updateOomAdjLocked(this, true, OomAdjuster.OOM_ADJ_REASON_UI_VISIBILITY);
        }
    }

    public long getInputDispatchingTimeout() {
        return mWindowProcessController.getInputDispatchingTimeout();
    }
Loading