Merge "migrate from deprecated fragment api to latest" into ub-launcher3-master
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/HotseatPredictionController.java
index 17a3d91..0254340 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/HotseatPredictionController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/HotseatPredictionController.java
@@ -66,6 +66,9 @@
//TODO: replace this with AppTargetEvent.ACTION_UNPIN (b/144119543)
private static final int APPTARGET_ACTION_UNPIN = 4;
+ private static final String APP_LOCATION_HOTSEAT = "hotseat";
+ private static final String APP_LOCATION_WORKSPACE = "workspace";
+
private static final String PREDICTION_CLIENT = "hotseat";
private DropTarget.DragObject mDragObject;
@@ -132,7 +135,7 @@
}
WorkspaceItemInfo predictedItem = predictedApps.get(predictionIndex++);
- if (isPredictedIcon(child)) {
+ if (isPredictedIcon(child) && child.isEnabled()) {
PredictedAppIcon icon = (PredictedAppIcon) child;
icon.applyFromWorkspaceItem(predictedItem);
icon.finishBinding();
@@ -204,17 +207,24 @@
private Bundle getAppPredictionContextExtra() {
Bundle bundle = new Bundle();
- ViewGroup vg = mHotseat.getShortcutsAndWidgets();
+ bundle.putParcelableArrayList(APP_LOCATION_HOTSEAT,
+ getPinnedAppTargetsInViewGroup((mHotseat.getShortcutsAndWidgets())));
+ bundle.putParcelableArrayList(APP_LOCATION_WORKSPACE, getPinnedAppTargetsInViewGroup(
+ mLauncher.getWorkspace().getScreenWithId(
+ Workspace.FIRST_SCREEN_ID).getShortcutsAndWidgets()));
+ return bundle;
+ }
+
+ private ArrayList<AppTarget> getPinnedAppTargetsInViewGroup(ViewGroup viewGroup) {
ArrayList<AppTarget> pinnedApps = new ArrayList<>();
- for (int i = 0; i < vg.getChildCount(); i++) {
- View child = vg.getChildAt(i);
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ View child = viewGroup.getChildAt(i);
if (isPinnedIcon(child)) {
WorkspaceItemInfo itemInfo = (WorkspaceItemInfo) child.getTag();
pinnedApps.add(getAppTargetFromItemInfo(itemInfo));
}
}
- bundle.putParcelableArrayList("pinned_apps", pinnedApps);
- return bundle;
+ return pinnedApps;
}
private void setPredictedApps(List<AppTarget> appTargets) {
@@ -252,7 +262,7 @@
ObjectAnimator.ofFloat(icon, SCALE_PROPERTY, 1, 0.8f, 1).start();
icon.pin(workspaceItemInfo);
AppTarget appTarget = getAppTargetFromItemInfo(workspaceItemInfo);
- notifyItemAction(appTarget, AppTargetEvent.ACTION_PIN);
+ notifyItemAction(appTarget, APP_LOCATION_HOTSEAT, AppTargetEvent.ACTION_PIN);
}
private List<WorkspaceItemInfo> mapToWorkspaceItemInfo(
@@ -300,6 +310,7 @@
int rank = ((WorkspaceItemInfo) icon.getTag()).rank;
outlines.add(new PredictedAppIcon.PredictedIconOutlineDrawing(
mHotseat.getCellXFromOrder(rank), mHotseat.getCellYFromOrder(rank), icon));
+ icon.setEnabled(false);
icon.animate().scaleY(0).scaleX(0).setListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
@@ -312,9 +323,10 @@
}
- private void notifyItemAction(AppTarget target, int action) {
+ private void notifyItemAction(AppTarget target, String location, int action) {
if (mAppPredictor != null) {
- mAppPredictor.notifyAppTargetEvent(new AppTargetEvent.Builder(target, action).build());
+ mAppPredictor.notifyAppTargetEvent(new AppTargetEvent.Builder(target,
+ action).setLaunchLocation(location).build());
}
}
@@ -336,10 +348,18 @@
}
ItemInfo dragInfo = mDragObject.dragInfo;
if (dragInfo instanceof WorkspaceItemInfo && dragInfo.getTargetComponent() != null) {
+ AppTarget appTarget = getAppTargetFromItemInfo(dragInfo);
+ if (!isInHotseat(dragInfo) && isInHotseat(mDragObject.originalDragInfo)) {
+ notifyItemAction(appTarget, APP_LOCATION_HOTSEAT, APPTARGET_ACTION_UNPIN);
+ }
+ if (!isInFirstPage(dragInfo) && isInFirstPage(mDragObject.originalDragInfo)) {
+ notifyItemAction(appTarget, APP_LOCATION_WORKSPACE, APPTARGET_ACTION_UNPIN);
+ }
if (isInHotseat(dragInfo) && !isInHotseat(mDragObject.originalDragInfo)) {
- notifyItemAction(getAppTargetFromItemInfo(dragInfo), AppTargetEvent.ACTION_PIN);
- } else if (!isInHotseat(dragInfo) && isInHotseat(mDragObject.originalDragInfo)) {
- notifyItemAction(getAppTargetFromItemInfo(dragInfo), APPTARGET_ACTION_UNPIN);
+ notifyItemAction(appTarget, APP_LOCATION_HOTSEAT, AppTargetEvent.ACTION_PIN);
+ }
+ if (isInFirstPage(dragInfo) && !isInFirstPage(mDragObject.originalDragInfo)) {
+ notifyItemAction(appTarget, APP_LOCATION_WORKSPACE, AppTargetEvent.ACTION_PIN);
}
}
mDragObject = null;
@@ -412,7 +432,7 @@
return false;
}
ItemInfo info = (ItemInfo) view.getTag();
- return info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT && (
+ return info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION && (
info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT);
}
@@ -421,6 +441,11 @@
return itemInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT;
}
+ private static boolean isInFirstPage(ItemInfo itemInfo) {
+ return itemInfo.container == LauncherSettings.Favorites.CONTAINER_DESKTOP
+ && itemInfo.screenId == Workspace.FIRST_SCREEN_ID;
+ }
+
private static AppTarget getAppTargetFromItemInfo(ItemInfo info) {
if (info.getTargetComponent() == null) return null;
ComponentName cn = info.getTargetComponent();
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
index e41c75a..1dcbffb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
@@ -40,11 +40,12 @@
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
+import com.android.launcher3.views.DoubleShadowBubbleTextView;
/**
* A BubbleTextView with a ring around it's drawable
*/
-public class PredictedAppIcon extends BubbleTextView {
+public class PredictedAppIcon extends DoubleShadowBubbleTextView {
private static final float RING_EFFECT_RATIO = 0.12f;
@@ -97,6 +98,7 @@
applyFromWorkspaceItem(info);
setOnLongClickListener(ItemLongClickListener.INSTANCE_WORKSPACE);
mIsPinned = true;
+ ((CellLayout.LayoutParams) getLayoutParams()).canReorder = true;
invalidate();
}
@@ -111,6 +113,7 @@
}
return true;
});
+ ((CellLayout.LayoutParams) getLayoutParams()).canReorder = false;
setTextVisibility(false);
verifyHighRes();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
index b14da5c..630dd70 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
@@ -430,20 +430,6 @@
final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f;
anim.addOnUpdateListener(new RectFSpringAnim.OnUpdateListener() {
- // Alpha interpolates between [1, 0] between progress values [start, end]
- final float start = 0f;
- final float end = 0.85f;
-
- private float getWindowAlpha(float progress) {
- if (progress <= start) {
- return 1f;
- }
- if (progress >= end) {
- return 0f;
- }
- return Utilities.mapToRange(progress, start, end, 1, 0, ACCEL_1_5);
- }
-
@Override
public void onUpdate(RectF currentRect, float progress) {
homeAnim.setPlayFraction(progress);
@@ -484,6 +470,24 @@
return anim;
}
+ /**
+ * @param progress The progress of the animation to the home screen.
+ * @return The current alpha to set on the animating app window.
+ */
+ protected float getWindowAlpha(float progress) {
+ // Alpha interpolates between [1, 0] between progress values [start, end]
+ final float start = 0f;
+ final float end = 0.85f;
+
+ if (progress <= start) {
+ return 1f;
+ }
+ if (progress >= end) {
+ return 0f;
+ }
+ return Utilities.mapToRange(progress, start, end, 1, 0, ACCEL_1_5);
+ }
+
public interface Factory {
BaseSwipeUpHandler newHandler(GestureState gestureState, long touchTimeMs,
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
index c939de8..034f158 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep;
+import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
+import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.quickstep.GestureState.GestureEndTarget.HOME;
import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK;
import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK;
@@ -34,6 +36,7 @@
import android.graphics.RectF;
import android.os.Bundle;
import android.util.ArrayMap;
+import android.view.MotionEvent;
import com.android.launcher3.R;
import com.android.launcher3.anim.AnimationSuccessListener;
@@ -97,6 +100,7 @@
private final boolean mContinuingLastGesture;
private final boolean mRunningOverHome;
private final boolean mSwipeUpOverHome;
+ private boolean mTouchedHomeDuringTransition;
private final PointF mEndVelocityPxPerMs = new PointF(0, 0.5f);
private RunningWindowAnim mFinishAnimation;
@@ -105,13 +109,14 @@
GestureState gestureState, InputConsumerController inputConsumer,
boolean isLikelyToStartNewTask, boolean continuingLastGesture) {
super(context, deviceState, gestureState, inputConsumer);
- mLauncherAlpha.value = 1;
mInQuickSwitchMode = isLikelyToStartNewTask || continuingLastGesture;
mContinuingLastGesture = continuingLastGesture;
mRunningOverHome = ActivityManagerWrapper.isHomeTask(mGestureState.getRunningTask());
mSwipeUpOverHome = mRunningOverHome && !mInQuickSwitchMode;
+ // Keep the home launcher invisible until we decide to land there.
+ mLauncherAlpha.value = mRunningOverHome ? 1 : 0;
if (mSwipeUpOverHome) {
mAppWindowAnimationHelper.setBaseAlphaCallback((t, a) -> 1 - mLauncherAlpha.value);
} else {
@@ -198,15 +203,27 @@
@Override
protected InputConsumer createNewInputProxyHandler() {
// Just consume all input on the active task
- return InputConsumer.NO_OP;
+ return new InputConsumer() {
+ @Override
+ public int getType() {
+ return InputConsumer.TYPE_NO_OP;
+ }
+
+ @Override
+ public void onMotionEvent(MotionEvent ev) {
+ mTouchedHomeDuringTransition = true;
+ }
+ };
}
@Override
public void onMotionPauseChanged(boolean isPaused) {
if (!mInQuickSwitchMode) {
mIsMotionPaused = isPaused;
- mLauncherAlpha.animateToValue(mLauncherAlpha.value, isPaused ? 0 : 1)
- .setDuration(150).start();
+ if (mSwipeUpOverHome) {
+ mLauncherAlpha.animateToValue(mLauncherAlpha.value, isPaused ? 0 : 1)
+ .setDuration(150).start();
+ }
performHapticFeedback();
}
}
@@ -315,7 +332,14 @@
// Send a home intent to clear the task stack
mContext.startActivity(mGestureState.getHomeIntent());
} else {
- mRecentsAnimationController.finish(true, null, true);
+ mRecentsAnimationController.finish(true, () -> {
+ if (!mTouchedHomeDuringTransition) {
+ // If the user hasn't interacted with the screen during the transition,
+ // send a home intent so launcher can go to the default home screen.
+ // (If they are trying to touch something, we don't want to interfere.)
+ mContext.startActivity(mGestureState.getHomeIntent());
+ }
+ }, true);
}
break;
}
@@ -389,6 +413,8 @@
};
if (mGestureState.getEndTarget() == HOME && !mRunningOverHome) {
+ mRecentsAnimationController.enableInputProxy(mInputConsumer,
+ this::createNewInputProxyHandler);
RectFSpringAnim anim = createWindowAnimationToHome(mCurrentShift.value, duration);
anim.addAnimatorListener(endListener);
anim.start(mEndVelocityPxPerMs);
@@ -445,11 +471,18 @@
@Override
public AnimatorPlaybackController createActivityAnimationToHome() {
AnimatorSet anim = new AnimatorSet();
- anim.play(mLauncherAlpha.animateToValue(mLauncherAlpha.value, 1));
+ Animator fadeInLauncher = mLauncherAlpha.animateToValue(mLauncherAlpha.value, 1);
+ fadeInLauncher.setInterpolator(ACCEL_2);
+ anim.play(fadeInLauncher);
anim.setDuration(duration);
return AnimatorPlaybackController.wrap(anim, duration);
}
};
return createWindowAnimationToHome(startProgress, factory);
}
+
+ @Override
+ protected float getWindowAlpha(float progress) {
+ return 1 - ACCEL_1_5.getInterpolation(progress);
+ }
}
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 6e7214e..b602cea 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
@@ -177,6 +177,7 @@
private final float mFastFlingVelocity;
private final RecentsModel mModel;
private final int mTaskTopMargin;
+ private final int mTaskBottomMargin;
private final ClearAllButton mClearAllButton;
private final Rect mClearAllButtonDeadZoneRect = new Rect();
private final Rect mTaskViewDeadZoneRect = new Rect();
@@ -343,6 +344,8 @@
setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
mTaskTopMargin = getResources()
.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
+ mTaskBottomMargin = getResources().getDimensionPixelSize(
+ R.dimen.task_thumbnail_bottom_margin);
mSquaredTouchSlop = squaredTouchSlop(context);
mEmptyIcon = context.getDrawable(R.drawable.ic_empty_recents);
@@ -696,6 +699,7 @@
mTaskHeight = mTempRect.height();
mTempRect.top -= mTaskTopMargin;
+ mTempRect.bottom += mTaskBottomMargin;
setPadding(mTempRect.left - mInsets.left, mTempRect.top - mInsets.top,
dp.widthPx - mInsets.right - mTempRect.right,
dp.heightPx - mInsets.bottom - mTempRect.bottom);
@@ -1467,7 +1471,7 @@
// Set the pivot points to match the task preview center
setPivotY(((mInsets.top + getPaddingTop() + mTaskTopMargin)
- + (getHeight() - mInsets.bottom - getPaddingBottom())) / 2);
+ + (getHeight() - mInsets.bottom - getPaddingBottom() - mTaskBottomMargin)) / 2);
setPivotX(((mInsets.left + getPaddingLeft())
+ (getWidth() - mInsets.right - getPaddingRight())) / 2);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index a1775f4..0bfde64 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -540,8 +540,11 @@
}
addView(view, indexToAdd);
- ((LayoutParams) view.getLayoutParams()).gravity =
+ LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
+ layoutParams.gravity =
Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
+ layoutParams.bottomMargin =
+ ((MarginLayoutParams) mSnapshotView.getLayoutParams()).bottomMargin;
view.setAlpha(mFooterAlpha);
mFooters[index] = new FooterWrapper(view);
if (shouldAnimateEntry) {
@@ -618,10 +621,12 @@
private static final class TaskOutlineProvider extends ViewOutlineProvider {
private final int mMarginTop;
+ private final int mMarginBottom;
private FullscreenDrawParams mFullscreenParams;
TaskOutlineProvider(Resources res, FullscreenDrawParams fullscreenParams) {
mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
+ mMarginBottom = res.getDimensionPixelSize(R.dimen.task_thumbnail_bottom_margin);
mFullscreenParams = fullscreenParams;
}
@@ -636,7 +641,7 @@
outline.setRoundRect(0,
(int) (mMarginTop * scale),
(int) ((insets.left + view.getWidth() + insets.right) * scale),
- (int) ((insets.top + view.getHeight() + insets.bottom) * scale),
+ (int) ((insets.top + view.getHeight() + insets.bottom - mMarginBottom) * scale),
mFullscreenParams.mCurrentDrawnCornerRadius);
}
}
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index 60cfa0c..7a36416 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -25,7 +25,8 @@
android:id="@+id/snapshot"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="@dimen/task_thumbnail_top_margin"/>
+ android:layout_marginTop="@dimen/task_thumbnail_top_margin"
+ android:layout_marginBottom="@dimen/task_thumbnail_bottom_margin"/>
<com.android.quickstep.views.IconView
android:id="@+id/icon"
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 78424ca..82833ea 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -18,6 +18,8 @@
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
+ <!-- Can be overridden in overlays. -->
+ <dimen name="task_thumbnail_bottom_margin">0dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<!-- For screens without rounded corners -->
<dimen name="task_corner_radius_small">2dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/model/WellbeingModel.java b/quickstep/src/com/android/launcher3/model/WellbeingModel.java
index 5aa4388..c86139b 100644
--- a/quickstep/src/com/android/launcher3/model/WellbeingModel.java
+++ b/quickstep/src/com/android/launcher3/model/WellbeingModel.java
@@ -229,6 +229,31 @@
params.putInt(EXTRA_MAX_NUM_ACTIONS_SHOWN, 1);
// Perform wellbeing call .
remoteActionBundle = client.call(METHOD_GET_ACTIONS, null, params);
+
+ synchronized (mModelLock) {
+ // Remove the entries for requested packages, and then update the fist with what we
+ // got from service
+ Arrays.stream(packageNames).forEach(mPackageToActionId::remove);
+
+ // The result consists of sub-bundles, each one is per a remote action. Each
+ // sub-bundle has a RemoteAction and a list of packages to which the action applies.
+ for (String actionId :
+ remoteActionBundle.getStringArray(EXTRA_ACTIONS)) {
+ final Bundle actionBundle = remoteActionBundle.getBundle(actionId);
+ mActionIdMap.put(actionId,
+ actionBundle.getParcelable(EXTRA_ACTION));
+
+ final String[] packagesForAction =
+ actionBundle.getStringArray(EXTRA_PACKAGES);
+ if (DEBUG || mIsInTest) {
+ Log.d(TAG, "....actionId: " + actionId + ", packages: " + String.join(", ",
+ packagesForAction));
+ }
+ for (String packageName : packagesForAction) {
+ mPackageToActionId.put(packageName, actionId);
+ }
+ }
+ }
} catch (DeadObjectException e) {
Log.i(TAG, "retrieveActions(): DeadObjectException");
return false;
@@ -237,31 +262,6 @@
if (mIsInTest) throw new RuntimeException(e);
return true;
}
-
- synchronized (mModelLock) {
- // Remove the entries for requested packages, and then update the fist with what we
- // got from service
- Arrays.stream(packageNames).forEach(mPackageToActionId::remove);
-
- // The result consists of sub-bundles, each one is per a remote action. Each sub-bundle
- // has a RemoteAction and a list of packages to which the action applies.
- for (String actionId :
- remoteActionBundle.getStringArray(EXTRA_ACTIONS)) {
- final Bundle actionBundle = remoteActionBundle.getBundle(actionId);
- mActionIdMap.put(actionId,
- actionBundle.getParcelable(EXTRA_ACTION));
-
- final String[] packagesForAction =
- actionBundle.getStringArray(EXTRA_PACKAGES);
- if (DEBUG || mIsInTest) {
- Log.d(TAG, "....actionId: " + actionId + ", packages: " + String.join(", ",
- packagesForAction));
- }
- for (String packageName : packagesForAction) {
- mPackageToActionId.put(packageName, actionId);
- }
- }
- }
if (DEBUG || mIsInTest) Log.i(TAG, "retrieveActions(): finished");
return true;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java
index 965b5f0..1e03b05 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java
@@ -16,46 +16,13 @@
package com.android.launcher3.uioverrides;
-import android.app.Activity;
import android.app.Person;
import android.content.pm.ShortcutInfo;
-import android.util.Base64;
import com.android.launcher3.Utilities;
-import com.android.systemui.shared.system.ActivityCompat;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.util.zip.Deflater;
public class ApiWrapper {
- public static boolean dumpActivity(Activity activity, PrintWriter writer) {
- if (!Utilities.IS_DEBUG_DEVICE) {
- return false;
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- if (!(new ActivityCompat(activity).encodeViewHierarchy(out))) {
- return false;
- }
-
- Deflater deflater = new Deflater();
- deflater.setInput(out.toByteArray());
- deflater.finish();
-
- out.reset();
- byte[] buffer = new byte[1024];
- while (!deflater.finished()) {
- int count = deflater.deflate(buffer); // returns the generated code... index
- out.write(buffer, 0, count);
- }
-
- writer.println("--encoded-view-dump-v0--");
- writer.println(Base64.encodeToString(
- out.toByteArray(), Base64.NO_WRAP | Base64.NO_PADDING));
- return true;
- }
-
public static Person[] getPersons(ShortcutInfo si) {
Person[] persons = si.getPersons();
return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index 2e118b4..c47bb4a 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -105,6 +105,7 @@
}
float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
+ float bottomMargin = res.getDimension(R.dimen.task_thumbnail_bottom_margin);
float paddingVert = res.getDimension(R.dimen.task_card_vert_space);
// Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
@@ -113,7 +114,7 @@
int launcherVisibleHeight = dp.heightPx - insets.top - insets.bottom;
float availableHeight = launcherVisibleHeight
- - topIconMargin - extraVerticalSpace - paddingVert;
+ - topIconMargin - extraVerticalSpace - paddingVert - bottomMargin;
float availableWidth = launcherVisibleWidth - paddingHorz;
float scale = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 382bfdf..f319ae1 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -35,13 +35,11 @@
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
-import com.android.launcher3.uioverrides.ApiWrapper;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.ViewCache;
import com.android.launcher3.views.ActivityContext;
-import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.util.ArrayList;
@@ -305,13 +303,6 @@
void onMultiWindowModeChanged(boolean isInMultiWindowMode);
}
- @Override
- public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
- if (!ApiWrapper.dumpActivity(this, writer)) {
- super.dump(prefix, fd, writer, args);
- }
- }
-
protected void dumpMisc(String prefix, PrintWriter writer) {
writer.println(prefix + "deviceProfile isTransposed="
+ getDeviceProfile().isVerticalBarLayout());
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index 3347b2a..bd48aec 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -113,6 +113,7 @@
public void onDrop(DragObject d, DragOptions options) {
if (canRemove(d.dragInfo)) {
mLauncher.getModelWriter().prepareToUndoDelete();
+ d.dragInfo.container = NO_ID;
}
super.onDrop(d, options);
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d445bc9..816d710 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1641,7 +1641,9 @@
return false;
}
- boolean aboveShortcut = (dropOverView.getTag() instanceof WorkspaceItemInfo);
+ boolean aboveShortcut = (dropOverView.getTag() instanceof WorkspaceItemInfo
+ && ((WorkspaceItemInfo) dropOverView.getTag()).container
+ != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION);
boolean willBecomeShortcut =
(info.itemType == ITEM_TYPE_APPLICATION ||
info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index f4b705e..ae30380 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -69,16 +69,8 @@
*
* To add a new flag that can be toggled through the flags UI:
*
- * 1. Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"),
+ * Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"),
* and set a default value for the flag. This will be the default value on Debug builds.
- *
- * 2. Add your flag to mTogglableFlags.
- *
- * 3. Create a getter method (an 'is' method) for the flag by copying an existing one.
- *
- * 4. Create a getter method with the same name in the release flags copy of FeatureFlags.java.
- * This should returns a constant (true/false). This will be the value of the flag used on
- * release builds.
*/
// When enabled the promise icon is visible in all apps while installation an app.
public static final TogglableFlag PROMISE_APPS_IN_ALL_APPS = new TogglableFlag(
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 33da582..f59a192 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -417,7 +417,8 @@
* Show suggested folder title.
*/
public void showSuggestedTitle(String[] suggestName) {
- if (FeatureFlags.FOLDER_NAME_SUGGEST.get() && mInfo.contents.size() == 2) {
+ if (FeatureFlags.FOLDER_NAME_SUGGEST.get()
+ && TextUtils.isEmpty(mFolderName.getText().toString())) {
if (suggestName.length > 0 && !TextUtils.isEmpty(suggestName[0])) {
mFolderName.setHint(suggestName[0]);
mFolderName.setText(suggestName[0]);
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java b/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java
index 5407ea3..6fd147a 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java
@@ -16,20 +16,13 @@
package com.android.launcher3.uioverrides;
-import android.app.Activity;
import android.app.Person;
import android.content.pm.ShortcutInfo;
import com.android.launcher3.Utilities;
-import java.io.PrintWriter;
-
public class ApiWrapper {
- public static boolean dumpActivity(Activity activity, PrintWriter writer) {
- return false;
- }
-
public static Person[] getPersons(ShortcutInfo si) {
return Utilities.EMPTY_PERSON_ARRAY;
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index ccf98ae..727d757 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -558,6 +558,7 @@
dumpViewHierarchy();
log(action = "swiping up to home from " + getVisibleStateMessage());
final int finalState = mDevice.hasObject(By.pkg(getLauncherPackageName()))
+ || isFallbackOverview()
? NORMAL_STATE_ORDINAL : BACKGROUND_APP_STATE_ORDINAL;
try (LauncherInstrumentation.Closable c = addContextLayer(action)) {