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

Commit 6363e181 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "If pinned stack is focused, look for the one below for logging."

parents e502924e caae14e4
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;

import android.app.ActivityManager.StackId;
import android.content.Context;
@@ -49,13 +50,16 @@ class ActivityMetricsLogger {
        }
        mLastLogTimeSecs = now;

        mWindowState = WINDOW_STATE_INVALID;
        ActivityStack stack = mSupervisor.getStack(DOCKED_STACK_ID);
        if (stack != null && stack.isStackVisibleLocked()) {
            mWindowState = WINDOW_STATE_SIDE_BY_SIDE;
            return;
        }
        if (mWindowState == WINDOW_STATE_INVALID) {
        mWindowState = WINDOW_STATE_INVALID;
        stack = mSupervisor.getFocusedStack();
        if (stack.mStackId == PINNED_STACK_ID) {
            stack = mSupervisor.findStackBehind(stack);
        }
        if (stack.mStackId == HOME_STACK_ID
                || stack.mStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
            mWindowState = WINDOW_STATE_STANDARD;
@@ -69,4 +73,3 @@ class ActivityMetricsLogger {
        }
    }
}
}
+15 −0
Original line number Diff line number Diff line
@@ -5299,4 +5299,19 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }
    }

    ActivityStack findStackBehind(ActivityStack stack) {
        // TODO(multi-display): We are only looking for stacks on the default display.
        final ActivityDisplay display = mActivityDisplays.get(Display.DEFAULT_DISPLAY);
        if (display == null) {
            return null;
        }
        final ArrayList<ActivityStack> stacks = display.mStacks;
        for (int i = stacks.size() - 1; i >= 0; i--) {
            if (stacks.get(i) == stack && i > 0) {
                return stacks.get(i - 1);
            }
        }
        throw new IllegalStateException("Failed to find a stack behind stack=" + stack
                + " in=" + stacks);
    }
}