Merge "[11/n] Letterbox Education: set LAUNCHER_TASKBAR_EDUCATION_SHOWING."
diff --git a/quickstep/res/layout/taskbar_all_apps.xml b/quickstep/res/layout/taskbar_all_apps.xml
index 2848b0f..1ad20cc 100644
--- a/quickstep/res/layout/taskbar_all_apps.xml
+++ b/quickstep/res/layout/taskbar_all_apps.xml
@@ -30,6 +30,10 @@
android:theme="?attr/allAppsTheme">
<include
+ layout="@layout/all_apps_bottom_sheet_background"
+ android:visibility="gone" />
+
+ <include
layout="@layout/all_apps_rv_layout"
android:visibility="gone" />
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 20762b9..335b637 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -275,6 +275,9 @@
// taskbar, we use an OnLongClickListener on TaskbarView instead.
return false;
}
+ if (!canCurrentlyManuallyUnstash()) {
+ return false;
+ }
if (updateAndAnimateIsManuallyStashedInApp(false)) {
mControllers.taskbarActivityContext.getDragLayer().performHapticFeedback(LONG_PRESS);
return true;
@@ -283,6 +286,16 @@
}
/**
+ * Returns whether taskbar will unstash when long pressing it based on the current state. The
+ * only time this is true is if the user is in an app and the taskbar is only stashed because
+ * the user previously long pressed to manually stash (not due to other reasons like IME).
+ */
+ private boolean canCurrentlyManuallyUnstash() {
+ return (mState & (FLAG_IN_APP | FLAGS_STASHED_IN_APP))
+ == (FLAG_IN_APP | FLAG_STASHED_IN_APP_MANUAL);
+ }
+
+ /**
* Updates whether we should stash the taskbar when in apps, and animates to the changed state.
* @return Whether we started an animation to either be newly stashed or unstashed.
*/
@@ -423,6 +436,11 @@
// Already unstashed, no need to hint in that direction.
return;
}
+ if (!canCurrentlyManuallyUnstash()) {
+ // If any other flags are causing us to be stashed, long press won't cause us to
+ // unstash, so don't hint that it will.
+ return;
+ }
mTaskbarStashedHandleHintScale.animateToValue(
animateForward ? UNSTASHED_TASKBAR_HANDLE_HINT_SCALE : 1)
.setDuration(TASKBAR_HINT_STASH_DURATION).start();
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index 0046bbe..12a638a 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -571,9 +571,14 @@
}
private static int getSearchAttributes(LauncherAtom.ItemInfo info) {
- if (info.getContainerInfo().getExtendedContainers().getDeviceSearchResultContainer()
- .hasSearchAttributes()) {
- return searchAttributesToInt(info.getContainerInfo().getExtendedContainers()
+ ContainerInfo containerInfo = info.getContainerInfo();
+ if (containerInfo.getContainerCase() == EXTENDED_CONTAINERS
+ && containerInfo.getExtendedContainers().getContainerCase()
+ == DEVICE_SEARCH_RESULT_CONTAINER
+ && containerInfo.getExtendedContainers()
+ .getDeviceSearchResultContainer().hasSearchAttributes()
+ ) {
+ return searchAttributesToInt(containerInfo.getExtendedContainers()
.getDeviceSearchResultContainer().getSearchAttributes());
}
return 0;
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 6df6212..2ac7e63 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -26,6 +26,10 @@
android:saveEnabled="false">
<include
+ layout="@layout/all_apps_bottom_sheet_background"
+ android:visibility="gone" />
+
+ <include
layout="@layout/all_apps_rv_layout"
android:visibility="gone" />
diff --git a/res/layout/all_apps_bottom_sheet_background.xml b/res/layout/all_apps_bottom_sheet_background.xml
new file mode 100644
index 0000000..ad10d68
--- /dev/null
+++ b/res/layout/all_apps_bottom_sheet_background.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/bottom_sheet_background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/bg_all_apps_bottom_sheet">
+
+ <View
+ android:id="@+id/bottom_sheet_handle_area"
+ android:layout_width="match_parent"
+ android:layout_height="34dp" />
+
+ <View
+ android:id="@+id/bottom_sheet_handle"
+ android:layout_width="48dp"
+ android:layout_height="2dp"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="16dp"
+ android:layout_marginBottom="16dp"
+ android:background="?android:attr/textColorSecondary" />
+</FrameLayout>
diff --git a/res/layout/secondary_launcher.xml b/res/layout/secondary_launcher.xml
index 3ccd4f2..0fe05ee 100644
--- a/res/layout/secondary_launcher.xml
+++ b/res/layout/secondary_launcher.xml
@@ -42,7 +42,7 @@
android:onClick="onAppsButtonClicked" />
<view
- class="com.android.launcher3.allapps.ActivityAllAppsContainerView"
+ class="com.android.launcher3.allapps.SecondaryLauncherAllAppsContainerView"
android:id="@+id/apps_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -56,6 +56,10 @@
android:visibility="invisible" >
<include
+ layout="@layout/all_apps_bottom_sheet_background"
+ android:visibility="gone" />
+
+ <include
layout="@layout/all_apps_rv_layout"
android:visibility="gone" />
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index 2b2c7c5..a66ae78 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -110,6 +110,8 @@
private AllAppsPagedView mViewPager;
protected FloatingHeaderView mHeader;
+ private View mBottomSheetBackground;
+ private View mBottomSheetHandleArea;
protected boolean mUsingTabs;
private boolean mHasWorkApps;
@@ -146,8 +148,6 @@
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
mAllAppsStore.addUpdateListener(this::onAppsUpdated);
-
- updateBackground(mActivityContext.getDeviceProfile());
}
/** Creates the adapter provider for the main section. */
@@ -222,10 +222,8 @@
updateBackground(dp);
}
- private void updateBackground(DeviceProfile deviceProfile) {
- setBackground(deviceProfile.isTablet
- ? getContext().getDrawable(R.drawable.bg_all_apps_bottom_sheet)
- : null);
+ protected void updateBackground(DeviceProfile deviceProfile) {
+ mBottomSheetBackground.setVisibility(deviceProfile.isTablet ? View.VISIBLE : View.GONE);
}
private void onAppsUpdated() {
@@ -253,7 +251,9 @@
if (!mActivityContext.getDragLayer().isEventOverView(this, ev)) {
return true;
}
- // TODO(b/216203409) Support dragging down from bottom sheet divider, if present.
+ if (mActivityContext.getDragLayer().isEventOverView(mBottomSheetHandleArea, ev)) {
+ return true;
+ }
AllAppsRecyclerView rv = getActiveRecyclerView();
if (rv == null) {
return true;
@@ -375,6 +375,11 @@
mHeader = findViewById(R.id.all_apps_header);
rebindAdapters(true /* force */);
+
+ mBottomSheetBackground = findViewById(R.id.bottom_sheet_background);
+ updateBackground(mActivityContext.getDeviceProfile());
+
+ mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area);
}
@Override
@@ -392,7 +397,6 @@
}
MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
- mlp.topMargin = grid.isTablet ? insets.top : 0;
int leftRightMargin = grid.allAppsLeftRightMargin;
mlp.leftMargin = insets.left + leftRightMargin;
mlp.rightMargin = insets.right + leftRightMargin;
@@ -401,7 +405,7 @@
if (grid.isVerticalBarLayout()) {
setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0);
} else {
- setPadding(0, 0, 0, 0);
+ setPadding(0, grid.isTablet ? insets.top : 0, 0, 0);
}
InsettableFrameLayout.dispatchInsets(this, insets);
diff --git a/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java
new file mode 100644
index 0000000..0719c43
--- /dev/null
+++ b/src/com/android/launcher3/allapps/SecondaryLauncherAllAppsContainerView.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+package com.android.launcher3.allapps;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher;
+
+/**
+ * AllAppsContainerView for secondary launcher
+ */
+public class SecondaryLauncherAllAppsContainerView extends
+ ActivityAllAppsContainerView<SecondaryDisplayLauncher> {
+
+ public SecondaryLauncherAllAppsContainerView(Context context) {
+ this(context, null);
+ }
+
+ public SecondaryLauncherAllAppsContainerView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public SecondaryLauncherAllAppsContainerView(Context context, AttributeSet attrs,
+ int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected void updateBackground(DeviceProfile deviceProfile) {}
+}