Loading services/core/java/com/android/server/am/ActivityMetricsLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,7 @@ class ActivityMetricsLogger { return; } if (launchedActivity != null && launchedActivity.nowVisible) { if (launchedActivity != null && launchedActivity.drawn) { // Launched activity is already visible. We cannot measure windows drawn delay. reset(true /* abort */, info); return; Loading services/core/java/com/android/server/am/ActivityRecord.java +10 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo // process that it is hidden. boolean sleeping; // have we told the activity to sleep? boolean nowVisible; // is this activity's window visible? boolean drawn; // is this activity's window drawn? boolean mClientVisibilityDeferred;// was the visibility change message to client deferred? boolean idle; // has the activity gone idle? boolean hasBeenLaunched;// has this activity ever been launched? Loading Loading @@ -871,6 +872,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo inHistory = false; visible = false; nowVisible = false; drawn = false; idle = false; hasBeenLaunched = false; mStackSupervisor = supervisor; Loading Loading @@ -1999,6 +2001,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo @Override public void onWindowsDrawn(long timestamp) { synchronized (service) { drawn = true; final WindowingModeTransitionInfoSnapshot info = mStackSupervisor .getActivityMetricsLogger().notifyWindowsDrawn(getWindowingMode(), timestamp); final int windowsDrawnDelayMs = info != null ? info.windowsDrawnDelayMs : INVALID_DELAY; Loading @@ -2012,6 +2015,13 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } } @Override public void onWindowsNotDrawn(long timestamp) { synchronized (service) { drawn = false; } } @Override public void onWindowsVisible() { synchronized (service) { Loading services/core/java/com/android/server/wm/AppWindowContainerController.java +15 −2 Original line number Diff line number Diff line Loading @@ -18,9 +18,9 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; import static android.view.WindowManager.TRANSIT_UNSET; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION; Loading Loading @@ -65,6 +65,7 @@ public class AppWindowContainerController private final class H extends Handler { public static final int NOTIFY_WINDOWS_DRAWN = 1; public static final int NOTIFY_STARTING_WINDOW_DRAWN = 2; public static final int NOTIFY_WINDOWS_NOTDRAWN = 3; public H(Looper looper) { super(looper); Loading @@ -85,10 +86,18 @@ public class AppWindowContainerController if (mListener == null) { return; } if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting drawn in " if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting starting window drawn in " + AppWindowContainerController.this.mToken); mListener.onStartingWindowDrawn(msg.getWhen()); break; case NOTIFY_WINDOWS_NOTDRAWN: if (mListener == null) { return; } if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting undrawn in " + AppWindowContainerController.this.mToken); mListener.onWindowsNotDrawn(msg.getWhen()); break; default: break; } Loading Loading @@ -740,6 +749,10 @@ public class AppWindowContainerController mHandler.sendMessage(mHandler.obtainMessage(H.NOTIFY_WINDOWS_DRAWN)); } void reportWindowsNotDrawn() { mHandler.sendMessage(mHandler.obtainMessage(H.NOTIFY_WINDOWS_NOTDRAWN)); } void reportWindowsVisible() { mHandler.post(mOnWindowsVisible); } Loading services/core/java/com/android/server/wm/AppWindowContainerListener.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ package com.android.server.wm; public interface AppWindowContainerListener extends WindowContainerListener { /** Called when the windows associated app window container are drawn. */ void onWindowsDrawn(long timestamp); /** Called when the windows associated app window container are no longer drawn. */ default void onWindowsNotDrawn(long timestamp) {} /** Called when the windows associated app window container are visible. */ void onWindowsVisible(); /** Called when the windows associated app window container are no longer visible. */ Loading services/core/java/com/android/server/wm/AppWindowToken.java +4 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (controller != null) { controller.reportWindowsDrawn(); } } else { if (controller != null) { controller.reportWindowsNotDrawn(); } } reportedDrawn = nowDrawn; } Loading Loading
services/core/java/com/android/server/am/ActivityMetricsLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,7 @@ class ActivityMetricsLogger { return; } if (launchedActivity != null && launchedActivity.nowVisible) { if (launchedActivity != null && launchedActivity.drawn) { // Launched activity is already visible. We cannot measure windows drawn delay. reset(true /* abort */, info); return; Loading
services/core/java/com/android/server/am/ActivityRecord.java +10 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo // process that it is hidden. boolean sleeping; // have we told the activity to sleep? boolean nowVisible; // is this activity's window visible? boolean drawn; // is this activity's window drawn? boolean mClientVisibilityDeferred;// was the visibility change message to client deferred? boolean idle; // has the activity gone idle? boolean hasBeenLaunched;// has this activity ever been launched? Loading Loading @@ -871,6 +872,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo inHistory = false; visible = false; nowVisible = false; drawn = false; idle = false; hasBeenLaunched = false; mStackSupervisor = supervisor; Loading Loading @@ -1999,6 +2001,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo @Override public void onWindowsDrawn(long timestamp) { synchronized (service) { drawn = true; final WindowingModeTransitionInfoSnapshot info = mStackSupervisor .getActivityMetricsLogger().notifyWindowsDrawn(getWindowingMode(), timestamp); final int windowsDrawnDelayMs = info != null ? info.windowsDrawnDelayMs : INVALID_DELAY; Loading @@ -2012,6 +2015,13 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } } @Override public void onWindowsNotDrawn(long timestamp) { synchronized (service) { drawn = false; } } @Override public void onWindowsVisible() { synchronized (service) { Loading
services/core/java/com/android/server/wm/AppWindowContainerController.java +15 −2 Original line number Diff line number Diff line Loading @@ -18,9 +18,9 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.TRANSIT_DOCK_TASK_FROM_RECENTS; import static android.view.WindowManager.TRANSIT_UNSET; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION; Loading Loading @@ -65,6 +65,7 @@ public class AppWindowContainerController private final class H extends Handler { public static final int NOTIFY_WINDOWS_DRAWN = 1; public static final int NOTIFY_STARTING_WINDOW_DRAWN = 2; public static final int NOTIFY_WINDOWS_NOTDRAWN = 3; public H(Looper looper) { super(looper); Loading @@ -85,10 +86,18 @@ public class AppWindowContainerController if (mListener == null) { return; } if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting drawn in " if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting starting window drawn in " + AppWindowContainerController.this.mToken); mListener.onStartingWindowDrawn(msg.getWhen()); break; case NOTIFY_WINDOWS_NOTDRAWN: if (mListener == null) { return; } if (DEBUG_VISIBILITY) Slog.v(TAG_WM, "Reporting undrawn in " + AppWindowContainerController.this.mToken); mListener.onWindowsNotDrawn(msg.getWhen()); break; default: break; } Loading Loading @@ -740,6 +749,10 @@ public class AppWindowContainerController mHandler.sendMessage(mHandler.obtainMessage(H.NOTIFY_WINDOWS_DRAWN)); } void reportWindowsNotDrawn() { mHandler.sendMessage(mHandler.obtainMessage(H.NOTIFY_WINDOWS_NOTDRAWN)); } void reportWindowsVisible() { mHandler.post(mOnWindowsVisible); } Loading
services/core/java/com/android/server/wm/AppWindowContainerListener.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ package com.android.server.wm; public interface AppWindowContainerListener extends WindowContainerListener { /** Called when the windows associated app window container are drawn. */ void onWindowsDrawn(long timestamp); /** Called when the windows associated app window container are no longer drawn. */ default void onWindowsNotDrawn(long timestamp) {} /** Called when the windows associated app window container are visible. */ void onWindowsVisible(); /** Called when the windows associated app window container are no longer visible. */ Loading
services/core/java/com/android/server/wm/AppWindowToken.java +4 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (controller != null) { controller.reportWindowsDrawn(); } } else { if (controller != null) { controller.reportWindowsNotDrawn(); } } reportedDrawn = nowDrawn; } Loading