Snap for 7550727 from cac1186336 to tm-release

Change-Id: I0ea615b8d6352947042c6c45d13fd03d45d728e7
This commit is contained in:
Android Build Coastguard Worker
2021-07-15 03:08:08 +00:00
37 changed files with 327 additions and 1511 deletions
@@ -34,6 +34,7 @@
android:layout_weight="1" />
<LinearLayout
android:id="@+id/layout_translate"
style="@style/GoOverviewActionButtonContainer">
<ImageButton
android:id="@+id/action_translate"
@@ -46,10 +47,12 @@
</LinearLayout>
<Space
android:id="@+id/spacer_translate"
android:layout_width="@dimen/go_overview_button_container_margin"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/layout_listen"
style="@style/GoOverviewActionButtonContainer">
<ImageButton
android:id="@+id/action_listen"
@@ -63,10 +66,12 @@
</LinearLayout>
<Space
android:id="@+id/spacer_listen"
android:layout_width="@dimen/go_overview_button_container_margin"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/layout_screenshot"
style="@style/GoOverviewActionButtonContainer">
<ImageButton
android:id="@+id/action_screenshot"
@@ -16,6 +16,8 @@
package com.android.quickstep.views;
import static android.view.View.GONE;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
@@ -54,11 +56,11 @@ public class GoOverviewActionsView extends OverviewActionsView<OverlayUICallback
if (getResources().getBoolean(R.bool.enable_niu_actions)) {
findViewById(R.id.action_listen).setOnClickListener(this);
findViewById(R.id.action_translate).setOnClickListener(this);
findViewById(R.id.action_search).setOnClickListener(this);
} else {
findViewById(R.id.action_listen).setVisibility(View.GONE);
findViewById(R.id.action_translate).setVisibility(View.GONE);
findViewById(R.id.action_search).setVisibility(View.GONE);
findViewById(R.id.layout_listen).setVisibility(GONE);
findViewById(R.id.spacer_listen).setVisibility(GONE);
findViewById(R.id.layout_translate).setVisibility(GONE);
findViewById(R.id.spacer_translate).setVisibility(GONE);
}
}
@@ -1,96 +0,0 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<target android:name="_R_G_L_1_G_D_0_P_0">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="1000"
android:propertyName="fillAlpha"
android:startOffset="0"
android:valueFrom="0.25"
android:valueTo="0.75"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
</aapt:attr>
</objectAnimator>
<objectAnimator
android:duration="1000"
android:propertyName="fillAlpha"
android:startOffset="1000"
android:valueFrom="0.75"
android:valueTo="0.25"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
</aapt:attr>
</objectAnimator>
</set>
</aapt:attr>
</target>
<target android:name="_R_G_L_0_G">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="0"
android:propertyName="scaleY"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />
</set>
</aapt:attr>
</target>
<target android:name="_R_G_L_0_G">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="0"
android:propertyName="scaleY"
android:startOffset="783"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType" />
</set>
</aapt:attr>
</target>
<target android:name="time_group">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="2000"
android:propertyName="translateX"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />
</set>
</aapt:attr>
</target>
<aapt:attr name="android:drawable">
<vector
android:width="412dp"
android:height="892dp"
android:viewportHeight="892"
android:viewportWidth="412">
<group android:name="_R_G">
<group
android:name="_R_G_L_1_G"
android:translateX="399.5"
android:translateY="446">
<path
android:name="_R_G_L_1_G_D_0_P_0"
android:fillAlpha="0.25"
android:fillColor="@color/gesture_tutorial_primary_color"
android:fillType="nonZero"
android:pathData=" M12.5 -446 C12.5,-446 12.5,446 12.5,446 C12.5,446 -12.5,446 -12.5,446 C-12.5,446 -12.5,-446 -12.5,-446 C-12.5,-446 12.5,-446 12.5,-446c " />
</group>
<group
android:name="_R_G_L_0_G"
android:translateX="206"
android:translateY="446" />
</group>
<group android:name="time_group" />
</vector>
</aapt:attr>
</animated-vector>
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp"/>
<corners android:radius="3dp"/>
<size android:width="16dp" android:height="6dp"/>
</shape>
@@ -92,7 +92,8 @@
android:layout_marginStart="@dimen/gesture_tutorial_feedback_margin_start_end"
android:layout_marginEnd="@dimen/gesture_tutorial_feedback_margin_start_end"
android:layout_marginTop="24dp"
android:padding="24dp"
android:paddingTop="24dp"
android:paddingBottom="16dp"
android:background="@drawable/bg_sandbox_feedback">
<TextView
@@ -100,6 +101,8 @@
style="@style/TextAppearance.GestureTutorial.Feedback.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -111,6 +114,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -131,31 +136,36 @@
style="@style/TextAppearance.GestureTutorial.ButtonLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/gesture_tutorial_action_button_label_next"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="26dp"
android:paddingEnd="26dp"
android:text="@string/gesture_tutorial_action_button_label"
android:background="@drawable/gesture_tutorial_action_button_background"
android:stateListAnimator="@null"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"/>
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"
app:layout_constraintEnd_toEndOf="parent"/>
<Button
style="@style/TextAppearance.GestureTutorial.Feedback.Subtext"
android:id="@+id/gesture_tutorial_fragment_close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="26dp"
android:paddingEnd="26dp"
android:text="@string/gesture_tutorial_action_button_label_skip"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintTop_toTopOf="@id/gesture_tutorial_fragment_action_button"
app:layout_constraintBottom_toBottomOf="@id/gesture_tutorial_fragment_action_button"
app:layout_constraintStart_toStartOf="@id/gesture_tutorial_fragment_action_button"
app:layout_constraintEnd_toEndOf="@id/gesture_tutorial_fragment_action_button"/>
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
+11 -21
View File
@@ -91,16 +91,10 @@
<!-- content description for hotseat items -->
<string name="hotseat_prediction_content_description">Predicted app: <xliff:g id="title" example="Chrome">%1$s</xliff:g></string>
<!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_swipe_too_far_from_left_edge">Make sure you swipe from the far-left edge.</string>
<!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is cancelled. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_cancelled_left_edge">Make sure you swipe from the left edge to the middle of the screen and let go.</string>
<!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_swipe_too_far_from_right_edge">Make sure you swipe from the far-right edge.</string>
<string name="back_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe from the far-right or far-left edge.</string>
<!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is cancelled. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_cancelled_right_edge">Make sure you swipe from the right edge to the middle of the screen and let go.</string>
<!-- Feedback shown after completing the back gesture step if the user is following the full gesture tutorial flow. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_complete_with_back_right_follow_up">You learned how to swipe from the left to go back.</string>
<string name="back_gesture_feedback_cancelled">Make sure you swipe from the right or left edge to the middle of the screen and let go.</string>
<!-- Feedback shown after completing the back gesture step if the user is following the full gesture tutorial flow. [CHAR LIMIT=100] -->
<string name="back_gesture_feedback_complete_with_overview_follow_up">You learned how to swipe from the right to go back. Next up, learn how to switch apps.</string>
<!-- Feedback shown after completing the back gesture step if the user started this tutorial individually. [CHAR LIMIT=100] -->
@@ -110,14 +104,10 @@
<!-- Subtitle shown on the confirmation screen after successful gesture. [CHAR LIMIT=60] -->
<string name="back_gesture_tutorial_confirm_subtitle">To change the sensitivity of the back gesture, go to Settings</string>
<!-- Feedback shown during interactive parts of Home gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
<!-- Introduction title for the left edge Back gesture tutorial. [CHAR LIMIT=100] -->
<string name="back_left_gesture_intro_title">Swipe from the left to go back</string>
<!-- Introduction title for the right edge Back gesture tutorial. [CHAR LIMIT=100] -->
<string name="back_right_gesture_intro_title">Swipe from the right to go back</string>
<!-- Introduction subtitle for the Back left gesture tutorial. [CHAR LIMIT=200] -->
<string name="back_left_gesture_intro_subtitle">To go back to the last screen you were on, swipe from the left edge to the middle of the screen.</string>
<!-- Introduction subtitle for the Back right gesture tutorial. [CHAR LIMIT=100] -->
<string name="back_right_gesture_intro_subtitle">You can also go back to the last screen by swiping from the right edge to the middle of the screen. Try it now.</string>
<!-- Introduction title for the Back gesture tutorial. [CHAR LIMIT=100] -->
<string name="back_gesture_intro_title">Swipe to go back</string>
<!-- Introduction subtitle for the Back gesture tutorial. [CHAR LIMIT=200] -->
<string name="back_gesture_intro_subtitle">To go back to the last screen, swipe from the left or right edge to the middle of the screen.</string>
<string name="home_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up from the bottom edge of the screen.</string>
<!-- Feedback shown during interactive parts of Home gesture tutorial when the Overview gesture is detected. [CHAR LIMIT=100] -->
@@ -146,7 +136,7 @@
<!-- Introduction title for the Overview gesture tutorial. [CHAR LIMIT=100] -->
<string name="overview_gesture_intro_title">Swipe to switch apps</string>
<!-- Introduction subtitle for the Overview gesture tutorial. [CHAR LIMIT=100] -->
<string name="overview_gesture_intro_subtitle">Swipe up from the bottom of your screen, hold, then release.</string>
<string name="overview_gesture_intro_subtitle">To switch between apps, swipe up from the bottom of your screen, hold, then release.</string>
<!-- Title shown during interactive part of Assistant gesture tutorial. [CHAR LIMIT=30] -->
<string name="assistant_gesture_tutorial_playground_title" translatable="false">Tutorial: Assistant</string>
@@ -176,8 +166,8 @@
<!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
<string name="gesture_tutorial_confirm_title">All set</string>
<!-- Button text shown on a button on the feedback popup to proceed to the next tutorial step. [CHAR LIMIT=14] -->
<string name="gesture_tutorial_action_button_label_next">Next</string>
<!-- Button text shown on a button on the feedback popup to complete the gesture tutorial. [CHAR LIMIT=14] -->
<string name="gesture_tutorial_action_button_label">Done</string>
<!-- Button text shown on a button to go to Settings. [CHAR LIMIT=14] -->
<string name="gesture_tutorial_action_button_label_settings">Settings</string>
<!-- Feedback title to try again. [CHAR LIMIT=30] -->
@@ -190,11 +180,11 @@
<!-- Title of "All Set" page [CHAR LIMIT=NONE] -->
<string name="allset_title">All set!</string>
<!-- Hint string at the bottom of "All Set" page [CHAR LIMIT=NONE] -->
<string name="allset_hint">Swipe up to go home</string>
<string name="allset_hint">Swipe up to go Home</string>
<!-- Description of "All Set" page [CHAR LIMIT=NONE] -->
<string name="allset_description">You\u2019re ready to start using your phone</string>
<!-- String linking to navigation settings on "All Set" page [CHAR LIMIT=NONE] -->
<string name="allset_navigation_settings"><annotation id="link">Navigation settings for accessibility</annotation></string>
<string name="allset_navigation_settings"><annotation id="link">System navigation settings</annotation></string>
<!-- ******* Overview ******* -->
<!-- Label for a button that causes the current overview app to be shared. [CHAR_LIMIT=40] -->
+2 -2
View File
@@ -41,10 +41,10 @@
parent="TextAppearance.GestureTutorial">
<item name="android:gravity">start</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:fontFamily">google-sans-display</item>
<item name="android:fontFamily">google-sans-regular</item>
<item name="android:letterSpacing">0.03</item>
<item name="android:textSize">36sp</item>
<item name="android:lineHeight">42sp</item>
<item name="android:lineHeight">44sp</item>
</style>
<style name="TextAppearance.GestureTutorial.Dialog.Title"
@@ -37,6 +37,7 @@ import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -152,6 +153,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
TaskbarStashController stashController = mControllers.taskbarStashController;
stashController.animateToIsStashed(stashController.isStashedInApp(), duration);
}
SystemUiProxy.INSTANCE.get(mContext).notifyTaskbarStatus(!isResumed,
mControllers.taskbarStashController.isStashedInApp());
}
/**
@@ -36,6 +36,7 @@ import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.DisplayController.Info;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TouchInteractionService;
/**
@@ -127,16 +128,19 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
private void recreateTaskbar() {
destroyExistingTaskbar();
if (!FeatureFlags.ENABLE_TASKBAR.get()) {
return;
}
if (!mUserUnlocked) {
return;
}
DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext);
if (!dp.isTaskbarPresent) {
DeviceProfile dp =
mUserUnlocked ? LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
boolean isTaskBarEnabled =
FeatureFlags.ENABLE_TASKBAR.get() && dp != null && dp.isTaskbarPresent;
if (!isTaskBarEnabled) {
SystemUiProxy.INSTANCE.get(mContext)
.notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
return;
}
mTaskbarActivityContext = new TaskbarActivityContext(
mContext, dp.copy(mContext), mNavButtonController);
mTaskbarActivityContext.init();
@@ -28,6 +28,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.SystemUiProxy;
/**
* Coordinates between controllers such as TaskbarViewController and StashedHandleViewController to
@@ -104,6 +105,9 @@ public class TaskbarStashController {
mIsStashedInApp = supportsStashing()
&& mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF);
SystemUiProxy.INSTANCE.get(mActivity)
.notifyTaskbarStatus(/* visible */ true, /* stashed */ mIsStashedInApp);
}
/**
@@ -166,6 +170,8 @@ public class TaskbarStashController {
mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_KEY, mIsStashedInApp).apply();
boolean isStashed = mIsStashedInApp;
if (wasStashed != isStashed) {
SystemUiProxy.INSTANCE.get(mActivity)
.notifyTaskbarStatus(/* visible */ true, /* stashed */ isStashed);
createAnimToIsStashed(isStashed, TASKBAR_STASH_DURATION).start();
return true;
}
@@ -115,7 +115,6 @@ import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.LatencyTrackerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TaskInfoCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -1110,7 +1109,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
if (task.taskId == mGestureState.getRunningTaskId()
&& TaskInfoCompat.getActivityType(task) != ACTIVITY_TYPE_HOME) {
&& task.configuration.windowConfiguration.getActivityType()
!= ACTIVITY_TYPE_HOME) {
// Since this is an edge case, just cancel and relaunch with default activity
// options (since we don't know if there's an associated app icon to launch from)
endRunningWindowAnim(true /* cancel */);
@@ -1152,8 +1152,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
boolean appCanEnterPip = !mDeviceState.isPipActive()
&& runningTaskTarget != null
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
&& TaskInfoCompat.isAutoEnterPipEnabled(
runningTaskTarget.taskInfo.pictureInPictureParams);
&& runningTaskTarget.taskInfo.pictureInPictureParams.isAutoEnterEnabled();
HomeAnimationFactory homeAnimFactory =
createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip,
runningTaskTarget);
@@ -1254,7 +1253,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
final Rect destinationBounds = SystemUiProxy.INSTANCE.get(mContext)
.startSwipePipToHome(taskInfo.topActivity,
TaskInfoCompat.getTopActivityInfo(taskInfo),
taskInfo.topActivityInfo,
runningTaskTarget.taskInfo.pictureInPictureParams,
homeRotation,
mDp.hotseatBarSizePx);
@@ -1263,9 +1262,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
.setTaskId(runningTaskTarget.taskId)
.setComponentName(taskInfo.topActivity)
.setLeash(runningTaskTarget.leash.getSurfaceControl())
.setSourceRectHint(TaskInfoCompat.getPipSourceRectHint(
runningTaskTarget.taskInfo.pictureInPictureParams))
.setAppBounds(TaskInfoCompat.getWindowConfigurationBounds(taskInfo))
.setSourceRectHint(
runningTaskTarget.taskInfo.pictureInPictureParams.getSourceRectHint())
.setAppBounds(taskInfo.configuration.windowConfiguration.getBounds())
.setHomeToWindowPositionMap(homeToWindowPositionMap)
.setStartBounds(startRect)
.setDestinationBounds(destinationBounds)
@@ -1275,7 +1274,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
// is not ROTATION_0 (which implies the rotation is turned on in launcher settings).
if (homeRotation == ROTATION_0
&& (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) {
builder.setFromRotation(mTaskViewSimulator, windowRotation);
builder.setFromRotation(mTaskViewSimulator, windowRotation,
taskInfo.displayCutoutInsets);
}
final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build();
AnimatorPlaybackController activityAnimationToHome =
@@ -399,6 +399,18 @@ public class SystemUiProxy implements ISystemUiProxy,
}
}
@Override
public void notifyTaskbarStatus(boolean visible, boolean stashed) {
if (mSystemUiProxy != null) {
try {
mSystemUiProxy.notifyTaskbarStatus(visible, stashed);
} catch (RemoteException e) {
Log.w(TAG, "Failed call notifyTaskbarStatus with arg: " +
visible + ", " + stashed, e);
}
}
}
@Override
public void handleImageBundleAsScreenshot(Bundle screenImageBundle, Rect locationInScreen,
Insets visibleInsets, Task.TaskKey task) {
@@ -15,9 +15,8 @@
*/
package com.android.quickstep.interaction;
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION;
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION_COMPLETE;
import static com.android.quickstep.interaction.TutorialController.TutorialType.LEFT_EDGE_BACK_NAVIGATION;
import static com.android.quickstep.interaction.TutorialController.TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
import android.graphics.PointF;
@@ -36,15 +35,12 @@ final class BackGestureTutorialController extends TutorialController {
@Override
public Integer getIntroductionTitle() {
return mTutorialType == LEFT_EDGE_BACK_NAVIGATION
? R.string.back_left_gesture_intro_title : R.string.back_right_gesture_intro_title;
return R.string.back_gesture_intro_title;
}
@Override
public Integer getIntroductionSubtitle() {
return mTutorialType == LEFT_EDGE_BACK_NAVIGATION
? R.string.back_left_gesture_intro_subtitle
: R.string.back_right_gesture_intro_subtitle;
return R.string.back_gesture_intro_subtitle;
}
@Override
@@ -58,11 +54,8 @@ final class BackGestureTutorialController extends TutorialController {
return;
}
switch (mTutorialType) {
case RIGHT_EDGE_BACK_NAVIGATION:
handleAttemptFromRight(result);
break;
case LEFT_EDGE_BACK_NAVIGATION:
handleAttemptFromLeft(result);
case BACK_NAVIGATION:
handleBackAttempt(result);
break;
case BACK_NAVIGATION_COMPLETE:
if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT
@@ -73,8 +66,9 @@ final class BackGestureTutorialController extends TutorialController {
}
}
private void handleAttemptFromRight(BackGestureResult result) {
private void handleBackAttempt(BackGestureResult result) {
switch (result) {
case BACK_COMPLETED_FROM_LEFT:
case BACK_COMPLETED_FROM_RIGHT:
mTutorialFragment.releaseGestureVideoView();
hideFeedback(true);
@@ -85,39 +79,12 @@ final class BackGestureTutorialController extends TutorialController {
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
showFeedback(subtitleResId, true);
break;
case BACK_CANCELLED_FROM_RIGHT:
showFeedback(R.string.back_gesture_feedback_cancelled_right_edge);
break;
case BACK_COMPLETED_FROM_LEFT:
case BACK_CANCELLED_FROM_LEFT:
case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_right_edge);
break;
case BACK_NOT_STARTED_IN_NAV_BAR_REGION:
showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
break;
}
}
private void handleAttemptFromLeft(BackGestureResult result) {
switch (result) {
case BACK_COMPLETED_FROM_LEFT:
mTutorialFragment.releaseGestureVideoView();
hideFeedback(true);
mFakeTaskView.setBackground(AppCompatResources.getDrawable(mContext,
R.drawable.mock_conversations_list));
int subtitleResId = mTutorialFragment.isAtFinalStep()
? R.string.back_gesture_feedback_complete_without_follow_up
: R.string.back_gesture_feedback_complete_with_back_right_follow_up;
showFeedback(subtitleResId, true);
break;
case BACK_CANCELLED_FROM_LEFT:
showFeedback(R.string.back_gesture_feedback_cancelled_left_edge);
break;
case BACK_COMPLETED_FROM_RIGHT:
case BACK_CANCELLED_FROM_RIGHT:
showFeedback(R.string.back_gesture_feedback_cancelled);
break;
case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_left_edge);
showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_edge);
break;
case BACK_NOT_STARTED_IN_NAV_BAR_REGION:
showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
@@ -134,8 +101,7 @@ final class BackGestureTutorialController extends TutorialController {
if (result == NavBarGestureResult.HOME_GESTURE_COMPLETED) {
mTutorialFragment.closeTutorial();
}
} else if (mTutorialType == LEFT_EDGE_BACK_NAVIGATION
|| mTutorialType == RIGHT_EDGE_BACK_NAVIGATION) {
} else if (mTutorialType == BACK_NAVIGATION) {
showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
}
}
@@ -28,17 +28,13 @@ public class BackGestureTutorialFragment extends TutorialFragment {
@Nullable
@Override
Integer getFeedbackVideoResId(boolean forDarkMode) {
return mTutorialType == TutorialType.RIGHT_EDGE_BACK_NAVIGATION
? R.drawable.gesture_tutorial_motion_back_right
: R.drawable.gesture_tutorial_motion_back_left;
return R.drawable.gesture_tutorial_motion_back;
}
@Nullable
@Override
Integer getGestureVideoResId() {
return mTutorialType == TutorialType.RIGHT_EDGE_BACK_NAVIGATION
? R.drawable.gesture_tutorial_loop_back_right
: R.drawable.gesture_tutorial_loop_back_left;
return R.drawable.gesture_tutorial_loop_back;
}
@Override
@@ -141,7 +141,7 @@ public class GestureSandboxActivity extends FragmentActivity {
}
private TutorialType[] getTutorialSteps(Bundle extras) {
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.BACK_NAVIGATION};
mCurrentStep = 1;
mNumSteps = 1;
@@ -82,7 +82,6 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
case HOME_GESTURE_COMPLETED: {
mTutorialFragment.releaseGestureVideoView();
animateFakeTaskViewHome(finalVelocity, null);
showActionButton();
int subtitleResId = mTutorialFragment.isAtFinalStep()
? R.string.home_gesture_feedback_complete_without_follow_up
: R.string.home_gesture_feedback_complete_with_follow_up;
@@ -36,11 +36,9 @@ public class SandboxModeTutorialController extends SwipeUpGestureTutorialControl
showRippleEffect(null);
showFeedback(R.string.sandbox_mode_back_gesture_feedback_successful);
break;
case BACK_CANCELLED_FROM_RIGHT:
showFeedback(R.string.back_gesture_feedback_cancelled_right_edge);
break;
case BACK_CANCELLED_FROM_LEFT:
showFeedback(R.string.back_gesture_feedback_cancelled_left_edge);
case BACK_CANCELLED_FROM_RIGHT:
showFeedback(R.string.back_gesture_feedback_cancelled);
break;
case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
showFeedback(R.string.sandbox_mode_back_gesture_feedback_swipe_too_far_from_edge);
@@ -59,6 +59,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
private static final int FEEDBACK_ANIMATION_MS = 250;
private static final int RIPPLE_VISIBLE_MS = 300;
private static final int GESTURE_ANIMATION_DELAY_MS = 1500;
private static final int ADVANCE_TUTORIAL_TIMEOUT_MS = 4000;
final TutorialFragment mTutorialFragment;
TutorialType mTutorialType;
@@ -220,7 +221,15 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
subtitle.setText(subtitleResId);
if (isGestureSuccessful) {
showActionButton();
hideCloseButton();
if (mTutorialFragment.isAtFinalStep()) {
showActionButton();
}
if (mFeedbackVideoViewCallback != null) {
mFeedbackVideoView.removeCallbacks(mFeedbackVideoViewCallback);
mFeedbackVideoViewCallback = null;
}
}
mGestureCompleted = isGestureSuccessful;
@@ -248,6 +257,16 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFeedbackView.animate()
.setDuration(FEEDBACK_ANIMATION_MS)
.translationY(0)
.withEndAction(() -> {
if (isGestureSuccessful && !mTutorialFragment.isAtFinalStep()) {
if (mFeedbackViewCallback != null) {
mFeedbackView.removeCallbacks(mFeedbackViewCallback);
}
mFeedbackViewCallback = mTutorialFragment::continueTutorial;
mFeedbackView.postDelayed(mFeedbackViewCallback,
ADVANCE_TUTORIAL_TIMEOUT_MS);
}
})
.start();
mFeedbackTitleView.postDelayed(mTitleViewCallback, FEEDBACK_ANIMATION_MS);
}
@@ -352,19 +371,26 @@ abstract class TutorialController implements BackGestureAttemptCallback,
}
}
void hideActionButton() {
void hideCloseButton() {
mCloseButton.setVisibility(GONE);
}
void showCloseButton() {
mCloseButton.setVisibility(View.VISIBLE);
mCloseButton.setTextAppearance(Utilities.isDarkTheme(mContext)
? R.style.TextAppearance_GestureTutorial_Feedback_Subtext
: R.style.TextAppearance_GestureTutorial_Feedback_Subtext_Dark);
}
void hideActionButton() {
showCloseButton();
// Invisible to maintain the layout.
mActionButton.setVisibility(View.INVISIBLE);
mActionButton.setOnClickListener(null);
}
void showActionButton() {
mCloseButton.setVisibility(GONE);
hideCloseButton();
mActionButton.setVisibility(View.VISIBLE);
mActionButton.setOnClickListener(this::onActionButtonClicked);
}
@@ -461,8 +487,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
/** Denotes the type of the tutorial. */
enum TutorialType {
RIGHT_EDGE_BACK_NAVIGATION,
LEFT_EDGE_BACK_NAVIGATION,
BACK_NAVIGATION,
BACK_NAVIGATION_COMPLETE,
HOME_NAVIGATION,
HOME_NAVIGATION_COMPLETE,
@@ -64,7 +64,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
if (fragment == null) {
fragment = new BackGestureTutorialFragment();
tutorialType = TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
tutorialType = TutorialType.BACK_NAVIGATION;
}
Bundle args = new Bundle();
@@ -76,8 +76,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
@Nullable
private static TutorialFragment getFragmentForTutorialType(TutorialType tutorialType) {
switch (tutorialType) {
case RIGHT_EDGE_BACK_NAVIGATION:
case LEFT_EDGE_BACK_NAVIGATION:
case BACK_NAVIGATION:
case BACK_NAVIGATION_COMPLETE:
return new BackGestureTutorialFragment();
case HOME_NAVIGATION:
@@ -23,7 +23,6 @@ import android.content.Intent;
import android.os.Build;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskInfoCompat;
/**
* Utility class for interacting with the Assistant.
@@ -39,7 +38,7 @@ public final class AssistantUtilities {
/** Returns true if the given task holds an Assistant activity that is excluded from recents. */
public static boolean isExcludedAssistant(TaskInfo info) {
return info != null
&& TaskInfoCompat.getActivityType(info) == ACTIVITY_TYPE_ASSISTANT
&& info.configuration.windowConfiguration.getActivityType() == ACTIVITY_TYPE_ASSISTANT
&& (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
}
@@ -301,6 +301,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
private ComponentName mComponentName;
private SurfaceControl mLeash;
private Rect mSourceRectHint;
private Rect mDisplayCutoutInsets;
private Rect mAppBounds;
private Matrix mHomeToWindowPositionMap;
private RectF mStartBounds;
@@ -366,7 +367,8 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
}
public Builder setFromRotation(TaskViewSimulator taskViewSimulator,
@RecentsOrientedState.SurfaceRotation int fromRotation) {
@RecentsOrientedState.SurfaceRotation int fromRotation,
Rect displayCutoutInsets) {
if (fromRotation != Surface.ROTATION_90 && fromRotation != Surface.ROTATION_270) {
Log.wtf(TAG, "Not a supported rotation, rotation=" + fromRotation);
return this;
@@ -381,6 +383,9 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
transformed.round(mDestinationBoundsTransformed);
mFromRotation = fromRotation;
if (displayCutoutInsets != null) {
mDisplayCutoutInsets = new Rect(displayCutoutInsets);
}
return this;
}
@@ -388,6 +393,14 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
if (mDestinationBoundsTransformed.isEmpty()) {
mDestinationBoundsTransformed.set(mDestinationBounds);
}
// adjust the mSourceRectHint / mAppBounds by display cutout if applicable.
if (mSourceRectHint != null && mDisplayCutoutInsets != null) {
if (mFromRotation == Surface.ROTATION_90) {
mSourceRectHint.offset(mDisplayCutoutInsets.left, mDisplayCutoutInsets.top);
} else if (mFromRotation == Surface.ROTATION_270) {
mAppBounds.inset(mDisplayCutoutInsets);
}
}
return new SwipePipToHomeAnimator(mContext, mTaskId, mComponentName, mLeash,
mSourceRectHint, mAppBounds,
mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
@@ -1158,7 +1158,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
final TaskView taskView = (TaskView) getChildAt(pageIndex);
taskView.bind(task, mOrientationState);
}
if (mFocusedTaskId == -1 && getTaskViewCount() > 0) {
// If the list changed, maybe the focused task doesn't exist anymore
if (getFocusedTaskView() == null && getTaskViewCount() > 0) {
mFocusedTaskId = getTaskViewAt(0).getTaskId();
}
updateTaskSize();
@@ -2493,14 +2495,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
resetTaskVisuals();
int pageToSnapTo = mCurrentPage;
if ((dismissedIndex < pageToSnapTo && !showAsGrid)
|| pageToSnapTo == taskCount - 1) {
pageToSnapTo -= 1;
if (finalNextFocusedTaskView != null) {
pageToSnapTo = indexOfChild(finalNextFocusedTaskView);
}
if (showAsGrid) {
int primaryScroll = mOrientationHandler.getPrimaryScroll(RecentsView.this);
int currentPageScroll = getScrollForPage(pageToSnapTo);
mCurrentPageScrollDiff = primaryScroll - currentPageScroll;
if (dismissedIndex < pageToSnapTo || pageToSnapTo == (taskCount - 1)) {
pageToSnapTo -= 1;
}
removeViewInLayout(dismissedTaskView);
mTopRowIdSet.remove(dismissedTaskId);
@@ -2514,11 +2513,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mFocusedTaskId = finalNextFocusedTaskView.getTaskId();
mTopRowIdSet.remove(mFocusedTaskId);
finalNextFocusedTaskView.animateIconScaleAndDimIntoView();
setCurrentPage(pageToSnapTo);
}
updateTaskSize(true);
// Update scroll and snap to page.
updateScrollSynchronously();
setCurrentPage(pageToSnapTo);
snapToPageImmediately(pageToSnapTo);
dispatchScrollChanged();
}
}
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<view class="com.android.launcher3.graphics.LauncherPreviewRenderer$LauncherPreviewLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.launcher3.CellLayout
android:id="@+id/workspace_left"
android:layout_width="0dp"
android:layout_height="0dp"
android:theme="@style/HomeScreenElementTheme"
launcher:containerType="workspace"
launcher:layout_constraintStart_toStartOf="parent"
launcher:layout_constraintTop_toTopOf="parent"
launcher:layout_constraintEnd_toStartOf="@id/workspace"
launcher:layout_constraintBottom_toBottomOf="parent"
launcher:pageIndicator="@+id/page_indicator" />
<com.android.launcher3.CellLayout
android:id="@+id/workspace"
android:layout_width="0dp"
android:layout_height="0dp"
android:theme="@style/HomeScreenElementTheme"
launcher:containerType="workspace"
launcher:layout_constraintStart_toEndOf="@id/workspace_left"
launcher:layout_constraintTop_toTopOf="parent"
launcher:layout_constraintEnd_toEndOf="parent"
launcher:layout_constraintBottom_toBottomOf="parent"
launcher:pageIndicator="@+id/page_indicator" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include
android:id="@+id/hotseat"
layout="@layout/hotseat" />
</view>
@@ -131,7 +131,7 @@ public class GridSizeMigrationTaskV2Test {
mIdp.numDatabaseHotseatIcons);
GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(mContext, mDb, srcReader,
destReader, mIdp.numDatabaseHotseatIcons, new Point(mIdp.numColumns, mIdp.numRows));
task.migrate();
task.migrate(mIdp);
// Check hotseat items
Cursor c = mContext.getContentResolver().query(LauncherSettings.Favorites.CONTENT_URI,
@@ -211,7 +211,7 @@ public class GridSizeMigrationTaskV2Test {
mIdp.numDatabaseHotseatIcons);
GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(mContext, mDb, srcReader,
destReader, mIdp.numDatabaseHotseatIcons, new Point(mIdp.numColumns, mIdp.numRows));
task.migrate();
task.migrate(mIdp);
// Check hotseat items
Cursor c = mContext.getContentResolver().query(LauncherSettings.Favorites.CONTENT_URI,
@@ -259,7 +259,7 @@ public class GridSizeMigrationTaskV2Test {
mIdp.numDatabaseHotseatIcons);
GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(mContext, mDb, srcReader,
destReader, mIdp.numDatabaseHotseatIcons, new Point(mIdp.numColumns, mIdp.numRows));
task.migrate();
task.migrate(mIdp);
// Check hotseat items
Cursor c = mContext.getContentResolver().query(LauncherSettings.Favorites.CONTENT_URI,
+1 -6
View File
@@ -104,10 +104,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
@ViewDebug.ExportedProperty(category = "launcher")
protected int mCurrentPage;
// Difference between current scroll position and mCurrentPage's page scroll. Used to maintain
// relative scroll position unchanged in updateCurrentPageScroll. Cleared when snapping to a
// page.
protected int mCurrentPageScrollDiff;
@ViewDebug.ExportedProperty(category = "launcher")
protected int mNextPage = INVALID_PAGE;
@@ -251,7 +247,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
// If the current page is invalid, just reset the scroll position to zero
int newPosition = 0;
if (0 <= mCurrentPage && mCurrentPage < getPageCount()) {
newPosition = getScrollForPage(mCurrentPage) + mCurrentPageScrollDiff;
newPosition = getScrollForPage(mCurrentPage);
}
mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
@@ -456,7 +452,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
* to provide custom behavior during animation.
*/
protected void onPageEndTransition() {
mCurrentPageScrollDiff = 0;
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
AccessibilityManagerCompat.sendCustomAccessibilityEvent(getPageAt(mCurrentPage),
AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
@@ -208,7 +208,7 @@ public class LauncherPreviewRenderer extends ContextWrapper
private final LayoutInflater mHomeElementInflater;
private final InsettableFrameLayout mRootView;
private final Hotseat mHotseat;
private final CellLayout mWorkspace;
private final Map<Integer, CellLayout> mWorkspaceScreens = new HashMap<>();
private final AppWidgetHost mAppWidgetHost;
private final SparseIntArray mWallpaperColorResources;
@@ -254,19 +254,31 @@ public class LauncherPreviewRenderer extends ContextWrapper
new ContextThemeWrapper(this, R.style.HomeScreenElementTheme));
mHomeElementInflater.setFactory2(this);
int layoutRes = mDp.isTwoPanels ? R.layout.launcher_preview_two_panel_layout
: R.layout.launcher_preview_layout;
mRootView = (InsettableFrameLayout) mHomeElementInflater.inflate(
R.layout.launcher_preview_layout, null, false);
layoutRes, null, false);
mRootView.setInsets(mInsets);
measureView(mRootView, mDp.widthPx, mDp.heightPx);
mHotseat = mRootView.findViewById(R.id.hotseat);
mHotseat.resetLayout(false);
mWorkspace = mRootView.findViewById(R.id.workspace);
mWorkspace.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
if (mDp.isTwoPanels) {
CellLayout leftPanel = mRootView.findViewById(R.id.workspace_left);
leftPanel.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.top,
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.bottom);
mWorkspaceScreens.put(LEFT_PANEL_ID, leftPanel);
}
CellLayout firstScreen = mRootView.findViewById(R.id.workspace);
firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.top,
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.bottom);
mWorkspaceScreens.put(FIRST_SCREEN_ID, firstScreen);
if (FeatureFlags.WIDGETS_IN_LAUNCHER_PREVIEW.get()) {
mAppWidgetHost = new LauncherPreviewAppWidgetHost(context);
@@ -335,18 +347,20 @@ public class LauncherPreviewRenderer extends ContextWrapper
@Override
public CellLayout getScreenWithId(int screenId) {
return mWorkspace;
return mWorkspaceScreens.get(screenId);
}
private void inflateAndAddIcon(WorkspaceItemInfo info) {
CellLayout screen = mWorkspaceScreens.get(info.screenId);
BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
R.layout.app_icon, mWorkspace, false);
R.layout.app_icon, screen, false);
icon.applyFromWorkspaceItem(info);
addInScreenFromBind(icon, info);
}
private void inflateAndAddFolder(FolderInfo info) {
FolderIcon folderIcon = FolderIcon.inflateIcon(R.layout.folder_icon, this, mWorkspace,
CellLayout screen = mWorkspaceScreens.get(info.screenId);
FolderIcon folderIcon = FolderIcon.inflateIcon(R.layout.folder_icon, this, screen,
info);
addInScreenFromBind(folderIcon, info);
}
@@ -396,7 +410,8 @@ public class LauncherPreviewRenderer extends ContextWrapper
}
private void inflateAndAddPredictedIcon(WorkspaceItemInfo info) {
View view = PredictedAppIconInflater.inflate(mHomeElementInflater, mWorkspace, info);
CellLayout screen = mWorkspaceScreens.get(info.screenId);
View view = PredictedAppIconInflater.inflate(mHomeElementInflater, screen, info);
if (view != null) {
addInScreenFromBind(view, info);
}
@@ -428,8 +443,7 @@ public class LauncherPreviewRenderer extends ContextWrapper
ArrayList<LauncherAppWidgetInfo> currentAppWidgets = new ArrayList<>();
ArrayList<LauncherAppWidgetInfo> otherAppWidgets = new ArrayList<>();
IntSet currentScreenIds = IntSet.wrap(0);
// TODO(b/185508060): support two panel preview.
IntSet currentScreenIds = IntSet.wrap(mWorkspaceScreens.keySet());
filterCurrentWorkspaceItems(currentScreenIds, dataModel.workspaceItems,
currentWorkspaceItems, otherWorkspaceItems);
filterCurrentWorkspaceItems(currentScreenIds, dataModel.appWidgets, currentAppWidgets,
@@ -487,12 +501,13 @@ public class LauncherPreviewRenderer extends ContextWrapper
// Add first page QSB
if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);
View qsb = mHomeElementInflater.inflate(
R.layout.search_container_workspace, mWorkspace, false);
R.layout.search_container_workspace, firstScreen, false);
CellLayout.LayoutParams lp =
new CellLayout.LayoutParams(0, 0, mWorkspace.getCountX(), 1);
new CellLayout.LayoutParams(0, 0, firstScreen.getCountX(), 1);
lp.canReorder = false;
mWorkspace.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
}
measureView(mRootView, mDp.widthPx, mDp.heightPx);
@@ -38,11 +38,13 @@ import android.view.animation.AccelerateDecelerateInterpolator;
import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.graphics.LauncherPreviewRenderer.PreviewContext;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.GridSizeMigrationTask;
@@ -163,11 +165,17 @@ public class PreviewSurfaceRenderer {
@Override
public void run() {
DeviceProfile deviceProfile = mIdp.getDeviceProfile(mContext);
String query = (deviceProfile.isTwoPanels ? LauncherSettings.Favorites.SCREEN
+ " = " + Workspace.LEFT_PANEL_ID + " or " : "")
+ LauncherSettings.Favorites.SCREEN + " = " + Workspace.FIRST_SCREEN_ID
+ " or " + LauncherSettings.Favorites.CONTAINER + " = "
+ LauncherSettings.Favorites.CONTAINER_HOTSEAT;
loadWorkspace(new ArrayList<>(), LauncherSettings.Favorites.PREVIEW_CONTENT_URI,
LauncherSettings.Favorites.SCREEN + " = 0 or "
+ LauncherSettings.Favorites.CONTAINER + " = "
+ LauncherSettings.Favorites.CONTAINER_HOTSEAT);
query);
MAIN_EXECUTOR.execute(() -> {
mBgDataModel.isLeftPanelShown = deviceProfile.isTwoPanels;
renderView(previewContext, mBgDataModel, mWidgetProvidersMap);
mOnDestroyCallbacks.add(previewContext::onDestroy);
});
@@ -41,6 +41,7 @@ import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.graphics.LauncherPreviewRenderer;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.pm.InstallSessionHelper;
@@ -183,7 +184,7 @@ public class GridSizeMigrationTaskV2 {
Point targetSize = new Point(idp.numColumns, idp.numRows);
GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(context, t.getDb(),
srcReader, destReader, idp.numDatabaseHotseatIcons, targetSize);
task.migrate();
task.migrate(idp);
if (!migrateForPreview) {
dropTable(t.getDb(), LauncherSettings.Favorites.TMP_TABLE);
@@ -210,7 +211,7 @@ public class GridSizeMigrationTaskV2 {
}
@VisibleForTesting
protected boolean migrate() {
protected boolean migrate(InvariantDeviceProfile idp) {
if (mHotseatDiff.isEmpty() && mWorkspaceDiff.isEmpty()) {
return false;
}
@@ -224,7 +225,17 @@ public class GridSizeMigrationTaskV2 {
Collections.sort(mWorkspaceDiff);
// Migrate workspace.
// First we create a collection of the screens
List<Integer> screens = new ArrayList<>();
if (idp.getDeviceProfile(mContext).isTwoPanels) {
screens.add(Workspace.LEFT_PANEL_ID);
}
for (int screenId = 0; screenId <= mDestReader.mLastScreenId; screenId++) {
screens.add(screenId);
}
// Then we place the items on the screens
for (int screenId : screens) {
if (DEBUG) {
Log.d(TAG, "Migrating " + screenId);
}
@@ -236,6 +247,8 @@ public class GridSizeMigrationTaskV2 {
}
}
// In case the new grid is smaller, there might be some leftover items that don't fit on
// any of the screens, in this case we add them to new screens until all of them are placed.
int screenId = mDestReader.mLastScreenId + 1;
while (!mWorkspaceDiff.isEmpty()) {
GridPlacementSolution workspaceSolution = new GridPlacementSolution(mDb, mSrcReader,
@@ -293,8 +293,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
"tutorial_steps",
new String[] {
"HOME_NAVIGATION",
"LEFT_EDGE_BACK_NAVIGATION",
"RIGHT_EDGE_BACK_NAVIGATION",
"BACK_NAVIGATION",
"OVERVIEW_NAVIGATION"}));
return true;
});
@@ -306,7 +305,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
launchBackTutorialPreference.setOnPreferenceClickListener(preference -> {
startActivity(launchSandboxIntent.putExtra(
"tutorial_steps",
new String[] {"LEFT_EDGE_BACK_NAVIGATION", "RIGHT_EDGE_BACK_NAVIGATION"}));
new String[] {"BACK_NAVIGATION"}));
return true;
});
sandboxCategory.addPreference(launchBackTutorialPreference);
@@ -101,6 +101,15 @@ public class IntSet implements Iterable<Integer> {
return wrap(IntArray.wrap(array));
}
/**
* Returns an IntSet with the given values.
*/
public static IntSet wrap(Iterable<Integer> iterable) {
IntSet set = new IntSet();
iterable.forEach(set::add);
return set;
}
@Override
public Iterator<Integer> iterator() {
return mArray.iterator();
@@ -102,8 +102,7 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
setResult(acceptConfig);
if (acceptConfig) {
// Dismiss widget resize frame.
mDevice.pressHome();
// TODO(b/192655785) Assert widget resize frame is shown and then dismiss it.
Wait.atMost("", new WidgetSearchCondition(), DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
} else {
@@ -71,6 +71,10 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
return mLauncher.isTablet();
}
protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
return false;
}
protected void goToOverviewUnchecked() {
switch (mLauncher.getNavigationModel()) {
case ZERO_BUTTON: {
@@ -90,21 +94,32 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
mLauncher.sendPointer(
downTime, downTime, MotionEvent.ACTION_DOWN, start, gestureScope);
mLauncher.executeAndWaitForLauncherEvent(
() -> mLauncher.movePointer(
downTime,
downTime,
ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION,
start,
end,
gestureScope),
event -> TestProtocol.PAUSE_DETECTED_MESSAGE.equals(event.getClassName()),
() -> "Pause wasn't detected", "swiping and holding");
mLauncher.runToState(
() -> mLauncher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, end,
gestureScope),
OVERVIEW_STATE_ORDINAL, "sending UP event");
Runnable swipeAndHold = () -> mLauncher.movePointer(
downTime,
downTime,
ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION,
start,
end,
gestureScope);
String swipeAndHoldAction = "swiping and holding";
Runnable up = () -> mLauncher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, end,
gestureScope);
String upAction = "sending UP event";
if (zeroButtonToOverviewGestureStateTransitionWhileHolding()) {
mLauncher.runToState(swipeAndHold, OVERVIEW_STATE_ORDINAL, swipeAndHoldAction);
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(upAction)) {
up.run();
}
} else {
mLauncher.executeAndWaitForLauncherEvent(
swipeAndHold,
event -> TestProtocol.PAUSE_DETECTED_MESSAGE.equals(
event.getClassName()),
() -> "Pause wasn't detected",
swipeAndHoldAction);
mLauncher.runToState(up, OVERVIEW_STATE_ORDINAL, upAction);
}
break;
}
@@ -63,4 +63,8 @@ public abstract class Home extends Background {
return true;
}
@Override
protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
return true;
}
}
@@ -735,6 +735,7 @@ public final class LauncherInstrumentation {
dumpViewHierarchy();
action = "swiping up to home";
final boolean launcherIsVisible = isLauncherVisible();
swipeToState(
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
@@ -742,6 +743,9 @@ public final class LauncherInstrumentation {
launcherWasVisible
? GestureScope.INSIDE_TO_OUTSIDE
: GestureScope.OUTSIDE_WITH_PILFER);
// b/193653850: launcherWasVisible is a flaky indicator.
log("launcherWasVisible: " + launcherWasVisible + ", launcherIsVisible: "
+ launcherIsVisible);
}
} else {
log("Hierarchy before clicking home:");