Merge "Don't shrink overview bitmap for chips" into ub-launcher3-qt-dev
diff --git a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 734425e..39f8448 100644
--- a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -88,6 +88,10 @@
boolean gestureSwipeLeft) {
}
+ public void onSystemUiStateChanged(int stateFlags) {
+ // To be implemented
+ }
+
/** Deprecated methods **/
public void onQuickStep(MotionEvent motionEvent) { }
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 225ae84..462e630 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -75,12 +75,4 @@
return new ScaleAndTranslation(scale, 0f, 0f);
}
- @Override
- public int getVisibleElements(Launcher launcher) {
- if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) {
- return super.getVisibleElements(launcher);
- }
- // Hide shelf content (e.g. QSB) because we fade it in when swiping up.
- return ALL_APPS_HEADER_EXTRA;
- }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 94c1545..043fd55 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -17,8 +17,6 @@
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
-import static com.android.launcher3.logging.LoggerUtils.getTargetStr;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
@@ -27,7 +25,6 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -74,6 +71,15 @@
}
@Override
+ public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
+ if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) {
+ // If the hotseat icons are visible in overview, keep them in their normal position.
+ return super.getWorkspaceScaleAndTranslation(launcher);
+ }
+ return getWorkspaceScaleAndTranslation(launcher);
+ }
+
+ @Override
public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
return new ScaleAndTranslation(1f, 0f, 0f);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
index 6dd5e21..bab215b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java
@@ -111,6 +111,7 @@
AnimatorSetBuilder builder = new AnimatorSetBuilder();
builder.setInterpolator(AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS, OVERSHOOT_1_2);
+ builder.setInterpolator(AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE, OVERSHOOT_1_2);
AnimatorSet overviewAnim = mLauncher.getStateManager().createAtomicAnimation(
NORMAL, OVERVIEW, builder, ANIM_ALL, ATOMIC_DURATION);
overviewAnim.addListener(new AnimatorListenerAdapter() {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index 21ddfc0..8b1b51d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -44,6 +44,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Command;
@@ -212,6 +213,7 @@
private void onSwipeInteractionCompleted(LauncherState targetState) {
clearState();
mLauncher.getStateManager().goToState(targetState, false /* animated */);
+ AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal);
}
private void logStateChange(int startContainerType, int logAction) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
index 7c0791e..e865137 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java
@@ -41,6 +41,7 @@
import com.android.quickstep.util.MotionPauseDetector;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.launcher3.R;
+import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.NavigationBarCompat;
/**
@@ -83,8 +84,11 @@
private final InputConsumer mConsumerDelegate;
private final Context mContext;
+ private final InputMonitorCompat mInputMonitorCompat;
+
+
public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy,
- InputConsumer delegate) {
+ InputConsumer delegate, InputMonitorCompat inputMonitorCompat) {
final Resources res = context.getResources();
mContext = context;
mSysUiProxy = systemUiProxy;
@@ -94,6 +98,7 @@
mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold);
mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold);
mSlop = NavigationBarCompat.getQuickScrubTouchSlopPx();
+ mInputMonitorCompat = inputMonitorCompat;
mState = STATE_INACTIVE;
}
@@ -153,6 +158,10 @@
if (!mPassedSlop) {
// Normal gesture, ensure we pass the slop before we start tracking the gesture
if (Math.hypot(mLastPos.x - mDownPos.x, mLastPos.y - mDownPos.y) > mSlop) {
+
+ // Cancel touches to other windows (intercept)
+ mInputMonitorCompat.pilferPointers();
+
mPassedSlop = true;
mStartDragPos.set(mLastPos.x, mLastPos.y);
mDragTime = SystemClock.uptimeMillis();
@@ -162,7 +171,8 @@
Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x));
mDirection = angle > 90 ? UPLEFT : UPRIGHT;
angle = angle > 90 ? 180 - angle : angle;
- if (angle > mAngleThreshold) {
+
+ if (angle > mAngleThreshold && angle < 90 - mAngleThreshold) {
mState = STATE_ASSISTANT_ACTIVE;
if (mConsumerDelegate != null) {
@@ -209,6 +219,7 @@
animator.setInterpolator(Interpolators.DEACCEL_2);
animator.start();
}
+ mState = STATE_INACTIVE;
mMotionPauseDetector.clear();
break;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index e903b6f..7c71846 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -23,7 +23,6 @@
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_DAMPING_RATIO;
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_STIFFNESS;
-import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import android.animation.Animator;
@@ -39,16 +38,17 @@
import android.view.View;
import android.view.animation.Interpolator;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.UiThread;
+
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherInitListener;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.LauncherStateManager;
-import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
-import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.SpringObjectAnimator;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -63,10 +63,6 @@
import java.util.function.BiPredicate;
import java.util.function.Consumer;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.UiThread;
-
/**
* {@link ActivityControlHelper} for the in-launcher recents.
*/
@@ -167,21 +163,16 @@
}
activity.getStateManager().setRestState(resetState);
- final LauncherState fromState;
- if (!activityVisible) {
- // Since the launcher is not visible, we can safely reset the scroll position.
- // This ensures then the next swipe up to all-apps starts from scroll 0.
- activity.getAppsView().reset(false /* animate */);
- fromState = animateActivity ? BACKGROUND_APP : OVERVIEW;
- activity.getStateManager().goToState(fromState, false);
+ final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW;
+ activity.getStateManager().goToState(fromState, false);
+ // Since all apps is not visible, we can safely reset the scroll position.
+ // This ensures then the next swipe up to all-apps starts from scroll 0.
+ activity.getAppsView().reset(false /* animate */);
- // Optimization, hide the all apps view to prevent layout while initializing
- activity.getAppsView().getContentView().setVisibility(View.GONE);
+ // Optimization, hide the all apps view to prevent layout while initializing
+ activity.getAppsView().getContentView().setVisibility(View.GONE);
- AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal);
- } else {
- fromState = startState;
- }
+ AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal);
return new AnimationFactory() {
private Animator mShelfAnim;
@@ -189,8 +180,7 @@
@Override
public void createActivityController(long transitionLength) {
- createActivityControllerInternal(activity, activityVisible, fromState,
- transitionLength, callback);
+ createActivityControllerInternal(activity, fromState, transitionLength, callback);
}
@Override
@@ -220,7 +210,7 @@
: mShelfState == ShelfAnimState.PEEK
? shelfPeekingProgress
: shelfOverviewProgress;
- mShelfAnim = createShelfProgressAnim(activity, toProgress);
+ mShelfAnim = createShelfAnim(activity, toProgress);
mShelfAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -234,18 +224,9 @@
};
}
- private void createActivityControllerInternal(Launcher activity, boolean wasVisible,
- LauncherState fromState, long transitionLength,
- Consumer<AnimatorPlaybackController> callback) {
+ private void createActivityControllerInternal(Launcher activity, LauncherState fromState,
+ long transitionLength, Consumer<AnimatorPlaybackController> callback) {
LauncherState endState = OVERVIEW;
- DeviceProfile dp = activity.getDeviceProfile();
- long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
- if (wasVisible && fromState != BACKGROUND_APP) {
- // If a translucent app was launched fom launcher, animate launcher states.
- callback.accept(activity.getStateManager()
- .createAnimationToNewWorkspace(fromState, endState, accuracy));
- return;
- }
if (fromState == endState) {
return;
}
@@ -254,11 +235,10 @@
if (!activity.getDeviceProfile().isVerticalBarLayout()
&& SysUINavigationMode.getMode(activity) != Mode.NO_BUTTON) {
// Don't animate the shelf when the mode is NO_BUTTON, because we update it atomically.
- Animator shiftAnim = createShelfProgressAnim(activity,
+ Animator shiftAnim = createShelfAnim(activity,
fromState.getVerticalProgress(activity),
endState.getVerticalProgress(activity));
anim.play(shiftAnim);
- anim.play(createShelfAlphaAnim(activity, endState, accuracy));
}
playScaleDownAnim(anim, activity, endState);
@@ -275,7 +255,7 @@
callback.accept(controller);
}
- private Animator createShelfProgressAnim(Launcher activity, float ... progressValues) {
+ private Animator createShelfAnim(Launcher activity, float ... progressValues) {
Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(),
"allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(),
SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues);
@@ -284,19 +264,6 @@
}
/**
- * Very quickly fade the alpha of shelf content.
- */
- private Animator createShelfAlphaAnim(Launcher activity, LauncherState toState, long accuracy) {
- AllAppsTransitionController allAppsController = activity.getAllAppsController();
- AnimatorSetBuilder animBuilder = new AnimatorSetBuilder();
- animBuilder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, DEACCEL_3);
- LauncherStateManager.AnimationConfig config = new LauncherStateManager.AnimationConfig();
- config.duration = accuracy;
- allAppsController.setAlphas(toState.getVisibleElements(activity), config, animBuilder);
- return animBuilder.build();
- }
-
- /**
* Scale down recents from the center task being full screen to being in overview.
*/
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher,
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
index 990bcff..9c8e80e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java
@@ -149,6 +149,7 @@
mDragSlop = NavigationBarCompat.getQuickStepDragSlopPx();
mTouchSlop = NavigationBarCompat.getQuickStepTouchSlopPx();
+
mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
index 0924f38..ced9afa 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java
@@ -85,15 +85,24 @@
}
}
+ /** See {@link #finish(boolean, Runnable, boolean)} */
+ @UiThread
+ public void finish(boolean toRecents, Runnable onFinishComplete) {
+ finish(toRecents, onFinishComplete, false /* sendUserLeaveHint */);
+ }
+
/**
* @param onFinishComplete A callback that runs on the main thread after the animation
* controller has finished on the background thread.
+ * @param sendUserLeaveHint Determines whether userLeaveHint flag will be set on the pausing
+ * activity. If userLeaveHint is true, the activity will enter into
+ * picture-in-picture mode upon being paused.
*/
@UiThread
- public void finish(boolean toRecents, Runnable onFinishComplete) {
+ public void finish(boolean toRecents, Runnable onFinishComplete, boolean sendUserLeaveHint) {
Preconditions.assertUIThread();
if (!toRecents) {
- finishAndClear(false, onFinishComplete);
+ finishAndClear(false, onFinishComplete, sendUserLeaveHint);
} else {
if (mTouchInProgress) {
mFinishPending = true;
@@ -102,16 +111,17 @@
onFinishComplete.run();
}
} else {
- finishAndClear(true, onFinishComplete);
+ finishAndClear(true, onFinishComplete, sendUserLeaveHint);
}
}
}
- private void finishAndClear(boolean toRecents, Runnable onFinishComplete) {
+ private void finishAndClear(boolean toRecents, Runnable onFinishComplete,
+ boolean sendUserLeaveHint) {
SwipeAnimationTargetSet controller = targetSet;
targetSet = null;
if (controller != null) {
- controller.finishController(toRecents, onFinishComplete);
+ controller.finishController(toRecents, onFinishComplete, sendUserLeaveHint);
}
}
@@ -163,7 +173,7 @@
mTouchInProgress = false;
if (mFinishPending) {
mFinishPending = false;
- finishAndClear(true /* toRecents */, null);
+ finishAndClear(true /* toRecents */, null, false /* sendUserLeaveHint */);
}
}
if (mInputConsumer != null) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
index 42a28fb..e3dcadc 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java
@@ -38,7 +38,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.InstantAppResolver;
@@ -86,7 +86,7 @@
public View.OnClickListener getOnClickListener(BaseDraggingActivity activity, TaskView view) {
Task task = view.getTask();
- ShortcutInfo dummyInfo = new ShortcutInfo();
+ WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo();
dummyInfo.intent = new Intent();
ComponentName component = task.getTopComponent();
dummyInfo.intent.setComponent(component);
@@ -290,6 +290,10 @@
if (sysUiProxy == null) {
return null;
}
+ if (SysUINavigationMode.getMode(activity) == SysUINavigationMode.Mode.NO_BUTTON) {
+ // TODO(b/130225926): Temporarily disable pinning while gesture nav is enabled
+ return null;
+ }
if (!ActivityManagerWrapper.getInstance().isScreenPinningEnabled()) {
return null;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 79f0c36..95dea50 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -20,6 +20,9 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import android.annotation.TargetApi;
import android.app.ActivityManager.RunningTaskInfo;
@@ -65,6 +68,8 @@
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InputMonitorCompat;
+import com.android.systemui.shared.system.QuickStepContract;
+import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -135,6 +140,12 @@
@Override
public void onAssistantVisibilityChanged(float visibility) {
+ if (mOverviewComponentObserver == null) {
+ // Save the visibility to be applied when the user is unlocked
+ mPendingAssistantVisibility = visibility;
+ return;
+ }
+
MAIN_THREAD_EXECUTOR.execute(() -> {
mOverviewComponentObserver.getActivityControlHelper()
.onAssistantVisibilityChanged(visibility);
@@ -143,12 +154,20 @@
public void onBackAction(boolean completed, int downX, int downY, boolean isButton,
boolean gestureSwipeLeft) {
+ if (mOverviewComponentObserver == null) {
+ return;
+ }
+
final ActivityControlHelper activityControl =
mOverviewComponentObserver.getActivityControlHelper();
UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
isButton, gestureSwipeLeft, activityControl.getContainerType());
}
+ public void onSystemUiStateChanged(int stateFlags) {
+ mSystemUiStateFlags = stateFlags;
+ }
+
/** Deprecated methods **/
public void onQuickStep(MotionEvent motionEvent) { }
@@ -185,6 +204,8 @@
private InputConsumerController mInputConsumer;
private SwipeSharedState mSwipeSharedState;
private boolean mAssistantAvailable;
+ private float mPendingAssistantVisibility = 0;
+ private @SystemUiStateFlags int mSystemUiStateFlags;
private boolean mIsUserUnlocked;
private List<Runnable> mOnUserUnlockedCallbacks;
@@ -337,6 +358,8 @@
mAM = ActivityManagerWrapper.getInstance();
mRecentsModel = RecentsModel.INSTANCE.get(this);
mOverviewComponentObserver = new OverviewComponentObserver(this);
+ mOverviewComponentObserver.getActivityControlHelper().onAssistantVisibilityChanged(
+ mPendingAssistantVisibility);
mOverviewCommandHelper = new OverviewCommandHelper(this, mOverviewComponentObserver);
mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(this);
@@ -397,7 +420,8 @@
MotionEvent event = (MotionEvent) ev;
TOUCH_INTERACTION_LOG.addLog("onMotionEvent", event.getActionMasked());
if (event.getAction() == ACTION_DOWN) {
- if (mSwipeTouchRegion.contains(event.getX(), event.getY())) {
+ if (isInValidSystemUiState()
+ && mSwipeTouchRegion.contains(event.getX(), event.getY())) {
boolean useSharedState = mConsumer.isActive();
mConsumer.onConsumerAboutToBeSwitched();
mConsumer = newConsumer(useSharedState, event);
@@ -410,9 +434,15 @@
mUncheckedConsumer.onMotionEvent(event);
}
+ private boolean isInValidSystemUiState() {
+ return (mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) == 0
+ && (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
+ && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0;
+ }
+
private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
// TODO: this makes a binder call every touch down. we should move to a listener pattern.
- if (mKM.isDeviceLocked()) {
+ if (!mIsUserUnlocked || mKM.isDeviceLocked()) {
// This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched
// while device is locked even after exiting direct boot mode (e.g. camera).
return new DeviceLockedInputConsumer(this);
@@ -431,7 +461,7 @@
&& SysUINavigationMode.INSTANCE.get(this).getMode() == Mode.NO_BUTTON
&& AssistantTouchConsumer.withinTouchRegion(this, event)) {
return new AssistantTouchConsumer(this, mISystemUiProxy, !activityControl.isResumed()
- ? createOtherActivityInputConsumer(event, runningTaskInfo) : null);
+ ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat);
} else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) {
return OverviewInputConsumer.newInstance(activityControl, false);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index a974135..365e171 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -64,6 +64,9 @@
import android.view.WindowManager;
import android.view.animation.Interpolator;
+import androidx.annotation.NonNull;
+import androidx.annotation.UiThread;
+
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
@@ -103,9 +106,6 @@
import java.util.function.BiFunction;
import java.util.function.Consumer;
-import androidx.annotation.NonNull;
-import androidx.annotation.UiThread;
-
@TargetApi(Build.VERSION_CODES.O)
public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
implements SwipeAnimationListener, OnApplyWindowInsetsListener {
@@ -429,8 +429,19 @@
// If we've already ended the gesture and are going home, don't prepare recents UI,
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
if (mGestureEndTarget != HOME) {
- mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity,
- mWasLauncherAlreadyVisible, true, this::onAnimatorPlaybackControllerCreated);
+ Runnable initAnimFactory = () -> {
+ mAnimationFactory = mActivityControlHelper.prepareRecentsUI(mActivity,
+ mWasLauncherAlreadyVisible, true,
+ this::onAnimatorPlaybackControllerCreated);
+ };
+ if (mWasLauncherAlreadyVisible) {
+ // Launcher is visible, but might be about to stop. Thus, if we prepare recents
+ // now, it might get overridden by moveToRestState() in onStop(). To avoid this,
+ // wait until the next gesture (and possibly launcher) starts.
+ mStateCallback.addCallback(STATE_GESTURE_STARTED, initAnimFactory);
+ } else {
+ initAnimFactory.run();
+ }
}
AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible);
@@ -1044,7 +1055,12 @@
}
private void invalidateHandlerWithLauncher() {
- mLauncherTransitionController = null;
+ if (mLauncherTransitionController != null) {
+ if (mLauncherTransitionController.getAnimationPlayer().isStarted()) {
+ mLauncherTransitionController.getAnimationPlayer().cancel();
+ }
+ mLauncherTransitionController = null;
+ }
mRecentsView.setEnableFreeScroll(true);
mRecentsView.setRunningTaskIconScaledDown(false);
@@ -1130,7 +1146,8 @@
private void finishCurrentTransitionToHome() {
synchronized (mRecentsAnimationWrapper) {
mRecentsAnimationWrapper.finish(true /* toRecents */,
- () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
+ () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED),
+ true /* sendUserLeaveHint */);
}
TOUCH_INTERACTION_LOG.addLog("finishRecentsAnimation", true);
doLogGesture(HOME);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index cbac944..1242d79 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -102,7 +102,7 @@
public ClipAnimationHelper(Context context) {
mWindowCornerRadius = getWindowCornerRadius(context.getResources());
mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources());
- mTaskCornerRadius = Themes.getDialogCornerRadius(context);
+ mTaskCornerRadius = TaskCornerRadius.get(context);
}
private void updateSourceStack(RemoteAnimationTargetCompat target) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
index b682481..5a1a103 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java
@@ -53,11 +53,11 @@
this.mOnFinishListener = onFinishListener;
}
- public void finishController(boolean toRecents, Runnable callback) {
+ public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) {
mOnFinishListener.accept(this);
BACKGROUND_EXECUTOR.execute(() -> {
controller.setInputConsumerEnabled(false);
- controller.finish(toRecents);
+ controller.finish(toRecents, sendUserLeaveHint);
if (callback != null) {
MAIN_THREAD_EXECUTOR.execute(callback);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskCornerRadius.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskCornerRadius.java
new file mode 100644
index 0000000..3ddf1b6
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskCornerRadius.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.quickstep.util;
+
+import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
+
+import android.content.Context;
+
+import com.android.launcher3.R;
+import com.android.launcher3.util.Themes;
+
+public class TaskCornerRadius {
+
+ public static float get(Context context) {
+ return supportsRoundedCornersOnWindows(context.getResources()) ?
+ Themes.getDialogCornerRadius(context):
+ context.getResources().getDimension(R.dimen.task_corner_radius_small);
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
index 446fb39..b9791bf 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -59,7 +59,6 @@
private static final String TAG = DigitalWellBeingToast.class.getSimpleName();
private Task mTask;
- private ImageView mImage;
private TextView mText;
public DigitalWellBeingToast(Context context, AttributeSet attrs) {
@@ -75,7 +74,6 @@
super.onFinishInflate();
mText = findViewById(R.id.digital_well_being_remaining_time);
- mImage = findViewById(R.id.digital_well_being_hourglass);
}
public void initialize(Task task, InitializeCallback callback) {
@@ -103,8 +101,6 @@
} else {
setVisibility(VISIBLE);
mText.setText(getText(appRemainingTimeMs));
- mImage.setImageResource(appRemainingTimeMs > 0 ?
- R.drawable.hourglass_top : R.drawable.hourglass_bottom);
}
callback.call(getContentDescriptionForTask(
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index ddb94d2..d8aeb35 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -46,6 +46,7 @@
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
@@ -322,6 +323,8 @@
mEmptyMessagePaint.setColor(Themes.getAttrColor(context, android.R.attr.textColorPrimary));
mEmptyMessagePaint.setTextSize(getResources()
.getDimension(R.dimen.recents_empty_message_text_size));
+ mEmptyMessagePaint.setTypeface(Typeface.create(Themes.getDefaultBodyFont(context),
+ Typeface.NORMAL));
mEmptyMessagePadding = getResources()
.getDimensionPixelSize(R.dimen.recents_empty_message_text_padding);
setWillNotDraw(false);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index 7905230..ed68d87 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -48,6 +48,7 @@
import com.android.launcher3.util.Themes;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
+import com.android.quickstep.util.TaskCornerRadius;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.QuickStepContract;
@@ -108,7 +109,7 @@
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mCornerRadius = Themes.getDialogCornerRadius(context);
+ mCornerRadius = TaskCornerRadius.get(context);
mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
diff --git a/quickstep/res/drawable/hourglass_bottom.xml b/quickstep/res/drawable/hourglass_bottom.xml
deleted file mode 100644
index b5ef008..0000000
--- a/quickstep/res/drawable/hourglass_bottom.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <group>
- <clip-path android:pathData="M0,0H24V24H0Z M 0,0"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6,2V8H6l4,4L6,16H6v6H18V16h0l-4,-4,4,-4h0V2Zm6,9.5,-4,-4V4h8V7.5Z"/>
- </group>
-</vector>
diff --git a/quickstep/res/drawable/hourglass_top.xml b/quickstep/res/drawable/ic_hourglass_top.xml
similarity index 82%
rename from quickstep/res/drawable/hourglass_top.xml
rename to quickstep/res/drawable/ic_hourglass_top.xml
index 7fc77d3..2f8bec3 100644
--- a/quickstep/res/drawable/hourglass_top.xml
+++ b/quickstep/res/drawable/ic_hourglass_top.xml
@@ -2,7 +2,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
- android:viewportHeight="24">
+ android:viewportHeight="24"
+ android:tint="?android:attr/textColorPrimary">
<group>
<clip-path android:pathData="M0,0H24V24H0Z M 0,0"/>
<path
diff --git a/quickstep/res/drawable/ic_pin.xml b/quickstep/res/drawable/ic_pin.xml
index 8c799e3..f9eedbc 100644
--- a/quickstep/res/drawable/ic_pin.xml
+++ b/quickstep/res/drawable/ic_pin.xml
@@ -18,9 +18,16 @@
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="#FFffffff"
- android:pathData="M16,12L16,4l1,0L17,2L7,2l0,2l1,0l0,8l-2,2l0,2l5.2,0l0,6l1.6,0l0,-6L18,16l0,-2L16,12z"/>
+ android:strokeColor="#FFFFFFFF"
+ android:strokeAlpha=".008"
+ android:pathData="M0 0h24v24H0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M17 4v7l2 3v2h-6v5l-1 1-1-1v-5H5v-2l2-3V4c0-1.1 0.9 -2 2-2h6c1.11 0 2 0.89 2
+2zM9 4v7.75L7.5 14h9L15 11.75V4H9z" />
+
</vector>
\ No newline at end of file
diff --git a/quickstep/res/drawable/ic_split_screen.xml b/quickstep/res/drawable/ic_split_screen.xml
index 110af91..1080069 100644
--- a/quickstep/res/drawable/ic_split_screen.xml
+++ b/quickstep/res/drawable/ic_split_screen.xml
@@ -17,7 +17,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
- android:viewportHeight="24">
+ android:viewportHeight="24"
+ android:tint="?android:attr/textColorPrimary">
<path
android:fillColor="@android:color/white"
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index f96a66f..1d1c272 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -49,6 +49,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
+ android:src="@drawable/ic_hourglass_top"
/>
<TextView
android:id="@+id/digital_well_being_remaining_time"
diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml
index a966698..e29d3df 100644
--- a/quickstep/res/values/config.xml
+++ b/quickstep/res/values/config.xml
@@ -29,5 +29,5 @@
<!-- Assistant Gesture -->
<integer name="assistant_gesture_min_time_threshold">200</integer>
- <integer name="assistant_gesture_corner_deg_threshold">30</integer>
+ <integer name="assistant_gesture_corner_deg_threshold">10</integer>
</resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 6ec3bf6..75959d1 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -19,6 +19,8 @@
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
+ <!-- For screens without rounded corners -->
+ <dimen name="task_corner_radius_small">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
@@ -63,7 +65,7 @@
<dimen name="shelf_surface_offset">24dp</dimen>
<!-- Assistant Gestures -->
- <dimen name="gestures_assistant_size">28dp</dimen>
+ <dimen name="gestures_assistant_size">48dp</dimen>
<dimen name="gestures_assistant_drag_threshold">70dp</dimen>
<!-- Distance to move elements when swiping up to go home from launcher -->
diff --git a/quickstep/src/com/android/quickstep/TestInformationProvider.java b/quickstep/src/com/android/quickstep/TestInformationProvider.java
index b37ddda..a948570 100644
--- a/quickstep/src/com/android/quickstep/TestInformationProvider.java
+++ b/quickstep/src/com/android/quickstep/TestInformationProvider.java
@@ -111,6 +111,14 @@
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance);
break;
}
+
+ case TestProtocol.REQUEST_ENABLE_DRAG_LOGGING:
+ TestProtocol.sDebugTracing = true;
+ break;
+
+ case TestProtocol.REQUEST_DISABLE_DRAG_LOGGING:
+ TestProtocol.sDebugTracing = false;
+ break;
}
return response;
}
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index 68368fb..c8aed81 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -27,8 +27,6 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
-import com.android.quickstep.SysUINavigationMode;
-import com.android.quickstep.SysUINavigationMode.Mode;
import java.lang.annotation.Retention;
@@ -116,14 +114,10 @@
}
public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
- if (SysUINavigationMode.getMode(context) == Mode.NO_BUTTON) {
- // Track the bottom of the window rather than the top of the shelf.
- int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
- int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
- R.dimen.task_card_vert_space);
- return shelfHeight + spaceBetweenShelfAndRecents;
- }
- // Start from a third of bottom inset to provide some shelf overlap.
- return dp.hotseatBarSizePx + dp.getInsets().bottom / 3 - dp.edgeMarginPx * 2;
+ // Track the bottom of the window.
+ int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
+ int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
+ R.dimen.task_card_vert_space);
+ return shelfHeight + spaceBetweenShelfAndRecents;
}
}
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index 6034791..e552f56 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -21,6 +21,7 @@
import static com.android.quickstep.NavigationModeSwitchRule.Mode.ALL;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.THREE_BUTTON;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.TWO_BUTTON;
+import static com.android.quickstep.NavigationModeSwitchRule.Mode.ZERO_BUTTON;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_2BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY;
@@ -85,9 +86,9 @@
final LauncherInstrumentation.NavigationModel originalMode =
mLauncher.getNavigationModel();
try {
-// if (mode == ZERO_BUTTON || mode == ALL) {
-// evaluateWithZeroButtons();
-// }
+ if (mode == ZERO_BUTTON || mode == ALL) {
+ evaluateWithZeroButtons();
+ }
if (mode == TWO_BUTTON || mode == ALL) {
evaluateWithTwoButtons();
}
@@ -131,7 +132,10 @@
overlayPackage == NAV_BAR_MODE_GESTURAL_OVERLAY);
for (int i = 0; i != 100; ++i) {
- if (mLauncher.getNavigationModel() == expectedMode) return;
+ if (mLauncher.getNavigationModel() == expectedMode) {
+ Thread.sleep(1000);
+ return;
+ }
Thread.sleep(100);
}
Assert.fail("Couldn't switch to " + overlayPackage);
diff --git a/res/drawable/ic_close.xml b/res/drawable/ic_close.xml
deleted file mode 100644
index 8b2f55f..0000000
--- a/res/drawable/ic_close.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!-- Copyright (C) 2017 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportHeight="24.0"
- android:viewportWidth="24.0">
- <path
- android:fillColor="@android:color/white"
- android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41z" />
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_corp.xml b/res/drawable/ic_corp.xml
index 48f5007..b59113d 100644
--- a/res/drawable/ic_corp.xml
+++ b/res/drawable/ic_corp.xml
@@ -17,8 +17,11 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/textColorHint" >
<path
- android:pathData="M20,6h-4V4c0,-1.11 -0.89,-2 -2,-2h-4C8.89,2 8,2.89 8,4v2H4C2.89,6 2.01,6.89 2.01,8L2,19c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2V8C22,6.89 21.11,6 20,6zM12,15c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2s2,0.9 2,2S13.1,15 12,15zM14,6h-4V4h4V6z"
- android:fillColor="?android:attr/textColorHint"/>
+ android:pathData="M20 6h-4V4c0-1.11-0.89-2-2-2h-4c-1.11 0-2 0.89-2 2v2H4c-1.11 0-1.99 0.89 -1.99
+2L2 19c0 1.11 0.89 2 2 2h16c1.11 0 2-0.89 2-2V8c0-1.11-0.89-2-2-2zM10
+4h4v2h-4V4zm10 15H4V8h16v11z"
+ android:fillColor="@android:color/white"/>
</vector>
\ No newline at end of file
diff --git a/res/drawable/deep_shortcuts_drag_handle.xml b/res/drawable/ic_drag_handle.xml
similarity index 82%
rename from res/drawable/deep_shortcuts_drag_handle.xml
rename to res/drawable/ic_drag_handle.xml
index 8fc3779..0181ff1 100644
--- a/res/drawable/deep_shortcuts_drag_handle.xml
+++ b/res/drawable/ic_drag_handle.xml
@@ -22,7 +22,6 @@
android:tint="?android:attr/textColorHint" >
<path
- android:pathData="M19,9H5c-0.55,0-1,0.45-1,1l0,0c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1l0,0C20,9.45,19.55,9,19,9z M5,
- 15h14c0.55,0,1-0.45,1-1l0,0c0-0.55-0.45-1-1-1H5c-0.55,0-1,0.45-1,1l0,0C4,14.55,4.45,15,5,15z"
+ android:pathData="M20,9H4v2h16V9z M4,15h16v-2H4V15z"
android:fillColor="@android:color/white" />
</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_info_no_shadow.xml b/res/drawable/ic_info_no_shadow.xml
index d816f12..7c43779 100644
--- a/res/drawable/ic_info_no_shadow.xml
+++ b/res/drawable/ic_info_no_shadow.xml
@@ -21,12 +21,12 @@
android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="#FFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M 11 7 H 13 V 9 H 11 V 7 Z" />
<path
- android:fillColor="#FFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M 11 11 H 13 V 17 H 11 V 11 Z" />
<path
- android:fillColor="#FFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2,2,6.48,2,12c0,5.52,4.48,10,10,10s10-4.48,10-10C22,6.48,17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8 c0-4.41,3.59-8,8-8s8,3.59,8,8C20,16.41,16.41,20,12,20z" />
</vector>
diff --git a/res/drawable/ic_install_no_shadow.xml b/res/drawable/ic_install_no_shadow.xml
index ffce22a..eaad0de 100644
--- a/res/drawable/ic_install_no_shadow.xml
+++ b/res/drawable/ic_install_no_shadow.xml
@@ -17,11 +17,13 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
- android:viewportHeight="24">
+ android:viewportHeight="24"
+ android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="?android:attr/textColorPrimary"
- android:pathData="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" />
+ android:fillColor="@android:color/white"
+ android:pathData="M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z" />
<path
- android:pathData="M0 0h24v24H0z" />
+ android:fillColor="@android:color/white"
+ android:pathData="M 17 11.5 L 15.59 10.09 L 13 12.67 L 13 4 L 11 4 L 11 12.67 L 8.41 10.09 L 7 11.5 L 12 16.5 Z" />
</vector>
diff --git a/res/drawable/ic_palette.xml b/res/drawable/ic_palette.xml
new file mode 100644
index 0000000..21cec2d
--- /dev/null
+++ b/res/drawable/ic_palette.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/textColorPrimary">
+
+ <path
+ android:fillColor="@android:color/white"
+ android:strokeWidth="1"
+ android:pathData="M10,20 C4.49,20 0,15.51 0,10 C0,4.49 4.49,0 10,0 C15.51,0 20,4.04 20,9
+ C20,12.31 17.31,15 14,15 L12.23,15 C11.95,15 11.73,15.22 11.73,15.5 C11.73,15.62
+ 11.78,15.73 11.86,15.83 C12.27,16.3 12.5,16.89 12.5,17.5 C12.5,18.88 11.38,20
+ 10,20 Z M10,2 C5.59,2 2,5.59 2,10 C2,14.41 5.59,18 10,18 C10.28,18 10.5,17.78
+ 10.5,17.5 C10.5,17.34 10.42,17.22 10.36,17.15 C9.95,16.69 9.73,16.1 9.73,15.5
+ C9.73,14.12 10.85,13 12.23,13 L14,13 C16.21,13 18,11.21 18,9 C18,5.14 14.41,2
+ 10,2 Z M4.5,11 C5.32842712,11 6,10.3284271 6,9.5 C6,8.67157288 5.32842712,8
+ 4.5,8 C3.67157288,8 3,8.67157288 3,9.5 C3,10.3284271 3.67157288,11 4.5,11 Z
+ M7.5,7 C8.32842712,7 9,6.32842712 9,5.5 C9,4.67157288 8.32842712,4 7.5,4
+ C6.67157288,4 6,4.67157288 6,5.5 C6,6.32842712 6.67157288,7 7.5,7 Z M12.5,7
+ C13.3284271,7 14,6.32842712 14,5.5 C14,4.67157288 13.3284271,4 12.5,4
+ C11.6715729,4 11,4.67157288 11,5.5 C11,6.32842712 11.6715729,7 12.5,7 Z M15.5,11
+ C16.3284271,11 17,10.3284271 17,9.5 C17,8.67157288 16.3284271,8 15.5,8
+ C14.6715729,8 14,8.67157288 14,9.5 C14,10.3284271 14.6715729,11 15.5,11 Z" />
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_remove_no_shadow.xml b/res/drawable/ic_remove_no_shadow.xml
index be7f9f3..2c706db 100644
--- a/res/drawable/ic_remove_no_shadow.xml
+++ b/res/drawable/ic_remove_no_shadow.xml
@@ -14,14 +14,12 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/textColorPrimary" >
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0"
+ android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M13.41,12l5.29-5.29c0.39-0.39,0.39-1.02,0-1.41c-0.39-0.39-1.02-0.39-1.41,0L12,10.59L6.71,
- 5.29c-0.39-0.39-1.02-0.39-1.41,0c-0.39,0.39-0.39,1.02,0,1.41L10.59,12l-5.29,5.29c-0.39,0.39-0.39,1.02,
- 0,1.41c0.39,0.39,1.02,0.39,1.41,0L12,13.41l5.29,5.29c0.39,0.39,1.02,0.39,1.41,0c0.39-0.39,0.39-1.02,0-1.41L13.41,12z"/>
+ android:fillColor="@android:color/white"
+ android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41z" />
</vector>
diff --git a/res/drawable/ic_setting.xml b/res/drawable/ic_setting.xml
index a83aab3..8a3728c 100644
--- a/res/drawable/ic_setting.xml
+++ b/res/drawable/ic_setting.xml
@@ -20,7 +20,7 @@
android:viewportHeight="24.0"
android:tint="?android:attr/textColorPrimary" >
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M13.85,22.25h-3.7c-0.74,0-1.36-0.54-1.45-1.27l-0.27-1.89c-0.27-0.14-0.53-0.29-0.79-0.46l-1.8,0.72
c-0.7,0.26-1.47-0.03-1.81-0.65L2.2,15.53c-0.35-0.66-0.2-1.44,0.36-1.88l1.53-1.19c-0.01-0.15-0.02-0.3-0.02-0.46
c0-0.15,0.01-0.31,0.02-0.46l-1.52-1.19C1.98,9.9,1.83,9.09,2.2,8.47l1.85-3.19c0.34-0.62,1.11-0.9,1.79-0.63l1.81,0.73
@@ -38,6 +38,6 @@
M18.22,6.27c0,0.01,0.01,0.02,0.01,0.02L18.22,6.27z M5.79,6.25L5.78,6.27C5.78,6.27,5.79,6.26,5.79,6.25z M13.31,3.28
c0,0.01,0,0.01,0,0.02L13.31,3.28z M10.69,3.26l0,0.02C10.69,3.27,10.69,3.27,10.69,3.26z"/>
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M8.5,12a3.5,3.5 0 1,0 7,0a3.5,3.5 0 1,0 -7,0"/>
</vector>
diff --git a/res/drawable/ic_uninstall_no_shadow.xml b/res/drawable/ic_uninstall_no_shadow.xml
index 37632d1..6aff102 100644
--- a/res/drawable/ic_uninstall_no_shadow.xml
+++ b/res/drawable/ic_uninstall_no_shadow.xml
@@ -20,12 +20,12 @@
android:viewportHeight="24.0"
android:tint="?android:attr/textColorPrimary" >
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M15,4V3H9v1H4v2h1v13c0,1.1,0.9,2,2,2h10c1.1,0,2-0.9,2-2V6h1V4H15z M17,19H7V6h10V19z" />
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M 9 8 H 11 V 17 H 9 V 8 Z" />
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="@android:color/white"
android:pathData="M 13 8 H 15 V 17 H 13 V 8 Z" />
</vector>
diff --git a/res/drawable/ic_wallpaper.xml b/res/drawable/ic_wallpaper.xml
index 7fd9340..9543f88 100644
--- a/res/drawable/ic_wallpaper.xml
+++ b/res/drawable/ic_wallpaper.xml
@@ -1,5 +1,5 @@
<!--
-Copyright (C) 2016 The Android Open Source Project
+ Copyright (C) 2016 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.
@@ -17,9 +17,10 @@
android:width="@dimen/options_menu_icon_size"
android:height="@dimen/options_menu_icon_size"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="?android:attr/textColorPrimary"
+ android:fillColor="@android:color/white"
android:pathData="M9,12.71l2.14,2.58l3-3.87L18,16.57H6L9,12.71z M5,5h6V3H5C3.9,3,3,3.9,3,5v6h2V5z M19,19h-6v2h6c1.1,0,2-0.9,2-2v-6h-2V19z
M5,19v-6H3v6c0,1.1,0.9,2,2,2h6v-2H5z M19,5v6h2V5c0-1.1-0.9-2-2-2h-6v2H19z M16,9c0.55,0,1-0.45,1-1s-0.45-1-1-1
c-0.55,0-1,0.45-1,1S15.45,9,16,9z"/>
diff --git a/res/drawable/ic_warning.xml b/res/drawable/ic_warning.xml
index 332563d..c2c6e98 100644
--- a/res/drawable/ic_warning.xml
+++ b/res/drawable/ic_warning.xml
@@ -20,8 +20,12 @@
android:viewportHeight="24.0"
android:tint="?android:attr/textColorPrimary" >
<path
- android:fillColor="#FFFFFFFF"
- android:pathData="M22.85,19.39L12.93,2.25c-0.41-0.71-1.44-0.71-1.85,0L1.15,19.39C0.73,20.11,1.25,21,2.07,21h19.85
- C22.75,21,23.27,20.11,22.85,19.39z M11,10c0-0.55,0.45-1,1-1s1,0.45,1,1v3c0,0.55-0.45,1-1,1s-1-0.45-1-1V10z M12,18.2
- c-0.61,0-1.1-0.49-1.1-1.1S11.39,16,12,16s1.1,0.49,1.1,1.1C13.1,17.71,12.61,18.2,12,18.2z"/>
+ android:fillColor="@android:color/white"
+ android:pathData="M12,5.99L19.53,19H4.47L12,5.99 M12,2L1,21h22L12,2L12,2z" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M 13 16 L 11 16 L 11 18 L 13 18 L 13 16 Z" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M 13 10 L 11 10 L 11 14 L 13 14 L 13 10 Z" />
</vector>
diff --git a/res/drawable/ic_widget.xml b/res/drawable/ic_widget.xml
index 3ebbb68..460fe94 100644
--- a/res/drawable/ic_widget.xml
+++ b/res/drawable/ic_widget.xml
@@ -17,9 +17,10 @@
android:width="@dimen/options_menu_icon_size"
android:height="@dimen/options_menu_icon_size"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/textColorPrimary">
<path
- android:fillColor="?android:attr/textColorPrimary"
+ android:fillColor="@android:color/white"
android:pathData="M16.66,4.52l2.83,2.83l-2.83,2.83l-2.83-2.83L16.66,4.52 M9,5v4H5V5H9 M19,15v4h-4v-4H19 M9,15v4H5v-4H9 M16.66,1.69
L11,7.34L16.66,13l5.66-5.66L16.66,1.69L16.66,1.69z M11,3H3v8h8V7.34V3L11,3z M21,13h-4.34H13v8h8V13L21,13z M11,13H3v8h8V13L11,13z"/>
</vector>
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 33ff46b..9427ae0 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -24,7 +24,7 @@
android:clipChildren="true"
android:clipToPadding="false"
android:focusable="false"
- android:saveEnabled="false" >
+ android:saveEnabled="false">
<include
layout="@layout/all_apps_rv_layout"
@@ -47,7 +47,8 @@
android:layout_height="@dimen/all_apps_header_tab_height"
android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ style="@style/TextHeadline">
<Button
android:id="@+id/tab_personal"
@@ -55,7 +56,6 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
- android:fontFamily="sans-serif-medium"
android:text="@string/all_apps_personal_tab"
android:textAllCaps="true"
android:textColor="@color/all_apps_tab_text"
@@ -67,7 +67,6 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
- android:fontFamily="sans-serif-medium"
android:text="@string/all_apps_work_tab"
android:textAllCaps="true"
android:textColor="@color/all_apps_tab_text"
diff --git a/res/layout/deep_shortcut.xml b/res/layout/deep_shortcut.xml
index 92f70e6..840a8b7 100644
--- a/res/layout/deep_shortcut.xml
+++ b/res/layout/deep_shortcut.xml
@@ -29,11 +29,10 @@
android:textAlignment="viewStart"
android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
android:paddingEnd="@dimen/popup_padding_end"
- android:drawableEnd="@drawable/deep_shortcuts_drag_handle"
+ android:drawableEnd="@drawable/ic_drag_handle"
android:drawablePadding="@dimen/deep_shortcut_drawable_padding"
android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
- android:fontFamily="sans-serif"
launcher:layoutHorizontal="true"
launcher:iconDisplay="shortcut_popup"
launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size" />
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 04f3d02..4b7097a 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -31,7 +31,6 @@
android:paddingEnd="@dimen/popup_padding_end"
android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
- android:fontFamily="sans-serif"
launcher:iconDisplay="shortcut_popup"
launcher:layoutHorizontal="true"
android:focusable="false" />
diff --git a/res/layout/widget_cell_content.xml b/res/layout/widget_cell_content.xml
index c77b0b9..64f2362 100644
--- a/res/layout/widget_cell_content.xml
+++ b/res/layout/widget_cell_content.xml
@@ -34,7 +34,6 @@
android:layout_weight="1"
android:ellipsize="end"
android:fadingEdge="horizontal"
- android:fontFamily="sans-serif-condensed"
android:gravity="start"
android:singleLine="true"
android:maxLines="1"
@@ -51,7 +50,6 @@
android:layout_marginLeft="5dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
- android:fontFamily="sans-serif-condensed"
android:alpha="0.8" />
</LinearLayout>
diff --git a/res/layout/widgets_bottom_sheet.xml b/res/layout/widgets_bottom_sheet.xml
index 6bf9048..3fdfc96 100644
--- a/res/layout/widgets_bottom_sheet.xml
+++ b/res/layout/widgets_bottom_sheet.xml
@@ -26,7 +26,7 @@
android:theme="?attr/widgetsTheme">
<TextView
- style="@style/TextTitle"
+ style="@style/TextHeadline"
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/widgets_scroll_container.xml b/res/layout/widgets_scroll_container.xml
index 33c981a..fc509d1 100644
--- a/res/layout/widgets_scroll_container.xml
+++ b/res/layout/widgets_scroll_container.xml
@@ -23,6 +23,7 @@
android:scrollbars="none">
<LinearLayout
android:id="@+id/widgets_cell_list"
+ style="@style/TextTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="0dp"
diff --git a/res/layout/work_tab_bottom_user_education_view.xml b/res/layout/work_tab_bottom_user_education_view.xml
index ba6a939..ac2deeb 100644
--- a/res/layout/work_tab_bottom_user_education_view.xml
+++ b/res/layout/work_tab_bottom_user_education_view.xml
@@ -44,7 +44,7 @@
android:layout_marginEnd="12dp"
android:layout_gravity="right"
android:contentDescription="@string/bottom_work_tab_user_education_close_button"
- android:src="@drawable/ic_close"/>
+ android:src="@drawable/ic_remove_no_shadow"/>
<TextView
android:layout_width="wrap_content"
diff --git a/res/values/overlayable.xml b/res/values/overlayable.xml
new file mode 100644
index 0000000..b68d615
--- /dev/null
+++ b/res/values/overlayable.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<resources>
+ <overlayable name="SystemIcons">
+ <policy type="product|system|vendor">
+ <item type="drawable" name="ic_corp"/>
+ <item type="drawable" name="ic_info_no_shadow"/>
+ <item type="drawable" name="ic_remove_no_shadow"/>
+ <item type="drawable" name="ic_setting"/>
+ <item type="drawable" name="ic_wallpaper"/>
+ <item type="drawable" name="ic_warning"/>
+ <item type="drawable" name="ic_widget"/>
+ </policy>
+ </overlayable>
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ec63e35..9b84cc9 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -75,8 +75,8 @@
<item name="allAppsScrimColor">#EA212121</item>
<item name="allAppsInterimScrimAlpha">102</item>
<item name="allAppsNavBarScrimColor">#80000000</item>
- <item name="popupColorPrimary">?android:attr/colorPrimary</item>
- <item name="popupColorSecondary">#424242</item> <!-- Gray 800 -->
+ <item name="popupColorPrimary">#3C4043</item> <!-- Gray 800 -->
+ <item name="popupColorSecondary">#5F6368</item> <!-- Gray 700 -->
<item name="popupColorTertiary">#757575</item> <!-- Gray 600 -->
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
<item name="folderDotColor">#FF464646</item>
@@ -126,7 +126,7 @@
<style name="WidgetContainerTheme.Dark" />
- <style name="FastScrollerPopup" parent="@android:style/TextAppearance.DeviceDefault">
+ <style name="FastScrollerPopup" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
<item name="android:layout_width">wrap_content</item>
<item name="android:minWidth">@dimen/fastscroll_popup_width</item>
<item name="android:layout_height">@dimen/fastscroll_popup_height</item>
@@ -173,7 +173,7 @@
</style>
<!-- Drop targets -->
- <style name="DropTargetButtonBase">
+ <style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:drawablePadding">7.5dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
@@ -189,6 +189,8 @@
<style name="DropTargetButton" parent="DropTargetButtonBase" />
+ <style name="TextHeadline" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle" />
+
<style name="TextTitle" parent="@android:style/TextAppearance.DeviceDefault" />
<style name="AllAppsEmptySearchBackground">
diff --git a/robolectric_tests/resources/cache_data_updated_task_data.txt b/robolectric_tests/resources/cache_data_updated_task_data.txt
index 8199687..302d58f 100644
--- a/robolectric_tests/resources/cache_data_updated_task_data.txt
+++ b/robolectric_tests/resources/cache_data_updated_task_data.txt
@@ -1,6 +1,6 @@
# Model data used by CacheDataUpdatedTaskTest
-classMap s com.android.launcher3.ShortcutInfo
+classMap s com.android.launcher3.WorkspaceItemInfo
# Items for the BgDataModel
diff --git a/robolectric_tests/resources/package_install_state_change_task_data.txt b/robolectric_tests/resources/package_install_state_change_task_data.txt
index 84f9c16..4d63664 100644
--- a/robolectric_tests/resources/package_install_state_change_task_data.txt
+++ b/robolectric_tests/resources/package_install_state_change_task_data.txt
@@ -1,6 +1,6 @@
# Model data used by PackageInstallStateChangeTaskTest
-classMap s com.android.launcher3.ShortcutInfo
+classMap s com.android.launcher3.WorkspaceItemInfo
classMap w com.android.launcher3.LauncherAppWidgetInfo
# Items for the BgDataModel
diff --git a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
index 4f49817..d7a2278 100644
--- a/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
@@ -7,19 +7,14 @@
import static org.mockito.Mockito.verify;
import android.content.ComponentName;
-import android.content.ContentProviderOperation;
-import android.content.ContentValues;
-import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
-import android.net.Uri;
import android.util.Pair;
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.LauncherProvider;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
@@ -103,7 +98,7 @@
@Test
public void testAddItem_existing_item_ignored() throws Exception {
- ShortcutInfo info = new ShortcutInfo();
+ WorkspaceItemInfo info = new WorkspaceItemInfo();
info.intent = new Intent().setComponent(mComponent1);
// Setup a screen with a hole
@@ -115,10 +110,10 @@
@Test
public void testAddItem_some_items_added() throws Exception {
- ShortcutInfo info = new ShortcutInfo();
+ WorkspaceItemInfo info = new WorkspaceItemInfo();
info.intent = new Intent().setComponent(mComponent1);
- ShortcutInfo info2 = new ShortcutInfo();
+ WorkspaceItemInfo info2 = new WorkspaceItemInfo();
info2.intent = new Intent().setComponent(mComponent2);
// Setup a screen with a hole
@@ -155,7 +150,7 @@
continue;
}
- ShortcutInfo info = new ShortcutInfo();
+ WorkspaceItemInfo info = new WorkspaceItemInfo();
info.intent = new Intent().setComponent(mComponent1);
info.id = startId++;
info.screenId = screenId;
diff --git a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
index 2334993..e046cad 100644
--- a/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java
@@ -8,7 +8,7 @@
import com.android.launcher3.AppInfo;
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import org.junit.Before;
import org.junit.Ignore;
@@ -89,10 +89,10 @@
for (ItemInfo info : bgDataModel.itemsIdMap) {
if (updates.contains(info.id)) {
assertEquals(NEW_LABEL_PREFIX + info.id, info.title);
- assertNotNull(((ShortcutInfo) info).iconBitmap);
+ assertNotNull(((WorkspaceItemInfo) info).iconBitmap);
} else {
assertNotSame(NEW_LABEL_PREFIX + info.id, info.title);
- assertNull(((ShortcutInfo) info).iconBitmap);
+ assertNull(((WorkspaceItemInfo) info).iconBitmap);
}
}
}
diff --git a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
index c7b4613..e9324f9 100644
--- a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
@@ -4,7 +4,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
@@ -58,9 +58,9 @@
private void verifyProgressUpdate(int progress, Integer... idsUpdated) {
HashSet<Integer> updates = new HashSet<>(Arrays.asList(idsUpdated));
for (ItemInfo info : bgDataModel.itemsIdMap) {
- if (info instanceof ShortcutInfo) {
+ if (info instanceof WorkspaceItemInfo) {
assertEquals(updates.contains(info.id) ? progress: 0,
- ((ShortcutInfo) info).getInstallProgress());
+ ((WorkspaceItemInfo) info).getInstallProgress());
} else {
assertEquals(updates.contains(info.id) ? progress: -1,
((LauncherAppWidgetInfo) info).installProgress);
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index e7d7a69..0e08276 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -182,6 +182,7 @@
protected static <T extends AbstractFloatingView> T getOpenView(
ActivityContext activity, @FloatingViewType int type) {
BaseDragLayer dragLayer = activity.getDragLayer();
+ if (dragLayer == null) return null;
// Iterate in reverse order. AbstractFloatingView is added later to the dragLayer,
// and will be one of the last views.
for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) {
diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/AppInfo.java
index ed79914..d884049 100644
--- a/src/com/android/launcher3/AppInfo.java
+++ b/src/com/android/launcher3/AppInfo.java
@@ -81,8 +81,8 @@
return super.dumpProperties() + " componentName=" + componentName;
}
- public ShortcutInfo makeShortcut() {
- return new ShortcutInfo(this);
+ public WorkspaceItemInfo makeWorkspaceItem() {
+ return new WorkspaceItemInfo(this);
}
public ComponentKey toComponentKey() {
diff --git a/src/com/android/launcher3/AutoInstallsLayout.java b/src/com/android/launcher3/AutoInstallsLayout.java
index 62bc53a..9724869 100644
--- a/src/com/android/launcher3/AutoInstallsLayout.java
+++ b/src/com/android/launcher3/AutoInstallsLayout.java
@@ -50,6 +50,7 @@
import java.io.IOException;
import java.util.Locale;
+import java.util.function.Supplier;
/**
* Layout parsing code for auto installs layout
@@ -76,12 +77,8 @@
if (customizationApkInfo == null) {
return null;
}
- return get(context, customizationApkInfo.first, customizationApkInfo.second,
- appWidgetHost, callback);
- }
-
- static AutoInstallsLayout get(Context context, String pkg, Resources targetRes,
- AppWidgetHost appWidgetHost, LayoutParserCallback callback) {
+ String pkg = customizationApkInfo.first;
+ Resources targetRes = customizationApkInfo.second;
InvariantDeviceProfile grid = LauncherAppState.getIDP(context);
// Try with grid size and hotseat count
@@ -114,7 +111,7 @@
// Object Tags
private static final String TAG_INCLUDE = "include";
- private static final String TAG_WORKSPACE = "workspace";
+ public static final String TAG_WORKSPACE = "workspace";
private static final String TAG_APP_ICON = "appicon";
private static final String TAG_AUTO_INSTALL = "autoinstall";
private static final String TAG_FOLDER = "folder";
@@ -156,7 +153,7 @@
protected final PackageManager mPackageManager;
protected final Resources mSourceRes;
- protected final int mLayoutId;
+ protected final Supplier<XmlPullParser> mInitialLayoutSupplier;
private final InvariantDeviceProfile mIdp;
private final int mRowCount;
@@ -171,6 +168,12 @@
public AutoInstallsLayout(Context context, AppWidgetHost appWidgetHost,
LayoutParserCallback callback, Resources res,
int layoutId, String rootTag) {
+ this(context, appWidgetHost, callback, res, () -> res.getXml(layoutId), rootTag);
+ }
+
+ public AutoInstallsLayout(Context context, AppWidgetHost appWidgetHost,
+ LayoutParserCallback callback, Resources res,
+ Supplier<XmlPullParser> initialLayoutSupplier, String rootTag) {
mContext = context;
mAppWidgetHost = appWidgetHost;
mCallback = callback;
@@ -180,7 +183,7 @@
mRootTag = rootTag;
mSourceRes = res;
- mLayoutId = layoutId;
+ mInitialLayoutSupplier = initialLayoutSupplier;
mIdp = LauncherAppState.getIDP(context);
mRowCount = mIdp.numRows;
@@ -193,9 +196,9 @@
public int loadLayout(SQLiteDatabase db, IntArray screenIds) {
mDb = db;
try {
- return parseLayout(mLayoutId, screenIds);
+ return parseLayout(mInitialLayoutSupplier.get(), screenIds);
} catch (Exception e) {
- Log.e(TAG, "Error parsing layout: " + e);
+ Log.e(TAG, "Error parsing layout: ", e);
return -1;
}
}
@@ -203,9 +206,8 @@
/**
* Parses the layout and returns the number of elements added on the homescreen.
*/
- protected int parseLayout(int layoutId, IntArray screenIds)
+ protected int parseLayout(XmlPullParser parser, IntArray screenIds)
throws XmlPullParserException, IOException {
- XmlPullParser parser = mSourceRes.getXml(layoutId);
beginDocument(parser, mRootTag);
final int depth = parser.getDepth();
int type;
@@ -248,7 +250,7 @@
final int resId = getAttributeResourceValue(parser, ATTR_WORKSPACE, 0);
if (resId != 0) {
// recursively load some more favorites, why not?
- return parseLayout(resId, screenIds);
+ return parseLayout(mSourceRes.getXml(resId), screenIds);
} else {
return 0;
}
@@ -389,7 +391,7 @@
return -1;
}
- mValues.put(Favorites.RESTORED, ShortcutInfo.FLAG_AUTOINSTALL_ICON);
+ mValues.put(Favorites.RESTORED, WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON);
final Intent intent = new Intent(Intent.ACTION_MAIN, null)
.addCategory(Intent.CATEGORY_LAUNCHER)
.setComponent(new ComponentName(packageName, className))
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index 18599ac..c6fd906 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -16,8 +16,6 @@
package com.android.launcher3;
-import static com.android.launcher3.model.AppLaunchTracker.CONTAINER_SEARCH;
-
import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
import android.content.Intent;
@@ -169,10 +167,10 @@
intent.setSourceBounds(getViewBounds(v));
}
try {
- boolean isShortcut = (item instanceof ShortcutInfo)
+ boolean isShortcut = (item instanceof WorkspaceItemInfo)
&& (item.itemType == Favorites.ITEM_TYPE_SHORTCUT
|| item.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT)
- && !((ShortcutInfo) item).isPromise();
+ && !((WorkspaceItemInfo) item).isPromise();
if (isShortcut) {
// Shortcuts need some special checks due to legacy reasons.
startShortcutIntentSafely(intent, optsBundle, item, sourceContainer);
@@ -209,7 +207,7 @@
.penaltyLog().build());
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
- String id = ((ShortcutInfo) info).getDeepShortcutId();
+ String id = ((WorkspaceItemInfo) info).getDeepShortcutId();
String packageName = intent.getPackage();
DeepShortcutManager.getInstance(this).startShortcut(
packageName, id, intent.getSourceBounds(), optsBundle, info.user);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 4dd2e0a..3611ad4 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -215,11 +215,11 @@
mDotScaleAnim.start();
}
- public void applyFromShortcutInfo(ShortcutInfo info) {
- applyFromShortcutInfo(info, false);
+ public void applyFromWorkspaceItem(WorkspaceItemInfo info) {
+ applyFromWorkspaceItem(info, false);
}
- public void applyFromShortcutInfo(ShortcutInfo info, boolean promiseStateChanged) {
+ public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) {
applyIconAndLabel(info);
setTag(info);
if (promiseStateChanged || (info.hasPromiseIconUi())) {
@@ -232,7 +232,7 @@
public void applyFromApplicationInfo(AppInfo info) {
applyIconAndLabel(info);
- // We don't need to check the info since it's not a ShortcutInfo
+ // We don't need to check the info since it's not a WorkspaceItemInfo
super.setTag(info);
// Verify high res immediately
@@ -247,7 +247,7 @@
public void applyFromPackageItemInfo(PackageItemInfo info) {
applyIconAndLabel(info);
- // We don't need to check the info since it's not a ShortcutInfo
+ // We don't need to check the info since it's not a WorkspaceItemInfo
super.setTag(info);
// Verify high res immediately
@@ -480,8 +480,7 @@
*/
public ObjectAnimator createTextAlphaAnimator(boolean fadeIn) {
float toAlpha = shouldTextBeVisible() && fadeIn ? 1 : 0;
- float fromAlpha = toAlpha == 1 ? 0 : 1f;
- return ObjectAnimator.ofFloat(this, TEXT_ALPHA_PROPERTY, fromAlpha, toAlpha);
+ return ObjectAnimator.ofFloat(this, TEXT_ALPHA_PROPERTY, toAlpha);
}
@Override
@@ -492,11 +491,11 @@
}
public void applyPromiseState(boolean promiseStateChanged) {
- if (getTag() instanceof ShortcutInfo) {
- ShortcutInfo info = (ShortcutInfo) getTag();
+ if (getTag() instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
final boolean isPromise = info.hasPromiseIconUi();
final int progressLevel = isPromise ?
- ((info.hasStatusFlag(ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE) ?
+ ((info.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE) ?
info.getInstallProgress() : 0)) : 100;
PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel);
@@ -620,8 +619,8 @@
if (info instanceof AppInfo) {
applyFromApplicationInfo((AppInfo) info);
- } else if (info instanceof ShortcutInfo) {
- applyFromShortcutInfo((ShortcutInfo) info);
+ } else if (info instanceof WorkspaceItemInfo) {
+ applyFromWorkspaceItem((WorkspaceItemInfo) info);
mActivity.invalidateParent(info);
} else if (info instanceof PackageItemInfo) {
applyFromPackageItemInfo((PackageItemInfo) info);
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index 4c6824a..8cbad20 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -16,8 +16,6 @@
package com.android.launcher3;
-import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
-
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -64,7 +62,7 @@
*/
@Override
public boolean supportsAccessibilityDrop(ItemInfo info, View view) {
- if (info instanceof ShortcutInfo) {
+ if (info instanceof WorkspaceItemInfo) {
// Support the action unless the item is in a context menu.
return info.screenId >= 0;
}
diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/FolderInfo.java
index 21254ab..b747d62 100644
--- a/src/com/android/launcher3/FolderInfo.java
+++ b/src/com/android/launcher3/FolderInfo.java
@@ -50,7 +50,7 @@
/**
* The apps and shortcuts
*/
- public ArrayList<ShortcutInfo> contents = new ArrayList<ShortcutInfo>();
+ public ArrayList<WorkspaceItemInfo> contents = new ArrayList<WorkspaceItemInfo>();
ArrayList<FolderListener> listeners = new ArrayList<FolderListener>();
@@ -64,14 +64,14 @@
*
* @param item
*/
- public void add(ShortcutInfo item, boolean animate) {
+ public void add(WorkspaceItemInfo item, boolean animate) {
add(item, contents.size(), animate);
}
/**
* Add an app or shortcut for a specified rank.
*/
- public void add(ShortcutInfo item, int rank, boolean animate) {
+ public void add(WorkspaceItemInfo item, int rank, boolean animate) {
rank = Utilities.boundToRange(rank, 0, contents.size());
contents.add(rank, item);
for (int i = 0; i < listeners.size(); i++) {
@@ -85,7 +85,7 @@
*
* @param item
*/
- public void remove(ShortcutInfo item, boolean animate) {
+ public void remove(WorkspaceItemInfo item, boolean animate) {
contents.remove(item);
for (int i = 0; i < listeners.size(); i++) {
listeners.get(i).onRemove(item);
@@ -129,8 +129,8 @@
}
public interface FolderListener {
- public void onAdd(ShortcutInfo item, int rank);
- public void onRemove(ShortcutInfo item);
+ public void onAdd(WorkspaceItemInfo item, int rank);
+ public void onRemove(WorkspaceItemInfo item);
public void onTitleChanged(CharSequence title);
public void onItemsChanged(boolean animate);
public void prepareAutoUpdate();
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index 5c5f5e4..418f1e4 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -244,13 +244,13 @@
return convertToLauncherActivityIfPossible(info);
}
- public static ShortcutInfo fromShortcutIntent(Context context, Intent data) {
+ public static WorkspaceItemInfo fromShortcutIntent(Context context, Intent data) {
PendingInstallShortcutInfo info = createPendingInfo(context, data);
- return info == null ? null : (ShortcutInfo) info.getItemInfo().first;
+ return info == null ? null : (WorkspaceItemInfo) info.getItemInfo().first;
}
- public static ShortcutInfo fromActivityInfo(LauncherActivityInfo info, Context context) {
- return (ShortcutInfo) (new PendingInstallShortcutInfo(info, context).getItemInfo().first);
+ public static WorkspaceItemInfo fromActivityInfo(LauncherActivityInfo info, Context context) {
+ return (WorkspaceItemInfo) (new PendingInstallShortcutInfo(info, context).getItemInfo().first);
}
public static void queueShortcut(ShortcutInfoCompat info, Context context) {
@@ -483,11 +483,11 @@
// Set default values until proper values is loaded.
appInfo.title = "";
appInfo.applyFrom(app.getIconCache().getDefaultIcon(user));
- final ShortcutInfo si = appInfo.makeShortcut();
+ final WorkspaceItemInfo si = appInfo.makeWorkspaceItem();
if (Looper.myLooper() == LauncherModel.getWorkerLooper()) {
app.getIconCache().getTitleAndIcon(si, activityInfo, false /* useLowResIcon */);
} else {
- app.getModel().updateAndBindShortcutInfo(() -> {
+ app.getModel().updateAndBindWorkspaceItem(() -> {
app.getIconCache().getTitleAndIcon(
si, activityInfo, false /* useLowResIcon */);
return si;
@@ -495,7 +495,7 @@
}
return Pair.create((ItemInfo) si, (Object) activityInfo);
} else if (shortcutInfo != null) {
- ShortcutInfo si = new ShortcutInfo(shortcutInfo, mContext);
+ WorkspaceItemInfo si = new WorkspaceItemInfo(shortcutInfo, mContext);
LauncherIcons li = LauncherIcons.obtain(mContext);
si.applyFrom(li.createShortcutIcon(shortcutInfo));
li.recycle();
@@ -513,7 +513,7 @@
widgetInfo.spanY = Math.min(info.spanY, idp.numRows);
return Pair.create((ItemInfo) widgetInfo, (Object) providerInfo);
} else {
- ShortcutInfo si = createShortcutInfo(data, LauncherAppState.getInstance(mContext));
+ WorkspaceItemInfo si = createWorkspaceItemInfo(data, LauncherAppState.getInstance(mContext));
return Pair.create((ItemInfo) si, null);
}
}
@@ -625,18 +625,18 @@
return new PendingInstallShortcutInfo(info, original.mContext);
}
- private static ShortcutInfo createShortcutInfo(Intent data, LauncherAppState app) {
+ private static WorkspaceItemInfo createWorkspaceItemInfo(Intent data, LauncherAppState app) {
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
Parcelable bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
if (intent == null) {
- // If the intent is null, we can't construct a valid ShortcutInfo, so we return null
- Log.e(TAG, "Can't construct ShorcutInfo with null intent");
+ // If the intent is null, return null as we can't construct a valid WorkspaceItemInfo
+ Log.e(TAG, "Can't construct WorkspaceItemInfo with null intent");
return null;
}
- final ShortcutInfo info = new ShortcutInfo();
+ final WorkspaceItemInfo info = new WorkspaceItemInfo();
// Only support intents for current user for now. Intents sent from other
// users wouldn't get here without intent forwarding anyway.
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c14512a..0c35566 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -57,7 +57,6 @@
import android.os.Parcelable;
import android.os.Process;
import android.os.StrictMode;
-import android.os.UserHandle;
import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.Log;
@@ -981,7 +980,7 @@
*
* @param info The data structure describing the shortcut.
*/
- View createShortcut(ShortcutInfo info) {
+ View createShortcut(WorkspaceItemInfo info) {
return createShortcut((ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentPage()), info);
}
@@ -993,10 +992,10 @@
*
* @return A View inflated from layoutResId.
*/
- public View createShortcut(ViewGroup parent, ShortcutInfo info) {
+ public View createShortcut(ViewGroup parent, WorkspaceItemInfo info) {
BubbleTextView favorite = (BubbleTextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_icon, parent, false);
- favorite.applyFromShortcutInfo(info);
+ favorite.applyFromWorkspaceItem(info);
favorite.setOnClickListener(ItemClickHandler.INSTANCE);
favorite.setOnFocusChangeListener(mFocusHandler);
return favorite;
@@ -1017,9 +1016,9 @@
int[] cellXY = mTmpAddItemCellCoordinates;
CellLayout layout = getCellLayout(container, screenId);
- ShortcutInfo info = null;
+ WorkspaceItemInfo info = null;
if (Utilities.ATLEAST_OREO) {
- info = LauncherAppsCompatVO.createShortcutInfoFromPinItemRequest(
+ info = LauncherAppsCompatVO.createWorkspaceItemFromPinItemRequest(
this, LauncherAppsCompatVO.getPinItemRequest(data), 0);
}
@@ -1541,11 +1540,11 @@
* @param deleteFromDb whether or not to delete this item from the db.
*/
public boolean removeItem(View v, final ItemInfo itemInfo, boolean deleteFromDb) {
- if (itemInfo instanceof ShortcutInfo) {
+ if (itemInfo instanceof WorkspaceItemInfo) {
// Remove the shortcut from the folder before removing it from launcher
View folderIcon = mWorkspace.getHomescreenIconByItemId(itemInfo.container);
if (folderIcon instanceof FolderIcon) {
- ((FolderInfo) folderIcon.getTag()).remove((ShortcutInfo) itemInfo, true);
+ ((FolderInfo) folderIcon.getTag()).remove((WorkspaceItemInfo) itemInfo, true);
} else {
mWorkspace.removeWorkspaceItem(v);
}
@@ -1870,7 +1869,7 @@
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT: {
- ShortcutInfo info = (ShortcutInfo) item;
+ WorkspaceItemInfo info = (WorkspaceItemInfo) item;
view = createShortcut(info);
break;
}
@@ -2228,7 +2227,7 @@
* @param updated list of shortcuts which have changed.
*/
@Override
- public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated, final UserHandle user) {
+ public void bindWorkspaceItemsChanged(ArrayList<WorkspaceItemInfo> updated) {
if (!updated.isEmpty()) {
mWorkspace.updateShortcuts(updated);
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index c559f2b..dfbe0fe 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -149,7 +149,7 @@
public void bindAppsAdded(IntArray newScreens,
ArrayList<ItemInfo> addNotAnimated, ArrayList<ItemInfo> addAnimated);
public void bindPromiseAppProgressUpdated(PromiseAppInfo app);
- public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated, UserHandle user);
+ public void bindWorkspaceItemsChanged(ArrayList<WorkspaceItemInfo> updated);
public void bindWidgetsRestored(ArrayList<LauncherAppWidgetInfo> widgets);
public void bindRestoreItemsChange(HashSet<ItemInfo> updates);
public void bindWorkspaceComponentsRemoved(ItemInfoMatcher matcher);
@@ -530,8 +530,8 @@
}
- public void updateAndBindShortcutInfo(final ShortcutInfo si, final ShortcutInfoCompat info) {
- updateAndBindShortcutInfo(() -> {
+ public void updateAndBindWorkspaceItem(WorkspaceItemInfo si, ShortcutInfoCompat info) {
+ updateAndBindWorkspaceItem(() -> {
si.updateFromDeepShortcutInfo(info, mApp.getContext());
LauncherIcons li = LauncherIcons.obtain(mApp.getContext());
si.applyFrom(li.createShortcutIcon(info));
@@ -543,15 +543,15 @@
/**
* Utility method to update a shortcut on the background thread.
*/
- public void updateAndBindShortcutInfo(final Supplier<ShortcutInfo> shortcutProvider) {
+ public void updateAndBindWorkspaceItem(final Supplier<WorkspaceItemInfo> itemProvider) {
enqueueModelUpdateTask(new BaseModelUpdateTask() {
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
- ShortcutInfo info = shortcutProvider.get();
+ WorkspaceItemInfo info = itemProvider.get();
getModelWriter().updateItemInDatabase(info);
- ArrayList<ShortcutInfo> update = new ArrayList<>();
+ ArrayList<WorkspaceItemInfo> update = new ArrayList<>();
update.add(info);
- bindUpdatedShortcuts(update, info.user);
+ bindUpdatedWorkspaceItems(update);
}
});
}
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 39d93c8..f830301 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -34,6 +34,7 @@
import android.content.OperationApplicationException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ProviderInfo;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.DatabaseUtils;
@@ -51,8 +52,10 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.BaseColumns;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Xml;
import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -63,15 +66,21 @@
import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction;
import com.android.launcher3.provider.RestoreDbTask;
+import com.android.launcher3.util.IOUtils;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.NoLocaleSQLiteHelper;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.Thunk;
+import org.xmlpull.v1.XmlPullParser;
+
import java.io.File;
import java.io.FileDescriptor;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
+import java.io.StringReader;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -93,8 +102,6 @@
static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
- private static final String RESTRICTION_PACKAGE_NAME = "workspace.configuration.package.name";
-
private final ChangeListenerWrapper mListenerWrapper = new ChangeListenerWrapper();
private Handler mListenerHandler;
@@ -505,25 +512,40 @@
*/
private AutoInstallsLayout createWorkspaceLoaderFromAppRestriction(AppWidgetHost widgetHost) {
Context ctx = getContext();
- UserManager um = (UserManager) ctx.getSystemService(Context.USER_SERVICE);
- Bundle bundle = um.getApplicationRestrictions(ctx.getPackageName());
- if (bundle == null) {
+ InvariantDeviceProfile grid = LauncherAppState.getIDP(ctx);
+
+ String authority = Settings.Secure.getString(ctx.getContentResolver(),
+ "launcher3.layout.provider");
+ if (TextUtils.isEmpty(authority)) {
return null;
}
- String packageName = bundle.getString(RESTRICTION_PACKAGE_NAME);
- if (packageName != null) {
- try {
- Resources targetResources = ctx.getPackageManager()
- .getResourcesForApplication(packageName);
- return AutoInstallsLayout.get(ctx, packageName, targetResources,
- widgetHost, mOpenHelper);
- } catch (NameNotFoundException e) {
- Log.e(TAG, "Target package for restricted profile not found", e);
- return null;
- }
+ ProviderInfo pi = ctx.getPackageManager().resolveContentProvider(authority, 0);
+ if (pi == null) {
+ Log.e(TAG, "No provider found for authority " + authority);
+ return null;
}
- return null;
+ Uri uri = new Uri.Builder().scheme("content").authority(authority).path("launcher_layout")
+ .appendQueryParameter("version", "1")
+ .appendQueryParameter("gridWidth", Integer.toString(grid.numColumns))
+ .appendQueryParameter("gridHeight", Integer.toString(grid.numRows))
+ .appendQueryParameter("hotseatSize", Integer.toString(grid.numHotseatIcons))
+ .build();
+
+ try (InputStream in = ctx.getContentResolver().openInputStream(uri)) {
+ // Read the full xml so that we fail early in case of any IO error.
+ String layout = new String(IOUtils.toByteArray(in));
+ XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(new StringReader(layout));
+
+ Log.d(TAG, "Loading layout from " + authority);
+ return new AutoInstallsLayout(ctx, widgetHost, mOpenHelper,
+ ctx.getPackageManager().getResourcesForApplication(pi.applicationInfo),
+ () -> parser, AutoInstallsLayout.TAG_WORKSPACE);
+ } catch (Exception e) {
+ Log.e(TAG, "Error getting layout stream from: " + authority , e);
+ return null;
+ }
}
private DefaultLayoutParser getDefaultLayoutParser(AppWidgetHost widgetHost) {
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 5b654d8..eff0619 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -140,6 +140,10 @@
return mState;
}
+ public LauncherState getCurrentStableState() {
+ return mCurrentStableState;
+ }
+
public StateHandler[] getStateHandlers() {
if (mStateHandlers == null) {
mStateHandlers = UiFactory.getStateHandler(mLauncher);
@@ -320,8 +324,12 @@
if (!isWorkspaceVisible) {
workspace.setScaleX(0.92f);
workspace.setScaleY(0.92f);
- workspace.getHotseat().setScaleX(0.92f);
- workspace.getHotseat().setScaleY(0.92f);
+ }
+ Hotseat hotseat = workspace.getHotseat();
+ boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
+ if (!isHotseatVisible) {
+ hotseat.setScaleX(0.92f);
+ hotseat.setScaleY(0.92f);
}
} else if (fromState == NORMAL && toState == OVERVIEW_PEEK) {
builder.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
diff --git a/src/com/android/launcher3/PromiseAppInfo.java b/src/com/android/launcher3/PromiseAppInfo.java
index ea151cd..4ad0b3d 100644
--- a/src/com/android/launcher3/PromiseAppInfo.java
+++ b/src/com/android/launcher3/PromiseAppInfo.java
@@ -38,13 +38,13 @@
}
@Override
- public ShortcutInfo makeShortcut() {
- ShortcutInfo shortcut = new ShortcutInfo(this);
+ public WorkspaceItemInfo makeWorkspaceItem() {
+ WorkspaceItemInfo shortcut = new WorkspaceItemInfo(this);
shortcut.setInstallProgress(level);
// We need to update the component name when the apk is installed
- shortcut.status |= ShortcutInfo.FLAG_AUTOINSTALL_ICON;
+ shortcut.status |= WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
// Since the user is manually placing it on homescreen, it should not be auto-removed later
- shortcut.status |= ShortcutInfo.FLAG_RESTORE_STARTED;
+ shortcut.status |= WorkspaceItemInfo.FLAG_RESTORE_STARTED;
return shortcut;
}
diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/TestProtocol.java
index 7d3715e..dab4282 100644
--- a/src/com/android/launcher3/TestProtocol.java
+++ b/src/com/android/launcher3/TestProtocol.java
@@ -66,4 +66,6 @@
public static boolean sDebugTracing = false;
public static final String NO_DRAG_TAG = "b/129434166";
+ public static final String REQUEST_ENABLE_DRAG_LOGGING = "enable-drag-logging";
+ public static final String REQUEST_DISABLE_DRAG_LOGGING = "disable-drag-logging";
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 2ee537c..efb50f0 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1609,7 +1609,7 @@
return false;
}
- boolean aboveShortcut = (dropOverView.getTag() instanceof ShortcutInfo);
+ boolean aboveShortcut = (dropOverView.getTag() instanceof WorkspaceItemInfo);
boolean willBecomeShortcut =
(info.itemType == ITEM_TYPE_APPLICATION ||
info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
@@ -1658,12 +1658,12 @@
mCreateUserFolderOnDrop = false;
final int screenId = getIdForScreen(target);
- boolean aboveShortcut = (v.getTag() instanceof ShortcutInfo);
- boolean willBecomeShortcut = (newView.getTag() instanceof ShortcutInfo);
+ boolean aboveShortcut = (v.getTag() instanceof WorkspaceItemInfo);
+ boolean willBecomeShortcut = (newView.getTag() instanceof WorkspaceItemInfo);
if (aboveShortcut && willBecomeShortcut) {
- ShortcutInfo sourceInfo = (ShortcutInfo) newView.getTag();
- ShortcutInfo destInfo = (ShortcutInfo) v.getTag();
+ WorkspaceItemInfo sourceInfo = (WorkspaceItemInfo) newView.getTag();
+ WorkspaceItemInfo destInfo = (WorkspaceItemInfo) v.getTag();
// if the drag started here, we need to remove it from the workspace
if (!external) {
getParentCellLayoutForView(mDragInfo.cell).removeView(mDragInfo.cell);
@@ -2418,8 +2418,8 @@
*/
private void onDropExternal(final int[] touchXY, final CellLayout cellLayout, DragObject d) {
if (d.dragInfo instanceof PendingAddShortcutInfo) {
- ShortcutInfo si = ((PendingAddShortcutInfo) d.dragInfo)
- .activityInfo.createShortcutInfo();
+ WorkspaceItemInfo si = ((PendingAddShortcutInfo) d.dragInfo)
+ .activityInfo.createWorkspaceItemInfo();
if (si != null) {
d.dragInfo = si;
}
@@ -2524,10 +2524,10 @@
case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
if (info.container == NO_ID && info instanceof AppInfo) {
// Came from all apps -- make a copy
- info = ((AppInfo) info).makeShortcut();
+ info = ((AppInfo) info).makeWorkspaceItem();
d.dragInfo = info;
}
- view = mLauncher.createShortcut(cellLayout, (ShortcutInfo) info);
+ view = mLauncher.createShortcut(cellLayout, (WorkspaceItemInfo) info);
break;
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
view = FolderIcon.fromXml(R.layout.folder_icon, mLauncher, cellLayout,
@@ -2916,7 +2916,7 @@
final Workspace.ItemOperator packageAndUserInFolder = (info, view) -> {
if (info instanceof FolderInfo) {
FolderInfo folderInfo = (FolderInfo) info;
- for (ShortcutInfo shortcutInfo : folderInfo.contents) {
+ for (WorkspaceItemInfo shortcutInfo : folderInfo.contents) {
if (packageAndUser.evaluate(shortcutInfo, view)) {
return true;
}
@@ -3045,7 +3045,7 @@
if (parent != null) {
FolderInfo folderInfo = (FolderInfo) parent.getTag();
folderInfo.prepareAutoUpdate();
- folderInfo.remove((ShortcutInfo) itemToRemove, false);
+ folderInfo.remove((WorkspaceItemInfo) itemToRemove, false);
}
}
}
@@ -3112,13 +3112,13 @@
return false;
}
- void updateShortcuts(ArrayList<ShortcutInfo> shortcuts) {
+ void updateShortcuts(ArrayList<WorkspaceItemInfo> shortcuts) {
int total = shortcuts.size();
- final HashSet<ShortcutInfo> updates = new HashSet<>(total);
+ final HashSet<WorkspaceItemInfo> updates = new HashSet<>(total);
final IntSet folderIds = new IntSet();
for (int i = 0; i < total; i++) {
- ShortcutInfo s = shortcuts.get(i);
+ WorkspaceItemInfo s = shortcuts.get(i);
updates.add(s);
folderIds.add(s.container);
}
@@ -3126,14 +3126,14 @@
mapOverItems(MAP_RECURSE, new ItemOperator() {
@Override
public boolean evaluate(ItemInfo info, View v) {
- if (info instanceof ShortcutInfo && v instanceof BubbleTextView &&
+ if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView &&
updates.contains(info)) {
- ShortcutInfo si = (ShortcutInfo) info;
+ WorkspaceItemInfo si = (WorkspaceItemInfo) info;
BubbleTextView shortcut = (BubbleTextView) v;
Drawable oldIcon = shortcut.getIcon();
boolean oldPromiseState = (oldIcon instanceof PreloadIconDrawable)
&& ((PreloadIconDrawable) oldIcon).hasNotCompleted();
- shortcut.applyFromShortcutInfo(si, si.isPromise() != oldPromiseState);
+ shortcut.applyFromWorkspaceItem(si, si.isPromise() != oldPromiseState);
}
// process all the shortcuts
return false;
@@ -3159,7 +3159,7 @@
mapOverItems(MAP_RECURSE, new ItemOperator() {
@Override
public boolean evaluate(ItemInfo info, View v) {
- if (info instanceof ShortcutInfo && v instanceof BubbleTextView) {
+ if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView) {
if (!packageUserKey.updateFromItemInfo(info)
|| updatedDots.test(packageUserKey)) {
((BubbleTextView) v).applyDotState(info, true /* animate */);
@@ -3178,7 +3178,7 @@
if (info instanceof FolderInfo && folderIds.contains(info.id)
&& v instanceof FolderIcon) {
FolderDotInfo folderDotInfo = new FolderDotInfo();
- for (ShortcutInfo si : ((FolderInfo) info).contents) {
+ for (WorkspaceItemInfo si : ((FolderInfo) info).contents) {
folderDotInfo.addDotInfo(mLauncher.getDotInfoForItem(si));
}
((FolderIcon) v).setDotInfo(folderDotInfo);
@@ -3201,7 +3201,7 @@
mapOverItems(MAP_RECURSE, new ItemOperator() {
@Override
public boolean evaluate(ItemInfo info, View v) {
- if (info instanceof ShortcutInfo && v instanceof BubbleTextView
+ if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView
&& updates.contains(info)) {
((BubbleTextView) v).applyPromiseState(false /* promiseStateChanged */);
} else if (v instanceof PendingAppWidgetHostView
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/WorkspaceItemInfo.java
similarity index 93%
rename from src/com/android/launcher3/ShortcutInfo.java
rename to src/com/android/launcher3/WorkspaceItemInfo.java
index e53d59c..d0e8873 100644
--- a/src/com/android/launcher3/ShortcutInfo.java
+++ b/src/com/android/launcher3/WorkspaceItemInfo.java
@@ -29,7 +29,7 @@
/**
* Represents a launchable icon on the workspaces and in folders.
*/
-public class ShortcutInfo extends ItemInfoWithIcon {
+public class WorkspaceItemInfo extends ItemInfoWithIcon {
public static final int DEFAULT = 0;
@@ -86,11 +86,11 @@
*/
private int mInstallProgress;
- public ShortcutInfo() {
+ public WorkspaceItemInfo() {
itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
}
- public ShortcutInfo(ShortcutInfo info) {
+ public WorkspaceItemInfo(WorkspaceItemInfo info) {
super(info);
title = info.title;
intent = new Intent(info.intent);
@@ -99,17 +99,17 @@
mInstallProgress = info.mInstallProgress;
}
- /** TODO: Remove this. It's only called by ApplicationInfo.makeShortcut. */
- public ShortcutInfo(AppInfo info) {
+ /** TODO: Remove this. It's only called by ApplicationInfo.makeWorkspaceItem. */
+ public WorkspaceItemInfo(AppInfo info) {
super(info);
title = Utilities.trim(info.title);
intent = new Intent(info.intent);
}
/**
- * Creates a {@link ShortcutInfo} from a {@link ShortcutInfoCompat}.
+ * Creates a {@link WorkspaceItemInfo} from a {@link ShortcutInfoCompat}.
*/
- public ShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
+ public WorkspaceItemInfo(ShortcutInfoCompat shortcutInfo, Context context) {
user = shortcutInfo.getUserHandle();
itemType = Favorites.ITEM_TYPE_DEEP_SHORTCUT;
updateFromDeepShortcutInfo(shortcutInfo, context);
@@ -176,7 +176,7 @@
disabledMessage = shortcutInfo.getDisabledMessage();
}
- /** Returns the ShortcutInfo id associated with the deep shortcut. */
+ /** Returns the WorkspaceItemInfo id associated with the deep shortcut. */
public String getDeepShortcutId() {
return itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT ?
getIntent().getStringExtra(ShortcutInfoCompat.EXTRA_SHORTCUT_ID) : null;
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 45bade8..fd4df52 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -30,7 +30,7 @@
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Workspace;
import com.android.launcher3.dragndrop.DragController.DragListener;
import com.android.launcher3.dragndrop.DragOptions;
@@ -145,7 +145,7 @@
}
private boolean itemSupportsAccessibleDrag(ItemInfo item) {
- if (item instanceof ShortcutInfo) {
+ if (item instanceof WorkspaceItemInfo) {
// Support the action unless the item is in a context menu.
return item.screenId >= 0;
}
@@ -173,7 +173,7 @@
@Override
public void run() {
if (item instanceof AppInfo) {
- ShortcutInfo info = ((AppInfo) item).makeShortcut();
+ WorkspaceItemInfo info = ((AppInfo) item).makeWorkspaceItem();
mLauncher.getModelWriter().addItemToDatabase(info,
Favorites.CONTAINER_DESKTOP,
screenId, coordinates[0], coordinates[1]);
@@ -195,7 +195,7 @@
} else if (action == MOVE_TO_WORKSPACE) {
Folder folder = Folder.getOpen(mLauncher);
folder.close(true);
- ShortcutInfo info = (ShortcutInfo) item;
+ WorkspaceItemInfo info = (WorkspaceItemInfo) item;
folder.getInfo().remove(info, false);
final int[] coordinates = new int[2];
diff --git a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
index f37f70b..c0c0b37 100644
--- a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
@@ -27,7 +27,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.notification.NotificationMainView;
import com.android.launcher3.shortcuts.DeepShortcutView;
@@ -64,7 +64,7 @@
if (!(host.getParent() instanceof DeepShortcutView)) {
return false;
}
- final ShortcutInfo info = ((DeepShortcutView) host.getParent()).getFinalInfo();
+ final WorkspaceItemInfo info = ((DeepShortcutView) host.getParent()).getFinalInfo();
final int[] coordinates = new int[2];
final int screenId = findSpaceOnWorkspace(item, coordinates);
Runnable onComplete = new Runnable() {
diff --git a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
index 1c088db..17daeb8 100644
--- a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
+++ b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
@@ -27,7 +27,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DragType;
import com.android.launcher3.dragndrop.DragLayer;
@@ -106,7 +106,7 @@
// For icons, we can consider cells that have another icon or a folder.
ItemInfo info = (ItemInfo) child.getTag();
if (info instanceof AppInfo || info instanceof FolderInfo ||
- info instanceof ShortcutInfo) {
+ info instanceof WorkspaceItemInfo) {
return id;
}
}
@@ -125,7 +125,7 @@
return mContext.getString(R.string.item_moved);
} else {
ItemInfo info = (ItemInfo) child.getTag();
- if (info instanceof AppInfo || info instanceof ShortcutInfo) {
+ if (info instanceof AppInfo || info instanceof WorkspaceItemInfo) {
return mContext.getString(R.string.folder_created);
} else if (info instanceof FolderInfo) {
@@ -170,14 +170,14 @@
public static String getDescriptionForDropOver(View overChild, Context context) {
ItemInfo info = (ItemInfo) overChild.getTag();
- if (info instanceof ShortcutInfo) {
+ if (info instanceof WorkspaceItemInfo) {
return context.getString(R.string.create_folder_with, info.title);
} else if (info instanceof FolderInfo) {
if (TextUtils.isEmpty(info.title)) {
// Find the first item in the folder.
FolderInfo folder = (FolderInfo) info;
- ShortcutInfo firstItem = null;
- for (ShortcutInfo shortcut : folder.contents) {
+ WorkspaceItemInfo firstItem = null;
+ for (WorkspaceItemInfo shortcut : folder.contents) {
if (firstItem == null || firstItem.rank > shortcut.rank) {
firstItem = shortcut;
}
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVO.java b/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
index 82617fe..b64fff4 100644
--- a/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
+++ b/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
@@ -31,7 +31,7 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.ShortcutConfigActivityInfo.ShortcutConfigActivityInfoVO;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
@@ -103,12 +103,12 @@
* thread to UI thread.
* If (d) happens before we add this shortcut to our model, we will end up unpinning
* the shortcut in the system.
- * Here its the caller's responsibility to add the newly created ShortcutInfo immediately
+ * Here its the caller's responsibility to add the newly created WorkspaceItemInfo immediately
* to the model (which may involves a single post-to-worker-thread). That will guarantee
* that (d) happens after model is updated.
*/
@Nullable
- public static ShortcutInfo createShortcutInfoFromPinItemRequest(
+ public static WorkspaceItemInfo createWorkspaceItemFromPinItemRequest(
Context context, final PinItemRequest request, final long acceptDelay) {
if (request != null &&
request.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT &&
@@ -136,13 +136,13 @@
}
ShortcutInfoCompat compat = new ShortcutInfoCompat(request.getShortcutInfo());
- ShortcutInfo info = new ShortcutInfo(compat, context);
+ WorkspaceItemInfo info = new WorkspaceItemInfo(compat, context);
// Apply the unbadged icon and fetch the actual icon asynchronously.
LauncherIcons li = LauncherIcons.obtain(context);
info.applyFrom(li.createShortcutIcon(compat, false /* badged */));
li.recycle();
LauncherAppState.getInstance(context).getModel()
- .updateAndBindShortcutInfo(info, compat);
+ .updateAndBindWorkspaceItem(info, compat);
return info;
} else {
return null;
diff --git a/src/com/android/launcher3/compat/ShortcutConfigActivityInfo.java b/src/com/android/launcher3/compat/ShortcutConfigActivityInfo.java
index 76eec6d..ace5691 100644
--- a/src/com/android/launcher3/compat/ShortcutConfigActivityInfo.java
+++ b/src/com/android/launcher3/compat/ShortcutConfigActivityInfo.java
@@ -32,11 +32,11 @@
import android.util.Log;
import android.widget.Toast;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.ComponentWithLabel;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
/**
* Wrapper class for representing a shortcut configure activity.
@@ -70,10 +70,10 @@
public abstract Drawable getFullResIcon(IconCache cache);
/**
- * Return a shortcut info, if it can be created directly on drop, without requiring any
+ * Return a WorkspaceItemInfo, if it can be created directly on drop, without requiring any
* {@link #startConfigActivity(Activity, int)}.
*/
- public ShortcutInfo createShortcutInfo() {
+ public WorkspaceItemInfo createWorkspaceItemInfo() {
return null;
}
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 8b100d9..4d45ba9 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -39,7 +39,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.Thunk;
@@ -288,7 +288,7 @@
// Cancel the current drag if we are removing an app that we are dragging
if (mDragObject != null) {
ItemInfo dragInfo = mDragObject.dragInfo;
- if (dragInfo instanceof ShortcutInfo) {
+ if (dragInfo instanceof WorkspaceItemInfo) {
ComponentName cn = dragInfo.getTargetComponent();
if (cn != null && matcher.matches(dragInfo, cn)) {
cancelDrag();
diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
index 64655cc..91a31aa 100644
--- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
+++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
@@ -29,6 +29,7 @@
import android.os.Process;
import com.android.launcher3.FastBitmapDrawable;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
@@ -81,13 +82,13 @@
}
@Override
- public com.android.launcher3.ShortcutInfo createShortcutInfo() {
+ public WorkspaceItemInfo createWorkspaceItemInfo() {
// Total duration for the drop animation to complete.
long duration = mContext.getResources().getInteger(R.integer.config_dropAnimMaxDuration) +
LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY +
LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS;
// Delay the actual accept() call until the drop animation is complete.
- return LauncherAppsCompatVO.createShortcutInfoFromPinItemRequest(
+ return LauncherAppsCompatVO.createWorkspaceItemFromPinItemRequest(
mContext, mRequest, duration);
}
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 2ce6634..4dbff1c 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -61,7 +61,7 @@
import com.android.launcher3.OnAlarmListener;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.config.FeatureFlags;
@@ -236,8 +236,8 @@
public boolean startDrag(View v, DragOptions options) {
Object tag = v.getTag();
- if (tag instanceof ShortcutInfo) {
- ShortcutInfo item = (ShortcutInfo) tag;
+ if (tag instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo item = (WorkspaceItemInfo) tag;
mEmptyCellRank = item.rank;
mCurrentDragView = v;
@@ -269,13 +269,13 @@
}
mContent.removeItem(mCurrentDragView);
- if (dragObject.dragInfo instanceof ShortcutInfo) {
+ if (dragObject.dragInfo instanceof WorkspaceItemInfo) {
mItemsInvalidated = true;
// We do not want to get events for the item being removed, as they will get handled
// when the drop completes
try (SuppressInfoChanges s = new SuppressInfoChanges()) {
- mInfo.remove((ShortcutInfo) dragObject.dragInfo, true);
+ mInfo.remove((WorkspaceItemInfo) dragObject.dragInfo, true);
}
}
mDragInProgress = true;
@@ -379,7 +379,7 @@
void bind(FolderInfo info) {
mInfo = info;
- ArrayList<ShortcutInfo> children = info.contents;
+ ArrayList<WorkspaceItemInfo> children = info.contents;
Collections.sort(children, ITEM_POS_COMPARATOR);
mContent.bindItems(children);
@@ -800,7 +800,7 @@
}
} else {
// The drag failed, we need to return the item to the folder
- ShortcutInfo info = (ShortcutInfo) d.dragInfo;
+ WorkspaceItemInfo info = (WorkspaceItemInfo) d.dragInfo;
View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info)
? mCurrentDragView : mContent.createNewView(info);
ArrayList<View> views = getItemsInReadingOrder();
@@ -1023,7 +1023,7 @@
// folder
CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container,
mInfo.screenId);
- ShortcutInfo finalItem = mInfo.contents.remove(0);
+ WorkspaceItemInfo finalItem = mInfo.contents.remove(0);
newIcon = mLauncher.createShortcut(cellLayout, finalItem);
mLauncher.getModelWriter().addOrMoveItemInDatabase(finalItem,
mInfo.container, mInfo.screenId, mInfo.cellX, mInfo.cellY);
@@ -1111,9 +1111,9 @@
PendingAddShortcutInfo pasi = d.dragInfo instanceof PendingAddShortcutInfo
? (PendingAddShortcutInfo) d.dragInfo : null;
- ShortcutInfo pasiSi = pasi != null ? pasi.activityInfo.createShortcutInfo() : null;
+ WorkspaceItemInfo pasiSi = pasi != null ? pasi.activityInfo.createWorkspaceItemInfo() : null;
if (pasi != null && pasiSi == null) {
- // There is no ShortcutInfo, so we have to go through a configuration activity.
+ // There is no WorkspaceItemInfo, so we have to go through a configuration activity.
pasi.container = mInfo.id;
pasi.rank = mEmptyCellRank;
@@ -1122,15 +1122,15 @@
d.deferDragViewCleanupPostAnimation = false;
mRearrangeOnClose = true;
} else {
- final ShortcutInfo si;
+ final WorkspaceItemInfo si;
if (pasiSi != null) {
si = pasiSi;
} else if (d.dragInfo instanceof AppInfo) {
// Came from all apps -- make a copy.
- si = ((AppInfo) d.dragInfo).makeShortcut();
+ si = ((AppInfo) d.dragInfo).makeWorkspaceItem();
} else {
- // ShortcutInfo
- si = (ShortcutInfo) d.dragInfo;
+ // WorkspaceItemInfo
+ si = (WorkspaceItemInfo) d.dragInfo;
}
View currentDragView;
@@ -1138,7 +1138,7 @@
currentDragView = mContent.createAndAddViewForRank(si, mEmptyCellRank);
// Actually move the item in the database if it was an external drag. Call this
- // before creating the view, so that ShortcutInfo is updated appropriately.
+ // before creating the view, so that WorkspaceItemInfo is updated appropriately.
mLauncher.getModelWriter().addOrMoveItemInDatabase(
si, mInfo.id, 0, si.cellX, si.cellY);
@@ -1194,17 +1194,17 @@
// This is used so the item doesn't immediately appear in the folder when added. In one case
// we need to create the illusion that the item isn't added back to the folder yet, to
// to correspond to the animation of the icon back into the folder. This is
- public void hideItem(ShortcutInfo info) {
+ public void hideItem(WorkspaceItemInfo info) {
View v = getViewForInfo(info);
v.setVisibility(INVISIBLE);
}
- public void showItem(ShortcutInfo info) {
+ public void showItem(WorkspaceItemInfo info) {
View v = getViewForInfo(info);
v.setVisibility(VISIBLE);
}
@Override
- public void onAdd(ShortcutInfo item, int rank) {
+ public void onAdd(WorkspaceItemInfo item, int rank) {
View view = mContent.createAndAddViewForRank(item, rank);
mLauncher.getModelWriter().addOrMoveItemInDatabase(item, mInfo.id, 0, item.cellX,
item.cellY);
@@ -1215,7 +1215,7 @@
mItemsInvalidated = true;
}
- public void onRemove(ShortcutInfo item) {
+ public void onRemove(WorkspaceItemInfo item) {
mItemsInvalidated = true;
View v = getViewForInfo(item);
mContent.removeItem(v);
@@ -1233,7 +1233,7 @@
}
}
- private View getViewForInfo(final ShortcutInfo item) {
+ private View getViewForInfo(final WorkspaceItemInfo item) {
return mContent.iterateOverItems(new ItemOperator() {
@Override
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index bcd5701..02242a3 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -50,7 +50,7 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.OnAlarmListener;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.SimpleOnStylusPressListener;
import com.android.launcher3.StylusEventHelper;
import com.android.launcher3.Utilities;
@@ -226,15 +226,15 @@
return !mFolder.isDestroyed() && willAcceptItem(dragInfo);
}
- public void addItem(ShortcutInfo item) {
+ public void addItem(WorkspaceItemInfo item) {
addItem(item, true);
}
- public void addItem(ShortcutInfo item, boolean animate) {
+ public void addItem(WorkspaceItemInfo item, boolean animate) {
mInfo.add(item, animate);
}
- public void removeItem(ShortcutInfo item, boolean animate) {
+ public void removeItem(WorkspaceItemInfo item, boolean animate) {
mInfo.remove(item, animate);
}
@@ -247,7 +247,7 @@
mOpenAlarm.setOnAlarmListener(mOnOpenListener);
if (SPRING_LOADING_ENABLED &&
((dragInfo instanceof AppInfo)
- || (dragInfo instanceof ShortcutInfo)
+ || (dragInfo instanceof WorkspaceItemInfo)
|| (dragInfo instanceof PendingAddShortcutInfo))) {
mOpenAlarm.setAlarm(ON_OPEN_DELAY);
}
@@ -264,8 +264,8 @@
return mPreviewItemManager.prepareCreateAnimation(destView);
}
- public void performCreateAnimation(final ShortcutInfo destInfo, final View destView,
- final ShortcutInfo srcInfo, final DragView srcView, Rect dstRect,
+ public void performCreateAnimation(final WorkspaceItemInfo destInfo, final View destView,
+ final WorkspaceItemInfo srcInfo, final DragView srcView, Rect dstRect,
float scaleRelativeToDragLayer) {
prepareCreateAnimation(destView);
addItem(destInfo);
@@ -290,7 +290,7 @@
mOpenAlarm.cancelAlarm();
}
- private void onDrop(final ShortcutInfo item, DragView animateView, Rect finalRect,
+ private void onDrop(final WorkspaceItemInfo item, DragView animateView, Rect finalRect,
float scaleRelativeToDragLayer, int index,
boolean itemReturnedOnFailedDrop) {
item.cellX = -1;
@@ -382,15 +382,15 @@
}
public void onDrop(DragObject d, boolean itemReturnedOnFailedDrop) {
- ShortcutInfo item;
+ WorkspaceItemInfo item;
if (d.dragInfo instanceof AppInfo) {
// Came from all apps -- make a copy
- item = ((AppInfo) d.dragInfo).makeShortcut();
+ item = ((AppInfo) d.dragInfo).makeWorkspaceItem();
} else if (d.dragSource instanceof BaseItemDragListener){
// Came from a different window -- make a copy
- item = new ShortcutInfo((ShortcutInfo) d.dragInfo);
+ item = new WorkspaceItemInfo((WorkspaceItemInfo) d.dragInfo);
} else {
- item = (ShortcutInfo) d.dragInfo;
+ item = (WorkspaceItemInfo) d.dragInfo;
}
mFolder.notifyDrop();
onDrop(item, d.dragView, null, 1.0f, mInfo.contents.size(),
@@ -581,7 +581,7 @@
}
@Override
- public void onAdd(ShortcutInfo item, int rank) {
+ public void onAdd(WorkspaceItemInfo item, int rank) {
boolean wasDotted = mDotInfo.hasDot();
mDotInfo.addDotInfo(mLauncher.getDotInfoForItem(item));
boolean isDotted = mDotInfo.hasDot();
@@ -591,7 +591,7 @@
}
@Override
- public void onRemove(ShortcutInfo item) {
+ public void onRemove(WorkspaceItemInfo item) {
boolean wasDotted = mDotInfo.hasDot();
mDotInfo.subtractDotInfo(mLauncher.getDotInfoForItem(item));
boolean isDotted = mDotInfo.hasDot();
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index d4ce6dd..57105e7 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -38,7 +38,7 @@
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutAndWidgetContainer;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.anim.Interpolators;
@@ -178,9 +178,9 @@
/**
* Binds items to the layout.
*/
- public void bindItems(ArrayList<ShortcutInfo> items) {
+ public void bindItems(ArrayList<WorkspaceItemInfo> items) {
ArrayList<View> icons = new ArrayList<>();
- for (ShortcutInfo item : items) {
+ for (WorkspaceItemInfo item : items) {
icons.add(createNewView(item));
}
arrangeChildren(icons, icons.size(), false);
@@ -203,7 +203,7 @@
return rank;
}
- public View createAndAddViewForRank(ShortcutInfo item, int rank) {
+ public View createAndAddViewForRank(WorkspaceItemInfo item, int rank) {
View icon = createNewView(item);
allocateSpaceForRank(rank);
addViewForRank(icon, item, rank);
@@ -214,7 +214,7 @@
* Adds the {@param view} to the layout based on {@param rank} and updated the position
* related attributes. It assumes that {@param item} is already attached to the view.
*/
- public void addViewForRank(View view, ShortcutInfo item, int rank) {
+ public void addViewForRank(View view, WorkspaceItemInfo item, int rank) {
int pagePos = rank % mMaxItemsPerPage;
int pageNo = rank / mMaxItemsPerPage;
@@ -229,10 +229,10 @@
}
@SuppressLint("InflateParams")
- public View createNewView(ShortcutInfo item) {
+ public View createNewView(WorkspaceItemInfo item) {
final BubbleTextView textView = (BubbleTextView) mInflater.inflate(
R.layout.folder_application, null, false);
- textView.applyFromShortcutInfo(item);
+ textView.applyFromWorkspaceItem(item);
textView.setHapticFeedbackEnabled(false);
textView.setOnClickListener(ItemClickHandler.INSTANCE);
textView.setOnLongClickListener(mFolder);
@@ -631,7 +631,7 @@
if (v != null) {
if (pageToAnimate != p) {
page.removeView(v);
- addViewForRank(v, (ShortcutInfo) v.getTag(), moveStart);
+ addViewForRank(v, (WorkspaceItemInfo) v.getTag(), moveStart);
} else {
// Do a fake animation before removing it.
final int newRank = moveStart;
@@ -644,7 +644,7 @@
mPendingAnimations.remove(v);
v.setTranslationX(oldTranslateX);
((CellLayout) v.getParent().getParent()).removeView(v);
- addViewForRank(v, (ShortcutInfo) v.getTag(), newRank);
+ addViewForRank(v, (WorkspaceItemInfo) v.getTag(), newRank);
}
};
v.animate()
diff --git a/src/com/android/launcher3/folder/PreviewItemManager.java b/src/com/android/launcher3/folder/PreviewItemManager.java
index af98680..49763ba 100644
--- a/src/com/android/launcher3/folder/PreviewItemManager.java
+++ b/src/com/android/launcher3/folder/PreviewItemManager.java
@@ -31,7 +31,7 @@
import android.widget.TextView;
import com.android.launcher3.BubbleTextView;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import java.util.ArrayList;
@@ -301,7 +301,7 @@
* @param dropped The item that was dropped onto the FolderIcon.
*/
public void onDrop(List<BubbleTextView> oldParams, List<BubbleTextView> newParams,
- ShortcutInfo dropped) {
+ WorkspaceItemInfo dropped) {
int numItems = newParams.size();
final ArrayList<PreviewItemDrawingParams> params = mFirstPageParams;
buildParamsForPage(0, params, false);
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index eb45be1..d7b845b 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -21,7 +21,6 @@
import android.annotation.TargetApi;
import android.app.Fragment;
-import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -30,7 +29,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.AdaptiveIconDrawable;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Handler;
@@ -52,7 +50,7 @@
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.WorkspaceLayoutManager;
import com.android.launcher3.allapps.SearchUiManager;
@@ -85,7 +83,7 @@
private final DeviceProfile mDp;
private final Rect mInsets;
- private final ShortcutInfo mShortcutInfo;
+ private final WorkspaceItemInfo mWorkspaceItemInfo;
public LauncherPreviewRenderer(Context context, InvariantDeviceProfile idp) {
mUiHandler = new Handler(Looper.getMainLooper());
@@ -106,10 +104,10 @@
Process.myUserHandle(),
Build.VERSION.SDK_INT);
- mShortcutInfo = new ShortcutInfo();
- mShortcutInfo.applyFrom(iconInfo);
- mShortcutInfo.intent = new Intent();
- mShortcutInfo.contentDescription = mShortcutInfo.title =
+ mWorkspaceItemInfo = new WorkspaceItemInfo();
+ mWorkspaceItemInfo.applyFrom(iconInfo);
+ mWorkspaceItemInfo.intent = new Intent();
+ mWorkspaceItemInfo.contentDescription = mWorkspaceItemInfo.title =
context.getString(R.string.label_application);
}
@@ -217,10 +215,10 @@
return mWorkspace;
}
- private void inflateAndAddIcon(ShortcutInfo info) {
+ private void inflateAndAddIcon(WorkspaceItemInfo info) {
BubbleTextView icon = (BubbleTextView) mHomeElementInflater.inflate(
R.layout.app_icon, mWorkspace, false);
- icon.applyFromShortcutInfo(info);
+ icon.applyFromWorkspaceItem(info);
addInScreenFromBind(icon, info);
}
@@ -245,7 +243,7 @@
private void renderScreenShot(Canvas canvas) {
// Add hotseat icons
for (int i = 0; i < mIdp.numHotseatIcons; i++) {
- ShortcutInfo info = new ShortcutInfo(mShortcutInfo);
+ WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
info.container = Favorites.CONTAINER_HOTSEAT;
info.screenId = i;
inflateAndAddIcon(info);
@@ -253,7 +251,7 @@
// Add workspace icons
for (int i = 0; i < mIdp.numColumns; i++) {
- ShortcutInfo info = new ShortcutInfo(mShortcutInfo);
+ WorkspaceItemInfo info = new WorkspaceItemInfo(mWorkspaceItemInfo);
info.container = Favorites.CONTAINER_DESKTOP;
info.screenId = 0;
info.cellX = i;
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index fb0a367..648445e 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -36,7 +36,7 @@
import com.android.launcher3.LauncherFiles;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.MainThreadExecutor;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserManagerCompat;
@@ -130,7 +130,7 @@
IconLoadRequest request = new IconLoadRequest(mWorkerHandler, this::onIconRequestEnd) {
@Override
public void run() {
- if (info instanceof AppInfo || info instanceof ShortcutInfo) {
+ if (info instanceof AppInfo || info instanceof WorkspaceItemInfo) {
getTitleAndIcon(info, false);
} else if (info instanceof PackageItemInfo) {
getTitleAndIconForApp((PackageItemInfo) info, false);
@@ -199,7 +199,7 @@
}
/**
- * Fill in {@param shortcutInfo} with the icon and label for {@param info}
+ * Fill in {@param mWorkspaceItemInfo} with the icon and label for {@param info}
*/
private synchronized void getTitleAndIcon(
@NonNull ItemInfoWithIcon infoInOut,
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 0d55301..ed0d470 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -30,7 +30,7 @@
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
@@ -77,7 +77,7 @@
if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
if (item instanceof AppInfo) {
- item = ((AppInfo) item).makeShortcut();
+ item = ((AppInfo) item).makeWorkspaceItem();
}
}
if (item != null) {
@@ -92,11 +92,11 @@
int screenId = coords[0];
ItemInfo itemInfo;
- if (item instanceof ShortcutInfo || item instanceof FolderInfo ||
+ if (item instanceof WorkspaceItemInfo || item instanceof FolderInfo ||
item instanceof LauncherAppWidgetInfo) {
itemInfo = item;
} else if (item instanceof AppInfo) {
- itemInfo = ((AppInfo) item).makeShortcut();
+ itemInfo = ((AppInfo) item).makeWorkspaceItem();
} else {
throw new RuntimeException("Unexpected info type");
}
@@ -106,7 +106,7 @@
LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId,
coords[1], coords[2]);
- // Save the ShortcutInfo for binding in the workspace
+ // Save the WorkspaceItemInfo for binding in the workspace
addedItemsFinal.add(itemInfo);
}
}
@@ -165,8 +165,8 @@
boolean isLauncherAppTarget = Utilities.isLauncherAppTarget(intent);
synchronized (dataModel) {
for (ItemInfo item : dataModel.itemsIdMap) {
- if (item instanceof ShortcutInfo) {
- ShortcutInfo info = (ShortcutInfo) item;
+ if (item instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo info = (WorkspaceItemInfo) item;
if (item.getIntent() != null && info.user.equals(user)) {
Intent copyIntent = new Intent(item.getIntent());
copyIntent.setSourceBounds(intent.getSourceBounds());
@@ -178,7 +178,7 @@
// checking for existing promise icon with same package name
if (isLauncherAppTarget
&& info.isPromise()
- && info.hasStatusFlag(ShortcutInfo.FLAG_AUTOINSTALL_ICON)
+ && info.hasStatusFlag(WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON)
&& info.getTargetComponent() != null
&& compPkgName != null
&& compPkgName.equals(info.getTargetComponent().getPackageName())) {
diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java
index c9d8e3e..eea3d8c 100644
--- a/src/com/android/launcher3/model/BaseModelUpdateTask.java
+++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.model;
-import android.os.UserHandle;
import android.util.Log;
import com.android.launcher3.AllAppsList;
@@ -24,7 +23,7 @@
import com.android.launcher3.LauncherModel.ModelUpdateTask;
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.Callbacks;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.widget.WidgetListRowEntry;
@@ -94,13 +93,12 @@
}
- public void bindUpdatedShortcuts(
- final ArrayList<ShortcutInfo> updatedShortcuts, final UserHandle user) {
+ public void bindUpdatedWorkspaceItems(final ArrayList<WorkspaceItemInfo> updatedShortcuts) {
if (!updatedShortcuts.isEmpty()) {
scheduleCallbackTask(new CallbackTask() {
@Override
public void execute(Callbacks callbacks) {
- callbacks.bindShortcutsChanged(updatedShortcuts, user);
+ callbacks.bindWorkspaceItemsChanged(updatedShortcuts);
}
});
}
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index e8cc8f9..b0cc87b 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -26,7 +26,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Workspace;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.DumpTargetWrapper;
@@ -185,7 +185,7 @@
FolderInfo fInfo = folders.valueAt(i);
dtw = new DumpTargetWrapper(ContainerType.FOLDER, folders.size());
dtw.writeToDumpTarget(fInfo);
- for(ShortcutInfo sInfo: fInfo.contents) {
+ for(WorkspaceItemInfo sInfo: fInfo.contents) {
DumpTargetWrapper child = new DumpTargetWrapper(sInfo);
child.writeToDumpTarget(sInfo);
dtw.add(child);
@@ -335,7 +335,7 @@
Log.e(TAG, msg);
}
} else {
- findOrMakeFolder(item.container).add((ShortcutInfo) item, false);
+ findOrMakeFolder(item.container).add((WorkspaceItemInfo) item, false);
}
}
diff --git a/src/com/android/launcher3/model/CacheDataUpdatedTask.java b/src/com/android/launcher3/model/CacheDataUpdatedTask.java
index be83d36..7852444 100644
--- a/src/com/android/launcher3/model/CacheDataUpdatedTask.java
+++ b/src/com/android/launcher3/model/CacheDataUpdatedTask.java
@@ -20,13 +20,13 @@
import com.android.launcher3.AllAppsList;
import com.android.launcher3.AppInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
import java.util.ArrayList;
import java.util.HashSet;
@@ -55,11 +55,11 @@
final ArrayList<AppInfo> updatedApps = new ArrayList<>();
- ArrayList<ShortcutInfo> updatedShortcuts = new ArrayList<>();
+ ArrayList<WorkspaceItemInfo> updatedShortcuts = new ArrayList<>();
synchronized (dataModel) {
for (ItemInfo info : dataModel.itemsIdMap) {
- if (info instanceof ShortcutInfo && mUser.equals(info.user)) {
- ShortcutInfo si = (ShortcutInfo) info;
+ if (info instanceof WorkspaceItemInfo && mUser.equals(info.user)) {
+ WorkspaceItemInfo si = (WorkspaceItemInfo) info;
ComponentName cn = si.getTargetComponent();
if (si.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
&& isValidShortcut(si) && cn != null
@@ -71,7 +71,7 @@
}
apps.updateIconsAndLabels(mPackages, mUser, updatedApps);
}
- bindUpdatedShortcuts(updatedShortcuts, mUser);
+ bindUpdatedWorkspaceItems(updatedShortcuts);
if (!updatedApps.isEmpty()) {
scheduleCallbackTask(new CallbackTask() {
@@ -83,7 +83,7 @@
}
}
- public boolean isValidShortcut(ShortcutInfo si) {
+ public boolean isValidShortcut(WorkspaceItemInfo si) {
switch (mOp) {
case OP_CACHE_UPDATE:
return true;
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index 88193d0..1a03b77 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -33,12 +33,12 @@
import android.util.LongSparseArray;
import com.android.launcher3.AppInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.compat.LauncherAppsCompat;
@@ -145,8 +145,8 @@
}
}
- public ShortcutInfo loadSimpleShortcut() {
- final ShortcutInfo info = new ShortcutInfo();
+ public WorkspaceItemInfo loadSimpleWorkspaceItem() {
+ final WorkspaceItemInfo info = new WorkspaceItemInfo();
// Non-app shortcuts are only supported for current user.
info.user = user;
info.itemType = itemType;
@@ -164,7 +164,7 @@
/**
* Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
*/
- protected boolean loadIcon(ShortcutInfo info) {
+ protected boolean loadIcon(WorkspaceItemInfo info) {
try (LauncherIcons li = LauncherIcons.obtain(mContext)) {
return loadIcon(info, li);
}
@@ -173,7 +173,7 @@
/**
* Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
*/
- protected boolean loadIcon(ShortcutInfo info, LauncherIcons li) {
+ protected boolean loadIcon(WorkspaceItemInfo info, LauncherIcons li) {
if (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
String packageName = getString(iconPackageIndex);
String resourceName = getString(iconResourceIndex);
@@ -209,11 +209,11 @@
}
/**
- * Make an ShortcutInfo object for a restored application or shortcut item that points
+ * Make an WorkspaceItemInfo object for a restored application or shortcut item that points
* to a package that is not yet installed on the system.
*/
- public ShortcutInfo getRestoredItemInfo(Intent intent) {
- final ShortcutInfo info = new ShortcutInfo();
+ public WorkspaceItemInfo getRestoredItemInfo(Intent intent) {
+ final WorkspaceItemInfo info = new WorkspaceItemInfo();
info.user = user;
info.intent = intent;
@@ -222,12 +222,12 @@
mIconCache.getTitleAndIcon(info, false /* useLowResIcon */);
}
- if (hasRestoreFlag(ShortcutInfo.FLAG_RESTORED_ICON)) {
+ if (hasRestoreFlag(WorkspaceItemInfo.FLAG_RESTORED_ICON)) {
String title = getTitle();
if (!TextUtils.isEmpty(title)) {
info.title = Utilities.trim(title);
}
- } else if (hasRestoreFlag(ShortcutInfo.FLAG_AUTOINSTALL_ICON)) {
+ } else if (hasRestoreFlag(WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON)) {
if (TextUtils.isEmpty(info.title)) {
info.title = getTitle();
}
@@ -242,9 +242,9 @@
}
/**
- * Make an ShortcutInfo object for a shortcut that is an application.
+ * Make an WorkspaceItemInfo object for a shortcut that is an application.
*/
- public ShortcutInfo getAppShortcutInfo(
+ public WorkspaceItemInfo getAppShortcutInfo(
Intent intent, boolean allowMissingTarget, boolean useLowResIcon) {
if (user == null) {
Log.d(TAG, "Null user found in getShortcutInfo");
@@ -267,7 +267,7 @@
return null;
}
- final ShortcutInfo info = new ShortcutInfo();
+ final WorkspaceItemInfo info = new WorkspaceItemInfo();
info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
info.user = user;
info.intent = newIntent;
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index cc8e92f..f8c48ed 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -19,7 +19,6 @@
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
-import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.model.LoaderResults.filterCurrentWorkspaceItems;
import android.appwidget.AppWidgetProviderInfo;
@@ -49,7 +48,7 @@
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
@@ -335,7 +334,7 @@
unlockedUsers.put(serialNo, userUnlocked);
}
- ShortcutInfo info;
+ WorkspaceItemInfo info;
LauncherAppWidgetInfo appWidgetInfo;
Intent intent;
String targetPkg;
@@ -360,7 +359,7 @@
}
int disabledState = quietMode.get(c.serialNumber) ?
- ShortcutInfo.FLAG_DISABLED_QUIET_USER : 0;
+ WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER : 0;
ComponentName cn = intent.getComponent();
targetPkg = cn == null ? intent.getPackage() : cn.getPackageName();
@@ -420,11 +419,11 @@
// installed later.
FileLog.d(TAG, "package not yet restored: " + targetPkg);
- if (c.hasRestoreFlag(ShortcutInfo.FLAG_RESTORE_STARTED)) {
+ if (c.hasRestoreFlag(WorkspaceItemInfo.FLAG_RESTORE_STARTED)) {
// Restore has started once.
} else if (installingPkgs.containsKey(targetPkg)) {
// App restore has started. Update the flag
- c.restoreFlag |= ShortcutInfo.FLAG_RESTORE_STARTED;
+ c.restoreFlag |= WorkspaceItemInfo.FLAG_RESTORE_STARTED;
c.updater().put(LauncherSettings.Favorites.RESTORED,
c.restoreFlag).commit();
} else {
@@ -433,7 +432,7 @@
}
} else if (pmHelper.isAppOnSdcard(targetPkg, c.user)) {
// Package is present but not available.
- disabledState |= ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE;
+ disabledState |= WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE;
// Add the icon on the workspace anyway.
allowMissingTarget = true;
} else if (!isSdCardReady) {
@@ -450,7 +449,7 @@
}
}
- if ((c.restoreFlag & ShortcutInfo.FLAG_SUPPORTS_WEB_UI) != 0) {
+ if ((c.restoreFlag & WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI) != 0) {
validTarget = false;
}
@@ -481,8 +480,8 @@
c.markDeleted("Pinned shortcut not found");
continue;
}
- info = new ShortcutInfo(pinnedShortcut, context);
- final ShortcutInfo finalInfo = info;
+ info = new WorkspaceItemInfo(pinnedShortcut, context);
+ final WorkspaceItemInfo finalInfo = info;
LauncherIcons li = LauncherIcons.obtain(context);
// If the pinned deep shortcut is no longer published,
@@ -499,11 +498,11 @@
intent = info.intent;
} else {
// Create a shortcut info in disabled mode for now.
- info = c.loadSimpleShortcut();
+ info = c.loadSimpleWorkspaceItem();
info.runtimeStatusFlags |= FLAG_DISABLED_LOCKED_USER;
}
} else { // item type == ITEM_TYPE_SHORTCUT
- info = c.loadSimpleShortcut();
+ info = c.loadSimpleWorkspaceItem();
// Shortcuts are only available on the primary profile
if (!TextUtils.isEmpty(targetPkg)
@@ -539,7 +538,7 @@
if (c.restoreFlag != 0 && !TextUtils.isEmpty(targetPkg)) {
SessionInfo si = installingPkgs.get(targetPkg);
if (si == null) {
- info.status &= ~ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE;
+ info.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
} else {
info.setInstallProgress((int) (si.getProgress() * 100));
}
@@ -547,7 +546,7 @@
c.checkAndAddItem(info, mBgDataModel);
} else {
- throw new RuntimeException("Unexpected null ShortcutInfo");
+ throw new RuntimeException("Unexpected null WorkspaceItemInfo");
}
break;
@@ -755,7 +754,7 @@
// Ranks are the source of truth for folder items, so cellX and cellY can be ignored
// for now. Database will be updated once user manually modifies folder.
for (int rank = 0; rank < size; ++rank) {
- ShortcutInfo info = folder.contents.get(rank);
+ WorkspaceItemInfo info = folder.contents.get(rank);
info.rank = rank;
if (info.usingLowResIcon()
@@ -782,8 +781,8 @@
HashSet<String> packagesToIgnore = new HashSet<>();
synchronized (mBgDataModel) {
for (ItemInfo info : mBgDataModel.itemsIdMap) {
- if (info instanceof ShortcutInfo) {
- ShortcutInfo si = (ShortcutInfo) info;
+ if (info instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo si = (WorkspaceItemInfo) info;
if (si.isPromise() && si.getTargetComponent() != null) {
packagesToIgnore.add(si.getTargetComponent().getPackageName());
}
diff --git a/src/com/android/launcher3/model/ModelWriter.java b/src/com/android/launcher3/model/ModelWriter.java
index daf99e9..40c914b 100644
--- a/src/com/android/launcher3/model/ModelWriter.java
+++ b/src/com/android/launcher3/model/ModelWriter.java
@@ -36,7 +36,7 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.LauncherSettings.Settings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ContentWriter;
@@ -114,7 +114,7 @@
if (modelItem != null && item != modelItem) {
// check all the data is consistent
if (!Utilities.IS_DEBUG_DEVICE && !FeatureFlags.IS_DOGFOOD_BUILD &&
- modelItem instanceof ShortcutInfo && item instanceof ShortcutInfo) {
+ modelItem instanceof WorkspaceItemInfo && item instanceof WorkspaceItemInfo) {
if (modelItem.title.toString().equals(item.title.toString()) &&
modelItem.getIntent().filterEquals(item.getIntent()) &&
modelItem.id == item.id &&
diff --git a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
index 32dfe25..5f6d128 100644
--- a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
+++ b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
@@ -28,7 +28,7 @@
import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.PromiseAppInfo;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.util.InstantAppResolver;
@@ -106,15 +106,15 @@
synchronized (dataModel) {
final HashSet<ItemInfo> updates = new HashSet<>();
for (ItemInfo info : dataModel.itemsIdMap) {
- if (info instanceof ShortcutInfo) {
- ShortcutInfo si = (ShortcutInfo) info;
+ if (info instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo si = (WorkspaceItemInfo) info;
ComponentName cn = si.getTargetComponent();
if (si.hasPromiseIconUi() && (cn != null)
&& mInstallInfo.packageName.equals(cn.getPackageName())) {
si.setInstallProgress(mInstallInfo.progress);
if (mInstallInfo.state == PackageInstallerCompat.STATUS_FAILED) {
// Mark this info as broken.
- si.status &= ~ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE;
+ si.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
}
updates.add(si);
}
diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java
index 0f67f0c..671dc54 100644
--- a/src/com/android/launcher3/model/PackageUpdatedTask.java
+++ b/src/com/android/launcher3/model/PackageUpdatedTask.java
@@ -24,6 +24,7 @@
import com.android.launcher3.AllAppsList;
import com.android.launcher3.AppInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.ItemInfo;
@@ -33,7 +34,6 @@
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.SessionCommitReceiver;
-import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserManagerCompat;
@@ -108,7 +108,7 @@
SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
}
}
- flagOp = FlagOp.removeFlag(ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE);
+ flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
break;
}
case OP_UPDATE:
@@ -119,7 +119,7 @@
app.getWidgetCache().removePackage(packages[i], mUser);
}
// Since package was just updated, the target must be available now.
- flagOp = FlagOp.removeFlag(ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE);
+ flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
break;
case OP_REMOVE: {
for (int i = 0; i < N; i++) {
@@ -133,20 +133,20 @@
appsList.removePackage(packages[i], mUser);
app.getWidgetCache().removePackage(packages[i], mUser);
}
- flagOp = FlagOp.addFlag(ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE);
+ flagOp = FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
break;
case OP_SUSPEND:
case OP_UNSUSPEND:
flagOp = mOp == OP_SUSPEND ?
- FlagOp.addFlag(ShortcutInfo.FLAG_DISABLED_SUSPENDED) :
- FlagOp.removeFlag(ShortcutInfo.FLAG_DISABLED_SUSPENDED);
+ FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED) :
+ FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_SUSPENDED);
if (DEBUG) Log.d(TAG, "mAllAppsList.(un)suspend " + N);
appsList.updateDisabledFlags(matcher, flagOp);
break;
case OP_USER_AVAILABILITY_CHANGE:
flagOp = UserManagerCompat.getInstance(context).isQuietModeEnabled(mUser)
- ? FlagOp.addFlag(ShortcutInfo.FLAG_DISABLED_QUIET_USER)
- : FlagOp.removeFlag(ShortcutInfo.FLAG_DISABLED_QUIET_USER);
+ ? FlagOp.addFlag(WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER)
+ : FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER);
// We want to update all packages for this user.
matcher = ItemInfoMatcher.ofUser(mUser);
appsList.updateDisabledFlags(matcher, flagOp);
@@ -175,15 +175,15 @@
// Update shortcut infos
if (mOp == OP_ADD || flagOp != FlagOp.NO_OP) {
- final ArrayList<ShortcutInfo> updatedShortcuts = new ArrayList<>();
+ final ArrayList<WorkspaceItemInfo> updatedWorkspaceItems = new ArrayList<>();
final ArrayList<LauncherAppWidgetInfo> widgets = new ArrayList<>();
// For system apps, package manager send OP_UPDATE when an app is enabled.
final boolean isNewApkAvailable = mOp == OP_ADD || mOp == OP_UPDATE;
synchronized (dataModel) {
for (ItemInfo info : dataModel.itemsIdMap) {
- if (info instanceof ShortcutInfo && mUser.equals(info.user)) {
- ShortcutInfo si = (ShortcutInfo) info;
+ if (info instanceof WorkspaceItemInfo && mUser.equals(info.user)) {
+ WorkspaceItemInfo si = (WorkspaceItemInfo) info;
boolean infoUpdated = false;
boolean shortcutUpdated = false;
@@ -203,7 +203,7 @@
if (cn != null && matcher.matches(si, cn)) {
String packageName = cn.getPackageName();
- if (si.hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI)) {
+ if (si.hasStatusFlag(WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI)) {
removedShortcuts.put(si.id, false);
if (mOp == OP_REMOVE) {
continue;
@@ -227,9 +227,9 @@
isTargetValid = LauncherAppsCompat.getInstance(context)
.isActivityEnabledForProfile(cn, mUser);
}
- if (si.hasStatusFlag(ShortcutInfo.FLAG_AUTOINSTALL_ICON)
+ if (si.hasStatusFlag(WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON)
&& !isTargetValid) {
- if (updateShortcutIntent(context, si, packageName)) {
+ if (updateWorkspaceItemIntent(context, si, packageName)) {
infoUpdated = true;
} else if (si.hasPromiseIconUi()) {
removedShortcuts.put(si.id, true);
@@ -241,11 +241,11 @@
+ si.intent);
continue;
} else {
- si.status = ShortcutInfo.DEFAULT;
+ si.status = WorkspaceItemInfo.DEFAULT;
infoUpdated = true;
}
} else if (isNewApkAvailable && removedComponents.contains(cn)) {
- if (updateShortcutIntent(context, si, packageName)) {
+ if (updateWorkspaceItemIntent(context, si, packageName)) {
infoUpdated = true;
}
}
@@ -264,7 +264,7 @@
}
if (infoUpdated || shortcutUpdated) {
- updatedShortcuts.add(si);
+ updatedWorkspaceItems.add(si);
}
if (infoUpdated) {
getModelWriter().updateItemInDatabase(si);
@@ -290,7 +290,7 @@
}
}
- bindUpdatedShortcuts(updatedShortcuts, mUser);
+ bindUpdatedWorkspaceItems(updatedWorkspaceItems);
if (!removedShortcuts.isEmpty()) {
deleteAndBindComponentsRemoved(ItemInfoMatcher.ofItemIds(removedShortcuts, false));
}
@@ -356,12 +356,13 @@
* Updates {@param si}'s intent to point to a new ComponentName.
* @return Whether the shortcut intent was changed.
*/
- private boolean updateShortcutIntent(Context context, ShortcutInfo si, String packageName) {
+ private boolean updateWorkspaceItemIntent(Context context,
+ WorkspaceItemInfo si, String packageName) {
// Try to find the best match activity.
Intent intent = new PackageManagerHelper(context).getAppLaunchIntent(packageName, mUser);
if (intent != null) {
si.intent = intent;
- si.status = ShortcutInfo.DEFAULT;
+ si.status = WorkspaceItemInfo.DEFAULT;
return true;
}
return false;
diff --git a/src/com/android/launcher3/model/ShortcutsChangedTask.java b/src/com/android/launcher3/model/ShortcutsChangedTask.java
index 1644c89..6adcc6e 100644
--- a/src/com/android/launcher3/model/ShortcutsChangedTask.java
+++ b/src/com/android/launcher3/model/ShortcutsChangedTask.java
@@ -22,7 +22,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
@@ -58,14 +58,14 @@
DeepShortcutManager deepShortcutManager = DeepShortcutManager.getInstance(context);
deepShortcutManager.onShortcutsChanged(mShortcuts);
- // Find ShortcutInfo's that have changed on the workspace.
+ // Find WorkspaceItemInfo's that have changed on the workspace.
HashSet<ShortcutKey> removedKeys = new HashSet<>();
- MultiHashMap<ShortcutKey, ShortcutInfo> keyToShortcutInfo = new MultiHashMap<>();
+ MultiHashMap<ShortcutKey, WorkspaceItemInfo> keyToShortcutInfo = new MultiHashMap<>();
HashSet<String> allIds = new HashSet<>();
for (ItemInfo itemInfo : dataModel.itemsIdMap) {
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
- ShortcutInfo si = (ShortcutInfo) itemInfo;
+ WorkspaceItemInfo si = (WorkspaceItemInfo) itemInfo;
if (si.getIntent().getPackage().equals(mPackageName) && si.user.equals(mUser)) {
keyToShortcutInfo.addToList(ShortcutKey.fromItemInfo(si), si);
allIds.add(si.getDeepShortcutId());
@@ -73,14 +73,14 @@
}
}
- final ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
+ final ArrayList<WorkspaceItemInfo> updatedWorkspaceItemInfos = new ArrayList<>();
if (!keyToShortcutInfo.isEmpty()) {
// Update the workspace to reflect the changes to updated shortcuts residing on it.
List<ShortcutInfoCompat> shortcuts = deepShortcutManager.queryForFullDetails(
mPackageName, new ArrayList<>(allIds), mUser);
for (ShortcutInfoCompat fullDetails : shortcuts) {
ShortcutKey key = ShortcutKey.fromInfo(fullDetails);
- List<ShortcutInfo> shortcutInfos = keyToShortcutInfo.remove(key);
+ List<WorkspaceItemInfo> workspaceItemInfos = keyToShortcutInfo.remove(key);
if (!fullDetails.isPinned()) {
// The shortcut was previously pinned but is no longer, so remove it from
// the workspace and our pinned shortcut counts.
@@ -90,15 +90,15 @@
removedKeys.add(key);
continue;
}
- for (final ShortcutInfo shortcutInfo : shortcutInfos) {
- shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context);
+ for (final WorkspaceItemInfo workspaceItemInfo : workspaceItemInfos) {
+ workspaceItemInfo.updateFromDeepShortcutInfo(fullDetails, context);
// If the shortcut is pinned but no longer has an icon in the system,
// keep the current icon instead of reverting to the default icon.
LauncherIcons li = LauncherIcons.obtain(context);
- shortcutInfo.applyFrom(li.createShortcutIcon(fullDetails, true,
- () -> shortcutInfo));
+ workspaceItemInfo.applyFrom(li.createShortcutIcon(fullDetails, true,
+ () -> workspaceItemInfo));
li.recycle();
- updatedShortcutInfos.add(shortcutInfo);
+ updatedWorkspaceItemInfos.add(workspaceItemInfo);
}
}
}
@@ -108,7 +108,7 @@
// means they were cleared, so we remove and unpin them now.
removedKeys.addAll(keyToShortcutInfo.keySet());
- bindUpdatedShortcuts(updatedShortcutInfos, mUser);
+ bindUpdatedWorkspaceItems(updatedWorkspaceItemInfos);
if (!keyToShortcutInfo.isEmpty()) {
deleteAndBindComponentsRemoved(ItemInfoMatcher.ofShortcutKeys(removedKeys));
}
diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java
index 7c4e454..478800e 100644
--- a/src/com/android/launcher3/model/UserLockStateChangedTask.java
+++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java
@@ -24,7 +24,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
@@ -73,13 +73,13 @@
}
// Update the workspace to reflect the changes to updated shortcuts residing on it.
- ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
+ ArrayList<WorkspaceItemInfo> updatedWorkspaceItemInfos = new ArrayList<>();
HashSet<ShortcutKey> removedKeys = new HashSet<>();
for (ItemInfo itemInfo : dataModel.itemsIdMap) {
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT
&& mUser.equals(itemInfo.user)) {
- ShortcutInfo si = (ShortcutInfo) itemInfo;
+ WorkspaceItemInfo si = (WorkspaceItemInfo) itemInfo;
if (isUserUnlocked) {
ShortcutKey key = ShortcutKey.fromItemInfo(si);
ShortcutInfoCompat shortcut = pinnedShortcuts.get(key);
@@ -99,10 +99,10 @@
} else {
si.runtimeStatusFlags |= FLAG_DISABLED_LOCKED_USER;
}
- updatedShortcutInfos.add(si);
+ updatedWorkspaceItemInfos.add(si);
}
}
- bindUpdatedShortcuts(updatedShortcutInfos, mUser);
+ bindUpdatedWorkspaceItems(updatedWorkspaceItemInfos);
if (!removedKeys.isEmpty()) {
deleteAndBindComponentsRemoved(ItemInfoMatcher.ofShortcutKeys(removedKeys));
}
diff --git a/src/com/android/launcher3/popup/PopupPopulator.java b/src/com/android/launcher3/popup/PopupPopulator.java
index 2c59202..2b55405 100644
--- a/src/com/android/launcher3/popup/PopupPopulator.java
+++ b/src/com/android/launcher3/popup/PopupPopulator.java
@@ -23,7 +23,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.notification.NotificationInfo;
import com.android.launcher3.notification.NotificationKeyData;
@@ -147,7 +147,7 @@
shortcuts = PopupPopulator.sortAndFilterShortcuts(shortcuts, shortcutIdToDeDupe);
for (int i = 0; i < shortcuts.size() && i < shortcutViews.size(); i++) {
final ShortcutInfoCompat shortcut = shortcuts.get(i);
- final ShortcutInfo si = new ShortcutInfo(shortcut, launcher);
+ final WorkspaceItemInfo si = new WorkspaceItemInfo(shortcut, launcher);
// Use unbadged icon for the menu.
LauncherIcons li = LauncherIcons.obtain(launcher);
si.applyFrom(li.createShortcutIcon(shortcut, false /* badged */));
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index e7b8292..563f3b3 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -3,6 +3,7 @@
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
+import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
@@ -20,7 +21,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.util.InstantAppResolver;
import com.android.launcher3.util.PackageManagerHelper;
@@ -159,9 +160,8 @@
return (view) -> {
dismissTaskMenuView(activity);
Rect sourceBounds = activity.getViewBounds(view);
- Bundle opts = activity.getActivityLaunchOptionsAsBundle(view);
new PackageManagerHelper(activity).startDetailsActivityForInfo(
- itemInfo, sourceBounds, opts);
+ itemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle());
activity.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view);
};
@@ -176,8 +176,8 @@
@Override
public View.OnClickListener getOnClickListener(
BaseDraggingActivity activity, ItemInfo itemInfo) {
- boolean supportsWebUI = (itemInfo instanceof ShortcutInfo) &&
- ((ShortcutInfo) itemInfo).hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI);
+ boolean supportsWebUI = (itemInfo instanceof WorkspaceItemInfo) &&
+ ((WorkspaceItemInfo) itemInfo).hasStatusFlag(WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI);
boolean isInstantApp = false;
if (itemInfo instanceof com.android.launcher3.AppInfo) {
com.android.launcher3.AppInfo appInfo = (com.android.launcher3.AppInfo) itemInfo;
diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java
index 040b5e5..e6e20e1 100644
--- a/src/com/android/launcher3/provider/RestoreDbTask.java
+++ b/src/com/android/launcher3/provider/RestoreDbTask.java
@@ -31,7 +31,7 @@
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherProvider.DatabaseHelper;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction;
@@ -110,8 +110,8 @@
// Mark all items as restored.
boolean keepAllIcons = Utilities.isPropertyEnabled(LogConfig.KEEP_ALL_ICONS);
ContentValues values = new ContentValues();
- values.put(Favorites.RESTORED, ShortcutInfo.FLAG_RESTORED_ICON
- | (keepAllIcons ? ShortcutInfo.FLAG_RESTORE_STARTED : 0));
+ values.put(Favorites.RESTORED, WorkspaceItemInfo.FLAG_RESTORED_ICON
+ | (keepAllIcons ? WorkspaceItemInfo.FLAG_RESTORE_STARTED : 0));
db.update(Favorites.TABLE_NAME, values, null, null);
// Mark widgets with appropriate restore flag.
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutView.java b/src/com/android/launcher3/shortcuts/DeepShortcutView.java
index 7b93ba2..199d9c8 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutView.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutView.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.graphics.Point;
-import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
@@ -27,10 +26,9 @@
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.popup.PopupContainerWithArrow;
-import com.android.launcher3.touch.ItemClickHandler;
/**
* A {@link android.widget.FrameLayout} that contains a {@link DeepShortcutView}.
@@ -44,7 +42,7 @@
private View mIconView;
private View mDivider;
- private ShortcutInfo mInfo;
+ private WorkspaceItemInfo mInfo;
private ShortcutInfoCompat mDetail;
public DeepShortcutView(Context context) {
@@ -95,11 +93,11 @@
}
/** package private **/
- public void applyShortcutInfo(ShortcutInfo info, ShortcutInfoCompat detail,
+ public void applyShortcutInfo(WorkspaceItemInfo info, ShortcutInfoCompat detail,
PopupContainerWithArrow container) {
mInfo = info;
mDetail = detail;
- mBubbleText.applyFromShortcutInfo(info);
+ mBubbleText.applyFromWorkspaceItem(info);
mIconView.setBackground(mBubbleText.getIcon());
// Use the long label as long as it exists and fits.
@@ -119,12 +117,12 @@
/**
* Returns the shortcut info that is suitable to be added on the homescreen
*/
- public ShortcutInfo getFinalInfo() {
- final ShortcutInfo badged = new ShortcutInfo(mInfo);
+ public WorkspaceItemInfo getFinalInfo() {
+ final WorkspaceItemInfo badged = new WorkspaceItemInfo(mInfo);
// Queue an update task on the worker thread. This ensures that the badged
// shortcut eventually gets its icon updated.
Launcher.getLauncher(getContext()).getModel()
- .updateAndBindShortcutInfo(badged, mDetail);
+ .updateAndBindWorkspaceItem(badged, mDetail);
return badged;
}
diff --git a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
index e5bd002..5ec1997 100644
--- a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
+++ b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
@@ -23,11 +23,12 @@
import android.os.UserHandle;
import com.android.launcher3.R;
+import com.android.launcher3.WorkspaceItemInfo;
/**
* Wrapper class for {@link android.content.pm.ShortcutInfo}, representing deep shortcuts into apps.
*
- * Not to be confused with {@link com.android.launcher3.ShortcutInfo}.
+ * Not to be confused with {@link WorkspaceItemInfo}.
*/
public class ShortcutInfoCompat {
private static final String INTENT_CATEGORY = "com.android.launcher3.DEEP_SHORTCUT";
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 3c77860..026770c 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -43,7 +43,7 @@
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.PromiseAppInfo;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
@@ -86,8 +86,8 @@
}
Object tag = v.getTag();
- if (tag instanceof ShortcutInfo) {
- onClickAppShortcut(v, (ShortcutInfo) tag, launcher, sourceContainer);
+ if (tag instanceof WorkspaceItemInfo) {
+ onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
} else if (tag instanceof FolderInfo) {
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
@@ -176,12 +176,13 @@
/**
* Event handler for an app shortcut click.
*
- * @param v The view that was clicked. Must be a tagged with a {@link ShortcutInfo}.
+ * @param v The view that was clicked. Must be a tagged with a {@link WorkspaceItemInfo}.
*/
- public static void onClickAppShortcut(View v, ShortcutInfo shortcut, Launcher launcher,
+ public static void onClickAppShortcut(View v, WorkspaceItemInfo shortcut, Launcher launcher,
@Nullable String sourceContainer) {
if (shortcut.isDisabled()) {
- final int disabledFlags = shortcut.runtimeStatusFlags & ShortcutInfo.FLAG_DISABLED_MASK;
+ final int disabledFlags = shortcut.runtimeStatusFlags
+ & WorkspaceItemInfo.FLAG_DISABLED_MASK;
if ((disabledFlags &
~FLAG_DISABLED_SUSPENDED &
~FLAG_DISABLED_QUIET_USER) == 0) {
@@ -212,7 +213,7 @@
shortcut.intent.getComponent().getPackageName() : shortcut.intent.getPackage();
if (!TextUtils.isEmpty(packageName)) {
onClickPendingAppItem(v, launcher, packageName,
- shortcut.hasStatusFlag(ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE));
+ shortcut.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE));
return;
}
}
@@ -233,9 +234,9 @@
if (intent == null) {
throw new IllegalArgumentException("Input must have a valid intent");
}
- if (item instanceof ShortcutInfo) {
- ShortcutInfo si = (ShortcutInfo) item;
- if (si.hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI)
+ if (item instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo si = (WorkspaceItemInfo) item;
+ if (si.hasStatusFlag(WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI)
&& Intent.ACTION_VIEW.equals(intent.getAction())) {
// make a copy of the intent that has the package set to null
// we do this because the platform sometimes disables instant
diff --git a/src/com/android/launcher3/util/FlagOp.java b/src/com/android/launcher3/util/FlagOp.java
index a012c86..bd40eb9 100644
--- a/src/com/android/launcher3/util/FlagOp.java
+++ b/src/com/android/launcher3/util/FlagOp.java
@@ -7,7 +7,7 @@
int apply(int flags);
static FlagOp addFlag(int flag) {
- return i -> i + flag;
+ return i -> i | flag;
}
static FlagOp removeFlag(int flag) {
diff --git a/src/com/android/launcher3/util/ItemInfoMatcher.java b/src/com/android/launcher3/util/ItemInfoMatcher.java
index c3570fe..59a5ed6 100644
--- a/src/com/android/launcher3/util/ItemInfoMatcher.java
+++ b/src/com/android/launcher3/util/ItemInfoMatcher.java
@@ -23,7 +23,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.shortcuts.ShortcutKey;
import java.util.HashSet;
@@ -41,15 +41,15 @@
default HashSet<ItemInfo> filterItemInfos(Iterable<ItemInfo> infos) {
HashSet<ItemInfo> filtered = new HashSet<>();
for (ItemInfo i : infos) {
- if (i instanceof ShortcutInfo) {
- ShortcutInfo info = (ShortcutInfo) i;
+ if (i instanceof WorkspaceItemInfo) {
+ WorkspaceItemInfo info = (WorkspaceItemInfo) i;
ComponentName cn = info.getTargetComponent();
if (cn != null && matches(info, cn)) {
filtered.add(info);
}
} else if (i instanceof FolderInfo) {
FolderInfo info = (FolderInfo) i;
- for (ShortcutInfo s : info.contents) {
+ for (WorkspaceItemInfo s : info.contents) {
ComponentName cn = s.getTargetComponent();
if (cn != null && matches(s, cn)) {
filtered.add(s);
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index d71bd15..3b4c313 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -41,7 +41,7 @@
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.PromiseAppInfo;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.compat.LauncherAppsCompat;
import java.net.URISyntaxException;
@@ -183,7 +183,7 @@
ComponentName componentName = null;
if (info instanceof AppInfo) {
componentName = ((AppInfo) info).componentName;
- } else if (info instanceof ShortcutInfo) {
+ } else if (info instanceof WorkspaceItemInfo) {
componentName = info.getTargetComponent();
} else if (info instanceof PendingAddItemInfo) {
componentName = ((PendingAddItemInfo) info).componentName;
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
index 59fd859..a45f17d 100644
--- a/src/com/android/launcher3/util/Themes.java
+++ b/src/com/android/launcher3/util/Themes.java
@@ -32,6 +32,14 @@
*/
public class Themes {
+ public static String getDefaultBodyFont(Context context) {
+ TypedArray ta = context.obtainStyledAttributes(android.R.style.TextAppearance_DeviceDefault,
+ new int[]{android.R.attr.fontFamily});
+ String value = ta.getString(0);
+ ta.recycle();
+ return value;
+ }
+
public static float getDialogCornerRadius(Context context) {
return getDimension(context, android.R.attr.dialogCornerRadius,
context.getResources().getDimension(R.dimen.default_dialog_corner_radius));
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 5889468..f96652e 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -34,6 +34,7 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
@@ -73,6 +74,7 @@
private static final Rect sTmpRect = new Rect();
private Runnable mEndRunnable;
+ private CancellationSignal mLoadIconSignal;
private final int mBlurSizeOutline;
@@ -153,6 +155,9 @@
@Override
public void onAnimationEnd(Animator animator) {
+ if (mLoadIconSignal != null) {
+ mLoadIconSignal.cancel();
+ }
if (mEndRunnable != null) {
mEndRunnable.run();
} else {
@@ -186,7 +191,7 @@
@WorkerThread
private void getIcon(Launcher launcher, View v, ItemInfo info, boolean isOpening,
- Runnable onIconLoadedRunnable) {
+ Runnable onIconLoadedRunnable, CancellationSignal loadIconSignal) {
final LayoutParams lp = (LayoutParams) getLayoutParams();
Drawable drawable = null;
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
@@ -290,7 +295,9 @@
setBackground(finalDrawable);
}
- onIconLoadedRunnable.run();
+ if (!loadIconSignal.isCanceled()) {
+ onIconLoadedRunnable.run();
+ }
invalidate();
invalidateOutline();
});
@@ -370,6 +377,7 @@
* Creates a floating icon view for {@param originalView}.
* @param originalView The view to copy
* @param hideOriginal If true, it will hide {@param originalView} while this view is visible.
+ * Else, we will not draw anything in this view.
* @param positionOut Rect that will hold the size and position of v.
* @param isOpening True if this view replaces the icon for app open animation.
*/
@@ -385,17 +393,17 @@
// Get the drawable on the background thread
// Must be called after matchPositionOf so that we know what size to load.
- if (originalView.getTag() instanceof ItemInfo) {
+ if (originalView.getTag() instanceof ItemInfo && hideOriginal) {
+ view.mLoadIconSignal = new CancellationSignal();
Runnable onIconLoaded = () -> {
// Delay swapping views until the icon is loaded to prevent a flash.
view.setVisibility(VISIBLE);
- if (hideOriginal) {
- originalView.setVisibility(INVISIBLE);
- }
+ originalView.setVisibility(INVISIBLE);
};
+ CancellationSignal loadIconSignal = view.mLoadIconSignal;
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
view.getIcon(launcher, originalView, (ItemInfo) originalView.getTag(), isOpening,
- onIconLoaded);
+ onIconLoaded, loadIconSignal);
});
}
@@ -412,12 +420,6 @@
@Override
public void onAnimationStart(Animator animation) {
originalView.setVisibility(VISIBLE);
-
- if (originalView instanceof FolderIcon) {
- FolderIcon folderIcon = (FolderIcon) originalView;
- folderIcon.setBackgroundVisible(false);
- folderIcon.getFolderName().setTextVisibility(false);
- }
}
@Override
@@ -432,6 +434,8 @@
if (originalView instanceof FolderIcon) {
FolderIcon folderIcon = (FolderIcon) originalView;
+ folderIcon.setBackgroundVisible(false);
+ folderIcon.getFolderName().setTextVisibility(false);
fade.play(folderIcon.getFolderName().createTextAlphaAnimator(true));
fade.addListener(new AnimatorListenerAdapter() {
@Override
@@ -461,6 +465,10 @@
setScaleY(1);
setAlpha(1);
setBackground(null);
+ if (mLoadIconSignal != null) {
+ mLoadIconSignal.cancel();
+ }
+ mLoadIconSignal = null;
mEndRunnable = null;
mIsAdaptiveIcon = false;
mForeground = null;
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 29866cf..7062369 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -152,9 +152,11 @@
RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
ArrayList<OptionItem> options = new ArrayList<>();
- int res = existsStyleWallpapers(launcher) ?
+ int resString = existsStyleWallpapers(launcher) ?
R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
- options.add(new OptionItem(res, R.drawable.ic_wallpaper,
+ int resDrawable = existsStyleWallpapers(launcher) ?
+ R.drawable.ic_palette : R.drawable.ic_wallpaper;
+ options.add(new OptionItem(resString, resDrawable,
ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
if (!FeatureFlags.GO_DISABLE_WIDGETS) {
options.add(new OptionItem(R.string.widget_button_text, R.drawable.ic_widget,
@@ -212,6 +214,8 @@
launcher.getWorkspace().getWallpaperOffsetForCenterPage());
if (!existsStyleWallpapers(launcher)) {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
+ } else {
+ intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "focus_wallpaper");
}
String pickerPackage = launcher.getString(R.string.wallpaper_picker_package);
if (!TextUtils.isEmpty(pickerPackage)) {
diff --git a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
index 6c0c429..e7008fd 100644
--- a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
+++ b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
@@ -29,6 +29,7 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.WorkspaceItemInfo;
import java.util.ArrayList;
import java.util.Collections;
@@ -63,8 +64,8 @@
}
public static boolean supportsShortcuts(ItemInfo info) {
- boolean isItemPromise = info instanceof com.android.launcher3.ShortcutInfo
- && ((com.android.launcher3.ShortcutInfo) info).hasPromiseIconUi();
+ boolean isItemPromise = info instanceof WorkspaceItemInfo
+ && ((WorkspaceItemInfo) info).hasPromiseIconUi();
return info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
&& !info.isDisabled() && !isItemPromise;
}
diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml
index 089d672..3686493 100644
--- a/tests/AndroidManifest-common.xml
+++ b/tests/AndroidManifest-common.xml
@@ -18,39 +18,39 @@
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3.tests">
- <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
+ <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<application android:debuggable="true">
- <uses-library android:name="android.test.runner" />
+ <uses-library android:name="android.test.runner"/>
<receiver
android:name="com.android.launcher3.testcomponent.AppWidgetNoConfig"
android:label="No Config">
<intent-filter>
- <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
- android:resource="@xml/appwidget_no_config" />
+ android:resource="@xml/appwidget_no_config"/>
</receiver>
<receiver
android:name="com.android.launcher3.testcomponent.AppWdigetHidden"
android:label="Hidden widget">
<intent-filter>
- <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
- android:resource="@xml/appwidget_hidden" />
+ android:resource="@xml/appwidget_hidden"/>
</receiver>
<receiver
android:name="com.android.launcher3.testcomponent.AppWidgetWithConfig"
android:label="With Config">
<intent-filter>
- <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
- android:resource="@xml/appwidget_with_config" />
+ android:resource="@xml/appwidget_with_config"/>
</receiver>
<activity
@@ -61,8 +61,8 @@
</activity>
<activity
android:name="com.android.launcher3.testcomponent.RequestPinItemActivity"
- android:label="Test Pin Item"
- android:icon="@drawable/test_drawable_pin_item">
+ android:icon="@drawable/test_drawable_pin_item"
+ android:label="Test Pin Item">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@@ -73,28 +73,28 @@
<provider
android:name="com.android.launcher3.testcomponent.TestCommandReceiver"
android:authorities="${packageName}.commands"
- android:exported="true" />
+ android:exported="true"/>
<activity
android:name="com.android.launcher3.testcomponent.TestLauncherActivity"
- android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
- android:label="Test launcher"
- android:stateNotNeeded="true"
- android:theme="@android:style/Theme.DeviceDefault.Light"
- android:windowSoftInputMode="adjustPan"
- android:screenOrientation="unspecified"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
- android:resizeableActivity="true"
- android:taskAffinity=""
+ android:enabled="false"
+ android:label="Test launcher"
+ android:launchMode="singleTask"
android:process=":testLauncherProcess"
- android:enabled="false">
+ android:resizeableActivity="true"
+ android:screenOrientation="unspecified"
+ android:stateNotNeeded="true"
+ android:taskAffinity=""
+ android:theme="@android:style/Theme.DeviceDefault.Light"
+ android:windowSoftInputMode="adjustPan">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.HOME" />
- <category android:name="android.intent.category.DEFAULT" />
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.HOME"/>
+ <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.MONKEY"/>
- <category android:name="android.intent.category.LAUNCHER_APP" />
+ <category android:name="android.intent.category.LAUNCHER_APP"/>
</intent-filter>
</activity>
<activity
@@ -104,6 +104,12 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
+ <intent-filter>
+ <action android:name="com.android.launcher3.intent.action.test_shortcut"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ <meta-data android:name="android.app.shortcuts"
+ android:resource="@xml/shortcuts"/>
</activity>
</application>
</manifest>
diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml
new file mode 100644
index 0000000..0ad87fb
--- /dev/null
+++ b/tests/res/values/strings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="shortcut1" translatable="false">Shortcut 1</string>
+ <string name="shortcut2" translatable="false">Shortcut 2</string>
+ <string name="shortcut3" translatable="false">Shortcut 3</string>
+</resources>
diff --git a/tests/res/xml/shortcuts.xml b/tests/res/xml/shortcuts.xml
new file mode 100644
index 0000000..bdc22f9
--- /dev/null
+++ b/tests/res/xml/shortcuts.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
+ <shortcut
+ android:shortcutId="shortcut1"
+ android:shortcutShortLabel="@string/shortcut1">
+ <intent android:action="com.android.launcher3.intent.action.test_shortcut"/>
+ </shortcut>
+ <shortcut
+ android:shortcutId="shortcut2"
+ android:shortcutShortLabel="@string/shortcut2">
+ <intent android:action="com.android.launcher3.intent.action.test_shortcut"/>
+ </shortcut>
+ <shortcut
+ android:shortcutId="shortcut3"
+ android:shortcutShortLabel="@string/shortcut3">
+ <intent android:action="com.android.launcher3.intent.action.test_shortcut"/>
+ </shortcut>
+</shortcuts>
diff --git a/tests/src/com/android/launcher3/model/LoaderCursorTest.java b/tests/src/com/android/launcher3/model/LoaderCursorTest.java
index df935b8..7d60ad6 100644
--- a/tests/src/com/android/launcher3/model/LoaderCursorTest.java
+++ b/tests/src/com/android/launcher3/model/LoaderCursorTest.java
@@ -10,11 +10,11 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.icons.BitmapInfo;
@@ -112,7 +112,7 @@
ComponentName cn = mLauncherApps.getActivityList(null, mLoaderCursor.user)
.get(0).getComponentName();
- ShortcutInfo info = mLoaderCursor.getAppShortcutInfo(
+ WorkspaceItemInfo info = mLoaderCursor.getAppShortcutInfo(
new Intent().setComponent(cn), false /* allowMissingTarget */, true);
assertNotNull(info);
assertTrue(Utilities.isLauncherAppTarget(info.intent));
@@ -124,7 +124,7 @@
assertTrue(mLoaderCursor.moveToNext());
ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do");
- ShortcutInfo info = mLoaderCursor.getAppShortcutInfo(
+ WorkspaceItemInfo info = mLoaderCursor.getAppShortcutInfo(
new Intent().setComponent(cn), true /* allowMissingTarget */, true);
assertNotNull(info);
assertTrue(Utilities.isLauncherAppTarget(info.intent));
@@ -138,7 +138,7 @@
Bitmap icon = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8);
when(mMockIconCache.getDefaultIcon(eq(mLoaderCursor.user)))
.thenReturn(BitmapInfo.fromBitmap(icon));
- ShortcutInfo info = mLoaderCursor.loadSimpleShortcut();
+ WorkspaceItemInfo info = mLoaderCursor.loadSimpleWorkspaceItem();
assertEquals(icon, info.iconBitmap);
assertEquals("my-shortcut", info.title);
assertEquals(ITEM_TYPE_SHORTCUT, info.itemType);
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity1.java b/tests/src/com/android/launcher3/testcomponent/MainActivity1.java
new file mode 100644
index 0000000..7ef0ab6
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity1.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity1 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity10.java b/tests/src/com/android/launcher3/testcomponent/MainActivity10.java
new file mode 100644
index 0000000..11df0d2
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity10.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity10 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity2.java b/tests/src/com/android/launcher3/testcomponent/MainActivity2.java
new file mode 100644
index 0000000..dfbba3e
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity2.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity2 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity3.java b/tests/src/com/android/launcher3/testcomponent/MainActivity3.java
new file mode 100644
index 0000000..87d77d9
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity3.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity3 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity4.java b/tests/src/com/android/launcher3/testcomponent/MainActivity4.java
new file mode 100644
index 0000000..dabd2c5
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity4.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity4 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity5.java b/tests/src/com/android/launcher3/testcomponent/MainActivity5.java
new file mode 100644
index 0000000..e58210c
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity5.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity5 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity6.java b/tests/src/com/android/launcher3/testcomponent/MainActivity6.java
new file mode 100644
index 0000000..005d248
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity6.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity6 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity7.java b/tests/src/com/android/launcher3/testcomponent/MainActivity7.java
new file mode 100644
index 0000000..0f21549
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity7.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity7 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity8.java b/tests/src/com/android/launcher3/testcomponent/MainActivity8.java
new file mode 100644
index 0000000..5ba5c55
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity8.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity8 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/MainActivity9.java b/tests/src/com/android/launcher3/testcomponent/MainActivity9.java
new file mode 100644
index 0000000..82b1fcd
--- /dev/null
+++ b/tests/src/com/android/launcher3/testcomponent/MainActivity9.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.testcomponent;
+
+import android.app.Activity;
+
+/**
+ * Base activity with utility methods to help automate testing.
+ */
+public class MainActivity9 extends Activity {
+}
diff --git a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
index 0edb3d6..fa23b8d 100644
--- a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
+++ b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
@@ -18,6 +18,7 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
import static android.content.pm.PackageManager.DONT_KILL_APP;
+import static android.os.ParcelFileDescriptor.MODE_READ_WRITE;
import android.app.Activity;
import android.app.ActivityManager;
@@ -28,6 +29,13 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
+import android.os.ParcelFileDescriptor;
+import android.util.Base64;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
import androidx.test.InstrumentationRegistry;
@@ -104,4 +112,19 @@
Uri uri = Uri.parse("content://" + inst.getContext().getPackageName() + ".commands");
return inst.getTargetContext().getContentResolver().call(uri, command, arg, null);
}
+
+ @Override
+ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
+ String path = Base64.encodeToString(uri.getPath().getBytes(),
+ Base64.NO_CLOSE | Base64.NO_PADDING | Base64.NO_WRAP);
+ File file = new File(getContext().getCacheDir(), path);
+ if (!file.exists()) {
+ // Create an empty file so that we can pass its descriptor
+ try {
+ file.createNewFile();
+ } catch (IOException e) { }
+ }
+
+ return ParcelFileDescriptor.open(file, MODE_READ_WRITE);
+ }
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 9e77937..ab2808d 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -163,6 +163,8 @@
public void setUp() throws Exception {
mTargetContext = InstrumentationRegistry.getTargetContext();
mTargetPackage = mTargetContext.getPackageName();
+ // Unlock the phone
+ mDevice.executeShellCommand("input keyevent 82");
}
@After
@@ -278,7 +280,7 @@
// the results of that gesture because the wait can hide flakeness.
protected void waitForState(String message, LauncherState state) {
waitForLauncherCondition(message,
- launcher -> launcher.getStateManager().getState() == state);
+ launcher -> launcher.getStateManager().getCurrentStableState() == state);
}
protected void waitForResumed(String message) {
@@ -299,6 +301,19 @@
Wait.atMost(message, () -> getFromLauncher(condition), timeout);
}
+ // Cannot be used in TaplTests after injecting any gesture using Tapl because this can hide
+ // flakiness.
+ protected void waitForLauncherCondition(
+ String message,
+ Runnable testThreadAction, Function<Launcher, Boolean> condition,
+ long timeout) {
+ if (!TestHelpers.isInLauncherProcess()) return;
+ Wait.atMost(message, () -> {
+ testThreadAction.run();
+ return getFromLauncher(condition);
+ }, timeout);
+ }
+
protected LauncherActivityInfo getSettingsApp() {
return LauncherAppsCompat.getInstance(mTargetContext)
.getActivityList("com.android.settings",
diff --git a/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java b/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java
new file mode 100644
index 0000000..1efdee8
--- /dev/null
+++ b/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java
@@ -0,0 +1,138 @@
+/**
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.pm.ProviderInfo;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
+import android.os.ParcelFileDescriptor.AutoCloseOutputStream;
+
+import com.android.launcher3.LauncherAppWidgetProviderInfo;
+import com.android.launcher3.testcomponent.TestCommandReceiver;
+import com.android.launcher3.util.LauncherLayoutBuilder;
+import com.android.launcher3.util.rule.ShellCommandRule;
+import com.android.launcher3.widget.LauncherAppWidgetHostView;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.OutputStreamWriter;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+import androidx.test.uiautomator.UiSelector;
+
+@MediumTest
+@RunWith(AndroidJUnit4.class)
+public class DefaultLayoutProviderTest extends AbstractLauncherUiTest {
+
+ @Rule
+ public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind();
+
+ private static final String SETTINGS_APP = "com.android.settings";
+
+ private Context mContext;
+ private String mAuthority;
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ mContext = InstrumentationRegistry.getContext();
+
+ PackageManager pm = mTargetContext.getPackageManager();
+ ProviderInfo pi = pm.getProviderInfo(new ComponentName(mContext,
+ TestCommandReceiver.class), 0);
+ mAuthority = pi.authority;
+ }
+
+ @Test
+ public void testCustomProfileLoaded_with_icon_on_hotseat() throws Exception {
+ writeLayout(new LauncherLayoutBuilder().atHotseat(0).putApp(SETTINGS_APP, SETTINGS_APP));
+
+ // Launch the home activity
+ mActivityMonitor.startLauncher();
+ waitForModelLoaded();
+
+ // Verify widget present
+ UiSelector selector = new UiSelector().packageName(mTargetContext.getPackageName())
+ .description(getSettingsApp().getLabel().toString());
+ assertTrue(mDevice.findObject(selector).waitForExists(DEFAULT_UI_TIMEOUT));
+ }
+
+ @Test
+ public void testCustomProfileLoaded_with_widget() throws Exception {
+ // A non-restored widget with no config screen gets restored automatically.
+ LauncherAppWidgetProviderInfo info = TestViewHelpers.findWidgetProvider(this, false);
+
+ writeLayout(new LauncherLayoutBuilder().atWorkspace(0, 1, 0)
+ .putWidget(info.getComponent().getPackageName(),
+ info.getComponent().getClassName(), 2, 2));
+
+ // Launch the home activity
+ mActivityMonitor.startLauncher();
+ waitForModelLoaded();
+
+ // Verify widget present
+ UiSelector selector = new UiSelector().packageName(mTargetContext.getPackageName())
+ .className(LauncherAppWidgetHostView.class).description(info.label);
+ assertTrue(mDevice.findObject(selector).waitForExists(DEFAULT_UI_TIMEOUT));
+ }
+
+ @Test
+ public void testCustomProfileLoaded_with_folder() throws Exception {
+ writeLayout(new LauncherLayoutBuilder().atHotseat(0).putFolder(android.R.string.copy)
+ .addApp(SETTINGS_APP, SETTINGS_APP)
+ .addApp(SETTINGS_APP, SETTINGS_APP)
+ .addApp(SETTINGS_APP, SETTINGS_APP)
+ .build());
+
+ // Launch the home activity
+ mActivityMonitor.startLauncher();
+ waitForModelLoaded();
+
+ // Verify widget present
+ UiSelector selector = new UiSelector().packageName(mTargetContext.getPackageName())
+ .descriptionContains(mTargetContext.getString(android.R.string.copy));
+ assertTrue(mDevice.findObject(selector).waitForExists(DEFAULT_UI_TIMEOUT));
+ }
+
+ @After
+ public void cleanup() throws Exception {
+ mDevice.executeShellCommand("settings delete secure launcher3.layout.provider");
+ }
+
+ private void writeLayout(LauncherLayoutBuilder builder) throws Exception {
+ mDevice.executeShellCommand("settings put secure launcher3.layout.provider " + mAuthority);
+ ParcelFileDescriptor pfd = mTargetContext.getContentResolver().openFileDescriptor(
+ Uri.parse("content://" + mAuthority + "/launcher_layout"), "w");
+
+ try (OutputStreamWriter writer = new OutputStreamWriter(new AutoCloseOutputStream(pfd))) {
+ builder.build(writer);
+ }
+ clearLauncherData();
+ }
+}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index e11e62e..dfb0edf 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -25,7 +25,6 @@
import static org.junit.Assert.assertTrue;
import android.content.Intent;
-import android.content.pm.LauncherActivityInfo;
import android.util.Log;
import androidx.test.filters.LargeTest;
@@ -62,6 +61,7 @@
@RunWith(AndroidJUnit4.class)
public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
private static final String TAG = "TaplTestsAosp";
+ private static final String APP_NAME = "LauncherTestApp";
private static int sScreenshotCount = 0;
@@ -307,12 +307,11 @@
@PortraitLandscape
public void testLaunchMenuItem() throws Exception {
if (!TestHelpers.isInLauncherProcess()) return;
- final LauncherActivityInfo testApp = getSettingsApp();
final AppIconMenu menu = mLauncher.
getWorkspace().
switchToAllApps().
- getAppIcon(testApp.getLabel().toString()).
+ getAppIcon(APP_NAME).
openMenu();
executeOnLauncher(
@@ -322,7 +321,7 @@
final AppIconMenuItem menuItem = menu.getMenuItem(1);
final String itemName = menuItem.getText();
- menuItem.launch(testApp.getComponentName().getPackageName(), itemName);
+ menuItem.launch(getAppPackageName());
}
@Test
@@ -330,16 +329,15 @@
public void testDragAppIcon() throws Throwable {
try {
TestProtocol.sDebugTracing = true;
- final String appName = "LauncherTestApp";
// 1. Open all apps and wait for load complete.
// 2. Drag icon to homescreen.
// 3. Verify that the icon works on homescreen.
mLauncher.getWorkspace().
switchToAllApps().
- getAppIcon(appName).
+ getAppIcon(APP_NAME).
dragToWorkspace().
- getWorkspaceAppIcon(appName).
- launch(getInstrumentation().getContext().getPackageName());
+ getWorkspaceAppIcon(APP_NAME).
+ launch(getAppPackageName());
} finally {
TestProtocol.sDebugTracing = false;
}
@@ -349,7 +347,6 @@
@PortraitLandscape
public void testDragShortcut() throws Throwable {
if (!TestHelpers.isInLauncherProcess()) return;
- LauncherActivityInfo testApp = getSettingsApp();
// 1. Open all apps and wait for load complete.
// 2. Find the app and long press it to show shortcuts.
@@ -357,7 +354,7 @@
final AppIconMenuItem menuItem = mLauncher.
getWorkspace().
switchToAllApps().
- getAppIcon(testApp.getLabel().toString()).
+ getAppIcon(APP_NAME).
openMenu().
getMenuItem(0);
final String shortcutName = menuItem.getText();
@@ -368,6 +365,10 @@
menuItem.
dragToWorkspace().
getWorkspaceAppIcon(shortcutName).
- launch(testApp.getComponentName().getPackageName(), shortcutName);
+ launch(getAppPackageName());
+ }
+
+ private static String getAppPackageName() {
+ return getInstrumentation().getContext().getPackageName();
}
}
diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
index 95a1289..4899334 100644
--- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
@@ -34,7 +34,7 @@
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.R;
-import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.shortcuts.ShortcutKey;
@@ -134,7 +134,7 @@
runTest("pinShortcut", false, new ItemOperator() {
@Override
public boolean evaluate(ItemInfo info, View view) {
- return info instanceof ShortcutInfo &&
+ return info instanceof WorkspaceItemInfo &&
info.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT &&
ShortcutKey.fromItemInfo(info).getId().equals(mShortcutId);
}
diff --git a/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java b/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java
new file mode 100644
index 0000000..d3659eb
--- /dev/null
+++ b/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java
@@ -0,0 +1,172 @@
+/**
+ * Copyright (C) 2019 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.
+ */
+package com.android.launcher3.util;
+
+
+import android.text.TextUtils;
+import android.util.Pair;
+import android.util.Xml;
+
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Helper class to build xml for Launcher Layout
+ */
+public class LauncherLayoutBuilder {
+
+ // Object Tags
+ private static final String TAG_WORKSPACE = "workspace";
+ private static final String TAG_AUTO_INSTALL = "autoinstall";
+ private static final String TAG_FOLDER = "folder";
+ private static final String TAG_APPWIDGET = "appwidget";
+ private static final String TAG_EXTRA = "extra";
+
+ private static final String ATTR_CONTAINER = "container";
+ private static final String ATTR_RANK = "rank";
+
+ private static final String ATTR_PACKAGE_NAME = "packageName";
+ private static final String ATTR_CLASS_NAME = "className";
+ private static final String ATTR_TITLE = "title";
+ private static final String ATTR_SCREEN = "screen";
+
+ // x and y can be specified as negative integers, in which case -1 represents the
+ // last row / column, -2 represents the second last, and so on.
+ private static final String ATTR_X = "x";
+ private static final String ATTR_Y = "y";
+ private static final String ATTR_SPAN_X = "spanX";
+ private static final String ATTR_SPAN_Y = "spanY";
+
+ private static final String ATTR_CHILDREN = "children";
+
+
+ // Style attrs -- "Extra"
+ private static final String ATTR_KEY = "key";
+ private static final String ATTR_VALUE = "value";
+
+ private static final String CONTAINER_DESKTOP = "desktop";
+ private static final String CONTAINER_HOTSEAT = "hotseat";
+
+ private final ArrayList<Pair<String, HashMap<String, Object>>> mNodes = new ArrayList<>();
+
+ public Location atHotseat(int rank) {
+ Location l = new Location();
+ l.items.put(ATTR_CONTAINER, CONTAINER_HOTSEAT);
+ l.items.put(ATTR_RANK, Integer.toString(rank));
+ return l;
+ }
+
+ public Location atWorkspace(int x, int y, int screen) {
+ Location l = new Location();
+ l.items.put(ATTR_CONTAINER, CONTAINER_DESKTOP);
+ l.items.put(ATTR_X, Integer.toString(x));
+ l.items.put(ATTR_Y, Integer.toString(y));
+ l.items.put(ATTR_SCREEN, Integer.toString(screen));
+ return l;
+ }
+
+ public String build() throws IOException {
+ StringWriter writer = new StringWriter();
+ build(writer);
+ return writer.toString();
+ }
+
+ public void build(Writer writer) throws IOException {
+ XmlSerializer serializer = Xml.newSerializer();
+ serializer.setOutput(writer);
+
+ serializer.startDocument("UTF-8", true);
+ serializer.startTag(null, TAG_WORKSPACE);
+ writeNodes(serializer, mNodes);
+ serializer.endTag(null, TAG_WORKSPACE);
+ serializer.endDocument();
+ serializer.flush();
+ }
+
+ private static void writeNodes(XmlSerializer serializer,
+ ArrayList<Pair<String, HashMap<String, Object>>> nodes) throws IOException {
+ for (Pair<String, HashMap<String, Object>> node : nodes) {
+ ArrayList<Pair<String, HashMap<String, Object>>> children = null;
+
+ serializer.startTag(null, node.first);
+ for (Map.Entry<String, Object> attr : node.second.entrySet()) {
+ if (ATTR_CHILDREN.equals(attr.getKey())) {
+ children = (ArrayList<Pair<String, HashMap<String, Object>>>) attr.getValue();
+ } else {
+ serializer.attribute(null, attr.getKey(), (String) attr.getValue());
+ }
+ }
+
+ if (children != null) {
+ writeNodes(serializer, children);
+ }
+ serializer.endTag(null, node.first);
+ }
+ }
+
+ public class Location {
+
+ final HashMap<String, Object> items = new HashMap<>();
+
+ public LauncherLayoutBuilder putApp(String packageName, String className) {
+ items.put(ATTR_PACKAGE_NAME, packageName);
+ items.put(ATTR_CLASS_NAME, TextUtils.isEmpty(className) ? packageName : className);
+ mNodes.add(Pair.create(TAG_AUTO_INSTALL, items));
+ return LauncherLayoutBuilder.this;
+ }
+
+ public LauncherLayoutBuilder putWidget(String packageName, String className,
+ int spanX, int spanY) {
+ items.put(ATTR_PACKAGE_NAME, packageName);
+ items.put(ATTR_CLASS_NAME, className);
+ items.put(ATTR_SPAN_X, Integer.toString(spanX));
+ items.put(ATTR_SPAN_Y, Integer.toString(spanY));
+ mNodes.add(Pair.create(TAG_APPWIDGET, items));
+ return LauncherLayoutBuilder.this;
+ }
+
+ public FolderBuilder putFolder(int titleResId) {
+ FolderBuilder folderBuilder = new FolderBuilder();
+ items.put(ATTR_TITLE, Integer.toString(titleResId));
+ items.put(ATTR_CHILDREN, folderBuilder.mChildren);
+ mNodes.add(Pair.create(TAG_FOLDER, items));
+ return folderBuilder;
+ }
+ }
+
+ public class FolderBuilder {
+
+ final ArrayList<Pair<String, HashMap<String, Object>>> mChildren = new ArrayList<>();
+
+ public FolderBuilder addApp(String packageName, String className) {
+ HashMap<String, Object> items = new HashMap<>();
+ items.put(ATTR_PACKAGE_NAME, packageName);
+ items.put(ATTR_CLASS_NAME, TextUtils.isEmpty(className) ? packageName : className);
+ mChildren.add(Pair.create(TAG_AUTO_INSTALL, items));
+ return this;
+ }
+
+ public LauncherLayoutBuilder build() {
+ return LauncherLayoutBuilder.this;
+ }
+ }
+}
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 98fb07f..4685c7d 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -16,6 +16,8 @@
package com.android.launcher3.tapl;
+import static com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
+
import androidx.annotation.NonNull;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
@@ -47,6 +49,7 @@
private boolean hasClickableIcon(UiObject2 allAppsContainer, BySelector appIconSelector) {
final UiObject2 icon = allAppsContainer.findObject(appIconSelector);
if (icon == null) return false;
+ if (mLauncher.getNavigationModel() == ZERO_BUTTON) return true;
final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
return icon.getVisibleBounds().bottom < navBar.getVisibleBounds().top;
}
@@ -63,8 +66,10 @@
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to get app icon on all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
- final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
- allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1);
+ if (mLauncher.getNavigationModel() != ZERO_BUTTON) {
+ final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
+ allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1);
+ }
final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher);
if (!hasClickableIcon(allAppsContainer, appIconSelector)) {
scrollBackToBeginning();
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
index fbeb3a2..44fc3f7 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -50,4 +50,9 @@
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, iconCenter);
return new AppIconMenu(mLauncher, deepShortcutsContainer);
}
+
+ @Override
+ protected String getLongPressIndicator() {
+ return "deep_shortcuts_container";
+ }
}
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
index c39f8d1..ba9c10e 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIconMenuItem.java
@@ -32,4 +32,9 @@
public String getText() {
return mObject.getText();
}
+
+ @Override
+ protected String getLongPressIndicator() {
+ return "drop_target_bar";
+ }
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 358d5e9..3b2a7b8 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -109,6 +109,6 @@
}
protected int getSwipeStartY() {
- return mLauncher.waitForSystemUiObject("navigation_bar_frame").getVisibleBounds().centerY();
+ return mLauncher.getRealDisplaySize().y - 1;
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 16ddba8..1b372ec 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -27,7 +27,7 @@
/**
* Ancestor for AppIcon and AppMenuItem.
*/
-class Launchable {
+abstract class Launchable {
protected final LauncherInstrumentation mLauncher;
protected final UiObject2 mObject;
@@ -45,24 +45,17 @@
* Clicks the object to launch its app.
*/
public Background launch(String expectedPackageName) {
- return launch(expectedPackageName, By.pkg(expectedPackageName).depth(0));
+ return launch(By.pkg(expectedPackageName));
}
- /**
- * Clicks the object to launch its app.
- */
- public Background launch(String expectedPackageName, String expectedAppText) {
- return launch(expectedPackageName, By.pkg(expectedPackageName).text(expectedAppText));
- }
-
- private Background launch(String errorMessage, BySelector selector) {
+ private Background launch(BySelector selector) {
LauncherInstrumentation.log("Launchable.launch before click " +
mObject.getVisibleCenter());
mLauncher.assertTrue(
"Launching an app didn't open a new window: " + mObject.getText(),
mObject.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS));
mLauncher.assertTrue(
- "App didn't start: " + errorMessage,
+ "App didn't start: " + selector,
mLauncher.getDevice().wait(Until.hasObject(selector),
LauncherInstrumentation.WAIT_TIME_MS));
return new Background(mLauncher);
@@ -76,10 +69,13 @@
Workspace.dragIconToWorkspace(
mLauncher,
this,
- new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2));
+ new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2),
+ getLongPressIndicator());
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"dragged launchable to workspace")) {
return new Workspace(mLauncher);
}
}
+
+ protected abstract String getLongPressIndicator();
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 3a45e93..8f777b6 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -38,6 +38,7 @@
import android.view.MotionEvent;
import android.view.Surface;
import android.view.ViewConfiguration;
+import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import androidx.annotation.NonNull;
@@ -154,8 +155,6 @@
} catch (IOException e) {
fail(e.toString());
}
-
- assertTrue("Phone is locked", !hasSystemUiObject("keyguard_status_view"));
}
Context getContext() {
@@ -201,13 +200,19 @@
Closable addContextLayer(String piece) {
mDiagnosticContext.addLast(piece);
- return () -> mDiagnosticContext.removeLast();
+ log("Added context: " + getContextDescription());
+ return () -> {
+ log("Removing context: " + getContextDescription());
+ mDiagnosticContext.removeLast();
+ };
}
private void fail(String message) {
- final String ctxt = mDiagnosticContext.isEmpty() ? "" : String.join(", ",
- mDiagnosticContext) + "; ";
- Assert.fail("http://go/tapl : " + ctxt + message);
+ Assert.fail("http://go/tapl : " + getContextDescription() + message);
+ }
+
+ private String getContextDescription() {
+ return mDiagnosticContext.isEmpty() ? "" : String.join(", ", mDiagnosticContext) + "; ";
}
void assertTrue(String message, boolean condition) {
@@ -250,12 +255,14 @@
assertEquals("Unexpected display rotation",
mExpectedRotation, mDevice.getDisplayRotation());
final NavigationModel navigationModel = getNavigationModel();
- assertTrue("Presence of recents button doesn't match the interaction mode",
- (navigationModel == NavigationModel.THREE_BUTTON) ==
- hasSystemUiObject("recent_apps"));
- assertTrue("Presence of home button doesn't match the interaction mode",
- (navigationModel != NavigationModel.ZERO_BUTTON) ==
- hasSystemUiObject("home"));
+ final boolean hasRecentsButton = hasSystemUiObject("recent_apps");
+ final boolean hasHomeButton = hasSystemUiObject("home");
+ assertTrue("Presence of recents button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasRecents=" + hasRecentsButton,
+ (navigationModel == NavigationModel.THREE_BUTTON) == hasRecentsButton);
+ assertTrue("Presence of home button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasHome=" + hasHomeButton,
+ (navigationModel != NavigationModel.ZERO_BUTTON) == hasHomeButton);
log("verifyContainerType: " + containerType);
try (Closable c = addContextLayer(
@@ -344,36 +351,17 @@
final String action;
if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
if (hasLauncherObject(WORKSPACE_RES_ID)) {
- log(action = "0-button: already in workspace");
- } else if (hasLauncherObject(OVERVIEW_RES_ID)) {
- log(action = "0-button: from overview");
- final UiObject2 navBar = waitForSystemUiObject("navigation_bar_frame");
-
- swipe(
- navBar.getVisibleBounds().centerX(), navBar.getVisibleBounds().centerY(),
- navBar.getVisibleBounds().centerX(), 0,
- NORMAL_STATE_ORDINAL, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME);
- } else if (hasLauncherObject(WIDGETS_RES_ID)) {
- log(action = "0-button: from widgets");
- mDevice.pressHome();
- } else if (hasLauncherObject(APPS_RES_ID)) {
- log(action = "0-button: from all apps");
- final UiObject2 navBar = waitForSystemUiObject("navigation_bar_frame");
-
- swipe(
- navBar.getVisibleBounds().centerX(), navBar.getVisibleBounds().centerY(),
- navBar.getVisibleBounds().centerX(), 0,
- NORMAL_STATE_ORDINAL, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME);
+ log(action = "already at home");
} else {
- log(action = "0-button: from another app");
- assertTrue("Launcher is visible, don't know how to go home",
- !mDevice.hasObject(By.pkg(getLauncherPackageName())));
- final UiObject2 navBar = waitForSystemUiObject("navigation_bar_frame");
+ log(action = "swiping up to home");
+ final int finalState = mDevice.hasObject(By.pkg(getLauncherPackageName()))
+ ? NORMAL_STATE_ORDINAL : BACKGROUND_APP_STATE_ORDINAL;
+ final Point displaySize = getRealDisplaySize();
swipe(
- navBar.getVisibleBounds().centerX(), navBar.getVisibleBounds().centerY(),
- navBar.getVisibleBounds().centerX(), 0,
- BACKGROUND_APP_STATE_ORDINAL, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME);
+ displaySize.x / 2, displaySize.y - 1,
+ displaySize.x / 2, 0,
+ finalState, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME);
}
} else {
log(action = "clicking home button");
@@ -612,11 +600,12 @@
void movePointer(long downTime, long duration, Point from, Point to) {
final Point point = new Point();
+ final long startTime = SystemClock.uptimeMillis();
for (; ; ) {
sleep(16);
final long currentTime = SystemClock.uptimeMillis();
- final float progress = (currentTime - downTime) / (float) duration;
+ final float progress = (currentTime - startTime) / (float) duration;
if (progress > 1) return;
point.x = from.x + (int) (progress * (to.x - from.x));
@@ -684,4 +673,10 @@
return 0;
}
}
+
+ Point getRealDisplaySize() {
+ final Point size = new Point();
+ getContext().getSystemService(WindowManager.class).getDefaultDisplay().getRealSize(size);
+ return size;
+ }
}
\ No newline at end of file
diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java
index b88da3a..e625510 100644
--- a/tests/tapl/com/android/launcher3/tapl/Overview.java
+++ b/tests/tapl/com/android/launcher3/tapl/Overview.java
@@ -49,11 +49,13 @@
"want to switch from overview to all apps")) {
verifyActiveContainer();
- // Swipe from navbar to the top.
- final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
+ // Swipe from the prediction row to the top.
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
- final int x = navBar.getVisibleCenter().x;
- mLauncher.swipe(x, navBar.getVisibleBounds().top - 1, x, 0, ALL_APPS_STATE_ORDINAL);
+ final UiObject2 predictionRow = mLauncher.waitForLauncherObject("prediction_row");
+ mLauncher.swipe(mLauncher.getDevice().getDisplayWidth() / 2,
+ predictionRow.getVisibleBounds().centerY(),
+ mLauncher.getDevice().getDisplayWidth() / 2,
+ 0, ALL_APPS_STATE_ORDINAL);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped all way up from overview")) {
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 943332e..a520f0e 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -114,12 +114,16 @@
public void ensureWorkspaceIsScrollable() {
final UiObject2 workspace = verifyActiveContainer();
if (!isWorkspaceScrollable(workspace)) {
- dragIconToWorkspace(
- mLauncher,
- getHotseatAppIcon("Chrome"),
- new Point(mLauncher.getDevice().getDisplayWidth(),
- workspace.getVisibleBounds().centerY()));
- verifyActiveContainer();
+ try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
+ "dragging icon to a second page of workspace to make it scrollable")) {
+ dragIconToWorkspace(
+ mLauncher,
+ getHotseatAppIcon("Chrome"),
+ new Point(mLauncher.getDevice().getDisplayWidth(),
+ workspace.getVisibleBounds().centerY()),
+ "deep_shortcuts_container");
+ verifyActiveContainer();
+ }
}
assertTrue("Home screen workspace didn't become scrollable",
isWorkspaceScrollable(workspace));
@@ -136,17 +140,20 @@
}
static void dragIconToWorkspace(
- LauncherInstrumentation launcher, Launchable launchable, Point dest) {
+ LauncherInstrumentation launcher, Launchable launchable, Point dest,
+ String longPressIndicator) {
+ launcher.getTestInfo(TestProtocol.REQUEST_ENABLE_DRAG_LOGGING);
LauncherInstrumentation.log("dragIconToWorkspace: begin");
final Point launchableCenter = launchable.getObject().getVisibleCenter();
final long downTime = SystemClock.uptimeMillis();
launcher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, launchableCenter);
- launcher.waitForLauncherObject("deep_shortcuts_container");
+ launcher.waitForLauncherObject(longPressIndicator);
launcher.movePointer(downTime, DRAG_DURACTION, launchableCenter, dest);
launcher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
+ launcher.getTestInfo(TestProtocol.REQUEST_DISABLE_DRAG_LOGGING);
}
/**