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

Commit 940bf1fe authored by jinwoo805.lee's avatar jinwoo805.lee Committed by Xiang Wang
Browse files

BrightnessTracker: getRootTaskInfoOnDisplay

BrightnessTracker records the brightness change only on the default display. When it records its stat, it gets the top focused package and its user id.
In MUMD (Multiple Users on Multiple Displays) system, the top most focused package could be on the secondary display with a user signed on its display.
This patch fixes DisplayTracker gets the top most package and its user only on the default display when the default display brightness is changed.

Bug: 340310264
Flag: EXEMPT bugfix (localized component, does not affect phones)
Test: atest DisplayServiceTests
(cherry picked from https://partner-android-review.googlesource.com/q/commit:2e73e61b2a98742b901abe8115542dd94c79e057)
Merged-In: If5591271f0de907d665f768768959800a3caf9e3
Change-Id: If5591271f0de907d665f768768959800a3caf9e3
parent 4c895e0e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.display;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;

import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
@@ -1135,6 +1138,14 @@ public class BrightnessTracker {
        }

        public RootTaskInfo getFocusedStack() throws RemoteException {
            if (UserManager.isVisibleBackgroundUsersEnabled()) {
                // In MUMD (Multiple Users on Multiple Displays) system, the top most focused stack
                // could be on the secondary display with a user signed on its display so get the
                // root task info only on the default display.
                return ActivityTaskManager.getService().getRootTaskInfoOnDisplay(
                        WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_UNDEFINED,
                        Display.DEFAULT_DISPLAY);
            }
            return ActivityTaskManager.getService().getFocusedRootTaskInfo();
        }