Merge "Invoke Assistant on 3 button long click on Taskbar" into sc-v2-dev
diff --git a/quickstep/src/com/android/quickstep/ViewUtils.java b/quickstep/src/com/android/quickstep/ViewUtils.java
index 184ab17..e290be8 100644
--- a/quickstep/src/com/android/quickstep/ViewUtils.java
+++ b/quickstep/src/com/android/quickstep/ViewUtils.java
@@ -15,8 +15,10 @@
*/
package com.android.quickstep;
+import android.graphics.HardwareRenderer;
import android.os.Handler;
import android.view.View;
+import android.view.ViewRootImpl;
import com.android.launcher3.Utilities;
import com.android.systemui.shared.system.ViewRootImplCompat;
@@ -45,9 +47,9 @@
return new FrameHandler(view, onFinishRunnable, canceled).schedule();
}
- private static class FrameHandler implements LongConsumer {
+ private static class FrameHandler implements HardwareRenderer.FrameDrawingCallback {
- final ViewRootImplCompat mViewRoot;
+ final ViewRootImpl mViewRoot;
final Runnable mFinishCallback;
final BooleanSupplier mCancelled;
final Handler mHandler;
@@ -55,14 +57,14 @@
int mDeferFrameCount = 1;
FrameHandler(View view, Runnable finishCallback, BooleanSupplier cancelled) {
- mViewRoot = new ViewRootImplCompat(view);
+ mViewRoot = view.getViewRootImpl();
mFinishCallback = finishCallback;
mCancelled = cancelled;
mHandler = new Handler();
}
@Override
- public void accept(long l) {
+ public void onFrameDraw(long frame) {
Utilities.postAsyncCallback(mHandler, this::onFrame);
}
@@ -83,7 +85,7 @@
}
private boolean schedule() {
- if (mViewRoot.isValid()) {
+ if (mViewRoot.getView() != null) {
mViewRoot.registerRtFrameCallback(this);
mViewRoot.getView().invalidate();
return true;
diff --git a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
index 3b4fd31..3b1c150 100644
--- a/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
+++ b/quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java
@@ -22,10 +22,10 @@
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.View;
+import android.view.ViewRootImpl;
import com.android.quickstep.RemoteAnimationTargets.ReleaseCheck;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
-import com.android.systemui.shared.system.ViewRootImplCompat;
import java.util.function.Consumer;
@@ -41,7 +41,7 @@
private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
private final SurfaceControl mBarrierSurfaceControl;
- private final ViewRootImplCompat mTargetViewRootImpl;
+ private final ViewRootImpl mTargetViewRootImpl;
private final Handler mApplyHandler;
private int mLastSequenceNumber = 0;
@@ -50,8 +50,8 @@
* @param targetView The view in the surface that acts as synchronization anchor.
*/
public SurfaceTransactionApplier(View targetView) {
- mTargetViewRootImpl = new ViewRootImplCompat(targetView);
- mBarrierSurfaceControl = mTargetViewRootImpl.getRenderSurfaceControl();
+ mTargetViewRootImpl = targetView.getViewRootImpl();
+ mBarrierSurfaceControl = mTargetViewRootImpl.getSurfaceControl();
mApplyHandler = new Handler(this::onApplyMessage);
}
@@ -109,7 +109,7 @@
if (targetView == null) {
// No target view, no applier
callback.accept(null);
- } else if (new ViewRootImplCompat(targetView).isValid()) {
+ } else if (targetView.isAttachedToWindow()) {
// Already attached, we're good to go
callback.accept(new SurfaceTransactionApplier(targetView));
} else {