summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-07 02:25:18 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-07 02:25:18 +0000
commitdf7830bb5294f7cb32ad0254abb5efa6fef785f9 (patch)
tree05ce0ce7cfd286966cd4104792525cdbd88033b1
parentce4df6a82f591a8f99853f124630af9546a4ae69 (diff)
parent2f4a1b9980c48a07ddf5ea5543c0a3da785cc429 (diff)
downloadLauncher3-df7830bb5294f7cb32ad0254abb5efa6fef785f9.tar.gz
Snap for 9463735 from 2f4a1b9980c48a07ddf5ea5543c0a3da785cc429 to tm-qpr2-release
Change-Id: I32fcee8829d0fe318ba737c2b0cda203682ffc97
-rw-r--r--quickstep/res/values-de/strings.xml2
-rw-r--r--quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java17
-rw-r--r--quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java29
-rw-r--r--src/com/android/launcher3/allapps/AlphabeticalAppsList.java27
-rw-r--r--src/com/android/launcher3/allapps/BaseAllAppsContainerView.java3
-rw-r--r--src/com/android/launcher3/allapps/WorkModeSwitch.java8
-rw-r--r--src/com/android/launcher3/allapps/WorkProfileManager.java11
-rw-r--r--src/com/android/launcher3/logging/StatsLogManager.java8
-rw-r--r--tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java2
9 files changed, 76 insertions, 31 deletions
diff --git a/quickstep/res/values-de/strings.xml b/quickstep/res/values-de/strings.xml
index 86ea26461f..c7664be036 100644
--- a/quickstep/res/values-de/strings.xml
+++ b/quickstep/res/values-de/strings.xml
@@ -78,7 +78,7 @@
<string name="allset_title" msgid="5021126669778966707">"Fertig!"</string>
<string name="allset_hint" msgid="2384632994739392447">"Nach oben wischen, um den Startbildschirm aufzurufen"</string>
<string name="allset_button_hint" msgid="2395219947744706291">"Startbildschirmtaste drücken, um zum Startbildschirm zu gehen"</string>
- <string name="allset_description_generic" msgid="5385500062202019855">"Du kannst dein Gerät (<xliff:g id="DEVICE">%1$s</xliff:g>) jetzt verwenden"</string>
+ <string name="allset_description_generic" msgid="5385500062202019855">"Du kannst dein <xliff:g id="DEVICE">%1$s</xliff:g> jetzt verwenden"</string>
<string name="default_device_name" msgid="6660656727127422487">"Gerät"</string>
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"Einstellungen der Systemsteuerung"</annotation></string>
<string name="action_share" msgid="2648470652637092375">"Teilen"</string>
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 857ace25b1..8409475e4c 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -324,6 +324,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
// May be set to false when mIsTransientTaskbar is true.
private boolean mCanSlowSwipeGoHome = true;
+ @Nullable
+ private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null;
+
public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
TaskAnimationManager taskAnimationManager, GestureState gestureState,
long touchTimeMs, boolean continuingLastGesture,
@@ -869,6 +872,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(mContext, targets);
mRecentsAnimationController = controller;
mRecentsAnimationTargets = targets;
+ mSwipePipToHomeReleaseCheck = new RemoteAnimationTargets.ReleaseCheck();
+ mSwipePipToHomeReleaseCheck.setCanRelease(true);
+ mRecentsAnimationTargets.addReleaseCheck(mSwipePipToHomeReleaseCheck);
// Only initialize the device profile, if it has not been initialized before, as in some
// configurations targets.homeContentInsets may not be correct.
@@ -1430,9 +1436,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
mSwipePipToHomeAnimator = createWindowAnimationToPip(
homeAnimFactory, runningTaskTarget, start);
mSwipePipToHomeAnimators[0] = mSwipePipToHomeAnimator;
+ if (mSwipePipToHomeReleaseCheck != null) {
+ mSwipePipToHomeReleaseCheck.setCanRelease(false);
+ }
windowAnim = mSwipePipToHomeAnimators;
} else {
mSwipePipToHomeAnimator = null;
+ if (mSwipePipToHomeReleaseCheck != null) {
+ mSwipePipToHomeReleaseCheck.setCanRelease(true);
+ mSwipePipToHomeReleaseCheck = null;
+ }
windowAnim = createWindowAnimationToHome(start, homeAnimFactory);
windowAnim[0].addAnimatorListener(new AnimationSuccessListener() {
@@ -1954,6 +1967,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
finishRecentsControllerToHome(
() -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
}
+ if (mSwipePipToHomeReleaseCheck != null) {
+ mSwipePipToHomeReleaseCheck.setCanRelease(true);
+ mSwipePipToHomeReleaseCheck = null;
+ }
doLogGesture(HOME, mRecentsView == null ? null : mRecentsView.getCurrentPageTaskView());
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 9a2fcc02d9..9f34775761 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -262,6 +262,19 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
return launchedAppState;
}
+ private void quickSwitchToPreviousAppAndAssert(boolean toRight) {
+ final LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
+ if (toRight) {
+ launchedAppState.quickSwitchToPreviousApp();
+ } else {
+ launchedAppState.quickSwitchToPreviousAppSwipeLeft();
+ }
+
+ // While enable shell transition, Launcher can be resumed due to transient launch.
+ waitForLauncherCondition("Launcher shouldn't stay in resume forever",
+ this::isInLaunchedApp, 3000 /* timeout */);
+ }
+
@Test
@PortraitLandscape
public void testAllAppsFromHome() throws Exception {
@@ -288,13 +301,11 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
startTestActivity(3);
startTestActivity(4);
- LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
- launchedAppState.quickSwitchToPreviousApp();
+ quickSwitchToPreviousAppAndAssert(true /* toRight */);
assertTrue("The first app we should have quick switched to is not running",
isTestActivityRunning(3));
- launchedAppState = getAndAssertLaunchedApp();
- launchedAppState.quickSwitchToPreviousApp();
+ quickSwitchToPreviousAppAndAssert(true /* toRight */);
if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) {
// 3-button mode toggles between 2 apps, rather than going back further.
assertTrue("Second quick switch should have returned to the first app.",
@@ -303,12 +314,12 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
assertTrue("The second app we should have quick switched to is not running",
isTestActivityRunning(2));
}
- launchedAppState = getAndAssertLaunchedApp();
- launchedAppState.quickSwitchToPreviousAppSwipeLeft();
+
+ quickSwitchToPreviousAppAndAssert(false /* toRight */);
assertTrue("The 2nd app we should have quick switched to is not running",
isTestActivityRunning(3));
- launchedAppState = getAndAssertLaunchedApp();
+ final LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
launchedAppState.switchToOverview();
}
@@ -327,8 +338,10 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
launchedAppState.assertTaskbarHidden();
// Quick-switch to the test app with swiping to right.
- launchedAppState.quickSwitchToPreviousApp();
+ quickSwitchToPreviousAppAndAssert(true /* toRight */);
+ assertTrue("The first app we should have quick switched to is not running",
+ isTestActivityRunning(2));
// Expect task bar visible when the launched app was the test activity.
launchedAppState = getAndAssertLaunchedApp();
launchedAppState.assertTaskbarVisible();
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index fc1b830aed..29767bf465 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -239,23 +239,24 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
mAdapterItems.addAll(mSearchResults);
} else {
int position = 0;
+ boolean addApps = true;
if (mWorkProviderManager != null) {
position += mWorkProviderManager.addWorkItems(mAdapterItems);
- if (!mWorkProviderManager.shouldShowWorkApps()) {
- return;
- }
+ addApps = mWorkProviderManager.shouldShowWorkApps();
}
- String lastSectionName = null;
- for (AppInfo info : mApps) {
- mAdapterItems.add(AdapterItem.asApp(info));
-
- String sectionName = info.sectionName;
- // Create a new section if the section names do not match
- if (!sectionName.equals(lastSectionName)) {
- lastSectionName = sectionName;
- mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position));
+ if (addApps) {
+ String lastSectionName = null;
+ for (AppInfo info : mApps) {
+ mAdapterItems.add(AdapterItem.asApp(info));
+
+ String sectionName = info.sectionName;
+ // Create a new section if the section names do not match
+ if (!sectionName.equals(lastSectionName)) {
+ lastSectionName = sectionName;
+ mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position));
+ }
+ position++;
}
- position++;
}
}
mAccessibilityResultsCount = (int) mAdapterItems.stream()
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index ca08164a05..00e89bacc5 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -163,7 +163,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
mWorkManager = new WorkProfileManager(
mActivityContext.getSystemService(UserManager.class),
- this, LauncherPrefs.getPrefs(mActivityContext));
+ this, LauncherPrefs.getPrefs(mActivityContext),
+ mActivityContext.getStatsLogManager());
mAH = Arrays.asList(null, null, null);
mNavBarScrimPaint = new Paint();
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index c9466a8f43..11ce738208 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.allapps;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_COLLAPSE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORK_FAB_BUTTON_EXTEND;
import static com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.getTabWidth;
import android.animation.LayoutTransition;
@@ -37,6 +39,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.KeyboardInsetAnimationCallback;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.StringCache;
import com.android.launcher3.views.ActivityContext;
/**
@@ -59,6 +62,8 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
private final int mScrollThreshold;
private ImageView mIcon;
private TextView mTextView;
+ private final StatsLogManager mStatsLogManager;
+
public WorkModeSwitch(@NonNull Context context) {
this(context, null, 0);
@@ -72,6 +77,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
super(context, attrs, defStyleAttr);
mScrollThreshold = Utilities.dpToPx(SCROLL_THRESHOLD_DP);
mActivityContext = ActivityContext.lookupContext(getContext());
+ mStatsLogManager = mActivityContext.getStatsLogManager();
}
@Override
@@ -197,10 +203,12 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
public void extend() {
mTextView.setVisibility(VISIBLE);
+ mStatsLogManager.logger().log(LAUNCHER_WORK_FAB_BUTTON_EXTEND);
}
public void shrink(){
mTextView.setVisibility(GONE);
+ mStatsLogManager.logger().log(LAUNCHER_WORK_FAB_BUTTON_COLLAPSE);
}
public int getScrollThreshold() {
diff --git a/src/com/android/launcher3/allapps/WorkProfileManager.java b/src/com/android/launcher3/allapps/WorkProfileManager.java
index 547b74c833..279f0d399c 100644
--- a/src/com/android/launcher3/allapps/WorkProfileManager.java
+++ b/src/com/android/launcher3/allapps/WorkProfileManager.java
@@ -43,8 +43,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip;
import java.lang.annotation.Retention;
@@ -80,6 +80,7 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
private final UserManager mUserManager;
private final BaseAllAppsContainerView<?> mAllApps;
private final Predicate<ItemInfo> mMatcher;
+ private final StatsLogManager mStatsLogManager;
private WorkModeSwitch mWorkModeSwitch;
@@ -88,11 +89,13 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
private SharedPreferences mPreferences;
public WorkProfileManager(
- UserManager userManager, BaseAllAppsContainerView<?> allApps, SharedPreferences prefs) {
+ UserManager userManager, BaseAllAppsContainerView<?> allApps, SharedPreferences prefs,
+ StatsLogManager statsLogManager) {
mUserManager = userManager;
mAllApps = allApps;
mPreferences = prefs;
mMatcher = mAllApps.mPersonalMatcher.negate();
+ mStatsLogManager = statsLogManager;
}
/**
@@ -227,9 +230,7 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
private void onWorkFabClicked(View view) {
if (Utilities.ATLEAST_P && mCurrentState == STATE_ENABLED && mWorkModeSwitch.isEnabled()) {
- ActivityContext activityContext = ActivityContext.lookupContext(
- mWorkModeSwitch.getContext());
- activityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
+ mStatsLogManager.logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
setWorkProfileEnabled(false);
}
}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 24d8c9dc5e..2159c6b68f 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -624,7 +624,13 @@ public class StatsLogManager implements ResourceBasedOverride {
LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_RIGHT_BOTTOM(1232),
@UiEvent(doc = "User has invoked split to left half with a keyboard shortcut.")
- LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233)
+ LAUNCHER_KEYBOARD_SHORTCUT_SPLIT_LEFT_TOP(1233),
+
+ @UiEvent(doc = "User has collapsed the work FAB button by swiping down")
+ LAUNCHER_WORK_FAB_BUTTON_COLLAPSE(1276),
+
+ @UiEvent(doc = "User has collapsed the work FAB button by swiping up")
+ LAUNCHER_WORK_FAB_BUTTON_EXTEND(1277),
;
// ADD MORE
diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
index 3f4a1c128e..2c9785c93d 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
@@ -37,7 +37,6 @@ import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -65,7 +64,6 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
mAppWidgetManager = AppWidgetManager.getInstance(mTargetContext);
}
- @Ignore
@Test
@PortraitLandscape
public void testWidgetConfig() throws Throwable {