Snap for 8989391 from 2cfc8abceb to udc-release
Change-Id: Id531dd1c7bc84b412c62410f6ef302d4d6c9664b
This commit is contained in:
commit
bc1a33daab
22 files changed
+184
-53
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<RemoteTransitionCompat> 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
|
||||
//
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -4105,7 +4105,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
public void initiateSplitSelect(QuickstepSystemShortcut.SplitSelectSource splitSelectSource) {
|
||||
mSplitSelectSource = splitSelectSource;
|
||||
mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
|
||||
splitSelectSource.position.stagePosition);
|
||||
splitSelectSource.position.stagePosition, splitSelectSource.user);
|
||||
}
|
||||
|
||||
public PendingAnimation createSplitSelectInitAnimation(int duration) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.content.Intent;
|
||||
@@ -32,6 +33,7 @@ import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.tapl.AllApps;
|
||||
import com.android.launcher3.tapl.LaunchedAppState;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
|
||||
import com.android.launcher3.tapl.Overview;
|
||||
@@ -404,4 +406,26 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
launcher -> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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<ShortcutInfo> {
|
||||
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<ShortcutInfo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastUpdatedTime(ShortcutInfo shortcutInfo, PackageInfo info) {
|
||||
public long getLastUpdatedTime(@Nullable ShortcutInfo shortcutInfo,
|
||||
@NonNull PackageInfo info) {
|
||||
if (shortcutInfo == null) {
|
||||
return info.lastUpdateTime;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -64,23 +64,26 @@ public class CacheDataUpdatedTaskTest {
|
||||
IconCache iconCache = LauncherAppState.getInstance(context).getIconCache();
|
||||
CachingLogic<ItemInfo> placeholderLogic = new CachingLogic<ItemInfo>() {
|
||||
@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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user