Remove getSfInstance usage from ViewRootImpl
The getSfInstance usage on ViewRootImpl is target to reduce jank when moving split divider, but legacy split is going to be depracated and it didn't used on new split too so we can remove whole related codes safely. Bug: 222696368 Test: build pass Change-Id: Icf9b543bdd1d4bee54efb3be852722f247d1bd47
This commit is contained in:
@@ -264,14 +264,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, useSfChoreographer);
|
||||
mViewRoot = new ViewRootImpl(c, d, mWm);
|
||||
WindowManagerGlobal.getInstance().addWindowlessRoot(mViewRoot);
|
||||
|
||||
mAccessibilityEmbeddedConnection = mViewRoot.getAccessibilityEmbeddedConnection();
|
||||
|
||||
@@ -852,16 +852,10 @@ public final class ViewRootImpl implements ViewParent,
|
||||
private String mTag = TAG;
|
||||
|
||||
public ViewRootImpl(Context context, Display display) {
|
||||
this(context, display, WindowManagerGlobal.getWindowSession(),
|
||||
false /* useSfChoreographer */);
|
||||
this(context, display, WindowManagerGlobal.getWindowSession());
|
||||
}
|
||||
|
||||
public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session) {
|
||||
this(context, display, session, false /* useSfChoreographer */);
|
||||
}
|
||||
|
||||
public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session,
|
||||
boolean useSfChoreographer) {
|
||||
mContext = context;
|
||||
mWindowSession = session;
|
||||
mDisplay = display;
|
||||
@@ -893,8 +887,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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.wm.shell.dagger;
|
||||
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;
|
||||
@@ -29,11 +28,9 @@ import android.os.Trace;
|
||||
|
||||
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.ShellMainThread;
|
||||
@@ -171,28 +168,4 @@ public abstract class WMShellConcurrencyModule {
|
||||
shellSplashscreenThread.start();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.dagger;
|
||||
|
||||
import android.animation.AnimationHandler;
|
||||
import android.content.Context;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.os.Handler;
|
||||
@@ -42,7 +41,6 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.common.SystemWindows;
|
||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
import com.android.wm.shell.common.annotations.ChoreographerSfVsync;
|
||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||
import com.android.wm.shell.freeform.FreeformTaskListener;
|
||||
import com.android.wm.shell.fullscreen.FullscreenUnfoldController;
|
||||
@@ -182,11 +180,10 @@ public class WMShellModule {
|
||||
DisplayImeController displayImeController, TransactionPool transactionPool,
|
||||
ShellTaskOrganizer shellTaskOrganizer, SyncTransactionQueue syncQueue,
|
||||
TaskStackListenerImpl taskStackListener, Transitions transitions,
|
||||
@ShellMainThread ShellExecutor mainExecutor,
|
||||
@ChoreographerSfVsync AnimationHandler sfVsyncAnimationHandler) {
|
||||
@ShellMainThread ShellExecutor mainExecutor) {
|
||||
return new LegacySplitScreenController(context, displayController, systemWindows,
|
||||
displayImeController, transactionPool, shellTaskOrganizer, syncQueue,
|
||||
taskStackListener, transitions, mainExecutor, sfVsyncAnimationHandler);
|
||||
taskStackListener, transitions, mainExecutor);
|
||||
}
|
||||
|
||||
@WMSingleton
|
||||
|
||||
@@ -25,7 +25,6 @@ import static com.android.wm.shell.animation.Interpolators.SLOWDOWN_INTERPOLATOR
|
||||
import static com.android.wm.shell.common.split.DividerView.TOUCH_ANIMATION_DURATION;
|
||||
import static com.android.wm.shell.common.split.DividerView.TOUCH_RELEASE_ANIMATION_DURATION;
|
||||
|
||||
import android.animation.AnimationHandler;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
@@ -142,7 +141,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
private DividerImeController mImeController;
|
||||
private DividerCallbacks mCallback;
|
||||
|
||||
private AnimationHandler mSfVsyncAnimationHandler;
|
||||
private ValueAnimator mCurrentAnimator;
|
||||
private boolean mEntranceAnimationRunning;
|
||||
private boolean mExitAnimationRunning;
|
||||
@@ -279,10 +277,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
mDefaultDisplay = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
|
||||
}
|
||||
|
||||
public void setAnimationHandler(AnimationHandler sfVsyncAnimationHandler) {
|
||||
mSfVsyncAnimationHandler = sfVsyncAnimationHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
@@ -674,7 +668,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
}
|
||||
});
|
||||
mCurrentAnimator = anim;
|
||||
mCurrentAnimator.setAnimationHandler(mSfVsyncAnimationHandler);
|
||||
return anim;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import android.animation.AnimationHandler;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.ActivityTaskManager;
|
||||
@@ -82,7 +81,6 @@ public class LegacySplitScreenController implements DisplayController.OnDisplays
|
||||
private final DividerState mDividerState = new DividerState();
|
||||
private final ForcedResizableInfoActivityController mForcedResizableController;
|
||||
private final ShellExecutor mMainExecutor;
|
||||
private final AnimationHandler mSfVsyncAnimationHandler;
|
||||
private final LegacySplitScreenTaskListener mSplits;
|
||||
private final SystemWindows mSystemWindows;
|
||||
final TransactionPool mTransactionPool;
|
||||
@@ -118,13 +116,12 @@ public class LegacySplitScreenController implements DisplayController.OnDisplays
|
||||
DisplayImeController imeController, TransactionPool transactionPool,
|
||||
ShellTaskOrganizer shellTaskOrganizer, SyncTransactionQueue syncQueue,
|
||||
TaskStackListenerImpl taskStackListener, Transitions transitions,
|
||||
ShellExecutor mainExecutor, AnimationHandler sfVsyncAnimationHandler) {
|
||||
ShellExecutor mainExecutor) {
|
||||
mContext = context;
|
||||
mDisplayController = displayController;
|
||||
mSystemWindows = systemWindows;
|
||||
mImeController = imeController;
|
||||
mMainExecutor = mainExecutor;
|
||||
mSfVsyncAnimationHandler = sfVsyncAnimationHandler;
|
||||
mForcedResizableController = new ForcedResizableInfoActivityController(context, this,
|
||||
mainExecutor);
|
||||
mTransactionPool = transactionPool;
|
||||
@@ -314,7 +311,6 @@ public class LegacySplitScreenController implements DisplayController.OnDisplays
|
||||
Context dctx = mDisplayController.getDisplayContext(mContext.getDisplayId());
|
||||
mView = (DividerView)
|
||||
LayoutInflater.from(dctx).inflate(R.layout.docked_stack_divider, null);
|
||||
mView.setAnimationHandler(mSfVsyncAnimationHandler);
|
||||
DisplayLayout displayLayout = mDisplayController.getDisplayLayout(mContext.getDisplayId());
|
||||
mView.injectDependencies(this, mWindowManager, mDividerState, mForcedResizableController,
|
||||
mSplits, mSplitLayout, mImePositionProcessor, mWindowManagerProxy);
|
||||
|
||||
@@ -138,7 +138,7 @@ constructor(
|
||||
|
||||
ensureOverlayRemoved()
|
||||
|
||||
val newRoot = SurfaceControlViewHost(context, context.display!!, wwm, false)
|
||||
val newRoot = SurfaceControlViewHost(context, context.display!!, wwm)
|
||||
val newView =
|
||||
LightRevealScrim(context, null).apply {
|
||||
revealEffect = createLightRevealEffect()
|
||||
|
||||
Reference in New Issue
Block a user