Remove flags ENABLE_TWO_PANEL_HOME FOLDABLE_WORKSPACE_REORDE and FOLDABLE_SINGLE_PAGE
Fix: 270392643 Fix: 270395070 Fix: 270395274 Test: atest FoldableItemsIntegrity Change-Id: I2d7af312da8aeb070588ca94a2a256d2def65eeb
This commit is contained in:
1 parent
9c17c9f046
commit
76a1ceb5f2
6 files changed
+12
-129
No files matched your search
@@ -28,7 +28,6 @@ import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT;
|
||||
@@ -127,7 +126,6 @@ import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverla
|
||||
import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
@@ -503,19 +501,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
.log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
|
||||
}
|
||||
|
||||
private boolean isTwoPanelEnabled() {
|
||||
return !FOLDABLE_SINGLE_PAGE.get() && mLauncher.mDeviceProfile.isTwoPanels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPanelCount() {
|
||||
return isTwoPanelEnabled() ? 2 : super.getPanelCount();
|
||||
}
|
||||
|
||||
public void deferRemoveExtraEmptyScreen() {
|
||||
mDeferRemoveExtraEmptyScreen = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPanelCount() {
|
||||
return super.getPanelCount();
|
||||
}
|
||||
@Override
|
||||
public void onDragEnd() {
|
||||
if (ENFORCE_DRAG_EVENT_ORDER) {
|
||||
@@ -668,7 +661,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
// created CellLayout.
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
CellLayout newScreen;
|
||||
if (FOLDABLE_SINGLE_PAGE.get() && dp.isTwoPanels) {
|
||||
if (dp.isTwoPanels) {
|
||||
newScreen = (CellLayout) LayoutInflater.from(getContext()).inflate(
|
||||
R.layout.workspace_screen_foldable, this, false /* attachToRoot */);
|
||||
} else {
|
||||
@@ -693,15 +686,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
if (mDragSourceInternal != null) {
|
||||
int dragSourceChildCount = mDragSourceInternal.getChildCount();
|
||||
|
||||
// If the icon was dragged from Hotseat, there is no page pair
|
||||
if (isTwoPanelEnabled() && !(mDragSourceInternal.getParent() instanceof Hotseat)) {
|
||||
int pagePairScreenId = getScreenPair(getCellPosMapper().mapModelToPresenter(
|
||||
dragObject.dragInfo).screenId);
|
||||
CellLayout pagePair = mWorkspaceScreens.get(pagePairScreenId);
|
||||
dragSourceChildCount += pagePair.getShortcutsAndWidgets().getChildCount();
|
||||
}
|
||||
|
||||
// When the drag view content is a LauncherAppWidgetHostView, we should increment the
|
||||
// drag source child count by 1 because the widget in drag has been detached from its
|
||||
// original parent, ShortcutAndWidgetContainer, and reattached to the DragView.
|
||||
@@ -712,11 +696,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
if (dragSourceChildCount == 1) {
|
||||
lastChildOnScreen = true;
|
||||
}
|
||||
CellLayout cl = (CellLayout) mDragSourceInternal.getParent();
|
||||
if (!FOLDABLE_SINGLE_PAGE.get() && getLeftmostVisiblePageForIndex(indexOfChild(cl))
|
||||
== getLeftmostVisiblePageForIndex(getPageCount() - 1)) {
|
||||
childOnFinalScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is the last item on the final screen
|
||||
@@ -751,9 +730,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
*/
|
||||
private void forEachExtraEmptyPageId(Consumer<Integer> callback) {
|
||||
callback.accept(EXTRA_EMPTY_SCREEN_ID);
|
||||
if (isTwoPanelEnabled()) {
|
||||
callback.accept(EXTRA_EMPTY_SCREEN_SECOND_ID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -867,9 +843,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
public boolean hasExtraEmptyScreens() {
|
||||
return mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_ID)
|
||||
&& getChildCount() > getPanelCount()
|
||||
&& (!isTwoPanelEnabled()
|
||||
|| mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_SECOND_ID));
|
||||
&& getChildCount() > getPanelCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -975,14 +949,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
*/
|
||||
@Nullable
|
||||
public CellLayout getScreenPair(CellLayout cellLayout) {
|
||||
if (!isTwoPanelEnabled()) {
|
||||
return null;
|
||||
}
|
||||
int screenId = getIdForScreen(cellLayout);
|
||||
if (screenId == -1) {
|
||||
return null;
|
||||
}
|
||||
return getScreenWithId(getScreenPair(screenId));
|
||||
return null;
|
||||
}
|
||||
|
||||
public void stripEmptyScreens() {
|
||||
@@ -1010,22 +977,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
}
|
||||
|
||||
// When two panel home is enabled we only remove an empty page if both visible pages are
|
||||
// empty.
|
||||
if (isTwoPanelEnabled()) {
|
||||
// We go through all the pages that were marked as removable and check their page pair
|
||||
Iterator<Integer> removeScreensIterator = removeScreens.iterator();
|
||||
while (removeScreensIterator.hasNext()) {
|
||||
int pageToRemove = removeScreensIterator.next();
|
||||
int pagePair = getScreenPair(pageToRemove);
|
||||
if (!removeScreens.contains(pagePair)) {
|
||||
// The page pair isn't empty so we want to remove the current page from the
|
||||
// removable pages' collection
|
||||
removeScreensIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We enforce at least one page (two pages on two panel home) to add new items to.
|
||||
// In the case that we remove the last such screen(s), we convert the last screen(s)
|
||||
// to the empty screen(s)
|
||||
@@ -1046,12 +997,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
removeView(cl);
|
||||
} else {
|
||||
// The last page(s) should be converted into extra empty page(s)
|
||||
int extraScreenId = isTwoPanelEnabled() && id % 2 == 1
|
||||
// This is the right panel in a two panel scenario
|
||||
? EXTRA_EMPTY_SCREEN_SECOND_ID
|
||||
// This is either the last screen in a one panel scenario, or the left panel
|
||||
// in a two panel scenario when there are only two empty pages left
|
||||
: EXTRA_EMPTY_SCREEN_ID;
|
||||
int extraScreenId = EXTRA_EMPTY_SCREEN_ID;
|
||||
mWorkspaceScreens.put(extraScreenId, cl);
|
||||
mScreenOrder.add(extraScreenId);
|
||||
}
|
||||
@@ -2572,8 +2518,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
// Go through the pages and check if the dragged item is inside one of them. This block
|
||||
// is responsible for determining whether we need to snap to a different screen.
|
||||
int nextPage = getNextPage();
|
||||
IntSet pageIndexesToVerify = IntSet.wrap(nextPage - 1,
|
||||
nextPage + (isTwoPanelEnabled() ? 2 : 1));
|
||||
IntSet pageIndexesToVerify = IntSet.wrap(nextPage - 1, nextPage + 1);
|
||||
|
||||
for (int pageIndex : pageIndexesToVerify) {
|
||||
// When deciding whether to perform a page switch, we need to consider the most
|
||||
|
||||
Reference in new issue
Block a user