Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java +20 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Trace; import android.view.Choreographer; import androidx.annotation.Nullable; Loading Loading @@ -143,6 +144,25 @@ public abstract class WMShellConcurrencyModule { return sysuiMainExecutor; } /** * Provide a Shell main-thread {@link Choreographer} with the app vsync. * * @param executor the executor of the shell main thread */ @WMSingleton @Provides @ShellMainThread public static Choreographer provideShellMainChoreographer( @ShellMainThread ShellExecutor executor) { try { final Choreographer[] choreographer = new Choreographer[1]; executor.executeBlocking(() -> choreographer[0] = Choreographer.getInstance()); return choreographer[0]; } catch (InterruptedException e) { throw new RuntimeException("Failed to obtain main Choreographer.", e); } } /** * Provide a Shell animation-thread Executor. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.pm.LauncherApps; import android.os.Handler; import android.os.UserManager; import android.view.Choreographer; import android.view.WindowManager; import com.android.internal.jank.InteractionJankMonitor; Loading Loading @@ -173,12 +174,14 @@ public abstract class WMShellModule { static WindowDecorViewModel<?> provideWindowDecorViewModel( Context context, @ShellMainThread Handler mainHandler, @ShellMainThread Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { return new CaptionWindowDecorViewModel( context, mainHandler, mainChoreographer, taskOrganizer, displayController, syncQueue); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityTaskManager; import android.content.Context; import android.os.Handler; import android.view.Choreographer; import android.view.MotionEvent; import android.view.SurfaceControl; import android.view.View; Loading @@ -45,17 +46,20 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption private final ShellTaskOrganizer mTaskOrganizer; private final Context mContext; private final Handler mMainHandler; private final Choreographer mMainChoreographer; private final DisplayController mDisplayController; private final SyncTransactionQueue mSyncQueue; public CaptionWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { mContext = context; mMainHandler = mainHandler; mMainChoreographer = mainChoreographer; mActivityTaskManager = mContext.getSystemService(ActivityTaskManager.class); mTaskOrganizer = taskOrganizer; mDisplayController = displayController; Loading @@ -72,6 +76,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption taskInfo, taskSurface, mMainHandler, mMainChoreographer, mSyncQueue); TaskPositioner taskPositioner = new TaskPositioner(mTaskOrganizer, windowDecoration); CaptionTouchEventListener touchEventListener = Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.graphics.Rect; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.view.Choreographer; import android.view.SurfaceControl; import android.view.View; import android.window.WindowContainerTransaction; Loading Loading @@ -59,6 +60,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP); private final Handler mHandler; private final Choreographer mChoreographer; private final SyncTransactionQueue mSyncQueue; private View.OnClickListener mOnCaptionButtonClickListener; Loading @@ -77,10 +79,12 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL ActivityManager.RunningTaskInfo taskInfo, SurfaceControl taskSurface, Handler handler, Choreographer choreographer, SyncTransactionQueue syncQueue) { super(context, displayController, taskOrganizer, taskInfo, taskSurface); mHandler = handler; mChoreographer = choreographer; mSyncQueue = syncQueue; } Loading Loading @@ -138,6 +142,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL mDragResizeListener = new DragResizeInputListener( mContext, mHandler, mChoreographer, mDisplay.getDisplayId(), mDecorationContainerSurface, mDragResizeCallback); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +8 −7 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ class DragResizeInputListener implements AutoCloseable { private final IWindowSession mWindowSession = WindowManagerGlobal.getWindowSession(); private final Handler mHandler; private final Choreographer mChoreographer; private final InputManager mInputManager; private final int mDisplayId; Loading @@ -68,11 +69,13 @@ class DragResizeInputListener implements AutoCloseable { DragResizeInputListener( Context context, Handler handler, Choreographer choreographer, int displayId, SurfaceControl decorationSurface, DragResizeCallback callback) { mInputManager = context.getSystemService(InputManager.class); mHandler = handler; mChoreographer = choreographer; mDisplayId = displayId; mDecorationSurface = decorationSurface; // Use a fake window as the backing surface is a container layer and we don't want to create Loading @@ -97,7 +100,8 @@ class DragResizeInputListener implements AutoCloseable { e.rethrowFromSystemServer(); } mInputEventReceiver = new TaskResizeInputEventReceiver(mInputChannel, mHandler); mInputEventReceiver = new TaskResizeInputEventReceiver( mInputChannel, mHandler, mChoreographer); mCallback = callback; } Loading Loading @@ -171,13 +175,10 @@ class DragResizeInputListener implements AutoCloseable { private final Runnable mConsumeBatchEventRunnable; private boolean mConsumeBatchEventScheduled; private TaskResizeInputEventReceiver(InputChannel inputChannel, Handler handler) { private TaskResizeInputEventReceiver( InputChannel inputChannel, Handler handler, Choreographer choreographer) { super(inputChannel, handler.getLooper()); final Choreographer[] choreographer = new Choreographer[1]; handler.runWithScissors( () -> choreographer[0] = Choreographer.getInstance(), 0); mChoreographer = choreographer[0]; mChoreographer = choreographer; mConsumeBatchEventRunnable = () -> { mConsumeBatchEventScheduled = false; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java +20 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Trace; import android.view.Choreographer; import androidx.annotation.Nullable; Loading Loading @@ -143,6 +144,25 @@ public abstract class WMShellConcurrencyModule { return sysuiMainExecutor; } /** * Provide a Shell main-thread {@link Choreographer} with the app vsync. * * @param executor the executor of the shell main thread */ @WMSingleton @Provides @ShellMainThread public static Choreographer provideShellMainChoreographer( @ShellMainThread ShellExecutor executor) { try { final Choreographer[] choreographer = new Choreographer[1]; executor.executeBlocking(() -> choreographer[0] = Choreographer.getInstance()); return choreographer[0]; } catch (InterruptedException e) { throw new RuntimeException("Failed to obtain main Choreographer.", e); } } /** * Provide a Shell animation-thread Executor. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.pm.LauncherApps; import android.os.Handler; import android.os.UserManager; import android.view.Choreographer; import android.view.WindowManager; import com.android.internal.jank.InteractionJankMonitor; Loading Loading @@ -173,12 +174,14 @@ public abstract class WMShellModule { static WindowDecorViewModel<?> provideWindowDecorViewModel( Context context, @ShellMainThread Handler mainHandler, @ShellMainThread Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { return new CaptionWindowDecorViewModel( context, mainHandler, mainChoreographer, taskOrganizer, displayController, syncQueue); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityTaskManager; import android.content.Context; import android.os.Handler; import android.view.Choreographer; import android.view.MotionEvent; import android.view.SurfaceControl; import android.view.View; Loading @@ -45,17 +46,20 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption private final ShellTaskOrganizer mTaskOrganizer; private final Context mContext; private final Handler mMainHandler; private final Choreographer mMainChoreographer; private final DisplayController mDisplayController; private final SyncTransactionQueue mSyncQueue; public CaptionWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, ShellTaskOrganizer taskOrganizer, DisplayController displayController, SyncTransactionQueue syncQueue) { mContext = context; mMainHandler = mainHandler; mMainChoreographer = mainChoreographer; mActivityTaskManager = mContext.getSystemService(ActivityTaskManager.class); mTaskOrganizer = taskOrganizer; mDisplayController = displayController; Loading @@ -72,6 +76,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption taskInfo, taskSurface, mMainHandler, mMainChoreographer, mSyncQueue); TaskPositioner taskPositioner = new TaskPositioner(mTaskOrganizer, windowDecoration); CaptionTouchEventListener touchEventListener = Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.graphics.Rect; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.view.Choreographer; import android.view.SurfaceControl; import android.view.View; import android.window.WindowContainerTransaction; Loading Loading @@ -59,6 +60,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP, RESIZE_HANDLE_IN_DIP); private final Handler mHandler; private final Choreographer mChoreographer; private final SyncTransactionQueue mSyncQueue; private View.OnClickListener mOnCaptionButtonClickListener; Loading @@ -77,10 +79,12 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL ActivityManager.RunningTaskInfo taskInfo, SurfaceControl taskSurface, Handler handler, Choreographer choreographer, SyncTransactionQueue syncQueue) { super(context, displayController, taskOrganizer, taskInfo, taskSurface); mHandler = handler; mChoreographer = choreographer; mSyncQueue = syncQueue; } Loading Loading @@ -138,6 +142,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL mDragResizeListener = new DragResizeInputListener( mContext, mHandler, mChoreographer, mDisplay.getDisplayId(), mDecorationContainerSurface, mDragResizeCallback); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +8 −7 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ class DragResizeInputListener implements AutoCloseable { private final IWindowSession mWindowSession = WindowManagerGlobal.getWindowSession(); private final Handler mHandler; private final Choreographer mChoreographer; private final InputManager mInputManager; private final int mDisplayId; Loading @@ -68,11 +69,13 @@ class DragResizeInputListener implements AutoCloseable { DragResizeInputListener( Context context, Handler handler, Choreographer choreographer, int displayId, SurfaceControl decorationSurface, DragResizeCallback callback) { mInputManager = context.getSystemService(InputManager.class); mHandler = handler; mChoreographer = choreographer; mDisplayId = displayId; mDecorationSurface = decorationSurface; // Use a fake window as the backing surface is a container layer and we don't want to create Loading @@ -97,7 +100,8 @@ class DragResizeInputListener implements AutoCloseable { e.rethrowFromSystemServer(); } mInputEventReceiver = new TaskResizeInputEventReceiver(mInputChannel, mHandler); mInputEventReceiver = new TaskResizeInputEventReceiver( mInputChannel, mHandler, mChoreographer); mCallback = callback; } Loading Loading @@ -171,13 +175,10 @@ class DragResizeInputListener implements AutoCloseable { private final Runnable mConsumeBatchEventRunnable; private boolean mConsumeBatchEventScheduled; private TaskResizeInputEventReceiver(InputChannel inputChannel, Handler handler) { private TaskResizeInputEventReceiver( InputChannel inputChannel, Handler handler, Choreographer choreographer) { super(inputChannel, handler.getLooper()); final Choreographer[] choreographer = new Choreographer[1]; handler.runWithScissors( () -> choreographer[0] = Choreographer.getInstance(), 0); mChoreographer = choreographer[0]; mChoreographer = choreographer; mConsumeBatchEventRunnable = () -> { mConsumeBatchEventScheduled = false; Loading