Merge "Using config for robo test configuration so that it can easily be customized" into ub-launcher3-rvc-dev
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 4259196..d7b5cf1 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -959,8 +959,13 @@
height = r.height();
}
- if (v != null && v.getViewType() == DraggableView.DRAGGABLE_ICON) {
- left += ((mCellWidth * spanX) - dragOutline.getWidth()) / 2;
+ // Center horizontaly
+ left += ((mCellWidth * spanX) - dragOutline.getWidth()) / 2;
+
+ if (v != null && v.getViewType() == DraggableView.DRAGGABLE_WIDGET) {
+ // Center vertically
+ top += ((mCellHeight * spanY) - dragOutline.getHeight()) / 2;
+ } else if (v != null && v.getViewType() == DraggableView.DRAGGABLE_ICON) {
int cHeight = getShortcutsAndWidgets().getCellContentHeight();
int cellPaddingY = (int) Math.max(0, ((mCellHeight - cHeight) / 2f));
top += cellPaddingY;
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e61b7a8..9e91e70 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -235,7 +235,8 @@
// we need to run the state change task again.
if (Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action) ||
Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) {
- enqueueModelUpdateTask(new UserLockStateChangedTask(user));
+ enqueueModelUpdateTask(new UserLockStateChangedTask(
+ user, Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)));
}
}
} else if (IS_STUDIO_BUILD && ACTION_FORCE_ROLOAD.equals(action)) {
diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java
index ed9dfbb..848c04a 100644
--- a/src/com/android/launcher3/graphics/DragPreviewProvider.java
+++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java
@@ -92,6 +92,8 @@
public Bitmap createDragBitmap() {
int width = 0;
int height = 0;
+ // Assume scaleX == scaleY, which is always the case for workspace items.
+ float scale = mView.getScaleX();
if (mView instanceof DraggableView) {
((DraggableView) mView).getVisualDragBounds(mTempRect);
width = mTempRect.width();
@@ -102,7 +104,7 @@
}
return BitmapRenderer.createHardwareBitmap(width + blurSizeOutline,
- height + blurSizeOutline, (c) -> drawDragView(c, 1));
+ height + blurSizeOutline, (c) -> drawDragView(c, scale));
}
public final void generateDragOutline(Bitmap preview) {
diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java
index a3adc82..03c0cfc 100644
--- a/src/com/android/launcher3/model/UserLockStateChangedTask.java
+++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.content.pm.ShortcutInfo;
import android.os.UserHandle;
-import android.os.UserManager;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
@@ -43,18 +42,19 @@
public class UserLockStateChangedTask extends BaseModelUpdateTask {
private final UserHandle mUser;
+ private boolean mIsUserUnlocked;
- public UserLockStateChangedTask(UserHandle user) {
+ public UserLockStateChangedTask(UserHandle user, boolean isUserUnlocked) {
mUser = user;
+ mIsUserUnlocked = isUserUnlocked;
}
@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
Context context = app.getContext();
- boolean isUserUnlocked = context.getSystemService(UserManager.class).isUserUnlocked(mUser);
HashMap<ShortcutKey, ShortcutInfo> pinnedShortcuts = new HashMap<>();
- if (isUserUnlocked) {
+ if (mIsUserUnlocked) {
QueryResult shortcuts = new ShortcutRequest(context, mUser)
.query(ShortcutRequest.PINNED);
if (shortcuts.wasSuccess()) {
@@ -65,7 +65,7 @@
// Shortcut manager can fail due to some race condition when the lock state
// changes too frequently. For the purpose of the update,
// consider it as still locked.
- isUserUnlocked = false;
+ mIsUserUnlocked = false;
}
}
@@ -77,7 +77,7 @@
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT
&& mUser.equals(itemInfo.user)) {
WorkspaceItemInfo si = (WorkspaceItemInfo) itemInfo;
- if (isUserUnlocked) {
+ if (mIsUserUnlocked) {
ShortcutKey key = ShortcutKey.fromItemInfo(si);
ShortcutInfo shortcut = pinnedShortcuts.get(key);
// We couldn't verify the shortcut during loader. If its no longer available
@@ -108,7 +108,7 @@
}
}
- if (isUserUnlocked) {
+ if (mIsUserUnlocked) {
dataModel.updateDeepShortcutCounts(
null, mUser,
new ShortcutRequest(context, mUser).query(ShortcutRequest.ALL));
diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
index 78acc34..6232a1d 100644
--- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java
@@ -365,10 +365,9 @@
@Override
public void getVisualDragBounds(Rect bounds) {
- int x = (int) (1 - getScaleToFit()) * getMeasuredWidth() / 2;
- int y = (int) (1 - getScaleToFit()) * getMeasuredWidth() / 2;
- int width = (int) getScaleToFit() * getMeasuredWidth();
- int height = (int) getScaleToFit() * getMeasuredHeight();
- bounds.set(x, y , x + width, y + height);
+ int width = (int) (getMeasuredWidth() * mScaleToFit);
+ int height = (int) (getMeasuredHeight() * mScaleToFit);
+
+ bounds.set(0, 0 , width, height);
}
}
diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
index 7ec6214..63e063f 100644
--- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
@@ -22,6 +22,7 @@
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
+import android.view.accessibility.AccessibilityNodeInfo;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.R;
@@ -220,4 +221,13 @@
}
super.setLayoutFrozen(frozen);
}
+
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
+ Log.d(TestProtocol.NO_SCROLL_END_WIDGETS,
+ "onInitializeAccessibilityNodeInfo, scrollable: " + info.isScrollable());
+ }
+ }
}
\ No newline at end of file