Snap for 9754537 from 910a2aafda to udc-release

Change-Id: I551f782bce90712a7e6cbe3844d6ae4015aee5aa
This commit is contained in:
Android Build Coastguard Worker
2023-03-16 03:26:29 +00:00
14 changed files with 82 additions and 45 deletions
-24
View File
@@ -5,36 +5,12 @@
#
adamcohen@google.com
alexchau@google.com
andonian@google.com
awickham@google.com
brdayauon@google.com
brianji@google.com
captaincole@google.com
charlander@google.com
fbaron@google.com
ganjam@google.com
hwwang@google.com
hyunyoungs@google.com
jagrutdesai@google.com
jeremysim@google.com
jiuyu@google.com
jonmiranda@google.com
kylim@google.com
patmanning@google.com
peanutbutter@google.com
pinyaoting@google.com
randypfohl@google.com
saumyaprakash@google.com
sihua@google.com
sunnygoyal@google.com
tracyzhou@google.com
tsuharesu@google.com
twickham@google.com
vadimt@google.com
victortulias@google.com
winsonc@google.com
xuqiu@google.com
per-file FeatureFlags.java, globs = set noparent
per-file FeatureFlags.java = sunnygoyal@google.com, winsonc@google.com, adamcohen@google.com, hyunyoungs@google.com, captaincole@google.com
@@ -77,13 +77,14 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
/**
* Creates an animation to animate the taskbar for the given state (but does not start it).
* Currently this animation just force stashes the taskbar in Overview.
*/
public Animator createAnimToRecentsState(RecentsState toState, long duration) {
boolean useStashedLauncherState = toState.hasOverviewActions();
boolean stashedLauncherState =
useStashedLauncherState && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()
&& toState == RecentsState.MODAL_TASK;
// Force stash the taskbar in overview modal state or when going home.
boolean useStashedLauncherState =
toState.hasOverviewActions() || toState == RecentsState.HOME;
boolean stashedLauncherState = useStashedLauncherState && (
(FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get() && toState == RecentsState.MODAL_TASK)
|| toState == RecentsState.HOME);
TaskbarStashController stashController = mControllers.taskbarStashController;
// Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected.
// For all other states, just use the current stashed-in-app setting (e.g. if long clicked).
@@ -46,7 +46,7 @@ public class FlagsFactory {
private static final String TAG = "FlagsFactory";
private static final FlagsFactory INSTANCE = new FlagsFactory();
private static final boolean FLAG_AUTO_APPLY_ENABLED = false;
private static final boolean FLAG_AUTO_APPLY_ENABLED = true;
public static final String FLAGS_PREF_NAME = "featureFlags";
public static final String NAMESPACE_LAUNCHER = "launcher";
@@ -75,9 +75,17 @@ public class OverviewState extends LauncherState {
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
RecentsView recentsView = launcher.getOverviewPanel();
float workspacePageHeight = launcher.getDeviceProfile().getCellLayoutHeight();
recentsView.getTaskSize(sTempRect);
float scale = (float) sTempRect.height() / workspacePageHeight;
float scale;
DeviceProfile deviceProfile = launcher.getDeviceProfile();
if (deviceProfile.isTwoPanels) {
// In two panel layout, width does not include both panels or space between them, so
// use height instead. We do not use height for handheld, as cell layout can be
// shorter than a task and we want the workspace to scale down to task size.
scale = (float) sTempRect.height() / deviceProfile.getCellLayoutHeight();
} else {
scale = (float) sTempRect.width() / deviceProfile.getCellLayoutWidth();
}
float parallaxFactor = 0.5f;
return new ScaleAndTranslation(scale, 0, -getDefaultSwipeHeight(launcher) * parallaxFactor);
}
@@ -33,6 +33,7 @@ import android.view.Surface;
import com.android.launcher3.R;
import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.NavigationMode;
import com.android.launcher3.util.window.CachedDisplayInfo;
@@ -119,7 +120,7 @@ class OrientationTouchTransformer {
}
void setNavigationMode(NavigationMode newMode, Info info, Resources newRes) {
if (DEBUG) {
if (enableLog()) {
Log.d(TAG, "setNavigationMode new: " + newMode + " oldMode: " + mMode + " " + this);
}
if (mMode == newMode) {
@@ -206,7 +207,7 @@ class OrientationTouchTransformer {
* Ok to call multiple times.
*/
private void resetSwipeRegions(Info region) {
if (DEBUG) {
if (enableLog()) {
Log.d(TAG, "clearing all regions except rotation: " + mCachedDisplayInfo.rotation);
}
@@ -230,9 +231,11 @@ class OrientationTouchTransformer {
}
private OrientationRectF createRegionForDisplay(Info display) {
if (DEBUG) {
if (enableLog()) {
Log.d(TAG, "creating rotation region for: " + mCachedDisplayInfo.rotation
+ " with mode: " + mMode + " displayRotation: " + display.rotation);
+ " with mode: " + mMode + " displayRotation: " + display.rotation +
" displaySize: " + display.currentSize +
" navBarHeight: " + mNavBarGesturalHeight);
}
Point size = display.currentSize;
@@ -296,9 +299,8 @@ class OrientationTouchTransformer {
}
boolean touchInValidSwipeRegions(float x, float y) {
if (DEBUG) {
Log.d(TAG, "touchInValidSwipeRegions " + x + "," + y + " in "
+ mLastRectTouched + " this: " + this);
if (enableLog()) {
Log.d(TAG, "touchInValidSwipeRegions " + x + "," + y + " in " + mLastRectTouched);
}
if (mLastRectTouched != null) {
return mLastRectTouched.contains(x, y);
@@ -357,11 +359,17 @@ class OrientationTouchTransformer {
}
case ACTION_POINTER_DOWN:
case ACTION_DOWN: {
if (enableLog()) {
Log.d(TAG, "ACTION_DOWN mLastRectTouched: " + mLastRectTouched);
}
if (mLastRectTouched != null) {
return;
}
for (OrientationRectF rect : mSwipeTouchRegions.values()) {
if (enableLog()) {
Log.d(TAG, "ACTION_DOWN rect: " + rect);
}
if (rect == null) {
continue;
}
@@ -376,7 +384,7 @@ class OrientationTouchTransformer {
mQuickStepStartingRotation = mLastRectTouched.getRotation();
resetSwipeRegions();
}
if (DEBUG) {
if (enableLog()) {
Log.d(TAG, "set active region: " + rect);
}
return;
@@ -387,6 +395,10 @@ class OrientationTouchTransformer {
}
}
private boolean enableLog() {
return DEBUG || TestProtocol.sDebugTracing;
}
public void dump(PrintWriter pw) {
pw.println("OrientationTouchTransformerState: ");
pw.println(" currentActiveRotation=" + getCurrentActiveRotation());
@@ -54,6 +54,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
private final float mScreenWidth;
private final int mTaskbarNavThreshold;
private final int mTaskbarNavThresholdY;
private final boolean mIsTaskbarAllAppsOpen;
private boolean mHasPassedTaskbarNavThreshold;
@@ -75,6 +76,8 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
Resources res = context.getResources();
mUnstashArea = res.getDimensionPixelSize(R.dimen.taskbar_unstash_input_area);
mTaskbarNavThreshold = res.getDimensionPixelSize(R.dimen.taskbar_nav_threshold);
mTaskbarNavThresholdY = taskbarActivityContext.getDeviceProfile().heightPx
- mTaskbarNavThreshold;
mIsTaskbarAllAppsOpen =
mTaskbarActivityContext != null && mTaskbarActivityContext.isTaskbarAllAppsOpen();
@@ -165,7 +168,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer {
}
if (dY < 0) {
dY = -OverScroll.dampedScroll(-dY, mTaskbarNavThreshold);
dY = -OverScroll.dampedScroll(-dY, mTaskbarNavThresholdY);
if (mTransitionCallback != null && !mIsTaskbarAllAppsOpen) {
mTransitionCallback.onActionMove(dY);
}
@@ -86,6 +86,7 @@ public abstract class BaseUnfoldMoveFromCenterAnimator implements TransitionProg
}
private void clearRegisteredViews() {
restoreClippings();
mMoveFromCenterAnimation.clearRegisteredViews();
mOriginalClipChildren.clear();
@@ -665,8 +665,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
getPaddingBottom());
}
// only apply two line for all_apps
if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() && (mLastOriginalText != null)
&& (mDisplay == DISPLAY_ALL_APPS)) {
if (((FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() && mDisplay == DISPLAY_ALL_APPS)
|| (FeatureFlags.ENABLE_TWOLINE_DEVICESEARCH.get()
&& mDisplay == DISPLAY_SEARCH_RESULT)) && (mLastOriginalText != null)) {
CharSequence modifiedString = modifyTitleToSupportMultiLine(
MeasureSpec.getSize(widthMeasureSpec) - getCompoundPaddingLeft()
- getCompoundPaddingRight(),
@@ -19,6 +19,7 @@ import static com.android.launcher3.allapps.ActivityAllAppsContainerView.Adapter
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE;
import android.animation.Animator;
@@ -73,6 +74,7 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.model.StringCache;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
@@ -183,7 +185,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mNavBarScrimPaint = new Paint();
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
mAllAppsStore.addUpdateListener(this::onAppsUpdated);
AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated;
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainer#init registeringListener: " +
onAppsUpdated);
}
mAllAppsStore.addUpdateListener(onAppsUpdated);
mActivityContext.addOnDeviceProfileChangeListener(this);
// This is a focus listener that proxies focus from a view into the list view. This is to
@@ -809,6 +816,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
private void onAppsUpdated() {
mHasWorkApps = Stream.of(mAllAppsStore.getApps()).anyMatch(mWorkManager.getMatcher());
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#onAppsUpdated hasWorkApps: " +
mHasWorkApps + " allApps: " + mAllAppsStore.getApps().length);
}
if (!isSearching()) {
rebindAdapters();
if (mHasWorkApps) {
@@ -18,7 +18,9 @@ package com.android.launcher3.allapps;
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -27,6 +29,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
@@ -119,6 +122,9 @@ public class AllAppsStore {
return;
}
for (OnUpdateListener listener : mUpdateListeners) {
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "AllAppsStore#notifyUpdate listener: " + listener);
}
listener.onAppsUpdated();
}
}
@@ -25,6 +25,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.os.Build;
@@ -47,6 +48,7 @@ import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip;
import java.lang.annotation.Retention;
@@ -143,6 +145,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
}
private void updateCurrentState(@WorkProfileState int currentState) {
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "WorkProfileManager#updateCurrentState: " +
currentState, new Throwable());
}
mCurrentState = currentState;
if (getAH() != null) {
getAH().mAppsList.updateAdapterItems();
@@ -161,6 +167,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
* Creates and attaches for profile toggle button to {@link ActivityAllAppsContainerView}
*/
public boolean attachWorkModeSwitch() {
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#attachWorkModeSwitch "
+ "mWorkModeSwitch: " + mWorkModeSwitch);
}
if (!mAllApps.getAppsStore().hasModelFlag(
FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)) {
Log.e(TAG, "unable to attach work mode switch; Missing required permissions");
@@ -348,7 +348,7 @@ public final class FeatureFlags {
"ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", false, "Show app icon for inline shortcut");
public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(270395278,
"SHOW_DOT_PAGINATION", false, "Enable showing dot pagination in workspace");
"SHOW_DOT_PAGINATION", true, "Enable showing dot pagination in workspace");
public static final BooleanFlag LARGE_SCREEN_WIDGET_PICKER = getDebugFlag(270395809,
"LARGE_SCREEN_WIDGET_PICKER", false, "Enable new widget picker that takes "
@@ -157,6 +157,7 @@ public final class TestProtocol {
public static final String NPE_TRANSIENT_TASKBAR = "b/257549303";
public static final String FLAKY_BINDING = "b/270216650";
public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325";
public static final String WORK_TAB_MISSING = "b/243688989";
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
@@ -18,6 +18,7 @@ package com.android.launcher3.ui;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -65,8 +66,13 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
String[] tokens = output.split("\\s+");
mProfileUserId = Integer.parseInt(tokens[tokens.length - 1]);
output = mDevice.executeShellCommand("am start-user " + mProfileUserId);
StringBuilder logStr = new StringBuilder().append("profileId: ").append(mProfileUserId);
for (String str : tokens) {
logStr.append(str).append("\n");
}
updateWorkProfileSetupSuccessful("am start-user", output);
Log.d(WORK_TAB_MISSING, "workProfileSuccessful? " + mWorkProfileSetupSuccessful);
if (!mWorkProfileSetupSuccessful) {
return; // no need to setup launcher since all tests will skip.
}
@@ -99,6 +105,7 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
private void waitForWorkTabSetup() {
waitForLauncherCondition("Work tab not setup", launcher -> {
if (launcher.getAppsView().getContentView() instanceof AllAppsPagedView) {
Log.d(WORK_TAB_MISSING, "Deferring AppsStore updates");
launcher.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
return true;
}