boolean isWidget = info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET ||
info.itemType == LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
- if ((animationType == ANIMATE_INTO_POSITION_AND_RESIZE || external) && finalView != null) {
+ if ((animationType == ANIMATE_INTO_POSITION_AND_RESIZE || external)
+ && finalView != null
+ && dragView.getContentView() != finalView) {
Drawable crossFadeDrawable = createWidgetDrawable(info, finalView);
dragView.crossFadeContent(crossFadeDrawable, (int) (duration * 0.8f));
} else if (isWidget && external) {
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 41865ce5e2..40f7ab167c 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -75,8 +75,9 @@ import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.OnActivePag
public class AllAppsContainerView extends SpringRelativeLayout implements DragSource,
Insettable, OnDeviceProfileChangeListener, OnActivePageChangedListener {
- private static final float FLING_VELOCITY_MULTIPLIER = 1000 * .2f;
- // Starts the springs after at least 55% of the animation has passed.
+ private static final float FLING_VELOCITY_MULTIPLIER = 1800f;
+
+ // Starts the springs after at least 25% of the animation has passed.
private static final float FLING_ANIMATION_THRESHOLD = 0.25f;
protected final BaseDraggingActivity mLauncher;
@@ -610,7 +611,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (shouldSpring
&& valueAnimator.getAnimatedFraction() >= FLING_ANIMATION_THRESHOLD) {
- absorbSwipeUpVelocity(Math.abs(
+ absorbSwipeUpVelocity(-Math.abs(
Math.round(velocity * FLING_VELOCITY_MULTIPLIER)));
shouldSpring = false;
}
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 66575eb289..b1c764c1d1 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -51,7 +51,7 @@ import java.util.List;
*/
public class AllAppsRecyclerView extends BaseRecyclerView {
private static final String TAG = "AllAppsContainerView";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private AlphabeticalAppsList mApps;
private final int mNumAppsPerRow;
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 6331ef2862..44e31389ae 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -168,7 +168,15 @@ public final class FeatureFlags {
public static final BooleanFlag ENABLE_SMARTSPACE_ENHANCED = new DeviceFlag(
"ENABLE_SMARTSPACE_ENHANCED", false,
"Replace Smartspace with the enhanced version. "
- + "Ignored if ENABLE_SMARTSPACE_UNIVERSAL is enabled.");
+ + "Ignored if ENABLE_SMARTSPACE_UNIVERSAL is enabled.");
+
+ public static final BooleanFlag ENABLE_SMARTSPACE_FEEDBACK = new DeviceFlag(
+ "ENABLE_SMARTSPACE_FEEDBACK", true,
+ "Adds a menu option to send feedback for Enhanced Smartspace.");
+
+ public static final BooleanFlag ENABLE_SMARTSPACE_DISMISS = new DeviceFlag(
+ "ENABLE_SMARTSPACE_DISMISS", false,
+ "Adds a menu option to dismiss the current Enhanced Smartspace card.");
public static final BooleanFlag ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS =
getDebugFlag(
diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java
index fc635a91db..d5a04a647d 100644
--- a/src/com/android/launcher3/dragndrop/AddItemActivity.java
+++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java
@@ -59,6 +59,7 @@ import com.android.launcher3.pm.PinRequestHelper;
import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.widget.LauncherAppWidgetHost;
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
+import com.android.launcher3.widget.NavigableAppWidgetHostView;
import com.android.launcher3.widget.PendingAddShortcutInfo;
import com.android.launcher3.widget.PendingAddWidgetInfo;
import com.android.launcher3.widget.WidgetCell;
@@ -147,20 +148,31 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
public boolean onLongClick(View view) {
// Find the position of the preview relative to the touch location.
WidgetImageView img = mWidgetCell.getWidgetView();
+ NavigableAppWidgetHostView appWidgetHostView = mWidgetCell.getAppWidgetHostViewPreview();
// If the ImageView doesn't have a drawable yet, the widget preview hasn't been loaded and
// we abort the drag.
- if (img.getDrawable() == null) {
+ if (img.getDrawable() == null && appWidgetHostView == null) {
return false;
}
- Rect bounds = img.getBitmapBounds();
- bounds.offset(img.getLeft() - (int) mLastTouchPos.x, img.getTop() - (int) mLastTouchPos.y);
-
+ final Rect bounds;
// Start home and pass the draw request params
- PinItemDragListener listener = new PinItemDragListener(mRequest, bounds,
- img.getDrawable().getIntrinsicWidth(), img.getWidth());
-
+ final PinItemDragListener listener;
+ if (appWidgetHostView != null) {
+ bounds = new Rect();
+ appWidgetHostView.getSourceVisualDragBounds(bounds);
+ bounds.offset(appWidgetHostView.getLeft() - (int) mLastTouchPos.x,
+ appWidgetHostView.getTop() - (int) mLastTouchPos.y);
+ listener = new PinItemDragListener(mRequest, bounds,
+ appWidgetHostView.getMeasuredWidth(), appWidgetHostView.getMeasuredWidth());
+ } else {
+ bounds = img.getBitmapBounds();
+ bounds.offset(img.getLeft() - (int) mLastTouchPos.x,
+ img.getTop() - (int) mLastTouchPos.y);
+ listener = new PinItemDragListener(mRequest, bounds,
+ img.getDrawable().getIntrinsicWidth(), img.getWidth());
+ }
// Start a system drag and drop. We use a transparent bitmap as preview for system drag
// as the preview is handled internally by launcher.
@@ -214,7 +226,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
// Cannot add widget
return false;
}
- mWidgetCell.setPreview(PinItemDragListener.getPreview(mRequest));
+ mWidgetCell.setRemoteViewsPreview(PinItemDragListener.getPreview(mRequest));
mAppWidgetManager = new WidgetManagerHelper(this);
mAppWidgetHost = new LauncherAppWidgetHost(this);
@@ -238,6 +250,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener
@Override
protected void onPostExecute(WidgetItem item) {
+ mWidgetCell.setPreviewSize(item.spanX, item.spanY);
mWidgetCell.applyFromCellItem(item, mApp.getWidgetCache());
mWidgetCell.ensurePreview();
}
diff --git a/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java b/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java
deleted file mode 100644
index 2135f5dff9..0000000000
--- a/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2021 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.dragndrop;
-
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.drawable.Drawable;
-
-import com.android.launcher3.widget.LauncherAppWidgetHostView;
-
-/**
- * A drawable which renders {@link LauncherAppWidgetHostView} to a canvas.
- *
- * TODO(b/183609936) Stop using that class and remove it.
- */
-public final class AppWidgetHostViewDrawable extends Drawable {
-
- private final LauncherAppWidgetHostView mAppWidgetHostView;
- private Paint mPaint = new Paint();
-
- public AppWidgetHostViewDrawable(LauncherAppWidgetHostView appWidgetHostView) {
- mAppWidgetHostView = appWidgetHostView;
- }
-
- @Override
- public void draw(Canvas canvas) {
- int saveCount = canvas.saveLayer(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), mPaint);
- mAppWidgetHostView.draw(canvas);
- canvas.restoreToCount(saveCount);
- }
-
- @Override
- public int getIntrinsicWidth() {
- return mAppWidgetHostView.getMeasuredWidth();
- }
-
- @Override
- public int getIntrinsicHeight() {
- return mAppWidgetHostView.getMeasuredHeight();
- }
-
- @Override
- public int getOpacity() {
- // This is up to app widget provider. We don't know if the host view will cover anything
- // behind the drawable.
- return PixelFormat.UNKNOWN;
- }
-
- @Override
- public void setAlpha(int alpha) {
- mPaint.setAlpha(alpha);
- }
-
- @Override
- public int getAlpha() {
- return mPaint.getAlpha();
- }
-
- @Override
- public void setColorFilter(ColorFilter colorFilter) {
- mPaint.setColorFilter(colorFilter);
- }
-
- @Override
- public ColorFilter getColorFilter() {
- return mPaint.getColorFilter();
- }
-
- /** Returns the {@link LauncherAppWidgetHostView}. */
- public LauncherAppWidgetHostView getAppWidgetHostView() {
- return mAppWidgetHostView;
- }
-}
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index b7a70cb654..d7f6cdb8bb 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -34,6 +34,8 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
@@ -125,20 +127,23 @@ public class DragController implements DragDriver.EventListener, TouchController
/**
* Starts a drag.
- * When the drag is started, the UI automatically goes into spring loaded mode. On a successful
- * drop, it is the responsibility of the {@link DropTarget} to exit out of the spring loaded
- * mode. If the drop was cancelled for some reason, the UI will automatically exit out of this mode.
+ *
+ * When the drag is started, the UI automatically goes into spring loaded mode. On a
+ * successful drop, it is the responsibility of the {@link DropTarget} to exit out of the spring
+ * loaded mode. If the drop was cancelled for some reason, the UI will automatically exit out of
+ * this mode.
*
* @param drawable The drawable to be displayed in the drag view. It will be re-scaled to the
- * enlarged size.
- * @param originalView The source view (ie. icon, widget etc.) that is being dragged
- * and which the DragView represents
+ * enlarged size.
+ * @param originalView The source view (ie. icon, widget etc.) that is being dragged and which
+ * the DragView represents
* @param dragLayerX The x position in the DragLayer of the left-top of the bitmap.
* @param dragLayerY The y position in the DragLayer of the left-top of the bitmap.
* @param source An object representing where the drag originated
* @param dragInfo The data associated with the object that is being dragged
* @param dragRegion Coordinates within the bitmap b for the position of item being dragged.
- * Makes dragging feel more precise, e.g. you can clip out a transparent border
+ * Makes dragging feel more precise, e.g. you can clip out a transparent
+ * border
*/
public DragView startDrag(
Drawable drawable,
@@ -152,6 +157,61 @@ public class DragController implements DragDriver.EventListener, TouchController
float initialDragViewScale,
float dragViewScaleOnDrop,
DragOptions options) {
+ return startDrag(drawable, /* view= */ null, originalView, dragLayerX, dragLayerY,
+ source, dragInfo, dragOffset, dragRegion, initialDragViewScale, dragViewScaleOnDrop,
+ options);
+ }
+
+ /**
+ * Starts a drag.
+ *
+ *
When the drag is started, the UI automatically goes into spring loaded mode. On a
+ * successful drop, it is the responsibility of the {@link DropTarget} to exit out of the spring
+ * loaded mode. If the drop was cancelled for some reason, the UI will automatically exit out of
+ * this mode.
+ *
+ * @param view The view to be displayed in the drag view. It will be re-scaled to the
+ * enlarged size.
+ * @param originalView The source view (ie. icon, widget etc.) that is being dragged and which
+ * the DragView represents
+ * @param dragLayerX The x position in the DragLayer of the left-top of the bitmap.
+ * @param dragLayerY The y position in the DragLayer of the left-top of the bitmap.
+ * @param source An object representing where the drag originated
+ * @param dragInfo The data associated with the object that is being dragged
+ * @param dragRegion Coordinates within the bitmap b for the position of item being dragged.
+ * Makes dragging feel more precise, e.g. you can clip out a transparent
+ * border
+ */
+ public DragView startDrag(
+ View view,
+ DraggableView originalView,
+ int dragLayerX,
+ int dragLayerY,
+ DragSource source,
+ ItemInfo dragInfo,
+ Point dragOffset,
+ Rect dragRegion,
+ float initialDragViewScale,
+ float dragViewScaleOnDrop,
+ DragOptions options) {
+ return startDrag(/* drawable= */ null, view, originalView, dragLayerX, dragLayerY,
+ source, dragInfo, dragOffset, dragRegion, initialDragViewScale, dragViewScaleOnDrop,
+ options);
+ }
+
+ private DragView startDrag(
+ @Nullable Drawable drawable,
+ @Nullable View view,
+ DraggableView originalView,
+ int dragLayerX,
+ int dragLayerY,
+ DragSource source,
+ ItemInfo dragInfo,
+ Point dragOffset,
+ Rect dragRegion,
+ float initialDragViewScale,
+ float dragViewScaleOnDrop,
+ DragOptions options) {
if (PROFILE_DRAWING_DURING_DRAG) {
android.os.Debug.startMethodTracing("Launcher");
}
@@ -182,14 +242,25 @@ public class DragController implements DragDriver.EventListener, TouchController
final Resources res = mLauncher.getResources();
final float scaleDps = mIsInPreDrag
? res.getDimensionPixelSize(R.dimen.pre_drag_view_scale) : 0f;
- final DragView dragView = mDragObject.dragView = new DragView(
- mLauncher,
- drawable,
- registrationX,
- registrationY,
- initialDragViewScale,
- dragViewScaleOnDrop,
- scaleDps);
+ final DragView dragView = mDragObject.dragView = drawable != null
+ ? new DragView(
+ mLauncher,
+ drawable,
+ registrationX,
+ registrationY,
+ initialDragViewScale,
+ dragViewScaleOnDrop,
+ scaleDps)
+ : new DragView(
+ mLauncher,
+ view,
+ view.getMeasuredWidth(),
+ view.getMeasuredHeight(),
+ registrationX,
+ registrationY,
+ initialDragViewScale,
+ dragViewScaleOnDrop,
+ scaleDps);
dragView.setItemInfo(dragInfo);
mDragObject.dragComplete = false;
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 346359954e..68a8af238e 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -42,9 +42,11 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import androidx.annotation.Nullable;
import androidx.dynamicanimation.animation.FloatPropertyCompat;
import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
@@ -69,6 +71,10 @@ public class DragView extends FrameLayout implements StateListenerIn the case of no change in the drop position, sets {@code reattachToPreviousParent} to
+ * {@code true} to attach the {@link #mContent} back to its previous parent.
+ */
+ public void detachContentView(boolean reattachToPreviousParent) {
+ if (mContent != null && mContentViewParent != null && mContentViewInParentViewIndex >= 0) {
+ removeView(mContent);
+ mContent.setLayoutParams(mContentViewLayoutParams);
+ if (reattachToPreviousParent) {
+ mContentViewParent.addView(mContent, mContentViewInParentViewIndex);
+ }
+ mContentViewParent = null;
+ mContentViewInParentViewIndex = -1;
+ }
+ }
+
+ /**
+ * Removes this view from the {@link DragLayer}.
+ *
+ * If the drag content is a {@link #mContent}, this call doesn't reattach the
+ * {@link #mContent} back to its previous parent. To reattach to previous parent, the caller
+ * should call {@link #detachContentView} with {@code reattachToPreviousParent} sets to true
+ * before this call.
+ */
public void remove() {
if (getParent() != null) {
mDragLayer.removeView(DragView.this);
@@ -449,9 +495,18 @@ public class DragView extends FrameLayout implements StateListener drawDragView(c, scale)));
}
+ /**
+ * Returns the content view if the content should be rendered directly in
+ * {@link com.android.launcher3.dragndrop.DragView}. Otherwise, returns null.
+ */
+ @Nullable
+ public View getContentView() {
+ if (mView instanceof LauncherAppWidgetHostView) {
+ return mView;
+ }
+ return null;
+ }
+
public final void generateDragOutline(Bitmap preview) {
if (FeatureFlags.IS_STUDIO_BUILD && mOutlineGeneratorCallback != null) {
throw new RuntimeException("Drag outline generated twice");
@@ -152,6 +165,22 @@ public class DragPreviewProvider {
return scale;
}
+ /** Returns the scale and position of a given view for drag-n-drop. */
+ public float getScaleAndPosition(View view, int[] outPos) {
+ float scale = Launcher.getLauncher(mView.getContext())
+ .getDragLayer().getLocationInDragLayer(mView, outPos);
+ if (mView instanceof LauncherAppWidgetHostView) {
+ // App widgets are technically scaled, but are drawn at their expected size -- so the
+ // app widget scale should not affect the scale of the preview.
+ scale /= ((LauncherAppWidgetHostView) mView).getScaleToFit();
+ }
+
+ outPos[0] = Math.round(outPos[0]
+ - (view.getWidth() - scale * mView.getWidth() * mView.getScaleX()) / 2);
+ outPos[1] = Math.round(outPos[1] - (1 - scale) * view.getHeight() / 2 - previewPadding / 2);
+ return scale;
+ }
+
protected Bitmap convertPreviewToAlphaBitmap(Bitmap preview) {
return preview.copy(Bitmap.Config.ALPHA_8, true);
}
diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java
index 6a75e6254d..7b3e509d52 100644
--- a/src/com/android/launcher3/model/GridSizeMigrationTask.java
+++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java
@@ -53,7 +53,7 @@ import java.util.HashSet;
public class GridSizeMigrationTask {
private static final String TAG = "GridSizeMigrationTask";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
// These are carefully selected weights for various item types (Math.random?), to allow for
// the least absurd migration experience.
diff --git a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
index cee93041e5..8a1d73ed72 100644
--- a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
+++ b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
@@ -67,7 +67,7 @@ import java.util.Set;
public class GridSizeMigrationTaskV2 {
private static final String TAG = "GridSizeMigrationTaskV2";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private final Context mContext;
private final SQLiteDatabase mDb;
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index e54f1e7705..05fd77d720 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -66,7 +66,7 @@ import java.util.Optional;
*/
public class ItemInfo {
- public static final boolean DEBUG = true;
+ public static final boolean DEBUG = false;
public static final int NO_ID = -1;
/**
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 60dd0f353d..3296ea51f6 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -109,10 +109,10 @@ public final class TestProtocol {
public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation";
public static final String PERMANENT_DIAG_TAG = "TaplTarget";
- public static final String RECEIVER_LEAK = "b/185385047";
+ public static final String LAUNCHER_NOT_TRANSPOSED = "b/185820525";
public static final String NO_SWIPE_TO_HOME = "b/158017601";
public static final String WORK_PROFILE_REMOVED = "b/159671700";
public static final String TIS_NO_EVENTS = "b/180915942";
public static final String GET_RECENTS_FAILED = "b/177472267";
- public static final String TWO_BUTTON_NORMAL_NOT_OVERVIEW = "b/13714484";
+ public static final String TWO_BUTTON_NORMAL_NOT_OVERVIEW = "b/177316094";
}
diff --git a/src/com/android/launcher3/util/ConfigMonitor.java b/src/com/android/launcher3/util/ConfigMonitor.java
index b3b69f6ab3..f7023e8f44 100644
--- a/src/com/android/launcher3/util/ConfigMonitor.java
+++ b/src/com/android/launcher3/util/ConfigMonitor.java
@@ -26,6 +26,7 @@ import android.content.res.Configuration;
import android.graphics.Point;
import android.util.Log;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
import com.android.launcher3.util.DisplayController.Info;
@@ -72,6 +73,10 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayInfoChang
// Listen for configuration change
mContext.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "ConfigMonitor.register: this="
+ + System.identityHashCode(this) + " callback=" + callback.getClass().getName());
+ }
}
@Override
@@ -113,6 +118,10 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayInfoChang
}
public void unregister() {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "ConfigMonitor.unregister: this="
+ + System.identityHashCode(this));
+ }
try {
mContext.unregisterReceiver(this);
DisplayController.getDefaultDisplay(mContext).removeChangeListener(this);
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 95b887c4c6..415f48d30f 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -114,7 +114,7 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView
}
PendingItemDragHelper dragHelper = new PendingItemDragHelper(v);
- dragHelper.setRemoteViewsPreview(v.getPreview());
+ dragHelper.setRemoteViewsPreview(v.getRemoteViewsPreview());
dragHelper.setAppWidgetHostViewPreview(v.getAppWidgetHostViewPreview());
if (image.getDrawable() != null) {
diff --git a/src/com/android/launcher3/widget/PendingItemDragHelper.java b/src/com/android/launcher3/widget/PendingItemDragHelper.java
index e78d517b09..cea4de7b37 100644
--- a/src/com/android/launcher3/widget/PendingItemDragHelper.java
+++ b/src/com/android/launcher3/widget/PendingItemDragHelper.java
@@ -23,6 +23,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.View;
+import android.view.View.MeasureSpec;
import android.widget.RemoteViews;
import androidx.annotation.Nullable;
@@ -33,7 +34,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.R;
-import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.graphics.DragPreviewProvider;
@@ -54,7 +54,7 @@ public class PendingItemDragHelper extends DragPreviewProvider {
private int[] mEstimatedCellSize;
@Nullable private RemoteViews mRemoteViewsPreview;
- @Nullable private LauncherAppWidgetHostView mAppWidgetHostViewPreview;
+ @Nullable private NavigableAppWidgetHostView mAppWidgetHostViewPreview;
private final float mEnforcedRoundedCornersForWidget;
public PendingItemDragHelper(View view) {
@@ -72,9 +72,9 @@ public class PendingItemDragHelper extends DragPreviewProvider {
mRemoteViewsPreview = remoteViewsPreview;
}
- /** Sets a {@link LauncherAppWidgetHostView} which shows a preview layout of an app widget. */
+ /** Sets a {@link NavigableAppWidgetHostView} which shows a preview layout of an app widget. */
public void setAppWidgetHostViewPreview(
- @Nullable LauncherAppWidgetHostView appWidgetHostViewPreview) {
+ @Nullable NavigableAppWidgetHostView appWidgetHostViewPreview) {
mAppWidgetHostViewPreview = appWidgetHostViewPreview;
}
@@ -93,6 +93,8 @@ public class PendingItemDragHelper extends DragPreviewProvider {
LauncherAppState app = LauncherAppState.getInstance(launcher);
Drawable preview = null;
+ final int previewWidth;
+ final int previewHeight;
final float scale;
final Point dragOffset;
final Rect dragRegion;
@@ -109,17 +111,29 @@ public class PendingItemDragHelper extends DragPreviewProvider {
int[] previewSizeBeforeScale = new int[1];
if (mRemoteViewsPreview != null) {
- preview = new FastBitmapDrawable(
- WidgetCell.generateFromRemoteViews(launcher, mRemoteViewsPreview,
- createWidgetInfo.info, maxWidth, previewSizeBeforeScale));
+ mAppWidgetHostViewPreview = new LauncherAppWidgetHostView(launcher);
+ mAppWidgetHostViewPreview.setAppWidget(/* appWidgetId= */ -1,
+ ((PendingAddWidgetInfo) mAddInfo).info);
+ DeviceProfile deviceProfile = launcher.getDeviceProfile();
+ Rect padding = new Rect();
+ mAppWidgetHostViewPreview.getWidgetInset(deviceProfile, padding);
+ mAppWidgetHostViewPreview.setPadding(padding.left, padding.top, padding.right,
+ padding.bottom);
+ mAppWidgetHostViewPreview.updateAppWidget(/* remoteViews= */ mRemoteViewsPreview);
+ int width =
+ deviceProfile.cellWidthPx * mAddInfo.spanX + padding.left + padding.right;
+ int height =
+ deviceProfile.cellHeightPx * mAddInfo.spanY + padding.top + padding.bottom;
+ mAppWidgetHostViewPreview.measure(
+ MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
}
if (mAppWidgetHostViewPreview != null) {
- preview = new AppWidgetHostViewDrawable(mAppWidgetHostViewPreview);
previewSizeBeforeScale[0] = mAppWidgetHostViewPreview.getMeasuredWidth();
launcher.getDragController()
.addDragListener(new AppWidgetHostViewDragListener(launcher));
}
- if (preview == null) {
+ if (preview == null && mAppWidgetHostViewPreview == null) {
Drawable p = new FastBitmapDrawable(
app.getWidgetCache().generateWidgetPreview(launcher,
createWidgetInfo.info, maxWidth, null,
@@ -140,7 +154,14 @@ public class PendingItemDragHelper extends DragPreviewProvider {
previewBounds.left += padding;
previewBounds.right -= padding;
}
- scale = previewBounds.width() / (float) preview.getIntrinsicWidth();
+ if (mAppWidgetHostViewPreview != null) {
+ previewWidth = mAppWidgetHostViewPreview.getMeasuredWidth();
+ previewHeight = mAppWidgetHostViewPreview.getMeasuredHeight();
+ } else {
+ previewWidth = preview.getIntrinsicWidth();
+ previewHeight = preview.getIntrinsicHeight();
+ }
+ scale = previewBounds.width() / (float) previewWidth;
launcher.getDragController().addDragListener(new WidgetHostViewLoader(launcher, mView));
dragOffset = null;
@@ -152,8 +173,10 @@ public class PendingItemDragHelper extends DragPreviewProvider {
LauncherIcons li = LauncherIcons.obtain(launcher);
preview = new FastBitmapDrawable(
li.createScaledBitmapWithoutShadow(icon, 0));
+ previewWidth = preview.getIntrinsicWidth();
+ previewHeight = preview.getIntrinsicHeight();
li.recycle();
- scale = ((float) launcher.getDeviceProfile().iconSizePx) / preview.getIntrinsicWidth();
+ scale = ((float) launcher.getDeviceProfile().iconSizePx) / previewWidth;
dragOffset = new Point(previewPadding / 2, previewPadding / 2);
@@ -181,13 +204,19 @@ public class PendingItemDragHelper extends DragPreviewProvider {
launcher.getWorkspace().prepareDragWithProvider(this);
int dragLayerX = screenPos.x + previewBounds.left
- + (int) ((scale * preview.getIntrinsicWidth() - preview.getIntrinsicWidth()) / 2);
+ + (int) ((scale * previewWidth - previewWidth) / 2);
int dragLayerY = screenPos.y + previewBounds.top
- + (int) ((scale * preview.getIntrinsicHeight() - preview.getIntrinsicHeight()) / 2);
+ + (int) ((scale * previewHeight - previewHeight) / 2);
// Start the drag
- launcher.getDragController().startDrag(preview, draggableView, dragLayerX, dragLayerY,
- source, mAddInfo, dragOffset, dragRegion, scale, scale, options);
+ if (mAppWidgetHostViewPreview != null) {
+ launcher.getDragController().startDrag(mAppWidgetHostViewPreview, draggableView,
+ dragLayerX, dragLayerY, source, mAddInfo, dragOffset, dragRegion, scale, scale,
+ options);
+ } else {
+ launcher.getDragController().startDrag(preview, draggableView, dragLayerX, dragLayerY,
+ source, mAddInfo, dragOffset, dragRegion, scale, scale, options);
+ }
}
@Override
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index c08160bbef..3fcd3f7b03 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -46,7 +46,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.WidgetPreviewLoader;
import com.android.launcher3.icons.BaseIconFactory;
-import com.android.launcher3.icons.BitmapRenderer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.icons.RoundDrawableWrapper;
import com.android.launcher3.model.WidgetItem;
@@ -100,8 +99,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private final CheckLongPressHelper mLongPressHelper;
private final float mEnforcedCornerRadius;
- private RemoteViews mPreview;
- private LauncherAppWidgetHostView mAppWidgetHostViewPreview;
+ private RemoteViews mRemoteViewsPreview;
+ private NavigableAppWidgetHostView mAppWidgetHostViewPreview;
public WidgetCell(Context context) {
this(context, null);
@@ -143,12 +142,13 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mWidgetDescription = findViewById(R.id.widget_description);
}
- public void setPreview(RemoteViews view) {
- mPreview = view;
+ public void setRemoteViewsPreview(RemoteViews view) {
+ mRemoteViewsPreview = view;
}
- public RemoteViews getPreview() {
- return mPreview;
+ @Nullable
+ public RemoteViews getRemoteViewsPreview() {
+ return mRemoteViewsPreview;
}
/**
@@ -172,7 +172,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mActiveRequest.cancel();
mActiveRequest = null;
}
- mPreview = null;
+ mRemoteViewsPreview = null;
if (mAppWidgetHostViewPreview != null) {
mWidgetImageContainer.removeView(mAppWidgetHostViewPreview);
}
@@ -180,7 +180,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
}
public void applyFromCellItem(WidgetItem item, WidgetPreviewLoader loader) {
- applyPreviewLayout(item);
+ applyPreviewOnAppWidgetHostView(item);
mItem = item;
mWidgetName.setText(mItem.label);
@@ -206,9 +206,26 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
}
}
- private void applyPreviewLayout(WidgetItem item) {
+
+ private void applyPreviewOnAppWidgetHostView(WidgetItem item) {
+ if (mRemoteViewsPreview != null) {
+ mAppWidgetHostViewPreview = new NavigableAppWidgetHostView(getContext()) {
+ @Override
+ protected boolean shouldAllowDirectClick() {
+ return false;
+ }
+ };
+ mAppWidgetHostViewPreview.setAppWidget(/* appWidgetId= */ -1, item.widgetInfo);
+ Rect padding = new Rect();
+ mAppWidgetHostViewPreview.getWidgetInset(mActivity.getDeviceProfile(), padding);
+ mAppWidgetHostViewPreview.setPadding(padding.left, padding.top, padding.right,
+ padding.bottom);
+ mAppWidgetHostViewPreview.updateAppWidget(/* remoteViews= */ mRemoteViewsPreview);
+ return;
+ }
+
if (ATLEAST_S
- && mPreview == null
+ && mRemoteViewsPreview == null
&& item.widgetInfo != null
&& item.widgetInfo.previewLayout != Resources.ID_NULL) {
mAppWidgetHostViewPreview = new LauncherAppWidgetHostView(getContext());
@@ -234,7 +251,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
}
@Nullable
- public LauncherAppWidgetHostView getAppWidgetHostViewPreview() {
+ public NavigableAppWidgetHostView getAppWidgetHostViewPreview() {
return mAppWidgetHostViewPreview;
}
@@ -303,15 +320,6 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
}
public void ensurePreview() {
- if (mPreview != null && mActiveRequest == null) {
- Bitmap preview = generateFromRemoteViews(
- mActivity, mPreview, mItem.widgetInfo, mPresetPreviewSize, new int[1]);
- if (preview != null) {
- applyPreview(new FastBitmapDrawable(preview));
- return;
- }
- }
-
if (mAppWidgetHostViewPreview != null) {
setContainerSize(mPreviewWidth, mPreviewHeight);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
@@ -385,53 +393,4 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
super.onInitializeAccessibilityNodeInfo(info);
info.removeAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK);
}
-
- /**
- * Generates a bitmap by inflating {@param views}.
- * @see com.android.launcher3.WidgetPreviewLoader#generateWidgetPreview
- *
- * TODO: Consider moving this to the background thread.
- */
- public static Bitmap generateFromRemoteViews(BaseActivity activity, RemoteViews views,
- LauncherAppWidgetProviderInfo info, int previewSize, int[] preScaledWidthOut) {
- try {
- return generateFromView(activity, views.apply(activity, new FrameLayout(activity)),
- info, previewSize, preScaledWidthOut);
- } catch (Exception e) {
- return null;
- }
- }
-
- private static Bitmap generateFromView(BaseActivity activity, View v,
- LauncherAppWidgetProviderInfo info, int previewSize, int[] preScaledWidthOut) {
-
- DeviceProfile dp = activity.getDeviceProfile();
- int viewWidth = dp.cellWidthPx * info.spanX;
- int viewHeight = dp.cellHeightPx * info.spanY;
-
- v.measure(MeasureSpec.makeMeasureSpec(viewWidth, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(viewHeight, MeasureSpec.EXACTLY));
-
- viewWidth = v.getMeasuredWidth();
- viewHeight = v.getMeasuredHeight();
- v.layout(0, 0, viewWidth, viewHeight);
-
- preScaledWidthOut[0] = viewWidth;
- final int bitmapWidth, bitmapHeight;
- final float scale;
- if (viewWidth > previewSize) {
- scale = ((float) previewSize) / viewWidth;
- bitmapWidth = previewSize;
- bitmapHeight = (int) (viewHeight * scale);
- } else {
- scale = 1;
- bitmapWidth = viewWidth;
- bitmapHeight = viewHeight;
- }
-
- return BitmapRenderer.createSoftwareBitmap(bitmapWidth, bitmapHeight, c -> {
- c.scale(scale, scale);
- v.draw(c);
- });
- }
}
diff --git a/src/com/android/launcher3/widget/dragndrop/AppWidgetHostViewDragListener.java b/src/com/android/launcher3/widget/dragndrop/AppWidgetHostViewDragListener.java
index 66bb363dde..4a60983624 100644
--- a/src/com/android/launcher3/widget/dragndrop/AppWidgetHostViewDragListener.java
+++ b/src/com/android/launcher3/widget/dragndrop/AppWidgetHostViewDragListener.java
@@ -17,7 +17,6 @@ package com.android.launcher3.widget.dragndrop;
import com.android.launcher3.DropTarget;
import com.android.launcher3.Launcher;
-import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
@@ -26,7 +25,6 @@ import com.android.launcher3.widget.LauncherAppWidgetHostView;
public final class AppWidgetHostViewDragListener implements DragController.DragListener {
private final Launcher mLauncher;
private DropTarget.DragObject mDragObject;
- private AppWidgetHostViewDrawable mAppWidgetHostViewDrawable;
private LauncherAppWidgetHostView mAppWidgetHostView;
public AppWidgetHostViewDragListener(Launcher launcher) {
@@ -35,11 +33,9 @@ public final class AppWidgetHostViewDragListener implements DragController.DragL
@Override
public void onDragStart(DropTarget.DragObject dragObject, DragOptions unused) {
- if (dragObject.dragView.getDrawable() instanceof AppWidgetHostViewDrawable) {
+ if (dragObject.dragView.getContentView() instanceof LauncherAppWidgetHostView) {
mDragObject = dragObject;
- mAppWidgetHostViewDrawable =
- (AppWidgetHostViewDrawable) mDragObject.dragView.getDrawable();
- mAppWidgetHostView = mAppWidgetHostViewDrawable.getAppWidgetHostView();
+ mAppWidgetHostView = (LauncherAppWidgetHostView) dragObject.dragView.getContentView();
mAppWidgetHostView.startDrag(this);
} else {
mLauncher.getDragController().removeDragListener(this);
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 5543256897..240958bc36 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -50,6 +50,7 @@ import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.model.WidgetItem;
@@ -278,6 +279,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
super.onAttachedToWindow();
mLauncher.getAppWidgetHost().addProviderChangeListener(this);
notifyWidgetProvidersChanged();
+ onRecommendedWidgetsBound();
}
@Override
@@ -415,6 +417,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
@Override
public void exitSearchMode() {
+ if (!mIsInSearchMode) return;
onSearchResults(new ArrayList<>());
setViewVisibilityBasedOnSearch(/*isInSearchMode=*/ false);
if (mHasWorkProfile) {
@@ -463,7 +466,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mLauncher.getPopupDataProvider().getRecommendedWidgets();
WidgetsRecommendationTableLayout table =
mSearchAndRecommendationViewHolder.mRecommendedWidgetsTable;
- if (recommendedWidgets.size() > 0) {
+ if (!mIsInSearchMode && recommendedWidgets.size() > 0) {
// TODO(b/185508758): Revert the following log after debugging.
if (getHeaderViewHeight() == 0) {
Log.d(TAG, "Header view height is 0 when inflating recommended widgets");
@@ -649,7 +652,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
}
private boolean hasSeenEducationTip() {
- return mLauncher.getSharedPrefs().getBoolean(WIDGETS_EDUCATION_TIP_SEEN, false);
+ return mLauncher.getSharedPrefs().getBoolean(WIDGETS_EDUCATION_TIP_SEEN, false)
+ || Utilities.IS_RUNNING_IN_TEST_HARNESS;
}
/** A holder class for holding adapters & their corresponding recycler view. */
diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
index 824b5806f4..1aefe41f7b 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
@@ -146,7 +146,7 @@ public final class WidgetsRecommendationTableLayout extends TableLayout {
List widgetItems = recommendedWidgetsInTable.get(i);
float rowHeight = 0;
for (int j = 0; j < widgetItems.size(); j++) {
- float previewHeight = widgetItems.get(j).spanY * deviceProfile.allAppsCellHeightPx
+ float previewHeight = widgetItems.get(j).spanY * deviceProfile.cellHeightPx
* previewScale;
rowHeight = Math.max(rowHeight, previewHeight + mWidgetCellTextViewsHeight);
}
diff --git a/tests/dummy_app/Android.mk b/tests/dummy_app/Android.mk
index f4ab582ebf..3472079d16 100644
--- a/tests/dummy_app/Android.mk
+++ b/tests/dummy_app/Android.mk
@@ -7,6 +7,9 @@ LOCAL_MODULE_TAGS := samples
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Aardwolf
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE
LOCAL_SDK_VERSION := current
diff --git a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
index 266f0aeb1d..6c68daa8c1 100644
--- a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
+++ b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
@@ -4,6 +4,7 @@ import android.util.Log;
import android.view.Surface;
import com.android.launcher3.tapl.TestHelpers;
+import com.android.launcher3.testing.TestProtocol;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@@ -54,19 +55,23 @@ class PortraitLandscapeRunner implements TestRule {
}
private void evaluateInPortrait() throws Throwable {
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInPortrait");
mTest.mDevice.setOrientationNatural();
mTest.mLauncher.setExpectedRotation(Surface.ROTATION_0);
AbstractLauncherUiTest.checkDetectedLeaks(mTest.mLauncher);
base.evaluate();
mTest.getDevice().pressHome();
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInPortrait finished");
}
private void evaluateInLandscape() throws Throwable {
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInLandscape");
mTest.mDevice.setOrientationLeft();
mTest.mLauncher.setExpectedRotation(Surface.ROTATION_90);
AbstractLauncherUiTest.checkDetectedLeaks(mTest.mLauncher);
base.evaluate();
mTest.getDevice().pressHome();
+ Log.d(TestProtocol.LAUNCHER_NOT_TRANSPOSED, "evaluateInLandscape finished");
}
};
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java
index a3f9ade054..51e331de42 100644
--- a/tests/tapl/com/android/launcher3/tapl/Widgets.java
+++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java
@@ -169,12 +169,16 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
"widgets_table");
boolean hasHeaderExpanded = false;
+ int scrollDistance = 0;
for (int i = 0; i < SCROLL_ATTEMPTS; i++) {
UiObject2 fullWidgetsPicker = verifyActiveContainer();
UiObject2 header = mLauncher.waitForObjectInContainer(fullWidgetsPicker,
headerSelector);
- int headerHeight = header.getVisibleBounds().height();
+ // If a header is barely visible in the bottom edge of the screen, its height could be
+ // too small for a scroll gesture. Since all header should have roughly the same height,
+ // let's pick the max height we have seen so far.
+ scrollDistance = Math.max(scrollDistance, header.getVisibleBounds().height());
// Look for a header that has the test app name.
UiObject2 headerTitle = mLauncher.findObjectInContainer(fullWidgetsPicker,
@@ -196,7 +200,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
return widgetsContainer;
}
}
- mLauncher.scrollDownByDistance(fullWidgetsPicker, headerHeight);
+ log("Finding test widget package - scroll with distance: " + scrollDistance);
+ mLauncher.scrollDownByDistance(fullWidgetsPicker, scrollDistance);
}
return null;