+ * All apps is in an application overlay window instead of taskbar's navigation bar panel window, + * because a navigation bar panel is higher than UI components that all apps should be below such as + * the notification tray. + *
+ * The all apps window is created and destroyed upon opening and closing all apps, respectively.
+ * Application data may be bound while the window does not exist, so this controller will store
+ * the models for the next all apps session.
+ */
+public final class TaskbarAllAppsController implements OnDeviceProfileChangeListener {
+
+ private static final String WINDOW_TITLE = "Taskbar All Apps";
+
+ private final TaskbarActivityContext mTaskbarContext;
+ private final TaskbarAllAppsProxyView mProxyView;
+ private final LayoutParams mLayoutParams;
+
+ private TaskbarControllers mControllers;
+ /** Window context for all apps if it is open. */
+ private @Nullable TaskbarAllAppsContext mAllAppsContext;
+
+ // Application data models.
+ private AppInfo[] mApps;
+ private int mAppsModelFlags;
+ private List
+ * This method should be called after an exit animation finishes, if applicable.
+ */
+ void closeWindow() {
+ mProxyView.close(false);
+ mTaskbarContext.removeOnDeviceProfileChangeListener(this);
+ Optional.ofNullable(mAllAppsContext)
+ .map(c -> c.getSystemService(WindowManager.class))
+ .ifPresent(m -> m.removeView(mAllAppsContext.getDragLayer()));
+ mAllAppsContext = null;
+ }
+
+ private LayoutParams createLayoutParams() {
+ LayoutParams layoutParams = new LayoutParams(
+ TYPE_APPLICATION_OVERLAY,
+ 0,
+ PixelFormat.TRANSLUCENT);
+ layoutParams.setTitle(WINDOW_TITLE);
+ layoutParams.gravity = Gravity.BOTTOM;
+ layoutParams.packageName = mTaskbarContext.getPackageName();
+ layoutParams.setFitInsetsTypes(0); // Handled by container view.
+ layoutParams.setSystemApplicationOverlay(true);
+ return layoutParams;
+ }
+
+ @Override
+ public void onDeviceProfileChanged(DeviceProfile dp) {
+ Optional.ofNullable(mAllAppsContext).ifPresent(c -> c.updateDeviceProfile(dp));
+ }
+
+ /**
+ * Proxy view connecting taskbar drag layer to the all apps window.
+ *
+ * The all apps view is in a separate window and has its own drag layer, but this proxy lets it
+ * behave as though its in the taskbar drag layer. For instance, when the taskbar closes all
+ * {@link AbstractFloatingView} instances, the all apps window will also close.
+ */
+ private class TaskbarAllAppsProxyView extends AbstractFloatingView {
+
+ private TaskbarAllAppsProxyView(Context context) {
+ super(context, null);
+ }
+
+ private void show() {
+ mIsOpen = true;
+ mTaskbarContext.getDragLayer().addView(this);
+ }
+
+ @Override
+ protected void handleClose(boolean animate) {
+ mTaskbarContext.getDragLayer().removeView(this);
+ Optional.ofNullable(mAllAppsContext)
+ .map(TaskbarAllAppsContext::getAllAppsViewController)
+ .ifPresent(v -> v.close(animate));
+ }
+
+ @Override
+ protected boolean isOfType(int type) {
+ return (type & TYPE_TASKBAR_ALL_APPS) != 0;
+ }
+
+ @Override
+ public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ return false;
+ }
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
similarity index 61%
rename from quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java
rename to quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
index 63690c4847..02aa3f208b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarAllAppsSlideInView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.launcher3.taskbar;
+package com.android.launcher3.taskbar.allapps;
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
@@ -23,18 +23,22 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.views.AbstractSlideInView;
-/** Wrapper for taskbar all apps with slide-in behavior. */
-public class TaskbarAllAppsSlideInView extends
- AbstractSlideInView