Merge "Revert "Introduce library for public animation APIs"" into udc-dev
diff --git a/res/layout/taskbar_divider.xml b/quickstep/res/layout/taskbar_divider.xml
similarity index 67%
rename from res/layout/taskbar_divider.xml
rename to quickstep/res/layout/taskbar_divider.xml
index e25e7a3..73f3811 100644
--- a/res/layout/taskbar_divider.xml
+++ b/quickstep/res/layout/taskbar_divider.xml
@@ -13,16 +13,16 @@
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/taskbar_divider_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="@dimen/taskbar_icon_min_touch_size"
+ android:layout_height="@dimen/taskbar_icon_min_touch_size"
+ android:contentDescription="@string/taskbar_divider_a11y_title"
+ android:backgroundTint="@android:color/transparent">
<View
- android:id="@+id/taskbar_divider_bar"
android:layout_height="32dp"
android:layout_width="2dp"
android:layout_gravity="center"
- android:background="@drawable/bg_rounded_corner_bottom_sheet_handle" />
- <!-- TODO(b/265347148): Create separate drawable -->
-</FrameLayout>
+ android:background="@drawable/taskbar_divider_bg" />
+</FrameLayout>
\ No newline at end of file
diff --git a/quickstep/res/layout/taskbar_divider_popup_menu.xml b/quickstep/res/layout/taskbar_divider_popup_menu.xml
new file mode 100644
index 0000000..195443e
--- /dev/null
+++ b/quickstep/res/layout/taskbar_divider_popup_menu.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2023 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.taskbar.TaskbarDividerPopupView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="@dimen/taskbar_pinning_popup_menu_width"
+ android:layout_height="wrap_content"
+ android:focusable="true"
+ android:background="@drawable/popup_background_material_u"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:id="@+id/taskbar_switch_option"
+ android:layout_width="match_parent"
+ android:layout_height="52dp"
+ android:layout_gravity="center_vertical"
+ android:elevation="2dp"
+ android:focusable="true"
+ android:clickable="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:background="@drawable/top_rounded_popup_ripple"
+ android:paddingEnd="10dp"
+ android:paddingStart="10dp"
+ android:theme="@style/PopupItem">
+
+ <View
+ android:layout_margin="6dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:background="@drawable/ic_visibility"
+ android:backgroundTint="?android:attr/textColorPrimary" />
+
+ <Switch
+ style="@style/BaseIcon"
+ android:id="@+id/taskbar_pinning_switch"
+ android:background="@null"
+ android:clickable="false"
+ android:gravity="start|center_vertical"
+ android:textAlignment="viewStart"
+ android:paddingStart="12dp"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textSize="14sp"
+ android:textColor="?android:attr/textColorPrimary"
+ android:text="@string/always_show_taskbar" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/navigation_mode_switch_option"
+ android:layout_width="match_parent"
+ android:layout_height="52dp"
+ android:layout_gravity="center_vertical"
+ android:elevation="2dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="@drawable/bottom_rounded_popup_ripple"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingEnd="10dp"
+ android:paddingStart="10dp"
+ android:theme="@style/PopupItem">
+
+ <View
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_margin="4dp"
+ android:background="@drawable/ic_touch"
+ android:backgroundTint="?android:attr/textColorPrimary" />
+
+ <com.android.launcher3.BubbleTextView
+ style="@style/BaseIcon"
+ android:id="@+id/change_navigation_mode_text"
+ android:gravity="start|center_vertical"
+ android:textAlignment="viewStart"
+ android:paddingStart="12dp"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textSize="14sp"
+ android:textColor="?android:attr/textColorPrimary"
+ android:text="@string/change_navigation_mode" />
+
+ </LinearLayout>
+</com.android.launcher3.taskbar.TaskbarDividerPopupView>
\ No newline at end of file
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index cdb3b1c..959fea7 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -341,6 +341,9 @@
<dimen name="taskbar_edu_features_lottie_height">106dp</dimen>
<dimen name="taskbar_edu_features_horizontal_spacing">24dp</dimen>
+ <!--- Taskbar Pinning -->
+ <dimen name="taskbar_pinning_popup_menu_width">300dp</dimen>
+
<!-- Recents overview -->
<dimen name="recents_filter_icon_size">30dp</dimen>
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 2c17ce8..2b6f749 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -277,6 +277,13 @@
<string name="taskbar_a11y_hidden_title">Taskbar hidden</string>
<!-- Accessibility title for the Taskbar window on phones. [CHAR_LIMIT=NONE] -->
<string name="taskbar_phone_a11y_title">Navigation bar</string>
+ <!-- Text in popup dialog for user to switch between always showing Taskbar or not. [CHAR LIMIT=30] -->
+ <string name="always_show_taskbar">Always show Taskbar</string>
+ <!-- Text in popup dialog for user to switch between system navigation modes. [CHAR LIMIT=30] -->
+ <string name="change_navigation_mode">Change navigation mode</string>
+ <!-- Accessibility title for the Taskbar vertical divider icon. [CHAR_LIMIT=NONE] -->
+ <string name="taskbar_divider_a11y_title">Taskbar Divider</string>
+
<!-- Label for moving drop target to the top or left side of the screen, depending on orientation (from the Taskbar only). -->
<string name="move_drop_target_top_or_left">Move to top/left</string>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 809d715..9db03f5 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -238,7 +238,8 @@
? new DesktopTaskbarRecentAppsController(this)
: TaskbarRecentAppsController.DEFAULT,
new TaskbarEduTooltipController(this),
- new KeyboardQuickSwitchController());
+ new KeyboardQuickSwitchController(),
+ new TaskbarDividerPopupController(this));
}
public void init(@NonNull TaskbarSharedState sharedState) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 8efb9b0..1cd6f50 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -60,6 +60,7 @@
public final TaskbarOverlayController taskbarOverlayController;
public final TaskbarEduTooltipController taskbarEduTooltipController;
public final KeyboardQuickSwitchController keyboardQuickSwitchController;
+ public final TaskbarDividerPopupController taskbarPinningController;
@Nullable private LoggableTaskbarController[] mControllersToLog = null;
@Nullable private BackgroundRendererController[] mBackgroundRendererControllers = null;
@@ -105,7 +106,8 @@
TaskbarSpringOnStashController taskbarSpringOnStashController,
TaskbarRecentAppsController taskbarRecentAppsController,
TaskbarEduTooltipController taskbarEduTooltipController,
- KeyboardQuickSwitchController keyboardQuickSwitchController) {
+ KeyboardQuickSwitchController keyboardQuickSwitchController,
+ TaskbarDividerPopupController taskbarPinningController) {
this.taskbarActivityContext = taskbarActivityContext;
this.taskbarDragController = taskbarDragController;
this.navButtonController = navButtonController;
@@ -130,6 +132,7 @@
this.taskbarRecentAppsController = taskbarRecentAppsController;
this.taskbarEduTooltipController = taskbarEduTooltipController;
this.keyboardQuickSwitchController = keyboardQuickSwitchController;
+ this.taskbarPinningController = taskbarPinningController;
}
/**
@@ -163,6 +166,7 @@
taskbarTranslationController.init(this);
taskbarEduTooltipController.init(this);
keyboardQuickSwitchController.init(this);
+ taskbarPinningController.init(this);
mControllersToLog = new LoggableTaskbarController[] {
taskbarDragController, navButtonController, navbarButtonsViewController,
@@ -171,7 +175,7 @@
stashedHandleViewController, taskbarStashController,
taskbarAutohideSuspendController, taskbarPopupController, taskbarInsetsController,
voiceInteractionWindowController, taskbarTranslationController,
- taskbarEduTooltipController, keyboardQuickSwitchController
+ taskbarEduTooltipController, keyboardQuickSwitchController, taskbarPinningController
};
mBackgroundRendererControllers = new BackgroundRendererController[] {
taskbarDragLayerController, taskbarScrimViewController,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt
new file mode 100644
index 0000000..8dbc51a
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2023 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.taskbar
+
+import android.view.View
+import com.android.launcher3.LauncherPrefs
+import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING
+import com.android.launcher3.taskbar.TaskbarDividerPopupView.Companion.createAndPopulate
+import java.io.PrintWriter
+
+/** Controls taskbar pinning through a popup view. */
+class TaskbarDividerPopupController(private val context: TaskbarActivityContext) :
+ TaskbarControllers.LoggableTaskbarController {
+
+ private lateinit var controllers: TaskbarControllers
+ private val launcherPrefs = LauncherPrefs.get(context)
+
+ fun init(taskbarControllers: TaskbarControllers) {
+ controllers = taskbarControllers
+ }
+
+ fun showPinningView(view: View) {
+ context.isTaskbarWindowFullscreen = true
+
+ view.post {
+ val popupView = createAndPopulate(view, context)
+ popupView.requestFocus()
+ popupView.onCloseCallback = {
+ context.onPopupVisibilityChanged(false)
+ if (launcherPrefs.get(TASKBAR_PINNING)) {
+ animateTransientToPersistentTaskBar()
+ } else {
+ animatePersistentToTransientTaskbar()
+ }
+ }
+ popupView.changePreference = {
+ launcherPrefs.put(TASKBAR_PINNING, !launcherPrefs.get(TASKBAR_PINNING))
+ }
+ context.onPopupVisibilityChanged(true)
+ popupView.show()
+ }
+ }
+
+ // TODO(b/265436799): provide animation/transition from transient taskbar to persistent one
+ private fun animateTransientToPersistentTaskBar() {}
+
+ // TODO(b/265436799): provide animation/transition from persistent taskbar to transient one
+ private fun animatePersistentToTransientTaskbar() {}
+
+ override fun dumpLogs(prefix: String, pw: PrintWriter) {
+ pw.println(prefix + "TaskbarPinningController:")
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
new file mode 100644
index 0000000..2000d98
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2023 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.taskbar
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.graphics.Rect
+import android.util.AttributeSet
+import android.view.Gravity
+import android.view.MotionEvent
+import android.view.View
+import android.widget.LinearLayout
+import android.widget.Switch
+import androidx.core.view.postDelayed
+import com.android.launcher3.R
+import com.android.launcher3.popup.ArrowPopup
+import com.android.launcher3.popup.RoundedArrowDrawable
+import com.android.launcher3.util.DisplayController
+import com.android.launcher3.util.Themes
+
+/** Popup view with arrow for taskbar pinning */
+class TaskbarDividerPopupView<T : TaskbarActivityContext>
+@JvmOverloads
+constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0,
+) : ArrowPopup<T>(context, attrs, defStyleAttr) {
+ companion object {
+ private const val TAG = "TaskbarDividerPopupView"
+ private const val DIVIDER_POPUP_CLOSING_DELAY = 500L
+
+ @JvmStatic
+ fun createAndPopulate(
+ view: View,
+ taskbarActivityContext: TaskbarActivityContext,
+ ): TaskbarDividerPopupView<*> {
+ val taskMenuViewWithArrow =
+ taskbarActivityContext.layoutInflater.inflate(
+ R.layout.taskbar_divider_popup_menu,
+ taskbarActivityContext.dragLayer,
+ false
+ ) as TaskbarDividerPopupView<*>
+
+ return taskMenuViewWithArrow.populateForView(view)
+ }
+ }
+ private lateinit var dividerView: View
+
+ private val menuWidth =
+ context.resources.getDimensionPixelSize(R.dimen.taskbar_pinning_popup_menu_width)
+ private val popupCornerRadius = Themes.getDialogCornerRadius(context)
+ private val arrowWidth = resources.getDimension(R.dimen.popup_arrow_width)
+ private val arrowHeight = resources.getDimension(R.dimen.popup_arrow_height)
+ private val arrowPointRadius = resources.getDimension(R.dimen.popup_arrow_corner_radius)
+
+ private var alwaysShowTaskbarOn = !DisplayController.isTransientTaskbar(context)
+ private var didPreferenceChange = false
+
+ /** Callback invoked when the pinning popup view is closing. */
+ var onCloseCallback: () -> Unit = {}
+
+ /**
+ * Callback invoked when the user preference changes in popup view. Preference change will be
+ * based upon current value stored in [LauncherPrefs] for `TASKBAR_PINNING`
+ */
+ var changePreference: () -> Unit = {}
+
+ init {
+ // This synchronizes the arrow and menu to open at the same time
+ mOpenChildFadeStartDelay = mOpenFadeStartDelay
+ mOpenChildFadeDuration = mOpenFadeDuration
+ mCloseFadeStartDelay = mCloseChildFadeStartDelay
+ mCloseFadeDuration = mCloseChildFadeDuration
+ }
+
+ override fun isOfType(type: Int): Boolean = type and TYPE_TASKBAR_PINNING_POPUP != 0
+
+ override fun getTargetObjectLocation(outPos: Rect) {
+ popupContainer.getDescendantRectRelativeToSelf(dividerView, outPos)
+ }
+
+ @SuppressLint("UseSwitchCompatOrMaterialCode")
+ override fun onFinishInflate() {
+ super.onFinishInflate()
+ val taskbarSwitchOption = findViewById<LinearLayout>(R.id.taskbar_switch_option)
+ val alwaysShowTaskbarSwitch = findViewById<Switch>(R.id.taskbar_pinning_switch)
+ alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn
+ taskbarSwitchOption.setOnClickListener {
+ alwaysShowTaskbarSwitch.isClickable = true
+ alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn
+ onClickAlwaysShowTaskbarSwitchOption()
+ }
+ }
+
+ /** Orient object as usual and then center object horizontally. */
+ override fun orientAboutObject() {
+ super.orientAboutObject()
+ x = mTempRect.centerX() - menuWidth / 2f
+ }
+
+ override fun onControllerInterceptTouchEvent(ev: MotionEvent?): Boolean {
+ if (ev?.action == MotionEvent.ACTION_DOWN) {
+ if (!popupContainer.isEventOverView(this, ev)) {
+ close(true)
+ }
+ } else if (popupContainer.isEventOverView(dividerView, ev)) {
+ return true
+ }
+ return false
+ }
+
+ private fun populateForView(view: View): TaskbarDividerPopupView<*> {
+ dividerView = view
+ return this
+ }
+
+ override fun addArrow() {
+ super.addArrow()
+ // Change arrow location to the middle of popup.
+ mArrow.x = (dividerView.x + dividerView.width / 2) - (mArrowWidth / 2)
+ }
+
+ override fun updateArrowColor() {
+ if (!Gravity.isVertical(mGravity)) {
+ mArrow.background =
+ RoundedArrowDrawable(
+ arrowWidth,
+ arrowHeight,
+ arrowPointRadius,
+ popupCornerRadius,
+ measuredWidth.toFloat(),
+ measuredHeight.toFloat(),
+ (measuredWidth - arrowWidth) / 2, // arrowOffsetX
+ 0f, // arrowOffsetY
+ false, // isPointingUp
+ true, // leftAligned
+ Themes.getAttrColor(context, R.attr.popupColorPrimary),
+ )
+ elevation = mElevation
+ mArrow.elevation = mElevation
+ }
+ }
+
+ override fun closeComplete() {
+ if (didPreferenceChange) {
+ onCloseCallback()
+ }
+ super.closeComplete()
+ }
+
+ private fun onClickAlwaysShowTaskbarSwitchOption() {
+ didPreferenceChange = true
+ changePreference()
+ // Allow switch animation to finish and then close the popup.
+ postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { close(true) }
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index ca29afb..738ff87 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -20,6 +20,8 @@
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
+import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING;
+import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY;
import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
@@ -32,6 +34,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.hardware.display.DisplayManager;
@@ -48,6 +51,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.unfold.NonDestroyableScopedUnfoldTransitionProgressProvider;
@@ -133,6 +137,13 @@
private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver =
new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast);
+ private final SharedPreferences.OnSharedPreferenceChangeListener
+ mTaskbarPinningPreferenceChangeListener = (sharedPreferences, key) -> {
+ if (TASKBAR_PINNING_KEY.equals(key)) {
+ recreateTaskbar();
+ }
+ };
+
@SuppressLint("WrongConstant")
public TaskbarManager(TouchInteractionService service) {
mDisplayController = DisplayController.INSTANCE.get(service);
@@ -249,6 +260,8 @@
private void destroyExistingTaskbar() {
debugWhyTaskbarNotDestroyed("destroyExistingTaskbar: " + mTaskbarActivityContext);
if (mTaskbarActivityContext != null) {
+ LauncherPrefs.get(mContext).removeListener(mTaskbarPinningPreferenceChangeListener,
+ TASKBAR_PINNING);
mTaskbarActivityContext.onDestroy();
if (!FLAG_HIDE_NAVBAR_WINDOW) {
mTaskbarActivityContext = null;
@@ -385,6 +398,10 @@
mTaskbarActivityContext.setUIController(
createTaskbarUIControllerForActivity(mActivity));
}
+
+ // We to wait until user unlocks the device to attach listener.
+ LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener,
+ TASKBAR_PINNING);
}
public void onSystemUiFlagsChanged(int systemUiStateFlags) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 69ea9fd..1d90a43 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -18,11 +18,12 @@
import static android.view.HapticFeedbackConstants.LONG_PRESS;
import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_CONTROLS;
+import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.config.FeatureFlags.FORCE_PERSISTENT_TASKBAR;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE;
@@ -324,7 +325,7 @@
// that taskbar unstashes when going to 3 button mode (supportsVisualStashing() false).
boolean isManuallyStashedInApp = supportsVisualStashing()
&& !isTransientTaskbar
- && !FORCE_PERSISTENT_TASKBAR.get()
+ && !ENABLE_TASKBAR_PINNING.get()
&& mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF);
boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible;
updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp);
@@ -353,7 +354,7 @@
* Returns whether the user can manually stash the taskbar based on the current device state.
*/
protected boolean supportsManualStashing() {
- if (FORCE_PERSISTENT_TASKBAR.get()) {
+ if (ENABLE_TASKBAR_PINNING.get() && mPrefs.getBoolean(TASKBAR_PINNING_KEY, false)) {
return false;
}
return supportsVisualStashing()
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index 6034739..f099e06 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -218,7 +218,8 @@
mAllAppsButton.setOnClickListener(mControllerCallbacks.getAllAppsButtonClickListener());
}
if (mTaskbarDivider != null) {
- //TODO(b/265434705): set long press listener
+ mTaskbarDivider.setOnLongClickListener(
+ mControllerCallbacks.getTaskbarDividerLongClickListener());
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 6eb409e..ec3d1bc 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -641,6 +641,13 @@
};
}
+ public View.OnLongClickListener getTaskbarDividerLongClickListener() {
+ return v -> {
+ mControllers.taskbarPinningController.showPinningView(v);
+ return true;
+ };
+ }
+
public View.OnLongClickListener getIconOnLongClickListener() {
return mControllers.taskbarDragController::startDragOnLongClick;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java
index 08d147f..163c36f 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java
@@ -56,6 +56,10 @@
return RemoteViews.startPendingIntent(hostView, pendingIntent,
remoteResponse.getLaunchOptions(view));
}
+ if (mLauncher.getSplitToWorkspaceController().handleSecondWidgetSelectionForSplit(view,
+ pendingIntent)) {
+ return true;
+ }
Pair<Intent, ActivityOptions> options = remoteResponse.getLaunchOptions(view);
ActivityOptionsWrapper activityOptions = mLauncher.getAppTransitionManager()
.getActivityLaunchOptions(hostView);
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 613e0f1..d67dbae 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -74,6 +74,7 @@
import android.hardware.devicestate.DeviceStateManager;
import android.hardware.display.DisplayManager;
import android.media.permission.SafeCloseable;
+import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.IBinder;
@@ -91,6 +92,7 @@
import androidx.annotation.BinderThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.AbstractFloatingView;
@@ -764,6 +766,7 @@
mActiveOnBackAnimationCallback.onBackStarted(backEvent);
}
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
@Override
public void onBackInvoked() {
// Recreate mActiveOnBackAnimationCallback if necessary to avoid NPE
@@ -970,8 +973,8 @@
return mTaskbarUIController;
}
- public SplitSelectStateController getSplitSelectStateController() {
- return mSplitSelectStateController;
+ public SplitToWorkspaceController getSplitToWorkspaceController() {
+ return mSplitToWorkspaceController;
}
public <T extends OverviewActionsView> T getActionsView() {
diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
index fd7b343..8135238 100644
--- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
@@ -128,19 +128,19 @@
* A menu item, "Save app pair", that allows the user to preserve the current app combination as
* a single persistent icon on the Home screen, allowing for quick split screen initialization.
*/
- class SaveAppPairSystemShortcut extends SystemShortcut {
-
+ class SaveAppPairSystemShortcut extends SystemShortcut<BaseDraggingActivity> {
private final TaskView mTaskView;
- public SaveAppPairSystemShortcut(BaseDraggingActivity target, TaskView taskView) {
- super(R.drawable.ic_save_app_pair, R.string.save_app_pair, target,
+ public SaveAppPairSystemShortcut(BaseDraggingActivity activity, TaskView taskView) {
+ super(R.drawable.ic_save_app_pair, R.string.save_app_pair, activity,
taskView.getItemInfo(), taskView);
mTaskView = taskView;
}
@Override
public void onClick(View view) {
- // TODO (b/274189428): Call "saveAppPair" function in new AppPairController class
+ ((RecentsView) mTarget.getOverviewPanel())
+ .getSplitSelectController().getAppPairsController().saveAppPair(mTaskView);
}
}
diff --git a/quickstep/src/com/android/quickstep/util/AppPairsController.java b/quickstep/src/com/android/quickstep/util/AppPairsController.java
new file mode 100644
index 0000000..cbde257
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/AppPairsController.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2023 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.quickstep.util;
+
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
+import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
+
+import android.content.Context;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
+import com.android.launcher3.icons.IconCache;
+import com.android.launcher3.model.data.FolderInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.quickstep.views.TaskView;
+
+/**
+ * Mini controller class that handles app pair interactions: saving, modifying, deleting, etc.
+ */
+public class AppPairsController {
+
+ private static final int POINT_THREE_RATIO = 0;
+ private static final int POINT_FIVE_RATIO = 1;
+ private static final int POINT_SEVEN_RATIO = 2;
+ /**
+ * Used to calculate {@link #complement(int)}
+ */
+ private static final int FULL_RATIO = 2;
+
+ private static final int LEFT_TOP = 0;
+ private static final int RIGHT_BOTTOM = 1 << 2;
+
+ // TODO (jeremysim b/274189428): Support saving different ratios in future.
+ public int DEFAULT_RATIO = POINT_FIVE_RATIO;
+
+ private final Context mContext;
+ private final SplitSelectStateController mSplitSelectStateController;
+ public AppPairsController(Context context,
+ SplitSelectStateController splitSelectStateController) {
+ mContext = context;
+ mSplitSelectStateController = splitSelectStateController;
+ }
+
+ /**
+ * Creates a new app pair ItemInfo and adds it to the workspace
+ */
+ public void saveAppPair(TaskView taskView) {
+ TaskView.TaskIdAttributeContainer[] attributes = taskView.getTaskIdAttributeContainers();
+ WorkspaceItemInfo app1 = attributes[0].getItemInfo().clone();
+ WorkspaceItemInfo app2 = attributes[1].getItemInfo().clone();
+ app1.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
+ app2.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
+ app1.rank = DEFAULT_RATIO + LEFT_TOP;
+ app2.rank = complement(DEFAULT_RATIO) + RIGHT_BOTTOM;
+ FolderInfo newAppPair = FolderInfo.createAppPair(app1, app2);
+ // TODO (jeremysim b/274189428): Generate default title here.
+ newAppPair.title = "App pair 1";
+
+ IconCache iconCache = LauncherAppState.getInstance(mContext).getIconCache();
+ MODEL_EXECUTOR.execute(() -> {
+ newAppPair.contents.forEach(member -> {
+ member.title = "";
+ member.bitmap = iconCache.getDefaultIcon(newAppPair.user);
+ iconCache.getTitleAndIcon(member, member.usingLowResIcon());
+ });
+ MAIN_EXECUTOR.execute(() -> {
+ LauncherAccessibilityDelegate delegate =
+ Launcher.getLauncher(mContext).getAccessibilityDelegate();
+ if (delegate != null) {
+ MAIN_EXECUTOR.execute(() -> delegate.addToWorkspace(newAppPair, true));
+ }
+ });
+ });
+
+ }
+
+ /**
+ * Used to calculate the "opposite" side of the split ratio, so we can know how big the split
+ * apps are supposed to be. This math works because POINT_THREE_RATIO is internally represented
+ * by 0, POINT_FIVE_RATIO is represented by 1, and POINT_SEVEN_RATIO is represented by 2. There
+ * are no other supported ratios for now.
+ */
+ private int complement(int ratio1) {
+ int ratio2 = FULL_RATIO - ratio1;
+ return ratio2;
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index d44d7f6..60af09f 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -84,6 +84,7 @@
private final Handler mHandler;
private final RecentsModel mRecentTasksModel;
private final SplitAnimationController mSplitAnimationController;
+ private final AppPairsController mAppPairsController;
private StatsLogManager mStatsLogManager;
private final SystemUiProxy mSystemUiProxy;
private final StateManager mStateManager;
@@ -97,8 +98,15 @@
private UserHandle mInitialUser;
private int mInitialTaskId = INVALID_TASK_ID;
/** {@link #mSecondTaskIntent} and {@link #mSecondUser} (the user of the Intent) are set
- * together when split is confirmed with an Intent. */
+ * together when split is confirmed with an Intent. Either this or {@link #mSecondPendingIntent}
+ * will be set, but not both
+ */
private Intent mSecondTaskIntent;
+ /**
+ * Set when split is confirmed via a widget. Either this or {@link #mSecondTaskIntent} will be
+ * set, but not both
+ */
+ private PendingIntent mSecondPendingIntent;
private UserHandle mSecondUser;
private int mSecondTaskId = INVALID_TASK_ID;
private boolean mRecentsAnimationRunning;
@@ -128,6 +136,7 @@
mDepthController = depthController;
mRecentTasksModel = recentsModel;
mSplitAnimationController = new SplitAnimationController(this);
+ mAppPairsController = new AppPairsController(context, this);
}
/**
@@ -247,6 +256,16 @@
}
/**
+ * To be called as soon as user selects the second app (even if animations aren't complete)
+ * Sets {@link #mSecondUser} from that of the pendingIntent
+ * @param pendingIntent The second PendingIntent that will be launched.
+ */
+ public void setSecondTask(PendingIntent pendingIntent) {
+ mSecondPendingIntent = pendingIntent;
+ mSecondUser = pendingIntent.getCreatorUserHandle();
+ }
+
+ /**
* To be called when we want to launch split pairs from an existing GroupedTaskView.
*/
public void launchTasks(GroupedTaskView groupedTaskView, Consumer<Boolean> callback,
@@ -290,17 +309,18 @@
if (freezeTaskList) {
options1.setFreezeRecentTasksReordering();
}
+ boolean hasSecondaryPendingIntent = mSecondPendingIntent != null;
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
final RemoteSplitLaunchTransitionRunner animationRunner =
new RemoteSplitLaunchTransitionRunner(taskId1, taskId2, callback);
final RemoteTransition remoteTransition = new RemoteTransition(animationRunner,
ActivityThread.currentActivityThread().getApplicationThread(),
"LaunchSplitPair");
- if (intent1 == null && intent2 == null) {
+ if (intent1 == null && (intent2 == null && !hasSecondaryPendingIntent)) {
mSystemUiProxy.startTasks(taskId1, options1.toBundle(), taskId2,
null /* options2 */, stagePosition, splitRatio, remoteTransition,
shellInstanceId);
- } else if (intent2 == null) {
+ } else if (intent2 == null && !hasSecondaryPendingIntent) {
launchIntentOrShortcut(intent1, mInitialUser, options1, taskId2, stagePosition,
splitRatio, remoteTransition, shellInstanceId);
} else if (intent1 == null) {
@@ -310,7 +330,9 @@
} else {
mSystemUiProxy.startIntents(getPendingIntent(intent1, mInitialUser),
getShortcutInfo(intent1, mInitialUser), options1.toBundle(),
- getPendingIntent(intent2, mSecondUser),
+ hasSecondaryPendingIntent
+ ? mSecondPendingIntent
+ : getPendingIntent(intent2, mSecondUser),
getShortcutInfo(intent2, mSecondUser), null /* options2 */,
stagePosition, splitRatio, remoteTransition, shellInstanceId);
}
@@ -321,11 +343,11 @@
animationRunner, 300, 150,
ActivityThread.currentActivityThread().getApplicationThread());
- if (intent1 == null && intent2 == null) {
+ if (intent1 == null && (intent2 == null && !hasSecondaryPendingIntent)) {
mSystemUiProxy.startTasksWithLegacyTransition(taskId1, options1.toBundle(),
taskId2, null /* options2 */, stagePosition, splitRatio, adapter,
shellInstanceId);
- } else if (intent2 == null) {
+ } else if (intent2 == null && !hasSecondaryPendingIntent) {
launchIntentOrShortcutLegacy(intent1, mInitialUser, options1, taskId2,
stagePosition, splitRatio, adapter, shellInstanceId);
} else if (intent1 == null) {
@@ -336,7 +358,9 @@
mSystemUiProxy.startIntentsWithLegacyTransition(
getPendingIntent(intent1, mInitialUser),
getShortcutInfo(intent1, mInitialUser), options1.toBundle(),
- getPendingIntent(intent2, mSecondUser),
+ hasSecondaryPendingIntent
+ ? mSecondPendingIntent
+ : getPendingIntent(intent2, mSecondUser),
getShortcutInfo(intent2, mSecondUser), null /* options2 */, stagePosition,
splitRatio, adapter, shellInstanceId);
}
@@ -374,7 +398,22 @@
}
}
+ /**
+ * We treat launching by intents as grouped in two ways,
+ * If {@param intent} represents the first app, we always convert the intent to pending intent
+ * It it represents second app, either the second intent OR mSecondPendingIntent will be used
+ * convert second intent to a pendingIntent OR return mSecondPendingIntent as is
+ */
private PendingIntent getPendingIntent(Intent intent, UserHandle user) {
+ boolean isParamFirstIntent = intent != null && intent == mInitialTaskIntent;
+ if (!isParamFirstIntent && mSecondPendingIntent != null) {
+ // Because mSecondPendingIntent and mSecondTaskIntent can't both be set, we know we need
+ // to be using mSecondPendingIntent
+ return mSecondPendingIntent;
+ }
+
+ // intent param must either be mInitialTaskIntent or mSecondTaskIntent, convert either to
+ // a new PendingIntent
return intent == null ? null : (user != null
? PendingIntent.getActivityAsUser(mContext, 0, intent,
FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, null /* options */, user)
@@ -546,6 +585,7 @@
mSplitEvent = null;
mAnimateCurrentTaskDismissal = false;
mDismissingFromSplitPair = false;
+ mSecondPendingIntent = null;
}
/**
@@ -577,7 +617,8 @@
}
private boolean isSecondTaskIntentSet() {
- return (mSecondTaskId != INVALID_TASK_ID || mSecondTaskIntent != null);
+ return (mSecondTaskId != INVALID_TASK_ID || mSecondTaskIntent != null
+ || mSecondPendingIntent != null);
}
public void setFirstFloatingTaskView(FloatingTaskView floatingTaskView) {
@@ -587,4 +628,8 @@
public FloatingTaskView getFirstFloatingTaskView() {
return mFirstFloatingTaskView;
}
+
+ public AppPairsController getAppPairsController() {
+ return mAppPairsController;
+ }
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
index dd10c2d..148a45a 100644
--- a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
@@ -21,9 +21,15 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.PendingIntent;
import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.view.View;
@@ -56,13 +62,37 @@
}
/**
+ * Handles widget selection from staged split.
+ * @param view Original widget view
+ * @param pendingIntent Provided by widget via InteractionHandler
+ * @return {@code true} if we can attempt launch the widget into split, {@code false} otherwise
+ * to allow launcher to handle the click
+ */
+ public boolean handleSecondWidgetSelectionForSplit(View view, PendingIntent pendingIntent) {
+ if (shouldIgnoreSecondSplitLaunch()) {
+ return false;
+ }
+
+ // Convert original widgetView into bitmap to use for animation
+ // TODO(b/276361926) get the icon for this widget via PackageManager?
+ int width = view.getWidth();
+ int height = view.getHeight();
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ view.draw(canvas);
+
+ mController.setSecondTask(pendingIntent);
+
+ startWorkspaceAnimation(view, bitmap, null /*icon*/);
+ return true;
+ }
+
+ /**
* Handles second app selection from stage split. If the item can't be opened in split or
* it's not in stage split state, we pass it onto Launcher's default item click handler.
*/
public boolean handleSecondAppSelectionForSplit(View view) {
- if ((!ENABLE_SPLIT_FROM_FULLSCREEN_WITH_KEYBOARD_SHORTCUTS.get()
- && !ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get())
- || !mController.isSplitSelectActive()) {
+ if (shouldIgnoreSecondSplitLaunch()) {
return false;
}
Object tag = view.getTag();
@@ -86,6 +116,12 @@
mController.setSecondTask(intent, user);
+ startWorkspaceAnimation(view, null /*bitmap*/, bitmapInfo.newIcon(mLauncher));
+ return true;
+ }
+
+ private void startWorkspaceAnimation(@NonNull View view, @Nullable Bitmap bitmap,
+ @Nullable Drawable icon) {
boolean isTablet = mLauncher.getDeviceProfile().isTablet;
SplitAnimationTimings timings = AnimUtils.getDeviceSplitToConfirmTimings(isTablet);
PendingAnimation pendingAnimation = new PendingAnimation(timings.getDuration());
@@ -107,8 +143,7 @@
false /* fadeWithThumbnail */, true /* isStagedTask */);
FloatingTaskView secondFloatingTaskView = FloatingTaskView.getFloatingTaskView(mLauncher,
- view, null /* thumbnail */, bitmapInfo.newIcon(mLauncher),
- secondTaskStartingBounds);
+ view, bitmap, icon, secondTaskStartingBounds);
secondFloatingTaskView.setAlpha(1);
secondFloatingTaskView.addConfirmAnimation(pendingAnimation, secondTaskStartingBounds,
secondTaskEndingBounds, true /* fadeWithThumbnail */, false /* isStagedTask */);
@@ -138,6 +173,11 @@
}
});
pendingAnimation.buildAnim().start();
- return true;
+ }
+
+ private boolean shouldIgnoreSecondSplitLaunch() {
+ return (!ENABLE_SPLIT_FROM_FULLSCREEN_WITH_KEYBOARD_SHORTCUTS.get()
+ && !ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get())
+ || !mController.isSplitSelectActive();
}
}
diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarBaseTestCase.kt b/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarBaseTestCase.kt
index 3bf4ad3..20466ad 100644
--- a/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarBaseTestCase.kt
+++ b/quickstep/tests/src/com/android/launcher3/taskbar/TaskbarBaseTestCase.kt
@@ -53,6 +53,7 @@
@Mock lateinit var taskbarOverlayController: TaskbarOverlayController
@Mock lateinit var taskbarEduTooltipController: TaskbarEduTooltipController
@Mock lateinit var keyboardQuickSwitchController: KeyboardQuickSwitchController
+ @Mock lateinit var taskbarPinningController: TaskbarDividerPopupController
lateinit var taskbarControllers: TaskbarControllers
@@ -91,7 +92,8 @@
taskbarSpringOnStashController,
taskbarRecentAppsController,
taskbarEduTooltipController,
- keyboardQuickSwitchController
+ keyboardQuickSwitchController,
+ taskbarPinningController,
)
}
}
diff --git a/quickstep/tests/src/com/android/quickstep/util/SplitSelectStateControllerTest.kt b/quickstep/tests/src/com/android/quickstep/util/SplitSelectStateControllerTest.kt
index 512df8e..acfd54c 100644
--- a/quickstep/tests/src/com/android/quickstep/util/SplitSelectStateControllerTest.kt
+++ b/quickstep/tests/src/com/android/quickstep/util/SplitSelectStateControllerTest.kt
@@ -18,6 +18,7 @@
package com.android.quickstep.util
import android.app.ActivityManager
+import android.app.PendingIntent
import android.content.ComponentName
import android.content.Context
import android.content.Intent
@@ -32,6 +33,8 @@
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.util.ComponentKey
import com.android.launcher3.util.SplitConfigurationOptions
+import com.android.launcher3.util.SplitConfigurationOptions.StagePosition
+import com.android.launcher3.util.mock
import com.android.launcher3.util.withArgCaptor
import com.android.quickstep.RecentsModel
import com.android.quickstep.SystemUiProxy
@@ -59,6 +62,7 @@
@Mock lateinit var handler: Handler
@Mock lateinit var context: Context
@Mock lateinit var recentsModel: RecentsModel
+ @Mock lateinit var pendingIntent: PendingIntent
lateinit var splitSelectStateController: SplitSelectStateController
@@ -348,6 +352,14 @@
assertFalse(splitSelectStateController.isSplitSelectActive)
}
+ @Test
+ fun secondPendingIntentSet() {
+ val itemInfo = ItemInfo()
+ splitSelectStateController.setInitialTaskSelect(null, 0, itemInfo, null, 1)
+ splitSelectStateController.setSecondTask(pendingIntent)
+ assertTrue(splitSelectStateController.isBothSplitAppsConfirmed)
+ }
+
// Generate GroupTask with default userId.
private fun generateGroupTask(
task1ComponentName: ComponentName,
diff --git a/res/drawable/bottom_rounded_popup_ripple.xml b/res/drawable/bottom_rounded_popup_ripple.xml
new file mode 100644
index 0000000..739833a
--- /dev/null
+++ b/res/drawable/bottom_rounded_popup_ripple.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="#FFFFFFFF"/>
+ <corners android:bottomLeftRadius="@dimen/dialogCornerRadius"
+ android:bottomRightRadius="@dimen/dialogCornerRadius"
+ android:topLeftRadius="0dp"
+ android:topRightRadius="0dp"/>
+ </shape>
+ </item>
+</ripple>
\ No newline at end of file
diff --git a/res/drawable/ic_touch.xml b/res/drawable/ic_touch.xml
new file mode 100644
index 0000000..ea0e05c
--- /dev/null
+++ b/res/drawable/ic_touch.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M18.19,12.44l-3.24,-1.62c1.29,-1 2.12,-2.56 2.12,-4.32c0,-3.03 -2.47,-5.5 -5.5,-5.5s-5.5,2.47 -5.5,5.5c0,2.13 1.22,3.98 3,4.89v3.26c-2.11,-0.45 -2.01,-0.44 -2.26,-0.44c-0.53,0 -1.03,0.21 -1.41,0.59L4,16.22l5.09,5.09C9.52,21.75 10.12,22 10.74,22h6.3c0.98,0 1.81,-0.7 1.97,-1.67l0.8,-4.71C20.03,14.32 19.38,13.04 18.19,12.44zM17.84,15.29L17.04,20h-6.3c-0.09,0 -0.17,-0.04 -0.24,-0.1l-3.68,-3.68l4.25,0.89V6.5c0,-0.28 0.22,-0.5 0.5,-0.5c0.28,0 0.5,0.22 0.5,0.5v6h1.76l3.46,1.73C17.69,14.43 17.91,14.86 17.84,15.29zM8.07,6.5c0,-1.93 1.57,-3.5 3.5,-3.5s3.5,1.57 3.5,3.5c0,0.95 -0.38,1.81 -1,2.44V6.5c0,-1.38 -1.12,-2.5 -2.5,-2.5c-1.38,0 -2.5,1.12 -2.5,2.5v2.44C8.45,8.31 8.07,7.45 8.07,6.5z"/>
+</vector>
diff --git a/res/drawable/ic_visibility.xml b/res/drawable/ic_visibility.xml
new file mode 100644
index 0000000..864de2e
--- /dev/null
+++ b/res/drawable/ic_visibility.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportWidth="20"
+ android:viewportHeight="20">
+ <group>
+ <path
+ android:pathData="M10,5.833C7.933,5.833 6.25,7.517 6.25,9.583C6.25,11.65 7.933,13.333 10,13.333C12.067,13.333 13.75,11.65 13.75,9.583C13.75,7.517 12.067,5.833 10,5.833ZM10,11.833C8.758,11.833 7.75,10.825 7.75,9.583C7.75,8.342 8.758,7.333 10,7.333C11.242,7.333 12.25,8.342 12.25,9.583C12.25,10.825 11.242,11.833 10,11.833Z"
+ android:fillColor="#191C1D"/>
+ <path
+ android:pathData="M10.001,3.333C5.834,3.333 2.276,5.925 0.834,9.583C2.276,13.242 5.834,15.833 10.001,15.833C14.167,15.833 17.726,13.242 19.167,9.583C17.726,5.925 14.167,3.333 10.001,3.333ZM10.001,14.167C6.842,14.167 4.026,12.392 2.651,9.583C4.026,6.775 6.842,5 10.001,5C13.159,5 15.976,6.775 17.351,9.583C15.976,12.392 13.159,14.167 10.001,14.167Z"
+ android:fillColor="#191C1D"/>
+ </group>
+</vector>
diff --git a/res/drawable/taskbar_divider_bg.xml b/res/drawable/taskbar_divider_bg.xml
new file mode 100644
index 0000000..a8c2ae7
--- /dev/null
+++ b/res/drawable/taskbar_divider_bg.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle" >
+ <solid android:color="?androidprv:attr/colorSurfaceVariant"/>
+ <corners android:radius="1dp" />
+</shape>
diff --git a/res/drawable/top_rounded_popup_ripple.xml b/res/drawable/top_rounded_popup_ripple.xml
new file mode 100644
index 0000000..7468480
--- /dev/null
+++ b/res/drawable/top_rounded_popup_ripple.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="#FFFFFFFF"/>
+ <corners android:bottomLeftRadius="0dp"
+ android:bottomRightRadius="0dp"
+ android:topLeftRadius="@dimen/dialogCornerRadius"
+ android:topRightRadius="@dimen/dialogCornerRadius"/>
+ </shape>
+ </item>
+</ripple>
\ No newline at end of file
diff --git a/res/values-v31/styles.xml b/res/values-v31/styles.xml
index 008a77c..932ce38 100644
--- a/res/values-v31/styles.xml
+++ b/res/values-v31/styles.xml
@@ -24,7 +24,7 @@
<item name="android:listPreferredItemPaddingStart">24dp</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:switchStyle">@style/HomeSettings.SwitchStyle</item>
+ <item name="android:switchStyle">@style/SwitchStyle</item>
<item name="android:textAppearanceListItem">@style/HomeSettings.PreferenceTitle</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
@@ -61,13 +61,6 @@
<item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
</style>
- <style name="HomeSettings.SwitchStyle"
- parent="@android:style/Widget.Material.CompoundButton.Switch">
- <item name="android:switchMinWidth">52dp</item>
- <item name="android:thumb">@drawable/home_settings_switch_thumb</item>
- <item name="android:track">@drawable/home_settings_switch_track</item>
- </style>
-
<style name="HomeSettings.PreferenceTitle"
parent="@android:style/TextAppearance.Material.Subhead">
<item name="android:fontFamily">google-sans</item>
diff --git a/res/values-v33/style.xml b/res/values-v33/style.xml
index bd48468..1261b23 100644
--- a/res/values-v33/style.xml
+++ b/res/values-v33/style.xml
@@ -23,7 +23,7 @@
<item name="android:listPreferredItemPaddingStart">24dp</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:switchStyle">@style/HomeSettings.SwitchStyle</item>
+ <item name="android:switchStyle">@style/SwitchStyle</item>
<item name="android:textAppearanceListItem">@style/HomeSettings.PreferenceTitle</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 98d09e7..0714863 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -65,12 +65,19 @@
<item name="overviewScrimColor">@color/overview_scrim</item>
<item name="preloadIconAccentColor">@color/preload_icon_accent_color_light</item>
<item name="preloadIconBackgroundColor">@color/preload_icon_background_color_light</item>
-
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
+ <item name="android:switchStyle">@style/SwitchStyle</item>
+ </style>
+
+ <style name="SwitchStyle"
+ parent="@android:style/Widget.Material.CompoundButton.Switch">
+ <item name="android:switchMinWidth">52dp</item>
+ <item name="android:thumb">@drawable/home_settings_switch_thumb</item>
+ <item name="android:track">@drawable/home_settings_switch_track</item>
</style>
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme" />
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 29f4a62..31f9bfe 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -74,7 +74,8 @@
TYPE_TASKBAR_EDUCATION_DIALOG,
TYPE_TASKBAR_ALL_APPS,
TYPE_ADD_TO_HOME_CONFIRMATION,
- TYPE_TASKBAR_OVERLAY_PROXY
+ TYPE_TASKBAR_OVERLAY_PROXY,
+ TYPE_TASKBAR_PINNING_POPUP
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
@@ -102,6 +103,7 @@
public static final int TYPE_TASKBAR_ALL_APPS = 1 << 18;
public static final int TYPE_ADD_TO_HOME_CONFIRMATION = 1 << 19;
public static final int TYPE_TASKBAR_OVERLAY_PROXY = 1 << 20;
+ public static final int TYPE_TASKBAR_PINNING_POPUP = 1 << 21;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
@@ -110,7 +112,7 @@
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
| TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS
| TYPE_OPTIONS_POPUP_DIALOG | TYPE_ADD_TO_HOME_CONFIRMATION
- | TYPE_TASKBAR_OVERLAY_PROXY;
+ | TYPE_TASKBAR_OVERLAY_PROXY | TYPE_TASKBAR_PINNING_POPUP;
// Type of popups which should be kept open during launcher rebind
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b8bb305..a548992 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -63,6 +63,8 @@
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
+import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.ItemInfoMatcher.forFolderMatch;
import android.animation.Animator;
@@ -119,6 +121,7 @@
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
@@ -572,7 +575,7 @@
* Note that state handler will always be handling the back press event if the previous 3 don't.
*/
@NonNull
- @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
protected OnBackAnimationCallback getOnBackAnimationCallback() {
// #1 auto cancel action mode handler
if (isInAutoCancelActionMode()) {
@@ -2413,6 +2416,12 @@
(FolderInfo) item);
break;
}
+ case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR: {
+ FolderInfo info = (FolderInfo) item;
+ // TODO (jeremysim b/274189428): Create app pair icon
+ view = null;
+ break;
+ }
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
case LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET: {
view = inflateAppWidget((LauncherAppWidgetInfo) item);
diff --git a/src/com/android/launcher3/LauncherPrefs.kt b/src/com/android/launcher3/LauncherPrefs.kt
index fb4da0c..c98df1b 100644
--- a/src/com/android/launcher3/LauncherPrefs.kt
+++ b/src/com/android/launcher3/LauncherPrefs.kt
@@ -273,12 +273,15 @@
@JvmStatic fun get(context: Context): LauncherPrefs = INSTANCE.get(context)
+ const val TASKBAR_PINNING_KEY = "TASKBAR_PINNING_KEY"
@JvmField val ICON_STATE = nonRestorableItem(LauncherAppState.KEY_ICON_STATE, "", true)
@JvmField val THEMED_ICONS = backedUpItem(Themes.KEY_THEMED_ICONS, false, true)
@JvmField val PROMISE_ICON_IDS = backedUpItem(InstallSessionHelper.PROMISE_ICON_IDS, "")
@JvmField val WORK_EDU_STEP = backedUpItem(WorkProfileManager.KEY_WORK_EDU_STEP, 0)
@JvmField val WORKSPACE_SIZE = backedUpItem(DeviceGridState.KEY_WORKSPACE_SIZE, "", true)
@JvmField val HOTSEAT_COUNT = backedUpItem(DeviceGridState.KEY_HOTSEAT_COUNT, -1, true)
+ @JvmField val TASKBAR_PINNING = backedUpItem(TASKBAR_PINNING_KEY, false)
+
@JvmField
val DEVICE_TYPE =
backedUpItem(DeviceGridState.KEY_DEVICE_TYPE, InvariantDeviceProfile.TYPE_PHONE, true)
diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java
index 52d814c..b65e96b 100644
--- a/src/com/android/launcher3/LauncherSettings.java
+++ b/src/com/android/launcher3/LauncherSettings.java
@@ -112,6 +112,10 @@
*/
public static final int ITEM_TYPE_DEEP_SHORTCUT = 6;
+ /**
+ * The favorite is an app pair for launching split screen
+ */
+ public static final int ITEM_TYPE_APP_PAIR = 10;
// *** Below enum values are used for metrics purpose but not used in Favorites DB ***
@@ -233,6 +237,7 @@
case ITEM_TYPE_DEEP_SHORTCUT: return "DEEPSHORTCUT";
case ITEM_TYPE_TASK: return "TASK";
case ITEM_TYPE_QSB: return "QSB";
+ case ITEM_TYPE_APP_PAIR: return "APP_PAIR";
default: return String.valueOf(type);
}
}
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 27119ae..a7a25f4 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -408,6 +408,14 @@
LauncherSettings.Favorites.CONTAINER_DESKTOP,
screenId, coordinates[0], coordinates[1]);
mContext.bindItems(Collections.singletonList(info), true, accessibility);
+ } else if (item instanceof FolderInfo fi) {
+ mContext.getModelWriter().addItemToDatabase(fi,
+ LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId, coordinates[0],
+ coordinates[1]);
+ fi.contents.forEach(member -> {
+ mContext.getModelWriter().addItemToDatabase(member, fi.id, -1, -1, -1);
+ });
+ mContext.bindItems(Collections.singletonList(fi), true, accessibility);
}
}));
return true;
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index b485780..470a75c 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -1270,6 +1270,11 @@
rv.addOnScrollListener(mScrollListener);
}
+ /** Returns the instance of @{code SearchTransitionController}. */
+ public SearchTransitionController getSearchTransitionController() {
+ return mSearchTransitionController;
+ }
+
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
public class AdapterHolder {
public static final int MAIN = 0;
diff --git a/src/com/android/launcher3/allapps/SearchTransitionController.java b/src/com/android/launcher3/allapps/SearchTransitionController.java
index de65302..b01ea53 100644
--- a/src/com/android/launcher3/allapps/SearchTransitionController.java
+++ b/src/com/android/launcher3/allapps/SearchTransitionController.java
@@ -28,6 +28,7 @@
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.Log;
@@ -79,6 +80,7 @@
private ObjectAnimator mSearchToAzAnimator = null;
private float mSearchToAzProgress = 1f;
+ private boolean mSkipNextAnimationWithinAllApps;
public SearchTransitionController(ActivityAllAppsContainerView<?> allAppsContainerView) {
mAllAppsContainerView = allAppsContainerView;
@@ -108,11 +110,16 @@
mSearchToAzAnimator = ObjectAnimator.ofFloat(this, SEARCH_TO_AZ_PROGRESS, targetProgress);
boolean inAllApps = mAllAppsContainerView.isInAllApps();
- if (!inAllApps) {
+ TimeInterpolator timeInterpolator =
+ inAllApps ? INTERPOLATOR_WITHIN_ALL_APPS : INTERPOLATOR_TRANSITIONING_TO_ALL_APPS;
+ if (mSkipNextAnimationWithinAllApps) {
+ timeInterpolator = INSTANT;
+ mSkipNextAnimationWithinAllApps = false;
+ }
+ if (timeInterpolator == INSTANT) {
duration = 0; // Don't want to animate when coming from QSB.
}
- mSearchToAzAnimator.setDuration(duration).setInterpolator(
- inAllApps ? INTERPOLATOR_WITHIN_ALL_APPS : INTERPOLATOR_TRANSITIONING_TO_ALL_APPS);
+ mSearchToAzAnimator.setDuration(duration).setInterpolator(timeInterpolator);
mSearchToAzAnimator.addListener(forEndCallback(() -> mSearchToAzAnimator = null));
if (!goingToSearch) {
mSearchToAzAnimator.addListener(forSuccessCallback(() -> {
@@ -338,4 +345,12 @@
private float getSearchToAzProgress() {
return mSearchToAzProgress;
}
+
+ /**
+ * This should only be called from {@code LauncherSearchSessionManager} when app restarts due to
+ * theme changes.
+ */
+ public void setSkipAnimationWithinAllApps(boolean skip) {
+ mSkipNextAnimationWithinAllApps = skip;
+ }
}
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index b0f6e13..0e3b06c 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -190,14 +190,15 @@
for (ItemInfo item : items) {
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
+ case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR:
folders.remove(item.id);
if (FeatureFlags.IS_STUDIO_BUILD) {
for (ItemInfo info : itemsIdMap) {
if (info.container == item.id) {
// We are deleting a folder which still contains items that
// think they are contained by that folder.
- String msg = "deleting a folder (" + item + ") which still " +
- "contains items (" + info + ")";
+ String msg = "deleting a collection (" + item + ") which still "
+ + "contains items (" + info + ")";
Log.e(TAG, msg);
}
}
@@ -238,6 +239,7 @@
itemsIdMap.put(item.id, item);
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
+ case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR:
folders.put(item.id, (FolderInfo) item);
workspaceItems.add(item);
break;
@@ -250,15 +252,14 @@
} else {
if (newItem) {
if (!folders.containsKey(item.container)) {
- // Adding an item to a folder that doesn't exist.
- String msg = "adding item: " + item + " to a folder that " +
- " doesn't exist";
+ // Adding an item to a nonexistent collection.
+ String msg = "attempted to add item: " + item + " to a nonexistent app"
+ + " collection";
Log.e(TAG, msg);
}
} else {
findOrMakeFolder(item.container).add((WorkspaceItemInfo) item, false);
}
-
}
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
diff --git a/src/com/android/launcher3/model/data/FolderInfo.java b/src/com/android/launcher3/model/data/FolderInfo.java
index 524b769..e5a0eb1 100644
--- a/src/com/android/launcher3/model/data/FolderInfo.java
+++ b/src/com/android/launcher3/model/data/FolderInfo.java
@@ -114,6 +114,17 @@
}
/**
+ * Create an app pair, a type of app collection that launches multiple apps into split screen
+ */
+ public static FolderInfo createAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) {
+ FolderInfo newAppPair = new FolderInfo();
+ newAppPair.itemType = LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR;
+ newAppPair.contents.add(app1);
+ newAppPair.contents.add(app2);
+ return newAppPair;
+ }
+
+ /**
* Add an app or shortcut
*
* @param item
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index 41a603d..bfb80b3 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -90,6 +90,7 @@
* {@link Favorites#ITEM_TYPE_SHORTCUT},
* {@link Favorites#ITEM_TYPE_DEEP_SHORTCUT}
* {@link Favorites#ITEM_TYPE_FOLDER},
+ * {@link Favorites#ITEM_TYPE_APP_PAIR},
* {@link Favorites#ITEM_TYPE_APPWIDGET} or
* {@link Favorites#ITEM_TYPE_CUSTOM_APPWIDGET}.
*/
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 02ebb15..776fe40 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -19,9 +19,10 @@
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING;
import static com.android.launcher3.Utilities.dpiFromPx;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TRANSIENT_TASKBAR;
-import static com.android.launcher3.config.FeatureFlags.FORCE_PERSISTENT_TASKBAR;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH;
@@ -45,6 +46,7 @@
import androidx.annotation.UiThread;
import androidx.annotation.VisibleForTesting;
+import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.window.CachedDisplayInfo;
import com.android.launcher3.util.window.WindowManagerProxy;
@@ -101,9 +103,12 @@
private Info mInfo;
private boolean mDestroyed = false;
+ private final LauncherPrefs mPrefs;
+
private DisplayController(Context context) {
mContext = context;
mDM = context.getSystemService(DisplayManager.class);
+ mPrefs = LauncherPrefs.get(context);
Display display = mDM.getDisplay(DEFAULT_DISPLAY);
if (Utilities.ATLEAST_S) {
@@ -144,7 +149,9 @@
// TODO(b/258604917): When running in test harness, use !sTransientTaskbarStatusForTests
// once tests are updated to expect new persistent behavior such as not allowing long press
// to stash.
- if (!Utilities.isRunningInTestHarness() && FORCE_PERSISTENT_TASKBAR.get()) {
+ if (!Utilities.isRunningInTestHarness()
+ && ENABLE_TASKBAR_PINNING.get()
+ && mPrefs.get(TASKBAR_PINNING)) {
return false;
}
return getInfo().navigationMode == NavigationMode.NO_BUTTON
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index 5730582..99616f1 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -28,7 +28,6 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
-import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Outline;
@@ -46,6 +45,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
+import androidx.annotation.RequiresApi;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Utilities;
@@ -195,7 +195,7 @@
}
@Override
- @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public void onBackProgressed(BackEvent backEvent) {
final float progress = backEvent.getProgress();
float deceleratedProgress =
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 49f3fe9..d565dc9 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -25,7 +25,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.PropertyValuesHolder;
-import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
@@ -52,6 +51,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
+import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
@@ -286,7 +286,7 @@
}
@Override
- @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public void onBackProgressed(@NonNull BackEvent backEvent) {
super.onBackProgressed(backEvent);
mFastScroller.setVisibility(backEvent.getProgress() > 0 ? View.INVISIBLE : View.VISIBLE);
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index cefba16..3141c7b 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -240,11 +240,16 @@
public void setUp() throws Exception {
mLauncher.onTestStart();
+ final boolean keyguardAlreadyVisible = sSeenKeygard;
+
sSeenKeygard = sSeenKeygard
|| !TestHelpers.wait(
Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000);
- Assert.assertFalse("Keyguard is visible, which is likely caused by a crash in SysUI",
+ Assert.assertFalse(
+ "Keyguard is visible, which is likely caused by a crash in SysUI, seeing keyguard"
+ + " for the first time = "
+ + !keyguardAlreadyVisible,
sSeenKeygard);
final String launcherPackageName = mDevice.getLauncherPackageName();
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 81f1525..9d9fdc9 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -522,6 +522,7 @@
}
@Test
+ @ScreenRecord // b/258071914
@PortraitLandscape
public void testUninstallFromAllApps() throws Exception {
installDummyAppAndWaitForUIUpdate();