diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index d348cc3353..92dd22c9dd 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -46,6 +46,7 @@ import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION; import static com.android.launcher3.views.FloatingIconView.getFloatingIconView; +import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch; import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius; import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows; @@ -1119,6 +1120,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener * Registers remote animations used when closing apps to home screen. */ public void registerRemoteTransitions() { + if (ENABLE_SHELL_TRANSITIONS) { + SystemUiProxy.INSTANCE.get(mLauncher).shareTransactionQueue(); + } if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } @@ -1158,6 +1162,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } private void unregisterRemoteTransitions() { + if (ENABLE_SHELL_TRANSITIONS) { + SystemUiProxy.INSTANCE.get(mLauncher).unshareTransactionQueue(); + } if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } diff --git a/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java b/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java index 9c3b8816cb..8baee004cc 100644 --- a/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java +++ b/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java @@ -22,6 +22,8 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import androidx.annotation.NonNull; + import com.android.launcher3.LauncherSettings; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -33,11 +35,13 @@ public class InstantAppItemInfo extends AppInfo { this.componentName = new ComponentName(packageName, COMPONENT_CLASS_MARKER); } + @NonNull @Override public ComponentName getTargetComponent() { return componentName; } + @NonNull @Override public WorkspaceItemInfo makeWorkspaceItem(Context context) { WorkspaceItemInfo workspaceItemInfo = super.makeWorkspaceItem(context); diff --git a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java index 4e59790771..89c07f234b 100644 --- a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java +++ b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java @@ -19,6 +19,7 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.os.UserHandle; import android.util.Log; import android.view.View; @@ -71,7 +72,7 @@ public interface QuickstepSystemShortcut { RecentsView recentsView = mTarget.getOverviewPanel(); recentsView.initiateSplitSelect( new SplitSelectSource(mOriginalView, new BitmapDrawable(bitmap), intent, - mPosition)); + mPosition, mItemInfo.user)); } } @@ -81,13 +82,15 @@ public interface QuickstepSystemShortcut { public final Drawable drawable; public final Intent intent; public final SplitPositionOption position; + public final UserHandle user; public SplitSelectSource(View view, Drawable drawable, Intent intent, - SplitPositionOption position) { + SplitPositionOption position, UserHandle user) { this.view = view; this.drawable = drawable; this.intent = intent; this.position = position; + this.user = user; } } } diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 0ec7e628b5..c2b8c8bd1b 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -28,7 +28,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; -import android.graphics.Bitmap; import android.graphics.Insets; import android.graphics.Rect; import android.os.Bundle; @@ -101,6 +100,7 @@ public class SystemUiProxy implements ISystemUiProxy, DisplayController.DisplayI private ILauncherUnlockAnimationController mLauncherUnlockAnimationController; private IRecentTasksListener mRecentTasksListener; private final ArrayList mRemoteTransitions = new ArrayList<>(); + private IBinder mOriginalTransactionToken = null; private IOnBackInvokedCallback mBackToLauncherCallback; // Used to dedupe calls to SystemUI @@ -199,6 +199,7 @@ public class SystemUiProxy implements ISystemUiProxy, DisplayController.DisplayI for (int i = mRemoteTransitions.size() - 1; i >= 0; --i) { registerRemoteTransition(mRemoteTransitions.get(i)); } + setupTransactionQueue(); if (mRecentTasksListener != null && mRecentTasks != null) { registerRecentTasksListener(mRecentTasksListener); } @@ -721,6 +722,50 @@ public class SystemUiProxy implements ISystemUiProxy, DisplayController.DisplayI mRemoteTransitions.remove(remoteTransition); } + /** + * Use SystemUI's transaction-queue instead of Launcher's independent one. This is necessary + * if Launcher and SystemUI need to coordinate transactions (eg. for shell transitions). + */ + public void shareTransactionQueue() { + if (mOriginalTransactionToken == null) { + mOriginalTransactionToken = SurfaceControl.Transaction.getDefaultApplyToken(); + } + setupTransactionQueue(); + } + + /** + * Switch back to using Launcher's independent transaction queue. + */ + public void unshareTransactionQueue() { + if (mOriginalTransactionToken == null) { + return; + } + SurfaceControl.Transaction.setDefaultApplyToken(mOriginalTransactionToken); + mOriginalTransactionToken = null; + } + + private void setupTransactionQueue() { + if (mOriginalTransactionToken == null) { + return; + } + if (mShellTransitions == null) { + SurfaceControl.Transaction.setDefaultApplyToken(mOriginalTransactionToken); + return; + } + final IBinder shellApplyToken; + try { + shellApplyToken = mShellTransitions.getShellApplyToken(); + } catch (RemoteException e) { + Log.e(TAG, "Error getting Shell's apply token", e); + return; + } + if (shellApplyToken == null) { + Log.e(TAG, "Didn't receive apply token from Shell"); + return; + } + SurfaceControl.Transaction.setDefaultApplyToken(shellApplyToken); + } + // // Starting window // diff --git a/quickstep/src/com/android/quickstep/ViewUtils.java b/quickstep/src/com/android/quickstep/ViewUtils.java index 1bb95b97f9..b1320674e6 100644 --- a/quickstep/src/com/android/quickstep/ViewUtils.java +++ b/quickstep/src/com/android/quickstep/ViewUtils.java @@ -53,13 +53,13 @@ public class ViewUtils { final Runnable mFinishCallback; final BooleanSupplier mCancelled; final Handler mHandler; + boolean mSurfaceCallbackRegistered = false; boolean mFinished; int mDeferFrameCount = 1; FrameHandler(View view, Runnable finishCallback, BooleanSupplier cancelled) { mViewRoot = view.getViewRootImpl(); - mViewRoot.addSurfaceChangedCallback(this); mFinishCallback = finishCallback; mCancelled = cancelled; mHandler = new Handler(); @@ -103,6 +103,10 @@ public class ViewUtils { private boolean schedule() { if (mViewRoot != null && mViewRoot.getView() != null) { + if (!mSurfaceCallbackRegistered) { + mSurfaceCallbackRegistered = true; + mViewRoot.addSurfaceChangedCallback(this); + } mViewRoot.registerRtFrameCallback(this); mViewRoot.getView().invalidate(); return true; @@ -119,7 +123,10 @@ public class ViewUtils { if (mFinishCallback != null) { mFinishCallback.run(); } - mViewRoot.removeSurfaceChangedCallback(this); + if (mViewRoot != null) { + mViewRoot.removeSurfaceChangedCallback(this); + mSurfaceCallbackRegistered = false; + } } } } diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index 0ca557443f..8f322140b8 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -33,6 +33,7 @@ import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.IBinder; +import android.os.UserHandle; import android.text.TextUtils; import android.view.RemoteAnimationAdapter; import android.view.SurfaceControl; @@ -77,6 +78,8 @@ public class SplitSelectStateController { private int mSecondTaskId = INVALID_TASK_ID; private String mSecondTaskPackageName; private boolean mRecentsAnimationRunning; + @Nullable + private UserHandle mUser; /** If not null, this is the TaskView we want to launch from */ @Nullable private GroupedTaskView mLaunchingTaskView; @@ -97,12 +100,15 @@ public class SplitSelectStateController { mInitialTaskId = taskId; mStagePosition = stagePosition; mInitialTaskIntent = null; + mUser = null; } - public void setInitialTaskSelect(Intent intent, @StagePosition int stagePosition) { + public void setInitialTaskSelect(Intent intent, @StagePosition int stagePosition, + @Nullable UserHandle user) { mInitialTaskIntent = intent; mStagePosition = stagePosition; mInitialTaskId = INVALID_TASK_ID; + mUser = user; } /** @@ -120,9 +126,12 @@ public class SplitSelectStateController { } else { fillInIntent = null; } - final PendingIntent pendingIntent = - mInitialTaskIntent == null ? null : PendingIntent.getActivity(mContext, 0, - mInitialTaskIntent, FLAG_MUTABLE); + + final PendingIntent pendingIntent = mInitialTaskIntent == null ? null : (mUser != null + ? PendingIntent.getActivityAsUser(mContext, 0, mInitialTaskIntent, + FLAG_MUTABLE, null /* options */, mUser) + : PendingIntent.getActivity(mContext, 0, mInitialTaskIntent, FLAG_MUTABLE)); + launchTasks(mInitialTaskId, pendingIntent, fillInIntent, mSecondTaskId, mStagePosition, callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO); } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index ebc8c001f6..6b8458d698 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4105,7 +4105,7 @@ public abstract class RecentsView assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher))); } + + @Test + public void testDisableRotationCheckForPhone() throws Exception { + assumeFalse(mLauncher.isTablet()); + try { + mLauncher.setExpectedRotationCheckEnabled(false); + mLauncher.setEnableRotation(false); + final AllApps allApps = mLauncher.getWorkspace().switchToAllApps(); + allApps.freeze(); + try { + allApps.getAppIcon("TestActivity7").launch(getAppPackageName()); + } finally { + allApps.unfreeze(); + } + mLauncher.getDevice().setOrientationLeft(); + mLauncher.goHome(); + } finally { + mLauncher.setExpectedRotationCheckEnabled(true); + mLauncher.setEnableRotation(true); + mLauncher.getDevice().setOrientationNatural(); + } + } } diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml index e1646ba43e..b46298cfdb 100644 --- a/res/layout/search_container_all_apps.xml +++ b/res/layout/search_container_all_apps.xml @@ -26,6 +26,7 @@ android:gravity="center" android:hint="@string/all_apps_search_bar_hint" android:imeOptions="actionSearch|flagNoExtractUi" + android:importantForAutofill="no" android:inputType="text|textNoSuggestions|textCapWords" android:maxLines="1" android:padding="8dp" diff --git a/res/layout/secondary_launcher.xml b/res/layout/secondary_launcher.xml index bdc51be3a6..4be2e456ac 100644 --- a/res/layout/secondary_launcher.xml +++ b/res/layout/secondary_launcher.xml @@ -93,6 +93,7 @@ android:gravity="center" android:hint="@string/all_apps_search_bar_hint" android:imeOptions="actionSearch|flagNoExtractUi" + android:importantForAutofill="no" android:inputType="text|textNoSuggestions|textCapWords" android:maxLines="1" android:padding="8dp" diff --git a/res/layout/user_folder_icon_normalized.xml b/res/layout/user_folder_icon_normalized.xml index 337014ace8..87bf33df8b 100644 --- a/res/layout/user_folder_icon_normalized.xml +++ b/res/layout/user_folder_icon_normalized.xml @@ -47,6 +47,7 @@ android:gravity="center_horizontal" android:hint="@string/folder_hint_text" android:imeOptions="flagNoExtractUi" + android:importantForAutofill="no" android:singleLine="true" android:textColor="?attr/folderTextColor" android:textColorHighlight="?android:attr/colorControlHighlight" diff --git a/res/layout/widgets_search_bar.xml b/res/layout/widgets_search_bar.xml index 9178a75076..6d44865ef0 100644 --- a/res/layout/widgets_search_bar.xml +++ b/res/layout/widgets_search_bar.xml @@ -23,6 +23,7 @@ android:layout_weight="1" android:inputType="text" android:imeOptions="actionSearch" + android:importantForAutofill="no" android:textColor="?android:attr/textColorPrimary" android:textColorHint="?android:attr/textColorSecondary"/> diff --git a/src/com/android/launcher3/icons/ComponentWithLabel.java b/src/com/android/launcher3/icons/ComponentWithLabel.java index 372c59166e..30575fcbe5 100644 --- a/src/com/android/launcher3/icons/ComponentWithLabel.java +++ b/src/com/android/launcher3/icons/ComponentWithLabel.java @@ -20,6 +20,8 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.UserHandle; +import androidx.annotation.NonNull; + import com.android.launcher3.icons.cache.CachingLogic; public interface ComponentWithLabel { @@ -42,22 +44,26 @@ public interface ComponentWithLabel { } @Override - public ComponentName getComponent(T object) { + @NonNull + public ComponentName getComponent(@NonNull T object) { return object.getComponent(); } + @NonNull @Override - public UserHandle getUser(T object) { + public UserHandle getUser(@NonNull T object) { return object.getUser(); } + @NonNull @Override - public CharSequence getLabel(T object) { + public CharSequence getLabel(@NonNull T object) { return object.getLabel(mPackageManager); } + @NonNull @Override - public BitmapInfo loadIcon(Context context, T object) { + public BitmapInfo loadIcon(@NonNull Context context, @NonNull T object) { return BitmapInfo.LOW_RES_INFO; } diff --git a/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java b/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java index c8606b1002..0a52dd7191 100644 --- a/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java +++ b/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java @@ -41,7 +41,8 @@ public interface ComponentWithLabelAndIcon extends ComponentWithLabel { @NonNull @Override - public BitmapInfo loadIcon(Context context, ComponentWithLabelAndIcon object) { + public BitmapInfo loadIcon(@NonNull Context context, + @NonNull ComponentWithLabelAndIcon object) { Drawable d = object.getFullResIcon(LauncherAppState.getInstance(context) .getIconCache()); if (d == null) { diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index 7621dc206b..0b4a4a53d4 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -118,15 +118,16 @@ public class IconCache extends BaseIconCache { } @Override - protected long getSerialNumberForUser(UserHandle user) { + protected long getSerialNumberForUser(@NonNull UserHandle user) { return mUserManager.getSerialNumberForUser(user); } @Override - protected boolean isInstantApp(ApplicationInfo info) { + protected boolean isInstantApp(@NonNull ApplicationInfo info) { return mInstantAppResolver.isInstantApp(info); } + @NonNull @Override public BaseIconFactory getIconFactory() { return LauncherIcons.obtain(mContext); @@ -135,7 +136,8 @@ public class IconCache extends BaseIconCache { /** * Updates the entries related to the given package in memory and persistent DB. */ - public synchronized void updateIconsForPkg(String packageName, UserHandle user) { + public synchronized void updateIconsForPkg(@NonNull final String packageName, + @NonNull final UserHandle user) { removeIconsForPkg(packageName, user); try { PackageInfo info = mPackageManager.getPackageInfo(packageName, @@ -471,7 +473,7 @@ public class IconCache extends BaseIconCache { * Fill in {@param infoInOut} with the corresponding icon and label. */ public synchronized void getTitleAndIconForApp( - PackageItemInfo infoInOut, boolean useLowResIcon) { + @NonNull final PackageItemInfo infoInOut, final boolean useLowResIcon) { CacheEntry entry = getEntryForPackageLocked( infoInOut.packageName, infoInOut.user, useLowResIcon); applyCacheEntry(entry, infoInOut); @@ -510,10 +512,16 @@ public class IconCache extends BaseIconCache { return bitmap.withFlags(getUserFlagOpLocked(user)); } - protected void applyCacheEntry(CacheEntry entry, ItemInfoWithIcon info) { + protected void applyCacheEntry(@NonNull final CacheEntry entry, + @NonNull final ItemInfoWithIcon info) { info.title = Utilities.trim(entry.title); info.contentDescription = entry.contentDescription; - info.bitmap = (entry.bitmap == null) ? getDefaultIcon(info.user) : entry.bitmap; + info.bitmap = entry.bitmap; + if (entry.bitmap == null) { + // TODO: entry.bitmap can never be null, so this should not happen at all. + Log.wtf(TAG, "Cannot find bitmap from the cache, default icon was loaded."); + info.bitmap = getDefaultIcon(info.user); + } } public Drawable getFullResIcon(LauncherActivityInfo info) { @@ -526,6 +534,7 @@ public class IconCache extends BaseIconCache { } @Override + @NonNull protected String getIconSystemState(String packageName) { return mIconProvider.getSystemStateForPackage(mSystemState, packageName); } diff --git a/src/com/android/launcher3/icons/LauncherActivityCachingLogic.java b/src/com/android/launcher3/icons/LauncherActivityCachingLogic.java index 4b8c1ad590..406f69758c 100644 --- a/src/com/android/launcher3/icons/LauncherActivityCachingLogic.java +++ b/src/com/android/launcher3/icons/LauncherActivityCachingLogic.java @@ -20,6 +20,8 @@ import android.content.Context; import android.content.pm.LauncherActivityInfo; import android.os.UserHandle; +import androidx.annotation.NonNull; + import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.icons.BaseIconFactory.IconOptions; @@ -40,23 +42,27 @@ public class LauncherActivityCachingLogic R.string.launcher_activity_logic_class); } + @NonNull @Override - public ComponentName getComponent(LauncherActivityInfo object) { + public ComponentName getComponent(@NonNull LauncherActivityInfo object) { return object.getComponentName(); } + @NonNull @Override - public UserHandle getUser(LauncherActivityInfo object) { + public UserHandle getUser(@NonNull LauncherActivityInfo object) { return object.getUser(); } + @NonNull @Override - public CharSequence getLabel(LauncherActivityInfo object) { + public CharSequence getLabel(@NonNull LauncherActivityInfo object) { return object.getLabel(); } + @NonNull @Override - public BitmapInfo loadIcon(Context context, LauncherActivityInfo object) { + public BitmapInfo loadIcon(@NonNull Context context, @NonNull LauncherActivityInfo object) { try (LauncherIcons li = LauncherIcons.obtain(context)) { return li.createBadgedIconBitmap(LauncherAppState.getInstance(context) .getIconProvider().getIcon(object, li.mFillResIconDpi), diff --git a/src/com/android/launcher3/icons/ShortcutCachingLogic.java b/src/com/android/launcher3/icons/ShortcutCachingLogic.java index 1e46344725..4890ba6d8a 100644 --- a/src/com/android/launcher3/icons/ShortcutCachingLogic.java +++ b/src/com/android/launcher3/icons/ShortcutCachingLogic.java @@ -29,6 +29,7 @@ import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.android.launcher3.LauncherAppState; import com.android.launcher3.icons.cache.CachingLogic; @@ -43,29 +44,34 @@ public class ShortcutCachingLogic implements CachingLogic { private static final String TAG = "ShortcutCachingLogic"; @Override - public ComponentName getComponent(ShortcutInfo info) { + @NonNull + public ComponentName getComponent(@NonNull ShortcutInfo info) { return ShortcutKey.fromInfo(info).componentName; } + @NonNull @Override - public UserHandle getUser(ShortcutInfo info) { + public UserHandle getUser(@NonNull ShortcutInfo info) { return info.getUserHandle(); } + @NonNull @Override - public CharSequence getLabel(ShortcutInfo info) { + public CharSequence getLabel(@NonNull ShortcutInfo info) { return info.getShortLabel(); } @Override - public CharSequence getDescription(ShortcutInfo object, CharSequence fallback) { + @NonNull + public CharSequence getDescription(@NonNull ShortcutInfo object, + @NonNull CharSequence fallback) { CharSequence label = object.getLongLabel(); return TextUtils.isEmpty(label) ? fallback : label; } @NonNull @Override - public BitmapInfo loadIcon(Context context, ShortcutInfo info) { + public BitmapInfo loadIcon(@NonNull Context context, @NonNull ShortcutInfo info) { try (LauncherIcons li = LauncherIcons.obtain(context)) { Drawable unbadgedDrawable = ShortcutCachingLogic.getIcon( context, info, LauncherAppState.getIDP(context).fillResIconDpi); @@ -76,7 +82,8 @@ public class ShortcutCachingLogic implements CachingLogic { } @Override - public long getLastUpdatedTime(ShortcutInfo shortcutInfo, PackageInfo info) { + public long getLastUpdatedTime(@Nullable ShortcutInfo shortcutInfo, + @NonNull PackageInfo info) { if (shortcutInfo == null) { return info.lastUpdateTime; } diff --git a/src/com/android/launcher3/model/data/AppInfo.java b/src/com/android/launcher3/model/data/AppInfo.java index 5b2bcf5819..24e7dd3c92 100644 --- a/src/com/android/launcher3/model/data/AppInfo.java +++ b/src/com/android/launcher3/model/data/AppInfo.java @@ -29,7 +29,6 @@ import android.os.UserHandle; import android.os.UserManager; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.LauncherSettings; @@ -55,6 +54,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory { */ public Intent intent; + @NonNull public ComponentName componentName; // Section name used for indexing. @@ -151,7 +151,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory { | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); } - @Nullable + @NonNull @Override public ComponentName getTargetComponent() { return componentName; diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 09b8228182..8f7a4ecfd1 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -32,6 +32,7 @@ import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFram import android.animation.Animator.AnimatorListener; import android.animation.ValueAnimator; +import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.Launcher; @@ -211,6 +212,10 @@ public abstract class AbstractStateChangeTouchController mFlingBlockCheck.blockFling(); } } + if (mFromState == LauncherState.ALL_APPS) { + mAllAppsOvershootStarted = true; + mLauncher.getAppsView().onPull(-progress , -progress); + } } else if (progress >= 1) { if (reinitCurrentAnimation(true, isDragTowardPositive)) { mDisplacementShift = displacement; diff --git a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java index 960d27d27f..7d36740734 100644 --- a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java +++ b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java @@ -64,23 +64,26 @@ public class CacheDataUpdatedTaskTest { IconCache iconCache = LauncherAppState.getInstance(context).getIconCache(); CachingLogic placeholderLogic = new CachingLogic() { @Override - public ComponentName getComponent(ItemInfo info) { + @NonNull + public ComponentName getComponent(@NonNull ItemInfo info) { return info.getTargetComponent(); } + @NonNull @Override - public UserHandle getUser(ItemInfo info) { + public UserHandle getUser(@NonNull ItemInfo info) { return info.user; } + @NonNull @Override - public CharSequence getLabel(ItemInfo info) { + public CharSequence getLabel(@NonNull ItemInfo info) { return NEW_LABEL_PREFIX + info.id; } @NonNull @Override - public BitmapInfo loadIcon(Context context, ItemInfo info) { + public BitmapInfo loadIcon(@NonNull Context context, @NonNull ItemInfo info) { return BitmapInfo.of(Bitmap.createBitmap(1, 1, Config.ARGB_8888), Color.RED); } }; diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index f46d78ff97..c812a0ffdc 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -18,6 +18,8 @@ package com.android.launcher3.ui; import static androidx.test.InstrumentationRegistry.getInstrumentation; +import android.platform.test.annotations.IwTest; + import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; @@ -203,6 +205,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { false /* tapRight */); } + @IwTest(focusArea="launcher") @Test @ScreenRecord // b/202433017 public void testWorkspace() throws Exception { @@ -330,6 +333,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } } + @IwTest(focusArea="launcher") @Test @PortraitLandscape public void testDragAppIcon() throws Throwable { @@ -431,22 +435,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL); } - @Test - public void testDisableRotationCheck() throws Exception { - try { - mLauncher.setExpectedRotationCheckEnabled(false); - mLauncher.setEnableRotation(false); - final AllApps allApps = mLauncher.getWorkspace().switchToAllApps(); - final AppIcon app = allApps.getAppIcon("TestActivity7"); - mLauncher.getDevice().setOrientationLeft(); - mLauncher.goHome(); - } finally { - mLauncher.setExpectedRotationCheckEnabled(true); - mLauncher.setEnableRotation(true); - mLauncher.getDevice().setOrientationNatural(); - } - } - @Test @PortraitLandscape public void testDeleteFromWorkspace() throws Exception { diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java index 194ee4f1c9..561f3ccbf2 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java @@ -20,6 +20,8 @@ import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import android.platform.test.annotations.IwTest; + import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -45,6 +47,7 @@ public class AddWidgetTest extends AbstractLauncherUiTest { @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind(); + @IwTest(focusArea="launcher") @Test @PortraitLandscape public void testDragIcon() throws Throwable {