Merge "Freeze task list if requested when launching split tasks" into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java
index 1305bbc..7c29c5b 100644
--- a/quickstep/src/com/android/launcher3/model/AppEventProducer.java
+++ b/quickstep/src/com/android/launcher3/model/AppEventProducer.java
@@ -271,9 +271,6 @@
case ALL_APPS_CONTAINER: {
return "all-apps";
}
- case SEARCH_RESULT_CONTAINER: {
- return "search-results";
- }
case PREDICTED_HOTSEAT_CONTAINER: {
return "predictions/hotseat";
}
@@ -293,6 +290,16 @@
}
return "folder";
}
+ case SEARCH_RESULT_CONTAINER:
+ return "search-results";
+ case EXTENDED_CONTAINERS: {
+ switch(ci.getExtendedContainers().getContainerCase()) {
+ case DEVICE_SEARCH_RESULT_CONTAINER:
+ case CORRECTED_DEVICE_SEARCH_RESULT_CONTAINER:
+ return "search-results";
+ }
+ }
+ default: // fall out
}
return "";
}
diff --git a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java
index 7794d27..e82c900 100644
--- a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java
+++ b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java
@@ -329,6 +329,8 @@
}
if (state.predictor != null) {
state.predictor.notifyAppTargetEvent(event);
+ Log.d(TAG, "notifyAppTargetEvent action=" + event.getAction()
+ + " launchLocation=" + event.getLaunchLocation());
}
}
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index f9b749e..e15aa92 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -322,11 +322,11 @@
public final void calculateGridTaskSize(Context context, DeviceProfile dp, Rect outRect,
PagedOrientationHandler orientedState) {
Resources res = context.getResources();
- Rect gridRect = new Rect();
- calculateGridSize(context, dp, gridRect);
+ Rect taskRect = new Rect();
+ calculateTaskSize(context, dp, taskRect);
float rowHeight =
- (gridRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
+ (taskRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
/ 2f;
PointF taskDimension = getTaskDimension(context, dp);
@@ -336,7 +336,7 @@
int gravity = Gravity.TOP;
gravity |= orientedState.getRecentsRtlSetting(res) ? Gravity.RIGHT : Gravity.LEFT;
- Gravity.apply(gravity, outWidth, outHeight, gridRect, outRect);
+ Gravity.apply(gravity, outWidth, outHeight, taskRect, outRect);
}
/**
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 67a94cc..ae3cc50 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -215,6 +215,7 @@
tvsLocal.taskSecondaryTranslation.value = gridTranslationSecondary;
}
tvsLocal.setScroll(startScroll);
+ tvsLocal.setIsGridTask(v.isGridTask());
// Fade in the task during the initial 20% of the animation
out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index 280b5d7..146d235 100644
--- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -101,6 +101,7 @@
private int mOrientationStateId;
private StagedSplitBounds mStagedSplitBounds;
private boolean mDrawsBelowRecents;
+ private boolean mIsGridTask;
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
mContext = context;
@@ -140,18 +141,23 @@
if (mDp == null) {
return 1;
}
- Rect fullTaskSize = new Rect();
- mSizeStrategy.calculateTaskSize(mContext, mDp, fullTaskSize);
+ if (mIsGridTask) {
+ mSizeStrategy.calculateGridTaskSize(mContext, mDp, mTaskRect,
+ mOrientationState.getOrientationHandler());
+ } else {
+ mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect);
+ }
+ Rect fullTaskSize;
if (mStagedSplitBounds != null) {
// The task rect changes according to the staged split task sizes, but recents
// fullscreen scale and pivot remains the same since the task fits into the existing
// sized task space bounds
- mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect);
+ fullTaskSize = new Rect(mTaskRect);
mOrientationState.getOrientationHandler()
.setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
} else {
- mTaskRect.set(fullTaskSize);
+ fullTaskSize = mTaskRect;
}
return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
}
@@ -205,6 +211,13 @@
}
/**
+ * Sets whether the task is part of overview grid and not being focused.
+ */
+ public void setIsGridTask(boolean isGridTask) {
+ mIsGridTask = isGridTask;
+ }
+
+ /**
* Adds animation for all the components corresponding to transition from an app to overview.
*/
public void addAppToOverviewAnim(PendingAnimation pa, TimeInterpolator interpolator) {
diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
index 5a86464..e2ffa18 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
@@ -15,6 +15,8 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
@@ -51,11 +53,11 @@
this(context, null);
}
- public FloatingTaskView(Context context, AttributeSet attrs) {
+ public FloatingTaskView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
- public FloatingTaskView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public FloatingTaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mLauncher = Launcher.getLauncher(context);
mIsRtl = Utilities.isRtl(getResources());
diff --git a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
index 88b11a0..463ed4b 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingWidgetView.java
@@ -30,6 +30,8 @@
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.FrameLayout;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -68,11 +70,11 @@
this(context, null);
}
- public FloatingWidgetView(Context context, AttributeSet attrs) {
+ public FloatingWidgetView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
- public FloatingWidgetView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public FloatingWidgetView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mLauncher = Launcher.getLauncher(context);
mListenerView = new ListenerView(context, attrs);
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
index c0b66f4..ebc6cc4 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
@@ -14,7 +14,6 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.util.RunnableList;
-import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.quickstep.RecentsModel;
@@ -242,4 +241,10 @@
taskIconHeight, mPrimaryTempRect, mSecondaryTempRect,
isRtl, deviceProfile, mSplitBoundsConfig);
}
+
+ @Override
+ protected void updateSnapshotRadius() {
+ super.updateSnapshotRadius();
+ mSnapshotView2.setFullscreenParams(mCurrentFullscreenParams);
+ }
}
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 715d30e..5d6b656 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -30,6 +30,8 @@
import android.view.MotionEvent;
import android.view.Surface;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statehandlers.DepthController;
@@ -49,11 +51,11 @@
this(context, null);
}
- public LauncherRecentsView(Context context, AttributeSet attrs) {
+ public LauncherRecentsView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
- public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public LauncherRecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr, LauncherActivityInterface.INSTANCE);
mActivity.getStateManager().addStateListener(this);
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 72e01bb..223ce1c 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -157,6 +157,7 @@
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.ViewUtils;
+import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.SplitScreenBounds;
@@ -166,7 +167,6 @@
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.util.VibratorWrapper;
import com.android.systemui.plugins.ResourceProvider;
-import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -1018,8 +1018,10 @@
}
private TaskView getLastGridTaskView() {
- IntArray topRowIdArray = getTopRowIdArray();
- IntArray bottomRowIdArray = getBottomRowIdArray();
+ return getLastGridTaskView(getTopRowIdArray(), getBottomRowIdArray());
+ }
+
+ private TaskView getLastGridTaskView(IntArray topRowIdArray, IntArray bottomRowIdArray) {
if (topRowIdArray.isEmpty() && bottomRowIdArray.isEmpty()) {
return null;
}
@@ -3145,38 +3147,23 @@
}
}
- TaskView newLastGridTaskView = getLastGridTaskView();
+ IntArray topRowIdArray = getTopRowIdArray();
+ IntArray bottomRowIdArray = getBottomRowIdArray();
if (finalSnapToLastTask) {
// If snapping to last task, find the last task after dismissal.
- pageToSnapTo = indexOfChild(newLastGridTaskView);
+ pageToSnapTo = indexOfChild(
+ getLastGridTaskView(topRowIdArray, bottomRowIdArray));
} else if (taskViewIdToSnapTo != -1) {
// If snapping to another page due to indices rearranging, find
// the new index after dismissal & rearrange using the task view id.
pageToSnapTo = indexOfChild(
getTaskViewFromTaskViewId(taskViewIdToSnapTo));
- int taskViewToSnapToScroll = getScrollForPage(pageToSnapTo);
- int lastGridTaskScroll = getScrollForPage(
- indexOfChild(newLastGridTaskView));
- if (!currentPageSnapsToEndOfGrid
- && taskViewToSnapToScroll == lastGridTaskScroll) {
+ if (!currentPageSnapsToEndOfGrid) {
// If it wasn't snapped to one of the last pages, but is now
// snapped to last pages, we'll need to compensate for the
- // difference as last pages' scroll is the position where
- // ClearAllButton is barely invisible, instead of aligned to
- // mLastComputedTaskSize.
- int normalTaskEnd = mIsRtl
- ? mLastComputedTaskSize.right
- : mLastComputedTaskSize.left;
- int lastTaskStart = mIsRtl
- ? mLastComputedGridSize.left
- : mLastComputedGridSize.right;
- // As snapped task is not the last task, it can only be the
- // second last task.
- int distanceToSnappedTaskEnd =
- (mPageSpacing + mLastComputedGridTaskSize.width()) * 2;
- int snappedTaskEnd = lastTaskStart + (mIsRtl
- ? distanceToSnappedTaskEnd : -distanceToSnappedTaskEnd);
- mCurrentPageScrollDiff += snappedTaskEnd - normalTaskEnd;
+ // offset from the page's scroll to its visual position.
+ mCurrentPageScrollDiff += getOffsetFromScrollPosition(
+ pageToSnapTo, topRowIdArray, bottomRowIdArray);
}
}
}
@@ -4613,7 +4600,58 @@
overScrollShift, getUndampedOverScrollShift());
}
return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this)
- + overScrollShift;
+ + overScrollShift + getOffsetFromScrollPosition(pageIndex);
+ }
+
+ /**
+ * Returns how many pixels the page is offset from its scroll position.
+ */
+ private int getOffsetFromScrollPosition(int pageIndex) {
+ return getOffsetFromScrollPosition(pageIndex, getTopRowIdArray(), getBottomRowIdArray());
+ }
+
+ private int getOffsetFromScrollPosition(
+ int pageIndex, IntArray topRowIdArray, IntArray bottomRowIdArray) {
+ if (!showAsGrid()) {
+ return 0;
+ }
+
+ TaskView taskView = getTaskViewAt(pageIndex);
+ if (taskView == null) {
+ return 0;
+ }
+
+ TaskView lastGridTaskView = getLastGridTaskView(topRowIdArray, bottomRowIdArray);
+ if (lastGridTaskView == null) {
+ return 0;
+ }
+
+ if (getScrollForPage(pageIndex) != getScrollForPage(indexOfChild(lastGridTaskView))) {
+ return 0;
+ }
+
+ // Check distance from lastGridTaskView to taskView.
+ int lastGridTaskViewPosition =
+ getPositionInRow(lastGridTaskView, topRowIdArray, bottomRowIdArray);
+ int taskViewPosition = getPositionInRow(taskView, topRowIdArray, bottomRowIdArray);
+ int gridTaskSizeAndSpacing = mLastComputedGridTaskSize.width() + mPageSpacing;
+ int positionDiff = gridTaskSizeAndSpacing * (lastGridTaskViewPosition - taskViewPosition);
+
+ int lastTaskEnd = (mIsRtl
+ ? mLastComputedGridSize.left
+ : mLastComputedGridSize.right)
+ + (mIsRtl ? mPageSpacing : -mPageSpacing);
+ int taskEnd = lastTaskEnd + (mIsRtl ? positionDiff : -positionDiff);
+ int normalTaskEnd = mIsRtl
+ ? mLastComputedGridTaskSize.left
+ : mLastComputedGridTaskSize.right;
+ return taskEnd - normalTaskEnd;
+ }
+
+ private int getPositionInRow(
+ TaskView taskView, IntArray topRowIdArray, IntArray bottomRowIdArray) {
+ int position = topRowIdArray.indexOf(taskView.getTaskViewId());
+ return position != -1 ? position : bottomRowIdArray.indexOf(taskView.getTaskViewId());
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 2d58ba5..d498428 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -43,6 +43,7 @@
import android.view.Surface;
import android.view.View;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.graphics.ColorUtils;
@@ -102,11 +103,11 @@
this(context, null);
}
- public TaskThumbnailView(Context context, AttributeSet attrs) {
+ public TaskThumbnailView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskThumbnailView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 62aa73d..9f961c9 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -92,7 +92,6 @@
import com.android.quickstep.TaskUtils;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.util.CancellableTask;
-import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.TaskCornerRadius;
import com.android.quickstep.util.TransformParams;
@@ -369,7 +368,7 @@
private float mGridProgress;
private float mNonGridScale = 1;
private float mDismissScale = 1;
- private final FullscreenDrawParams mCurrentFullscreenParams;
+ protected final FullscreenDrawParams mCurrentFullscreenParams;
protected final StatefulActivity mActivity;
// Various causes of changing primary translation, which we aggregate to setTranslationX/Y().
@@ -425,11 +424,11 @@
this(context, null);
}
- public TaskView(Context context, AttributeSet attrs) {
+ public TaskView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mActivity = StatefulActivity.fromContext(context);
setOnClickListener(this::onClick);
@@ -878,7 +877,7 @@
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
- boolean isGridTask = deviceProfile.overviewShowAsGrid && !isFocusedTask();
+ boolean isGridTask = isGridTask();
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
int taskMargin = isGridTask ? deviceProfile.overviewTaskMarginGridPx
: deviceProfile.overviewTaskMarginPx;
@@ -898,6 +897,14 @@
mSnapshotView.getTaskOverlay().updateOrientationState(orientationState);
}
+ /**
+ * Returns whether the task is part of overview grid and not being focused.
+ */
+ public boolean isGridTask() {
+ DeviceProfile deviceProfile = mActivity.getDeviceProfile();
+ return deviceProfile.overviewShowAsGrid && !isFocusedTask();
+ }
+
private void setIconAndDimTransitionProgress(float progress, boolean invert) {
if (invert) {
progress = 1 - progress;
@@ -1374,7 +1381,7 @@
invalidateOutline();
}
- void updateSnapshotRadius() {
+ protected void updateSnapshotRadius() {
updateCurrentFullscreenParams(mSnapshotView.getPreviewPositionHelper());
mSnapshotView.setFullscreenParams(mCurrentFullscreenParams);
}
diff --git a/res/layout/all_apps_icon_twoline.xml b/res/layout/all_apps_icon_twoline.xml
new file mode 100644
index 0000000..54c7147
--- /dev/null
+++ b/res/layout/all_apps_icon_twoline.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
+ style="@style/BaseIcon.AllApps"
+ android:id="@+id/icon"
+ android:singleLine="false"
+ android:lines="2"
+ android:inputType="textMultiLine"
+ launcher:iconDisplay="all_apps"
+ launcher:centerVertically="true" />
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2cf929f..78f3f11 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -104,8 +104,9 @@
<dimen name="all_apps_divider_height">2dp</dimen>
<dimen name="all_apps_divider_width">128dp</dimen>
<dimen name="all_apps_content_fade_in_offset">150dp</dimen>
-
<dimen name="all_apps_tip_bottom_margin">8dp</dimen>
+ <dimen name="all_apps_height_extra">6dp</dimen>
+
<!-- The size of corner radius of the arrow in the arrow toast. -->
<dimen name="arrow_toast_corner_radius">2dp</dimen>
<dimen name="arrow_toast_elevation">2dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e215c20..5f53d4e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -40,9 +40,9 @@
<!-- Options for recent tasks -->
<!-- Title for an option to enter split screen mode for a given app -->
<string name="recent_task_option_split_screen">Split screen</string>
- <string translatable="false" name="split_screen_position_top">Pin to top</string>
- <string translatable="false" name="split_screen_position_left">Pin to left</string>
- <string translatable="false" name="split_screen_position_right">Pin to right</string>
+ <string translatable="false" name="split_screen_position_top">Split top</string>
+ <string translatable="false" name="split_screen_position_left">Split left</string>
+ <string translatable="false" name="split_screen_position_right">Split right</string>
<!-- Widgets -->
<!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] -->
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index f089551..d5c9a53 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -41,6 +41,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.PackageManagerHelper;
@@ -273,6 +274,8 @@
// The intent to send off to the market app, updated each time the search query changes.
private Intent mMarketSearchIntent;
+ private final int mExtraHeight;
+
public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater,
AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) {
Resources res = launcher.getResources();
@@ -288,6 +291,7 @@
mAdapterProviders = adapterProviders;
setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns);
+ mExtraHeight = launcher.getResources().getDimensionPixelSize(R.dimen.all_apps_height_extra);
}
public void setAppsPerRow(int appsPerRow) {
@@ -347,14 +351,19 @@
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case VIEW_TYPE_ICON:
+ int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon
+ : R.layout.all_apps_icon_twoline;
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
- R.layout.all_apps_icon, parent, false);
+ layout, parent, false);
icon.setLongPressTimeoutFactor(1f);
icon.setOnFocusChangeListener(mIconFocusListener);
icon.setOnClickListener(mOnIconClickListener);
icon.setOnLongClickListener(mOnIconLongClickListener);
// Ensure the all apps icon height matches the workspace icons in portrait mode.
icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
+ if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
+ icon.getLayoutParams().height += mExtraHeight;
+ }
return new ViewHolder(icon);
case VIEW_TYPE_EMPTY_SEARCH:
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search,
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index d362994..e24ea66 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -94,6 +94,9 @@
public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false,
"Use homescreen search box to complete allApps searches");
+ public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(
+ "ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps.");
+
public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = new DeviceFlag(
"ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", true,
"Allows on device search in all apps logging");