[automerge] Revert "Revert "Sync hotseat/taskbar handoff"" 2p: 27f9559203
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17606862 Bug: 223789074 Bug: 223443781 Bug: 202507555 Change-Id: If72bec9d681a0fdb873a77cf8d5e67fc5be56801
This commit is contained in:
@@ -31,6 +31,7 @@ android_library {
|
|||||||
"androidx.test.uiautomator_uiautomator",
|
"androidx.test.uiautomator_uiautomator",
|
||||||
"androidx.preference_preference",
|
"androidx.preference_preference",
|
||||||
"SystemUISharedLib",
|
"SystemUISharedLib",
|
||||||
|
"SystemUIAnimationLib",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"tests/tapl/**/*.java",
|
"tests/tapl/**/*.java",
|
||||||
@@ -196,6 +197,7 @@ android_library {
|
|||||||
"lottie",
|
"lottie",
|
||||||
"SystemUISharedLib",
|
"SystemUISharedLib",
|
||||||
"SystemUI-statsd",
|
"SystemUI-statsd",
|
||||||
|
"SystemUIAnimationLib",
|
||||||
],
|
],
|
||||||
manifest: "quickstep/AndroidManifest.xml",
|
manifest: "quickstep/AndroidManifest.xml",
|
||||||
min_sdk_version: "current",
|
min_sdk_version: "current",
|
||||||
@@ -304,6 +306,7 @@ android_library {
|
|||||||
"SystemUISharedLib",
|
"SystemUISharedLib",
|
||||||
"Launcher3CommonDepsLib",
|
"Launcher3CommonDepsLib",
|
||||||
"QuickstepResLib",
|
"QuickstepResLib",
|
||||||
|
"SystemUIAnimationLib",
|
||||||
],
|
],
|
||||||
manifest: "quickstep/AndroidManifest.xml",
|
manifest: "quickstep/AndroidManifest.xml",
|
||||||
platform_apis: true,
|
platform_apis: true,
|
||||||
|
|||||||
@@ -29,13 +29,16 @@ import androidx.annotation.NonNull;
|
|||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
import com.android.launcher3.AbstractFloatingView;
|
||||||
import com.android.launcher3.BaseQuickstepLauncher;
|
import com.android.launcher3.BaseQuickstepLauncher;
|
||||||
|
import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.LauncherState;
|
import com.android.launcher3.LauncherState;
|
||||||
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.statemanager.StateManager;
|
import com.android.launcher3.statemanager.StateManager;
|
||||||
import com.android.launcher3.util.MultiValueAlpha;
|
import com.android.launcher3.util.MultiValueAlpha;
|
||||||
import com.android.quickstep.AnimatedFloat;
|
import com.android.quickstep.AnimatedFloat;
|
||||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||||
import com.android.quickstep.RecentsAnimationController;
|
import com.android.quickstep.RecentsAnimationController;
|
||||||
import com.android.quickstep.views.RecentsView;
|
import com.android.quickstep.views.RecentsView;
|
||||||
|
import com.android.systemui.animation.ViewRootSync;
|
||||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -76,6 +79,9 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
private boolean mShouldDelayLauncherStateAnim;
|
private boolean mShouldDelayLauncherStateAnim;
|
||||||
|
|
||||||
|
// We skip any view synchronizations during init/destroy.
|
||||||
|
private boolean mCanSyncViews;
|
||||||
|
|
||||||
private final StateManager.StateListener<LauncherState> mStateListener =
|
private final StateManager.StateListener<LauncherState> mStateListener =
|
||||||
new StateManager.StateListener<LauncherState>() {
|
new StateManager.StateListener<LauncherState>() {
|
||||||
|
|
||||||
@@ -102,6 +108,8 @@ import java.util.function.Supplier;
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void init(TaskbarControllers controllers, BaseQuickstepLauncher launcher) {
|
public void init(TaskbarControllers controllers, BaseQuickstepLauncher launcher) {
|
||||||
|
mCanSyncViews = false;
|
||||||
|
|
||||||
mControllers = controllers;
|
mControllers = controllers;
|
||||||
mLauncher = launcher;
|
mLauncher = launcher;
|
||||||
|
|
||||||
@@ -121,9 +129,13 @@ import java.util.function.Supplier;
|
|||||||
updateStateForFlag(FLAG_RESUMED, launcher.hasBeenResumed());
|
updateStateForFlag(FLAG_RESUMED, launcher.hasBeenResumed());
|
||||||
mLauncherState = launcher.getStateManager().getState();
|
mLauncherState = launcher.getStateManager().getState();
|
||||||
applyState(0);
|
applyState(0);
|
||||||
|
|
||||||
|
mCanSyncViews = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
mCanSyncViews = false;
|
||||||
|
|
||||||
mIconAlignmentForResumedState.finishAnimation();
|
mIconAlignmentForResumedState.finishAnimation();
|
||||||
mIconAlignmentForGestureState.finishAnimation();
|
mIconAlignmentForGestureState.finishAnimation();
|
||||||
mIconAlignmentForLauncherState.finishAnimation();
|
mIconAlignmentForLauncherState.finishAnimation();
|
||||||
@@ -131,6 +143,8 @@ import java.util.function.Supplier;
|
|||||||
mIconAlphaForHome.setConsumer(null);
|
mIconAlphaForHome.setConsumer(null);
|
||||||
mLauncher.getHotseat().setIconsAlpha(1f);
|
mLauncher.getHotseat().setIconsAlpha(1f);
|
||||||
mLauncher.getStateManager().removeStateListener(mStateListener);
|
mLauncher.getStateManager().removeStateListener(mStateListener);
|
||||||
|
|
||||||
|
mCanSyncViews = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animator createAnimToLauncher(@NonNull LauncherState toState,
|
public Animator createAnimToLauncher(@NonNull LauncherState toState,
|
||||||
@@ -380,6 +394,27 @@ import java.util.function.Supplier;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float alignment = alignmentSupplier.get();
|
float alignment = alignmentSupplier.get();
|
||||||
|
float currentValue = mIconAlphaForHome.getValue();
|
||||||
|
boolean taskbarWillBeVisible = alignment < 1;
|
||||||
|
boolean firstFrameVisChanged = (taskbarWillBeVisible && Float.compare(currentValue, 1) != 0)
|
||||||
|
|| (!taskbarWillBeVisible && Float.compare(currentValue, 0) != 0);
|
||||||
|
|
||||||
|
// Sync the first frame where we swap taskbar and hotseat.
|
||||||
|
if (firstFrameVisChanged && mCanSyncViews && !Utilities.IS_RUNNING_IN_TEST_HARNESS) {
|
||||||
|
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||||
|
|
||||||
|
// Do all the heavy work before the sync.
|
||||||
|
mControllers.taskbarViewController.createIconAlignmentControllerIfNotExists(dp);
|
||||||
|
|
||||||
|
ViewRootSync.synchronizeNextDraw(mLauncher.getHotseat(),
|
||||||
|
mControllers.taskbarActivityContext.getDragLayer(),
|
||||||
|
() -> updateIconAlignment(alignment));
|
||||||
|
} else {
|
||||||
|
updateIconAlignment(alignment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateIconAlignment(float alignment) {
|
||||||
mControllers.taskbarViewController.setLauncherIconAlignment(
|
mControllers.taskbarViewController.setLauncherIconAlignment(
|
||||||
alignment, mLauncher.getDeviceProfile());
|
alignment, mLauncher.getDeviceProfile());
|
||||||
|
|
||||||
|
|||||||
@@ -199,6 +199,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the icon alignment controller if it does not already exist.
|
||||||
|
* @param launcherDp Launcher device profile.
|
||||||
|
*/
|
||||||
|
public void createIconAlignmentControllerIfNotExists(DeviceProfile launcherDp) {
|
||||||
|
if (mIconAlignControllerLazy == null) {
|
||||||
|
mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the taskbar icon alignment relative to Launcher hotseat icons
|
* Sets the taskbar icon alignment relative to Launcher hotseat icons
|
||||||
* @param alignmentRatio [0, 1]
|
* @param alignmentRatio [0, 1]
|
||||||
@@ -206,9 +216,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
|||||||
* 1 => fully aligned
|
* 1 => fully aligned
|
||||||
*/
|
*/
|
||||||
public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) {
|
public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) {
|
||||||
if (mIconAlignControllerLazy == null) {
|
createIconAlignmentControllerIfNotExists(launcherDp);
|
||||||
mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
|
|
||||||
}
|
|
||||||
mIconAlignControllerLazy.setPlayFraction(alignmentRatio);
|
mIconAlignControllerLazy.setPlayFraction(alignmentRatio);
|
||||||
if (alignmentRatio <= 0 || alignmentRatio >= 1) {
|
if (alignmentRatio <= 0 || alignmentRatio >= 1) {
|
||||||
// Cleanup lazy controller so that it is created again in next animation
|
// Cleanup lazy controller so that it is created again in next animation
|
||||||
|
|||||||
Reference in New Issue
Block a user