Merge "Remove mPendingCallback from ActivityTracker" into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 1b3610a..f6f892b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -24,6 +24,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.view.MotionEvent;
+import android.view.View;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
@@ -209,9 +210,11 @@
mPendingAnimation = mRecentsView.createTaskLaunchAnimation(
mTaskBeingDragged, maxDuration, Interpolators.ZOOM_IN);
- mTempCords[1] = mTaskBeingDragged.getHeight();
- dl.getDescendantCoordRelativeToSelf(mTaskBeingDragged, mTempCords);
- mEndDisplacement = dl.getHeight() - mTempCords[1];
+ // Since the thumbnail is what is filling the screen, based the end displacement on it.
+ View thumbnailView = mTaskBeingDragged.getThumbnail();
+ mTempCords[1] = orientationHandler.getSecondaryDimension(thumbnailView);
+ dl.getDescendantCoordRelativeToSelf(thumbnailView, mTempCords);
+ mEndDisplacement = secondaryLayerDimension - mTempCords[1];
}
mEndDisplacement *= verticalFactor;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index 9dce984..e182c59 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -117,6 +117,7 @@
});
if (mActivity == null) {
Log.e(TAG, "Animation created, before activity");
+ anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
return anim;
}
@@ -135,6 +136,7 @@
RemoteAnimationTargetCompat runningTaskTarget = targets.findTask(mTargetTaskId);
if (runningTaskTarget == null) {
Log.e(TAG, "No closing app");
+ anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
return anim;
}
@@ -181,6 +183,7 @@
transaction.apply();
});
}
+ anim.play(valueAnimator);
return anim;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 9cf45b3..bde6f9a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -21,6 +21,7 @@
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS;
+import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import android.animation.Animator;
@@ -146,7 +147,7 @@
*/
private void prepareToAnimate(Launcher launcher) {
StateAnimationConfig config = new StateAnimationConfig();
- config.animFlags = ANIM_ALL_COMPONENTS | SKIP_OVERVIEW;
+ config.animFlags = ANIM_ALL_COMPONENTS | SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER;
config.duration = 0;
// setRecentsAttachedToAppWindow() will animate recents out.
launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();
diff --git a/quickstep/res/drawable/home_gesture.xml b/quickstep/res/drawable/home_gesture.xml
new file mode 100644
index 0000000..c253b7e
--- /dev/null
+++ b/quickstep/res/drawable/home_gesture.xml
@@ -0,0 +1,46 @@
+<!--
+ Copyright (C) 2020 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.
+-->
+<!-- Dummy translating rectangle until we have a proper animation. -->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt" >
+ <aapt:attr name="android:drawable">
+ <vector
+ android:height="64dp"
+ android:width="64dp"
+ android:viewportHeight="600"
+ android:viewportWidth="600" >
+ <group
+ android:name="translationGroup"
+ android:pivotX="300.0"
+ android:pivotY="300.0"
+ android:rotation="180.0" >
+ <path
+ android:fillColor="#eeeeee"
+ android:pathData="M300,70 l 0,-70 70,0 0,140 -70,0 z" />
+ </group>
+ </vector>
+ </aapt:attr>
+
+ <target android:name="translationGroup">
+ <aapt:attr name="android:animation">
+ <objectAnimator
+ android:duration="3000"
+ android:propertyName="translateY"
+ android:valueFrom="0"
+ android:valueTo="-100" />
+ </aapt:attr>
+ </target>
+</animated-vector>
\ No newline at end of file
diff --git a/quickstep/res/layout/gesture_tutorial_fragment.xml b/quickstep/res/layout/gesture_tutorial_fragment.xml
index 0bc062a..69481ad 100644
--- a/quickstep/res/layout/gesture_tutorial_fragment.xml
+++ b/quickstep/res/layout/gesture_tutorial_fragment.xml
@@ -39,79 +39,58 @@
android:src="@drawable/gesture_tutorial_close_button"/>
<LinearLayout
+ android:id="@+id/gesture_tutorial_fragment_titles_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_marginTop="70dp"
+ android:layout_alignParentTop="true"
+ android:focusable="true"
+ android:gravity="center_horizontal"
android:orientation="vertical">
- <LinearLayout
- android:id="@+id/gesture_tutorial_fragment_titles_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:focusable="true">
-
- <TextView
- android:id="@+id/gesture_tutorial_fragment_title_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginStart="@dimen/gesture_tutorial_title_margin_start_end"
- android:layout_marginEnd="@dimen/gesture_tutorial_title_margin_start_end"
- style="@style/TextAppearance.BackGestureTutorial.Title"/>
-
- <TextView
- android:id="@+id/gesture_tutorial_fragment_subtitle_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="10dp"
- android:layout_marginStart="@dimen/gesture_tutorial_subtitle_margin_start_end"
- android:layout_marginEnd="@dimen/gesture_tutorial_subtitle_margin_start_end"
- style="@style/TextAppearance.BackGestureTutorial.Subtitle"/>
-
- </LinearLayout>
-
- <Space
+ <TextView
+ android:id="@+id/gesture_tutorial_fragment_title_view"
android:layout_width="wrap_content"
- android:layout_weight="1"
- android:layout_height="0dp"
- android:layout_marginTop="48dp"
- android:layout_gravity="center_horizontal"
- android:gravity="center_horizontal"
- android:orientation="vertical"/>
-
- <!-- android:stateListAnimator="@null" removes shadow and normal on click behavior (increase
- of elevation and shadow) which is replaced by ripple effect in android:foreground -->
- <RelativeLayout
- android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="46dp"
- android:layout_marginBottom="48dp"
- android:layout_gravity="center_horizontal">
+ android:layout_marginStart="@dimen/gesture_tutorial_title_margin_start_end"
+ android:layout_marginEnd="@dimen/gesture_tutorial_title_margin_start_end"
+ style="@style/TextAppearance.GestureTutorial.Title"/>
- <Button
- android:id="@+id/gesture_tutorial_fragment_action_button"
- android:layout_width="142dp"
- android:layout_height="49dp"
- android:layout_marginEnd="@dimen/gesture_tutorial_button_margin_start_end"
- android:layout_alignParentEnd="true"
- android:stateListAnimator="@null"
- android:background="@drawable/gesture_tutorial_action_button_background"
- android:foreground="?android:attr/selectableItemBackgroundBorderless"
- style="@style/TextAppearance.BackGestureTutorial.ButtonLabel"/>
-
- <Button
- android:id="@+id/gesture_tutorial_fragment_action_text_button"
- android:layout_width="142dp"
- android:layout_height="49dp"
- android:layout_marginStart="@dimen/gesture_tutorial_button_margin_start_end"
- android:layout_alignParentStart="true"
- android:stateListAnimator="@null"
- android:background="@null"
- android:foreground="?android:attr/selectableItemBackgroundBorderless"
- style="@style/TextAppearance.BackGestureTutorial.TextButtonLabel"/>
-
- </RelativeLayout>
+ <TextView
+ android:id="@+id/gesture_tutorial_fragment_subtitle_view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginStart="@dimen/gesture_tutorial_subtitle_margin_start_end"
+ android:layout_marginEnd="@dimen/gesture_tutorial_subtitle_margin_start_end"
+ style="@style/TextAppearance.GestureTutorial.Subtitle"/>
</LinearLayout>
+
+ <!-- android:stateListAnimator="@null" removes shadow and normal on click behavior (increase
+ of elevation and shadow) which is replaced by ripple effect in android:foreground -->
+ <Button
+ android:id="@+id/gesture_tutorial_fragment_action_button"
+ android:layout_width="142dp"
+ android:layout_height="49dp"
+ android:layout_marginEnd="@dimen/gesture_tutorial_button_margin_start_end"
+ android:layout_marginBottom="48dp"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentBottom="true"
+ android:stateListAnimator="@null"
+ android:background="@drawable/gesture_tutorial_action_button_background"
+ android:foreground="?android:attr/selectableItemBackgroundBorderless"
+ style="@style/TextAppearance.GestureTutorial.ButtonLabel"/>
+
+ <Button
+ android:id="@+id/gesture_tutorial_fragment_action_text_button"
+ android:layout_width="142dp"
+ android:layout_height="49dp"
+ android:layout_marginStart="@dimen/gesture_tutorial_button_margin_start_end"
+ android:layout_marginBottom="48dp"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentBottom="true"
+ android:stateListAnimator="@null"
+ android:background="@null"
+ android:foreground="?android:attr/selectableItemBackgroundBorderless"
+ style="@style/TextAppearance.GestureTutorial.TextButtonLabel"/>
</RelativeLayout>
\ No newline at end of file
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index d7c976d..61690ae 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -104,11 +104,17 @@
<!-- Subtitle shown during interactive parts of Back gesture tutorial for left edge. [CHAR LIMIT=60] -->
<string name="back_gesture_tutorial_engaged_subtitle_swipe_inward_left_edge" translatable="false">That\'s it! Now try swiping from the left edge.</string>
- <!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
- <string name="back_gesture_tutorial_confirm_title" translatable="false">All set</string>
<!-- Subtitle shown on the confirmation screen after successful gesture. [CHAR LIMIT=60] -->
<string name="back_gesture_tutorial_confirm_subtitle" translatable="false">To change the sensitivity of the back gesture, go to Settings</string>
+
+ <!-- Title shown during interactive part of Home gesture tutorial. [CHAR LIMIT=30] -->
+ <string name="home_gesture_tutorial_playground_title" translatable="false">Tutorial: Go Home</string>
+ <!-- Subtitle shown during interactive parts of Home gesture tutorial. [CHAR LIMIT=60] -->
+ <string name="home_gesture_tutorial_playground_subtitle" translatable="false">Try swiping upward from the bottom edge of the screen</string>
+
+ <!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
+ <string name="gesture_tutorial_confirm_title" translatable="false">All set</string>
<!-- Button text shown on a button on the confirm screen. [CHAR LIMIT=14] -->
<string name="gesture_tutorial_action_button_label" translatable="false">Done</string>
<!-- Button text shown on a text button on the confirm screen. [CHAR LIMIT=14] -->
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index 14e054e..4915f5f 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -26,29 +26,29 @@
<item name="android:layout_height">wrap_content</item>
</style>
- <style name="TextAppearance.BackGestureTutorial"
+ <style name="TextAppearance.GestureTutorial"
parent="android:TextAppearance.Material.Body1" />
- <style name="TextAppearance.BackGestureTutorial.CallToAction"
+ <style name="TextAppearance.GestureTutorial.CallToAction"
parent="android:TextAppearance.Material.Body2" />
- <style name="TextAppearance.BackGestureTutorial.Title"
- parent="TextAppearance.BackGestureTutorial">
+ <style name="TextAppearance.GestureTutorial.Title"
+ parent="TextAppearance.GestureTutorial">
<item name="android:gravity">center</item>
<item name="android:textColor">@color/gesture_tutorial_title_color</item>
<item name="android:textSize">28sp</item>
</style>
- <style name="TextAppearance.BackGestureTutorial.Subtitle"
- parent="TextAppearance.BackGestureTutorial">
+ <style name="TextAppearance.GestureTutorial.Subtitle"
+ parent="TextAppearance.GestureTutorial">
<item name="android:gravity">center</item>
<item name="android:textColor">@color/gesture_tutorial_subtitle_color</item>
<item name="android:letterSpacing">0.03</item>
<item name="android:textSize">21sp</item>
</style>
- <style name="TextAppearance.BackGestureTutorial.ButtonLabel"
- parent="TextAppearance.BackGestureTutorial.CallToAction">
+ <style name="TextAppearance.GestureTutorial.ButtonLabel"
+ parent="TextAppearance.GestureTutorial.CallToAction">
<item name="android:gravity">center</item>
<item name="android:textColor">@color/gesture_tutorial_action_button_label_color</item>
<item name="android:letterSpacing">0.02</item>
@@ -56,8 +56,8 @@
<item name="android:textAllCaps">false</item>
</style>
- <style name="TextAppearance.BackGestureTutorial.TextButtonLabel"
- parent="TextAppearance.BackGestureTutorial.ButtonLabel">
+ <style name="TextAppearance.GestureTutorial.TextButtonLabel"
+ parent="TextAppearance.GestureTutorial.ButtonLabel">
<item name="android:textColor">@color/gesture_tutorial_primary_color</item>
</style>
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index a30e102..70cbd82 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -291,6 +291,15 @@
launcherContentAnimator.second.run();
}
});
+ } else {
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ mLauncher.addOnResumeCallback(() ->
+ ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
+ mLauncher.getStateManager().getState().getDepth(mLauncher)).start());
+ }
+ });
}
}
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 24ba89a..f83737e 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -17,6 +17,7 @@
package com.android.launcher3.statehandlers;
import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
import android.os.IBinder;
import android.util.FloatProperty;
@@ -163,7 +164,9 @@
@Override
public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config,
PendingAnimation animation) {
- if (mSurface == null || config.onlyPlayAtomicComponent()) {
+ if (mSurface == null
+ || config.onlyPlayAtomicComponent()
+ || config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)) {
return;
}
diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
index 640ae76..d58ab5d 100644
--- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialController.java
@@ -46,7 +46,7 @@
case LEFT_EDGE_BACK_NAVIGATION:
return R.string.back_gesture_tutorial_playground_title_swipe_inward_left_edge;
case BACK_NAVIGATION_COMPLETE:
- return R.string.back_gesture_tutorial_confirm_title;
+ return R.string.gesture_tutorial_confirm_title;
}
return null;
}
@@ -82,10 +82,12 @@
@Override
void onActionButtonClicked(View button) {
- hideHandCoachingAnimation();
- if (button == mActionTextButton) {
- mTutorialFragment.startSystemNavigationSetting();
- }
+ mTutorialFragment.closeTutorial();
+ }
+
+ @Override
+ void onActionTextButtonClicked(View button) {
+ mTutorialFragment.startSystemNavigationSetting();
mTutorialFragment.closeTutorial();
}
diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
index ddf1cda..59067c1 100644
--- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
@@ -15,29 +15,11 @@
*/
package com.android.quickstep.interaction;
-import android.os.Bundle;
-
import com.android.launcher3.R;
-import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureAttemptCallback;
-import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.TutorialController.TutorialType;
/** Shows the Back gesture interactive tutorial. */
-public class BackGestureTutorialFragment extends TutorialFragment
- implements BackGestureAttemptCallback {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mEdgeBackGestureHandler.registerBackGestureAttemptCallback(this);
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- mEdgeBackGestureHandler.unregisterBackGestureAttemptCallback();
- }
-
+public class BackGestureTutorialFragment extends TutorialFragment {
@Override
int getHandAnimationResId() {
return R.drawable.back_gesture;
@@ -47,11 +29,4 @@
TutorialController createController(TutorialType type) {
return new BackGestureTutorialController(this, type);
}
-
- @Override
- public void onBackGestureAttempted(BackGestureResult result) {
- if (mTutorialController != null) {
- mTutorialController.onBackGestureAttempted(result);
- }
- }
}
diff --git a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
index 414ddfa..f8d9d8d 100644
--- a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
@@ -15,11 +15,12 @@
*/
package com.android.quickstep.interaction;
+import static com.android.quickstep.interaction.TutorialFragment.KEY_TUTORIAL_TYPE;
+
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.Window;
@@ -44,13 +45,7 @@
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.gesture_tutorial_activity);
- try {
- mFragment = TutorialFragment.newInstance(BackGestureTutorialFragment.class,
- TutorialType.RIGHT_EDGE_BACK_NAVIGATION);
- } catch (InstantiationException | IllegalAccessException e) {
- Log.wtf(LOG_TAG, "Failed to create tutorial fragment!", e);
- mFragment = new BackGestureTutorialFragment();
- }
+ mFragment = TutorialFragment.newInstance(getTutorialType(getIntent().getExtras()));
getSupportFragmentManager().beginTransaction()
.add(R.id.gesture_tutorial_fragment_container, mFragment)
.commit();
@@ -77,6 +72,19 @@
}
}
+ private TutorialType getTutorialType(Bundle extras) {
+ TutorialType defaultType = TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
+
+ if (extras == null || !extras.containsKey(KEY_TUTORIAL_TYPE)) {
+ return defaultType;
+ }
+ try {
+ return TutorialType.valueOf(extras.getString(KEY_TUTORIAL_TYPE, ""));
+ } catch (IllegalArgumentException e) {
+ return defaultType;
+ }
+ }
+
private void hideSystemUI() {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
new file mode 100644
index 0000000..0bf996d
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2020 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.interaction;
+
+import static com.android.quickstep.interaction.TutorialController.TutorialType.HOME_NAVIGATION_COMPLETE;
+
+import android.view.View;
+
+import com.android.launcher3.R;
+import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
+
+/** A {@link TutorialController} for the Home tutorial. */
+final class HomeGestureTutorialController extends TutorialController {
+
+ HomeGestureTutorialController(HomeGestureTutorialFragment fragment, TutorialType tutorialType) {
+ super(fragment, tutorialType);
+ }
+
+ @Override
+ void transitToController() {
+ super.transitToController();
+ if (mTutorialType != HOME_NAVIGATION_COMPLETE) {
+ mHandCoachingAnimation.startLoopedAnimation(mTutorialType);
+ }
+ }
+
+ @Override
+ Integer getTitleStringId() {
+ switch (mTutorialType) {
+ case HOME_NAVIGATION:
+ return R.string.home_gesture_tutorial_playground_title;
+ case HOME_NAVIGATION_COMPLETE:
+ return R.string.gesture_tutorial_confirm_title;
+ }
+ return null;
+ }
+
+ @Override
+ Integer getSubtitleStringId() {
+ if (mTutorialType == TutorialType.HOME_NAVIGATION) {
+ return R.string.home_gesture_tutorial_playground_subtitle;
+ }
+ return null;
+ }
+
+ @Override
+ Integer getActionButtonStringId() {
+ if (mTutorialType == HOME_NAVIGATION_COMPLETE) {
+ return R.string.gesture_tutorial_action_button_label;
+ }
+ return null;
+ }
+
+ @Override
+ void onActionButtonClicked(View button) {
+ mTutorialFragment.closeTutorial();
+ }
+
+ @Override
+ public void onBackGestureAttempted(BackGestureResult result) {
+ switch (mTutorialType) {
+ case HOME_NAVIGATION:
+ break;
+ case HOME_NAVIGATION_COMPLETE:
+ if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT
+ || result == BackGestureResult.BACK_COMPLETED_FROM_RIGHT) {
+ mTutorialFragment.closeTutorial();
+ }
+ break;
+ }
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java
new file mode 100644
index 0000000..613f188
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 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.interaction;
+
+import com.android.launcher3.R;
+import com.android.quickstep.interaction.TutorialController.TutorialType;
+
+/** Shows the Home gesture interactive tutorial. */
+public class HomeGestureTutorialFragment extends TutorialFragment {
+ @Override
+ int getHandAnimationResId() {
+ return R.drawable.home_gesture;
+ }
+
+ @Override
+ TutorialController createController(TutorialType type) {
+ return new HomeGestureTutorialController(this, type);
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index cd4d0d8..f0cb567 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -82,6 +82,8 @@
void onActionButtonClicked(View button) {}
+ void onActionTextButtonClicked(View button) {}
+
void hideHandCoachingAnimation() {
mHandCoachingAnimation.stop();
}
@@ -94,9 +96,9 @@
private void updateTitles() {
updateTitleView(mTitleTextView, getTitleStringId(),
- R.style.TextAppearance_BackGestureTutorial_Title);
+ R.style.TextAppearance_GestureTutorial_Title);
updateTitleView(mSubtitleTextView, getSubtitleStringId(),
- R.style.TextAppearance_BackGestureTutorial_Subtitle);
+ R.style.TextAppearance_GestureTutorial_Subtitle);
}
private void updateTitleView(TextView textView, @Nullable Integer stringId, int styleId) {
@@ -112,7 +114,8 @@
private void updateActionButtons() {
updateButton(mActionButton, getActionButtonStringId(), this::onActionButtonClicked);
- updateButton(mActionTextButton, getActionTextButtonStringId(), this::onActionButtonClicked);
+ updateButton(
+ mActionTextButton, getActionTextButtonStringId(), this::onActionTextButtonClicked);
}
private void updateButton(Button button, @Nullable Integer stringId, OnClickListener listener) {
@@ -131,5 +134,7 @@
RIGHT_EDGE_BACK_NAVIGATION,
LEFT_EDGE_BACK_NAVIGATION,
BACK_NAVIGATION_COMPLETE,
+ HOME_NAVIGATION,
+ HOME_NAVIGATION_COMPLETE
}
}
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
index 09ea8d6..6346a9b 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
@@ -31,11 +31,13 @@
import androidx.fragment.app.FragmentActivity;
import com.android.launcher3.R;
+import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureAttemptCallback;
+import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.TutorialController.TutorialType;
import java.net.URISyntaxException;
-abstract class TutorialFragment extends Fragment {
+abstract class TutorialFragment extends Fragment implements BackGestureAttemptCallback {
private static final String LOG_TAG = "TutorialFragment";
private static final String SYSTEM_NAVIGATION_SETTING_INTENT =
@@ -43,7 +45,7 @@
+ ".:settings:fragment_args_key=gesture_system_navigation_input_summary;S"
+ ".:settings:show_fragment=com.android.settings.gestures"
+ ".SystemNavigationGestureSettings;end";
- private static final String KEY_TUTORIAL_TYPE = "tutorialType";
+ static final String KEY_TUTORIAL_TYPE = "tutorial_type";
TutorialType mTutorialType;
@Nullable TutorialController mTutorialController = null;
@@ -51,16 +53,34 @@
TutorialHandAnimation mHandCoachingAnimation;
EdgeBackGestureHandler mEdgeBackGestureHandler;
- public static TutorialFragment newInstance(
- Class<? extends TutorialFragment> fragmentClass, TutorialType tutorialType)
- throws java.lang.InstantiationException, IllegalAccessException {
- TutorialFragment fragment = fragmentClass.newInstance();
+ public static TutorialFragment newInstance(TutorialType tutorialType) {
+ TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
+ if (fragment == null) {
+ fragment = new BackGestureTutorialFragment();
+ tutorialType = TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
+ }
Bundle args = new Bundle();
args.putSerializable(KEY_TUTORIAL_TYPE, tutorialType);
fragment.setArguments(args);
return fragment;
}
+ @Nullable
+ private static TutorialFragment getFragmentForTutorialType(TutorialType tutorialType) {
+ switch (tutorialType) {
+ case RIGHT_EDGE_BACK_NAVIGATION:
+ case LEFT_EDGE_BACK_NAVIGATION:
+ case BACK_NAVIGATION_COMPLETE:
+ return new BackGestureTutorialFragment();
+ case HOME_NAVIGATION:
+ case HOME_NAVIGATION_COMPLETE:
+ return new HomeGestureTutorialFragment();
+ default:
+ Log.e(LOG_TAG, "Failed to find an appropriate fragment for " + tutorialType.name());
+ }
+ return null;
+ }
+
abstract int getHandAnimationResId();
abstract TutorialController createController(TutorialType type);
@@ -71,6 +91,13 @@
Bundle args = savedInstanceState != null ? savedInstanceState : getArguments();
mTutorialType = (TutorialType) args.getSerializable(KEY_TUTORIAL_TYPE);
mEdgeBackGestureHandler = new EdgeBackGestureHandler(getContext());
+ mEdgeBackGestureHandler.registerBackGestureAttemptCallback(this);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mEdgeBackGestureHandler.unregisterBackGestureAttemptCallback();
}
@Override
@@ -78,8 +105,7 @@
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
- mRootView = inflater.inflate(R.layout.gesture_tutorial_fragment,
- container, /* attachToRoot= */ false);
+ mRootView = inflater.inflate(R.layout.gesture_tutorial_fragment, container, false);
mRootView.setOnApplyWindowInsetsListener((view, insets) -> {
Insets systemInsets = insets.getInsets(WindowInsets.Type.systemBars());
mEdgeBackGestureHandler.setInsets(systemInsets.left, systemInsets.right);
@@ -131,6 +157,13 @@
return mHandCoachingAnimation;
}
+ @Override
+ public void onBackGestureAttempted(BackGestureResult result) {
+ if (mTutorialController != null) {
+ mTutorialController.onBackGestureAttempted(result);
+ }
+ }
+
void closeTutorial() {
FragmentActivity activity = getActivity();
if (activity != null) {
@@ -149,5 +182,4 @@
Log.e(LOG_TAG, "The launch Activity not found: " + e);
}
}
-
}
diff --git a/res/layout/all_apps_content_layout.xml b/res/layout/all_apps_content_layout.xml
new file mode 100644
index 0000000..5698977
--- /dev/null
+++ b/res/layout/all_apps_content_layout.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/apps_list_view_override"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@id/search_container_all_apps"
+ android:clipToPadding="false"
+ android:descendantFocusability="afterDescendants"
+ android:focusable="true"
+ android:layout_marginTop="@dimen/all_apps_header_top_padding"
+ android:orientation="vertical">
+</LinearLayout>
diff --git a/res/values-v26/styles.xml b/res/values-v26/styles.xml
index 8fb408b..d2f0802 100644
--- a/res/values-v26/styles.xml
+++ b/res/values-v26/styles.xml
@@ -20,6 +20,7 @@
<!-- Theme for the widget container. -->
<style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="android:colorPrimaryDark">#E8EAED</item>
+ <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
</style>
<style name="WidgetContainerTheme.Dark" parent="AppTheme.Dark">
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 814b728..7de44a3 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -40,8 +40,6 @@
import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.logging.UserEventDispatcher;
-import com.android.launcher3.testing.TestLogging;
-import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.ViewCache;
@@ -332,7 +330,6 @@
return;
}
try {
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: shortcut", packageName);
getSystemService(LauncherApps.class).startShortcut(packageName, id, sourceBounds,
startActivityOptions, user);
} catch (SecurityException | IllegalStateException e) {
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index 2dc7836..f69c8ed 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -41,8 +41,6 @@
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.testing.TestLogging;
-import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.util.DefaultDisplay;
@@ -173,7 +171,6 @@
startShortcutIntentSafely(intent, optsBundle, item, sourceContainer);
} else if (user == null || user.equals(Process.myUserHandle())) {
// Could be launching some bookkeeping activity
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: activity", intent);
startActivity(intent, optsBundle);
AppLaunchTracker.INSTANCE.get(this).onStartApp(intent.getComponent(),
Process.myUserHandle(), sourceContainer);
diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java
index ef353f9..ff405ec 100644
--- a/src/com/android/launcher3/CheckLongPressHelper.java
+++ b/src/com/android/launcher3/CheckLongPressHelper.java
@@ -113,7 +113,10 @@
}
private void triggerLongPress() {
- if ((mView.getParent() != null) && mView.hasWindowFocus() && !mHasPerformedLongPress) {
+ if ((mView.getParent() != null)
+ && mView.hasWindowFocus()
+ && (!mView.isPressed() || mListener == null)
+ && !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
handled = mListener.onLongClick(mView);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f69940b..bf05a24 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1547,6 +1547,7 @@
mOverlayManager.onActivityDestroyed(this);
mAppTransitionManager.unregisterRemoteAnimations();
mUserChangedCallbackCloseable.close();
+ mAllAppsController.onActivityDestroyed();
}
public LauncherAccessibilityDelegate getAccessibilityDelegate() {
@@ -1674,6 +1675,7 @@
private void processShortcutFromDrop(PendingAddShortcutInfo info) {
Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT).setComponent(info.componentName);
setWaitingForResult(PendingRequestArgs.forIntent(REQUEST_CREATE_SHORTCUT, intent, info));
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: processShortcutFromDrop");
if (!info.activityInfo.startConfigActivity(this, REQUEST_CREATE_SHORTCUT)) {
handleActivityResult(REQUEST_CREATE_SHORTCUT, RESULT_CANCELED, null);
}
diff --git a/src/com/android/launcher3/LauncherAppWidgetHost.java b/src/com/android/launcher3/LauncherAppWidgetHost.java
index 9921f76..7ea6851 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHost.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHost.java
@@ -30,6 +30,8 @@
import android.widget.Toast;
import com.android.launcher3.model.WidgetsModel;
+import com.android.launcher3.testing.TestLogging;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.widget.DeferredAppWidgetHostView;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.launcher3.widget.PendingAppWidgetHostView;
@@ -298,6 +300,7 @@
}
try {
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: startConfigActivity");
startAppWidgetConfigureActivityForResult(activity, widgetId, 0, requestCode, null);
} catch (ActivityNotFoundException | SecurityException e) {
Toast.makeText(activity, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 68b0706..071c03d 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -1,5 +1,6 @@
package com.android.launcher3.allapps;
+import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
import static com.android.launcher3.LauncherState.APPS_VIEW_ITEM_MASK;
@@ -17,7 +18,10 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
+import android.content.Context;
import android.util.FloatProperty;
+import android.view.View;
+import android.view.ViewGroup;
import android.view.animation.Interpolator;
import com.android.launcher3.DeviceProfile;
@@ -30,8 +34,11 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.states.StateAnimationConfig;
+import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ScrimView;
+import com.android.systemui.plugins.AllAppsSearchPlugin;
+import com.android.systemui.plugins.PluginListener;
/**
* Handles AllApps view transition.
@@ -43,7 +50,8 @@
* If release velocity < THRES1, snap according to either top or bottom depending on whether it's
* closer to top or closer to the page indicator.
*/
-public class AllAppsTransitionController implements StateHandler, OnDeviceProfileChangeListener {
+public class AllAppsTransitionController implements StateHandler, OnDeviceProfileChangeListener,
+ PluginListener<AllAppsSearchPlugin> {
public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PROGRESS =
new FloatProperty<AllAppsTransitionController>("allAppsProgress") {
@@ -79,6 +87,9 @@
private float mScrollRangeDelta = 0;
+ private AllAppsSearchPlugin mPlugin;
+ private View mPluginContent;
+
public AllAppsTransitionController(Launcher l) {
mLauncher = l;
mShiftRange = mLauncher.getDeviceProfile().heightPx;
@@ -145,6 +156,7 @@
setProgress(state.getVerticalProgress(mLauncher));
setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
onProgressAnimationEnd();
+ updatePlugin(state);
}
/**
@@ -178,6 +190,20 @@
builder.add(anim);
setAlphas(toState, config, builder);
+
+ updatePlugin(toState);
+ }
+
+ private void updatePlugin(LauncherState toState) {
+ if (mPlugin == null) return;
+ if (toState == ALL_APPS) {
+ // TODO: change this from toggle event to continuous transition event.
+ mPlugin.setEditText(mAppsView.getSearchUiManager().setTextSearchEnabled(true));
+ } else {
+ mAppsView.getSearchUiManager().setTextSearchEnabled(false);
+ mPlugin.setEditText(null);
+ }
+
}
public Animator createSpringAnimation(float... progressValues) {
@@ -196,10 +222,15 @@
Interpolator allAppsFade = config.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
Interpolator headerFade = config.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade);
- setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade);
- setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade);
- mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasAllAppsContent,
- setter, headerFade, allAppsFade);
+
+ if (mPlugin == null) {
+ setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade);
+ setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade);
+ mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra,
+ hasAllAppsContent, setter, headerFade, allAppsFade);
+ } else {
+ setter.setViewAlpha(mPluginContent, hasAllAppsContent ? 1 : 0, allAppsFade);
+ }
mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade);
setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA,
@@ -215,6 +246,8 @@
public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
mAppsView = appsView;
mScrimView = scrimView;
+ PluginManagerWrapper.INSTANCE.get(mLauncher)
+ .addPluginListener(this, AllAppsSearchPlugin.class, false);
}
/**
@@ -238,4 +271,24 @@
mAppsView.reset(false /* animate */);
}
}
+
+ @Override
+ public void onPluginConnected(AllAppsSearchPlugin plugin, Context context) {
+ mPlugin = plugin;
+ mPluginContent = mLauncher.getLayoutInflater().inflate(
+ R.layout.all_apps_content_layout, mAppsView, false);
+ mAppsView.addView(mPluginContent);
+ mPluginContent.setAlpha(0f);
+ mPlugin.setup((ViewGroup) mPluginContent);
+ }
+
+ @Override
+ public void onPluginDisconnected(AllAppsSearchPlugin plugin) {
+ mPlugin = null;
+ mAppsView.removeView(mPluginContent);
+ }
+
+ public void onActivityDestroyed() {
+ PluginManagerWrapper.INSTANCE.get(mLauncher).removePluginListener(this);
+ }
}
diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java
index cf9a088..34bf636 100644
--- a/src/com/android/launcher3/allapps/SearchUiManager.java
+++ b/src/com/android/launcher3/allapps/SearchUiManager.java
@@ -18,6 +18,9 @@
import android.graphics.Rect;
import android.view.KeyEvent;
import android.view.animation.Interpolator;
+import android.widget.EditText;
+
+import androidx.annotation.Nullable;
import com.android.launcher3.anim.PropertySetter;
@@ -52,4 +55,14 @@
*/
void setContentVisibility(int visibleElements, PropertySetter setter,
Interpolator interpolator);
+
+ /**
+ * Called to control how the search UI result should be handled.
+ *
+ * @param isEnabled when {@code true}, the search is all handled inside AOSP
+ * and is not overlayable.
+ * @return the searchbox edit text object
+ */
+ @Nullable
+ EditText setTextSearchEnabled(boolean isEnabled);
}
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 9e3a862..e72e1a8 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -33,6 +33,7 @@
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.animation.Interpolator;
+import android.widget.EditText;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
@@ -214,4 +215,9 @@
Interpolator interpolator) {
setter.setViewAlpha(this, (visibleElements & ALL_APPS_HEADER) != 0 ? 1 : 0, interpolator);
}
+
+ @Override
+ public EditText setTextSearchEnabled(boolean isEnabled) {
+ return this;
+ }
}
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index b9b33fe..4fe1d1a 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -331,7 +331,7 @@
.map(info -> info.suggestedFolderNames)
.map(folderNames -> (FolderNameInfo[]) folderNames
.getParcelableArrayExtra(FolderInfo.EXTRA_FOLDER_SUGGESTIONS))
- .ifPresent(nameInfos -> showLabelSuggestion(nameInfos, false));
+ .ifPresent(nameInfos -> showLabelSuggestions(nameInfos));
}
mFolderName.setHint("");
mIsEditingName = true;
@@ -457,24 +457,12 @@
});
}
- /**
- * Show suggested folder title in FolderEditText, push InputMethodManager suggestions and save
- * the suggestedFolderNames.
- */
- public void showSuggestedTitle(FolderNameInfo[] nameInfos) {
- if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
- if (isEmpty(mFolderName.getText().toString())
- && !mInfo.hasOption(FLAG_MANUAL_FOLDER_NAME)) {
- showLabelSuggestion(nameInfos, true);
- }
- }
- }
/**
* Show suggested folder title in FolderEditText if the first suggestion is non-empty, push
- * InputMethodManager suggestions.
+ * rest of the suggestions to InputMethodManager.
*/
- private void showLabelSuggestion(FolderNameInfo[] nameInfos, boolean animate) {
+ private void showLabelSuggestions(FolderNameInfo[] nameInfos) {
if (nameInfos == null) {
return;
}
@@ -494,9 +482,6 @@
mFolderName.setText(firstLabel);
}
}
- if (animate) {
- animateOpen(mInfo.contents, 0, true);
- }
mFolderName.showKeyboard();
mFolderName.displayCompletions(
asList(nameInfos).subList(0, nameInfos.length).stream()
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 680c3ba..e29971e 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -16,6 +16,8 @@
package com.android.launcher3.folder;
+import static android.text.TextUtils.isEmpty;
+
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.folder.PreviewItemManager.INITIAL_ITEM_ANIMATION_DURATION;
@@ -418,11 +420,33 @@
postDelayed(() -> {
mPreviewItemManager.hidePreviewItem(finalIndex, false);
mFolder.showItem(item);
+ setLabelSuggestion(nameInfos);
invalidate();
- mFolder.showSuggestedTitle(nameInfos);
}, DROP_IN_ANIMATION_DURATION);
}
+ /**
+ * Set the suggested folder name.
+ */
+ public void setLabelSuggestion(FolderNameInfo[] nameInfos) {
+ if (!FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
+ return;
+ }
+ if (!isEmpty(mFolderName.getText().toString())
+ || mInfo.hasOption(FolderInfo.FLAG_MANUAL_FOLDER_NAME)) {
+ return;
+ }
+ if (nameInfos == null || nameInfos[0] == null || isEmpty(nameInfos[0].getLabel())) {
+ return;
+ }
+ mInfo.title = nameInfos[0].getLabel();
+ onTitleChanged(mInfo.title);
+ mFolder.mFolderName.setText(mInfo.title);
+ mFolder.mLauncher.getModelWriter().updateItemInDatabase(mInfo);
+ // TODO: Add logging while folder creation.
+ }
+
+
public void onDrop(DragObject d, boolean itemReturnedOnFailedDrop) {
WorkspaceItemInfo item;
if (d.dragInfo instanceof AppInfo) {
diff --git a/src/com/android/launcher3/settings/DeveloperOptionsFragment.java b/src/com/android/launcher3/settings/DeveloperOptionsFragment.java
index 8dc2e61..5bf9173 100644
--- a/src/com/android/launcher3/settings/DeveloperOptionsFragment.java
+++ b/src/com/android/launcher3/settings/DeveloperOptionsFragment.java
@@ -216,17 +216,27 @@
if (launchSandboxIntent.resolveActivity(context.getPackageManager()) == null) {
return;
}
- PreferenceCategory sandboxCategory = newCategory("Sandbox");
- Preference launchSandboxPreference = new Preference(context);
- launchSandboxPreference.setKey("launchSandbox");
- launchSandboxPreference.setTitle("Launch Gesture Navigation Sandbox");
- launchSandboxPreference.setSummary(
- "This provides tutorials and a place to practice navigation gestures.");
- launchSandboxPreference.setOnPreferenceClickListener(preference -> {
- startActivity(launchSandboxIntent);
+ PreferenceCategory sandboxCategory = newCategory("Gesture Navigation Sandbox");
+ sandboxCategory.setSummary("Learn and practice navigation gestures");
+ Preference launchBackTutorialPreference = new Preference(context);
+ launchBackTutorialPreference.setKey("launchBackTutorial");
+ launchBackTutorialPreference.setTitle("Launch Back Tutorial");
+ launchBackTutorialPreference.setSummary("Learn how to use the Back gesture");
+ launchBackTutorialPreference.setOnPreferenceClickListener(preference -> {
+ startActivity(launchSandboxIntent.putExtra(
+ "tutorial_type", "RIGHT_EDGE_BACK_NAVIGATION"));
return true;
});
- sandboxCategory.addPreference(launchSandboxPreference);
+ sandboxCategory.addPreference(launchBackTutorialPreference);
+ Preference launchHomeTutorialPreference = new Preference(context);
+ launchHomeTutorialPreference.setKey("launchHomeTutorial");
+ launchHomeTutorialPreference.setTitle("Launch Home Tutorial");
+ launchHomeTutorialPreference.setSummary("Learn how to use the Home gesture");
+ launchHomeTutorialPreference.setOnPreferenceClickListener(preference -> {
+ startActivity(launchSandboxIntent.putExtra("tutorial_type", "HOME_NAVIGATION"));
+ return true;
+ });
+ sandboxCategory.addPreference(launchHomeTutorialPreference);
}
private String toName(String action) {
diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java
index 82cde64..8dccbd3 100644
--- a/src/com/android/launcher3/states/StateAnimationConfig.java
+++ b/src/com/android/launcher3/states/StateAnimationConfig.java
@@ -37,6 +37,7 @@
PLAY_ATOMIC_OVERVIEW_SCALE,
PLAY_ATOMIC_OVERVIEW_PEEK,
SKIP_OVERVIEW,
+ SKIP_DEPTH_CONTROLLER
})
@Retention(RetentionPolicy.SOURCE)
public @interface AnimationFlags {}
@@ -44,6 +45,7 @@
public static final int PLAY_ATOMIC_OVERVIEW_SCALE = 1 << 1;
public static final int PLAY_ATOMIC_OVERVIEW_PEEK = 1 << 2;
public static final int SKIP_OVERVIEW = 1 << 3;
+ public static final int SKIP_DEPTH_CONTROLLER = 1 << 4;
public long duration;
public boolean userControlled;
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index f7091fc..6abca76 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -52,6 +52,8 @@
import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.InstallSessionHelper;
+import com.android.launcher3.testing.TestLogging;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.widget.PendingAppWidgetHostView;
@@ -240,6 +242,8 @@
private static void startAppShortcutOrInfoActivity(View v, ItemInfo item, Launcher launcher,
@Nullable String sourceContainer) {
+ TestLogging.recordEvent(
+ TestProtocol.SEQUENCE_MAIN, "start: startAppShortcutOrInfoActivity");
Intent intent;
if (item instanceof PromiseAppInfo) {
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) item;
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 880f123..d5c3c1d 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -40,6 +40,8 @@
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.popup.ArrowPopup;
import com.android.launcher3.shortcuts.DeepShortcutView;
+import com.android.launcher3.testing.TestLogging;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.widget.WidgetsFullSheet;
@@ -184,6 +186,7 @@
}
public static boolean startSettings(View view) {
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: startSettings");
Launcher launcher = Launcher.getLauncher(view.getContext());
launcher.startActivity(new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
.setPackage(launcher.getPackageName())
diff --git a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
new file mode 100644
index 0000000..b865a20
--- /dev/null
+++ b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 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.systemui.plugins;
+
+import android.view.ViewGroup;
+import android.widget.EditText;
+
+import com.android.systemui.plugins.annotations.ProvidesInterface;
+
+/**
+ * Implement this plugin interface to add a row of views to the top of the all apps drawer.
+ */
+@ProvidesInterface(action = AllAppsSearchPlugin.ACTION, version = AllAppsSearchPlugin.VERSION)
+public interface AllAppsSearchPlugin extends Plugin {
+ String ACTION = "com.android.systemui.action.PLUGIN_ALL_APPS_SEARCH_ACTIONS";
+ int VERSION = 1;
+
+ void setup(ViewGroup parent);
+ void setEditText(EditText editText);
+}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index a7089fe..86faddb 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -162,7 +162,6 @@
mLauncher.enableDebugTracing();
// Avoid double-reporting of Launcher crashes.
mLauncher.setOnLauncherCrashed(() -> mLauncherPid = 0);
- mLauncher.disableSensorRotation();
}
protected final LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@@ -278,7 +277,6 @@
clearPackageData(mDevice.getLauncherPackageName());
mLauncher.enableDebugTracing();
mLauncherPid = mLauncher.getPid();
- mLauncher.disableSensorRotation();
}
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index de1ada4..57000a0 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -314,7 +314,7 @@
switchToAllApps();
allApps.freeze();
try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(false);
+ allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
} finally {
allApps.unfreeze();
@@ -342,7 +342,7 @@
getMenuItem(0);
final String shortcutName = menuItem.getText();
- menuItem.dragToWorkspace(false);
+ menuItem.dragToWorkspace(false, false);
mLauncher.getWorkspace().getWorkspaceAppIcon(shortcutName).launch(getAppPackageName());
} finally {
allApps.unfreeze();
diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
index 0a6579a..9d4ccff 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
@@ -94,7 +94,7 @@
WidgetConfigStartupMonitor monitor = new WidgetConfigStartupMonitor();
widgets.
getWidget(mWidgetInfo.getLabel(mTargetContext.getPackageManager())).
- dragToWorkspace(true);
+ dragToWorkspace(true, false);
// Widget id for which the config activity was opened
mWidgetId = monitor.getWidgetId();
diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
index 5e26aa6..f146db5 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java
@@ -57,7 +57,7 @@
getWorkspace().
openAllWidgets().
getWidget(widgetInfo.getLabel(mTargetContext.getPackageManager())).
- dragToWorkspace(false);
+ dragToWorkspace(false, false);
assertTrue(mActivityMonitor.itemExists(
(info, view) -> info instanceof LauncherAppWidgetInfo &&
@@ -83,7 +83,7 @@
mDevice.pressHome();
mLauncher.getWorkspace().openAllWidgets()
.getWidget("com.android.launcher3.testcomponent.CustomShortcutConfigActivity")
- .dragToWorkspace(false);
+ .dragToWorkspace(false, true);
mLauncher.getWorkspace().getWorkspaceAppIcon("Shortcut")
.launch(getAppPackageName());
}
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
index bdfd563..5de5b4a 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -31,7 +31,6 @@
*/
public final class AppIcon extends Launchable {
- private static final Pattern START_EVENT = Pattern.compile("start:");
private static final Pattern LONG_CLICK_EVENT = Pattern.compile("onAllAppsItemLongClick");
AppIcon(LauncherInstrumentation launcher, UiObject2 icon) {
@@ -64,6 +63,6 @@
@Override
protected void expectActivityStartEvents() {
- mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, START_EVENT);
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
index 37a7b91..a40919b 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
@@ -27,8 +27,6 @@
*/
public class AppIconMenuItem extends Launchable {
- private static final Pattern START_SHORTCUT_EVENT = Pattern.compile("start: shortcut:");
-
AppIconMenuItem(LauncherInstrumentation launcher, UiObject2 shortcut) {
super(launcher, shortcut);
}
@@ -51,6 +49,6 @@
@Override
protected void expectActivityStartEvents() {
- mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, START_SHORTCUT_EVENT);
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 2922acf..df7436c 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -77,8 +77,9 @@
/**
* Drags an object to the center of homescreen.
* @param startsActivity whether it's expected to start an activity.
+ * @param isWidgetShortcut whether we drag a widget shortcut
*/
- public void dragToWorkspace(boolean startsActivity) {
+ public void dragToWorkspace(boolean startsActivity, boolean isWidgetShortcut) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
final Point launchableCenter = getObject().getVisibleCenter();
final Point displaySize = mLauncher.getRealDisplaySize();
@@ -93,6 +94,7 @@
displaySize.y / 2),
getLongPressIndicator(),
startsActivity,
+ isWidgetShortcut,
() -> addExpectedEventsForLongClick());
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 84eae2d..debc736 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -99,6 +99,7 @@
private static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers");
static final Pattern EVENT_START_ACTIVITY = Pattern.compile("Activity\\.onStart");
static final Pattern EVENT_STOP_ACTIVITY = Pattern.compile("Activity\\.onStop");
+ static final Pattern EVENT_START = Pattern.compile("start:");
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
@@ -247,8 +248,6 @@
}
}
}
-
- disableSensorRotation();
}
public void enableCheckEventsForSuccessfulGestures() {
@@ -1265,7 +1264,7 @@
TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
- public void disableSensorRotation() {
+ private void disableSensorRotation() {
getTestInfo(TestProtocol.REQUEST_MOCK_SENSOR_ROTATION);
}
@@ -1306,6 +1305,7 @@
public Closable eventsCheck() {
Assert.assertTrue("Nested event checking", !sCheckingEvents);
+ disableSensorRotation();
sCheckingEvents = true;
mExpectedPid = getPid();
if (sEventChecker == null) sEventChecker = new LogEventChecker();
diff --git a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java b/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
index 63a97f4..d1268cc 100644
--- a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
+++ b/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
@@ -43,6 +43,7 @@
LauncherInstrumentation.log("OptionsPopupMenuItem before click "
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
mLauncher.clickLauncherObject(mObject);
+ mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
if (!Build.MODEL.contains("Cuttlefish") ||
Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q &&
!"R".equals(Build.VERSION.CODENAME)) {
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index b3b5e32..0d91dc2 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -180,6 +180,7 @@
mLauncher.getVisibleBounds(workspace).centerY()),
"deep_shortcuts_container",
false,
+ false,
() -> mLauncher.expectEvent(
TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT));
verifyActiveContainer();
@@ -202,7 +203,8 @@
static void dragIconToWorkspace(
LauncherInstrumentation launcher, Launchable launchable, Point dest,
- String longPressIndicator, boolean startsActivity, Runnable expectLongClickEvents) {
+ String longPressIndicator, boolean startsActivity, boolean isWidgetShortcut,
+ Runnable expectLongClickEvents) {
LauncherInstrumentation.log("dragIconToWorkspace: begin");
final Point launchableCenter = launchable.getObject().getVisibleCenter();
final long downTime = SystemClock.uptimeMillis();
@@ -224,6 +226,9 @@
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest,
LauncherInstrumentation.GestureScope.INSIDE),
NORMAL_STATE_ORDINAL);
+ if (startsActivity || isWidgetShortcut) {
+ launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
+ }
if (startsActivity) {
launcher.expectEvent(
TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);