Ensure that task org updates all happen off the main thread
- Move the animator to be called on the update thread
- Move the calls on task org to update on that thread as well
- Cache the leash and token to ensure we don't make binder calls to fetch
the leash on each frame of the animation
- Don't align with SF vsync now that we're driving the surface animations
Bug: 150810666
Test: Enter PIP, move it around
Test: atest PipAnimationControllerTest
Change-Id: Id05980529681f892638f52f492262fde246cac20
diff --git a/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
index f28c3f6..8636172 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java
@@ -20,6 +20,8 @@
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
+import static com.android.systemui.pip.PipAnimationController.DURATION_DEFAULT_MS;
+
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityTaskManager;
@@ -50,7 +52,6 @@
import com.android.systemui.UiOffloadThread;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.pip.BasePipManager;
-import com.android.systemui.pip.PipAnimationController;
import com.android.systemui.pip.PipBoundsHandler;
import com.android.systemui.pip.PipTaskOrganizer;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -232,6 +233,7 @@
if (mInitialized) {
return;
}
+
mInitialized = true;
mContext = context;
mPipBoundsHandler = new PipBoundsHandler(context);
@@ -433,8 +435,7 @@
mCurrentPipBounds = mPipBounds;
break;
}
- mPipTaskOrganizer.animateResizePip(mCurrentPipBounds,
- PipAnimationController.DURATION_DEFAULT_MS);
+ mPipTaskOrganizer.scheduleAnimateResizePip(mCurrentPipBounds, DURATION_DEFAULT_MS, null);
}
/**