Fix App Chip positioning in Fake Orientation
This CL changes how the layoutDirection of the App Chip is handled and update translations in the PagedViewHandler for the app chip for fake orientation. - The App Chip was updated to use the device layoutDirection instead of the same of RecentsView. This prevents the app chip being displayed in RTL when the device is LTR and vice-versa. - It also applies the correct layout direction to `IconAppChipView` and its related views to ensure proper RTL behavior. - RecentsView now updates layoutDirection for its children when updateChildTaskOrientation is called. This will make sure its children have the the latest and the correct layoutDirection.. Before it was only applied when adding a view (addView). - In `SeascapePagedViewHandler`, it adjust the gravity for app chip be aligned correctly in Seascape. - In `GroupedTaskView`, it checks if the device is in RTL to align the app chip correctly for split tasks. - Multiple test combinations were done to validate this fix, please see table in b/326377497#comment7. Fix: 326377497 Bug: 403284758 Flag: com.android.launcher3.enable_overview_icon_menu Test: Manual, please check b/326377497#comment7. Test: OverviewImageTest Test: OverviewSplitTaskImageTest Change-Id: I8e8050ccf58c3f90718a48773ee7e32ddbc00f13
This commit is contained in:
@@ -34,8 +34,6 @@ import static com.android.app.animation.Interpolators.FINAL_FRAME;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.app.animation.Interpolators.clampToProgress;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
|
||||
import static com.android.launcher3.Flags.enableAdditionalHomeAnimations;
|
||||
import static com.android.launcher3.Flags.enableDesktopExplodedView;
|
||||
@@ -142,7 +140,6 @@ import androidx.annotation.UiThread;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
|
||||
import com.android.app.tracing.TraceUtilsKt;
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener;
|
||||
@@ -832,7 +829,7 @@ public abstract class RecentsView<
|
||||
mOrientationState.setMultiWindowMode(inMultiWindowMode);
|
||||
setLayoutRotation(mOrientationState.getTouchRotation(),
|
||||
mOrientationState.getDisplayRotation());
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
if (!inMultiWindowMode && mOverviewStateEnabled) {
|
||||
// TODO: Re-enable layout transitions for addition of the unpinned task
|
||||
reloadIfNeeded();
|
||||
@@ -2087,7 +2084,7 @@ public abstract class RecentsView<
|
||||
|
||||
traceBegin(Trace.TRACE_TAG_APP, "RecentsView.applyLoadPlan.layouts");
|
||||
updateTaskSize();
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
traceEnd(Trace.TRACE_TAG_APP);
|
||||
|
||||
TaskView newRunningTaskView = mUtils.getDesktopTaskViewForDeskId(runningTaskViewDeskId);
|
||||
@@ -2339,7 +2336,7 @@ public abstract class RecentsView<
|
||||
updateSizeAndPadding();
|
||||
|
||||
// Update TaskView's DeviceProfile dependent layout.
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
|
||||
requestLayout();
|
||||
// Reapply the current page to update page scrolls.
|
||||
@@ -2949,22 +2946,6 @@ public abstract class RecentsView<
|
||||
return as;
|
||||
}
|
||||
|
||||
private void updateChildTaskOrientations() {
|
||||
for (TaskView taskView : getTaskViews()) {
|
||||
taskView.setOrientationState(mOrientationState);
|
||||
}
|
||||
boolean shouldRotateMenuForFakeRotation =
|
||||
!mOrientationState.isRecentsActivityRotationAllowed();
|
||||
if (!shouldRotateMenuForFakeRotation) {
|
||||
return;
|
||||
}
|
||||
AbstractFloatingView floatingView = getTopOpenViewWithType(mContainer, TYPE_TASK_MENU);
|
||||
if (floatingView instanceof TaskMenuView taskMenuView) {
|
||||
// Rotation is supported on phone (details at b/254198019#comment4)
|
||||
taskMenuView.onRotationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a gesture from an app has finished, and an end target has been determined.
|
||||
*/
|
||||
@@ -3201,7 +3182,7 @@ public abstract class RecentsView<
|
||||
setRunningTaskHidden(runningTaskTileHidden);
|
||||
// Update task size after setting current task.
|
||||
updateTaskSize();
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
|
||||
// Reload the task list
|
||||
reloadIfNeeded();
|
||||
@@ -4354,7 +4335,7 @@ public abstract class RecentsView<
|
||||
finalNextFocusedTaskView.getDismissIconFadeInAnimator().start();
|
||||
}
|
||||
updateTaskSize();
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
// Update scroll and snap to page.
|
||||
updateScrollSynchronously();
|
||||
|
||||
@@ -7034,7 +7015,7 @@ public abstract class RecentsView<
|
||||
addView(desktopTaskView, insertionIndex);
|
||||
|
||||
updateTaskSize();
|
||||
updateChildTaskOrientations();
|
||||
mUtils.updateChildTaskOrientations();
|
||||
|
||||
// TODO: b/401002178 - Recalculate the new current page such that the addition of the new
|
||||
// desk does not result in a change in the current scroll page.
|
||||
|
||||
Reference in New Issue
Block a user