Loading core/java/android/view/SurfaceControlViewHost.java +2 −8 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.util.Log; import android.window.WindowTokenClient; import android.view.accessibility.IAccessibilityEmbeddedConnection; import android.window.WindowTokenClient; import java.util.Objects; Loading Loading @@ -271,14 +271,8 @@ public class SurfaceControlViewHost { /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm) { this(c, d, wwm, false /* useSfChoreographer */); } /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, boolean useSfChoreographer) { mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout(), useSfChoreographer); mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); addConfigCallback(c, d); WindowManagerGlobal.getInstance().addWindowlessRoot(mViewRoot); Loading core/java/android/view/ViewRootImpl.java +2 −9 Original line number Diff line number Diff line Loading @@ -905,17 +905,11 @@ public final class ViewRootImpl implements ViewParent, private String mTag = TAG; public ViewRootImpl(Context context, Display display) { this(context, display, WindowManagerGlobal.getWindowSession(), new WindowLayout(), false /* useSfChoreographer */); this(context, display, WindowManagerGlobal.getWindowSession(), new WindowLayout()); } public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session, WindowLayout windowLayout) { this(context, display, session, windowLayout, false /* useSfChoreographer */); } public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session, WindowLayout windowLayout, boolean useSfChoreographer) { mContext = context; mWindowSession = session; mWindowLayout = windowLayout; Loading Loading @@ -947,8 +941,7 @@ public final class ViewRootImpl implements ViewParent, mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = new PhoneFallbackEventHandler(context); // TODO(b/222696368): remove getSfInstance usage and use vsyncId for transactions mChoreographer = useSfChoreographer ? Choreographer.getSfInstance() : Choreographer.getInstance(); mChoreographer = Choreographer.getInstance(); mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); mInsetsController = new InsetsController(new ViewRootInsetsControllerHost(this)); mHandwritingInitiator = new HandwritingInitiator(mViewConfiguration, Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +1 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,7 @@ public class SystemWindows { } final Display display = mDisplayController.getDisplay(mDisplayId); SurfaceControlViewHost viewRoot = new SurfaceControlViewHost( view.getContext(), display, wwm, true /* useSfChoreographer */); new SurfaceControlViewHost(view.getContext(), display, wwm); attrs.flags |= FLAG_HARDWARE_ACCELERATED; viewRoot.setView(view, attrs); mViewRoots.put(view, viewRoot); Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java +0 −27 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static android.os.Process.THREAD_PRIORITY_DISPLAY; import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST; import android.animation.AnimationHandler; import android.content.Context; import android.os.Build; import android.os.Handler; Loading @@ -31,11 +30,9 @@ import android.view.Choreographer; import androidx.annotation.Nullable; import com.android.internal.graphics.SfVsyncFrameCallbackProvider; import com.android.wm.shell.R; import com.android.wm.shell.common.HandlerExecutor; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.annotations.ChoreographerSfVsync; import com.android.wm.shell.common.annotations.ExternalMainThread; import com.android.wm.shell.common.annotations.ShellAnimationThread; import com.android.wm.shell.common.annotations.ShellBackgroundThread; Loading Loading @@ -194,30 +191,6 @@ public abstract class WMShellConcurrencyModule { return new HandlerExecutor(shellSplashscreenThread.getThreadHandler()); } /** * Provide a Shell main-thread AnimationHandler. The AnimationHandler can be set on * {@link android.animation.ValueAnimator}s and will ensure that the animation will run on * the Shell main-thread with the SF vsync. */ @WMSingleton @Provides @ChoreographerSfVsync public static AnimationHandler provideShellMainExecutorSfVsyncAnimationHandler( @ShellMainThread ShellExecutor mainExecutor) { try { AnimationHandler handler = new AnimationHandler(); mainExecutor.executeBlocking(() -> { // This is called on the animation thread since it calls // Choreographer.getSfInstance() which returns a thread-local Choreographer instance // that uses the SF vsync handler.setProvider(new SfVsyncFrameCallbackProvider()); }); return handler; } catch (InterruptedException e) { throw new RuntimeException("Failed to initialize SfVsync animation handler in 1s", e); } } /** * Provides a Shell background thread Handler for low priority background tasks. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +3 −4 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> lp.setTrustedOverlay(); if (mViewHost == null) { mViewHost = mSurfaceControlViewHostFactory.create(mDecorWindowContext, mDisplay, mCaptionWindowManager, true); mCaptionWindowManager); mViewHost.setView(outResult.mRootView, lp); } else { mViewHost.relayout(lp); Loading Loading @@ -345,9 +345,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> } interface SurfaceControlViewHostFactory { default SurfaceControlViewHost create( Context c, Display d, WindowlessWindowManager wmm, boolean useSfChoreographer) { return new SurfaceControlViewHost(c, d, wmm, useSfChoreographer); default SurfaceControlViewHost create(Context c, Display d, WindowlessWindowManager wmm) { return new SurfaceControlViewHost(c, d, wmm); } } } Loading
core/java/android/view/SurfaceControlViewHost.java +2 −8 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.util.Log; import android.window.WindowTokenClient; import android.view.accessibility.IAccessibilityEmbeddedConnection; import android.window.WindowTokenClient; import java.util.Objects; Loading Loading @@ -271,14 +271,8 @@ public class SurfaceControlViewHost { /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm) { this(c, d, wwm, false /* useSfChoreographer */); } /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, boolean useSfChoreographer) { mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout(), useSfChoreographer); mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); addConfigCallback(c, d); WindowManagerGlobal.getInstance().addWindowlessRoot(mViewRoot); Loading
core/java/android/view/ViewRootImpl.java +2 −9 Original line number Diff line number Diff line Loading @@ -905,17 +905,11 @@ public final class ViewRootImpl implements ViewParent, private String mTag = TAG; public ViewRootImpl(Context context, Display display) { this(context, display, WindowManagerGlobal.getWindowSession(), new WindowLayout(), false /* useSfChoreographer */); this(context, display, WindowManagerGlobal.getWindowSession(), new WindowLayout()); } public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session, WindowLayout windowLayout) { this(context, display, session, windowLayout, false /* useSfChoreographer */); } public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session, WindowLayout windowLayout, boolean useSfChoreographer) { mContext = context; mWindowSession = session; mWindowLayout = windowLayout; Loading Loading @@ -947,8 +941,7 @@ public final class ViewRootImpl implements ViewParent, mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = new PhoneFallbackEventHandler(context); // TODO(b/222696368): remove getSfInstance usage and use vsyncId for transactions mChoreographer = useSfChoreographer ? Choreographer.getSfInstance() : Choreographer.getInstance(); mChoreographer = Choreographer.getInstance(); mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); mInsetsController = new InsetsController(new ViewRootInsetsControllerHost(this)); mHandwritingInitiator = new HandwritingInitiator(mViewConfiguration, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +1 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,7 @@ public class SystemWindows { } final Display display = mDisplayController.getDisplay(mDisplayId); SurfaceControlViewHost viewRoot = new SurfaceControlViewHost( view.getContext(), display, wwm, true /* useSfChoreographer */); new SurfaceControlViewHost(view.getContext(), display, wwm); attrs.flags |= FLAG_HARDWARE_ACCELERATED; viewRoot.setView(view, attrs); mViewRoots.put(view, viewRoot); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java +0 −27 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static android.os.Process.THREAD_PRIORITY_DISPLAY; import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST; import android.animation.AnimationHandler; import android.content.Context; import android.os.Build; import android.os.Handler; Loading @@ -31,11 +30,9 @@ import android.view.Choreographer; import androidx.annotation.Nullable; import com.android.internal.graphics.SfVsyncFrameCallbackProvider; import com.android.wm.shell.R; import com.android.wm.shell.common.HandlerExecutor; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.annotations.ChoreographerSfVsync; import com.android.wm.shell.common.annotations.ExternalMainThread; import com.android.wm.shell.common.annotations.ShellAnimationThread; import com.android.wm.shell.common.annotations.ShellBackgroundThread; Loading Loading @@ -194,30 +191,6 @@ public abstract class WMShellConcurrencyModule { return new HandlerExecutor(shellSplashscreenThread.getThreadHandler()); } /** * Provide a Shell main-thread AnimationHandler. The AnimationHandler can be set on * {@link android.animation.ValueAnimator}s and will ensure that the animation will run on * the Shell main-thread with the SF vsync. */ @WMSingleton @Provides @ChoreographerSfVsync public static AnimationHandler provideShellMainExecutorSfVsyncAnimationHandler( @ShellMainThread ShellExecutor mainExecutor) { try { AnimationHandler handler = new AnimationHandler(); mainExecutor.executeBlocking(() -> { // This is called on the animation thread since it calls // Choreographer.getSfInstance() which returns a thread-local Choreographer instance // that uses the SF vsync handler.setProvider(new SfVsyncFrameCallbackProvider()); }); return handler; } catch (InterruptedException e) { throw new RuntimeException("Failed to initialize SfVsync animation handler in 1s", e); } } /** * Provides a Shell background thread Handler for low priority background tasks. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +3 −4 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> lp.setTrustedOverlay(); if (mViewHost == null) { mViewHost = mSurfaceControlViewHostFactory.create(mDecorWindowContext, mDisplay, mCaptionWindowManager, true); mCaptionWindowManager); mViewHost.setView(outResult.mRootView, lp); } else { mViewHost.relayout(lp); Loading Loading @@ -345,9 +345,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> } interface SurfaceControlViewHostFactory { default SurfaceControlViewHost create( Context c, Display d, WindowlessWindowManager wmm, boolean useSfChoreographer) { return new SurfaceControlViewHost(c, d, wmm, useSfChoreographer); default SurfaceControlViewHost create(Context c, Display d, WindowlessWindowManager wmm) { return new SurfaceControlViewHost(c, d, wmm); } } }