Fix crash for apps launched through non-BubbleTextView views.
* Same transition/animation, except we don't create a visual copy of the View.
Bug: 72314029
Bug: 70220260
Change-Id: I79898be1cae7160b5dc35cc1ea8ba3dc5b2db05c
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
index e221102..d56666a 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -156,12 +156,15 @@
}
private AnimatorSet getAppIconAnimator(View v) {
- // Create a copy of the app icon
+ boolean isBubbleTextView = v instanceof BubbleTextView;
mFloatingView = new ImageView(mLauncher);
- Bitmap iconBitmap = ((FastBitmapDrawable) ((BubbleTextView) v).getIcon()).getBitmap();
- mFloatingView.setImageDrawable(new FastBitmapDrawable(iconBitmap));
+ if (isBubbleTextView) {
+ // Create a copy of the app icon
+ Bitmap iconBitmap = ((FastBitmapDrawable) ((BubbleTextView) v).getIcon()).getBitmap();
+ mFloatingView.setImageDrawable(new FastBitmapDrawable(iconBitmap));
+ }
- // Position the copy of the app icon exactly on top of the original
+ // Position the floating view exactly on top of the original
Rect rect = new Rect();
mDragLayer.getDescendantRectRelativeToSelf(v, rect);
int viewLocationStart = mIsRtl
@@ -169,7 +172,9 @@
: rect.left;
int viewLocationTop = rect.top;
- ((BubbleTextView) v).getIconBounds(rect);
+ if (isBubbleTextView) {
+ ((BubbleTextView) v).getIconBounds(rect);
+ }
LayoutParams lp = new LayoutParams(rect.width(), rect.height());
lp.ignoreInsets = true;
lp.setMarginStart(viewLocationStart + rect.left);
@@ -226,8 +231,12 @@
}
private ValueAnimator getAppWindowAnimators(View v, RemoteAnimationTargetCompat[] targets) {
- Rect iconBounds = new Rect();
- ((BubbleTextView) v).getIconBounds(iconBounds);
+ Rect bounds = new Rect();
+ if (v instanceof BubbleTextView) {
+ ((BubbleTextView) v).getIconBounds(bounds);
+ } else {
+ mDragLayer.getDescendantRectRelativeToSelf(v, bounds);
+ }
int[] floatingViewBounds = new int[2];
Rect crop = new Rect();
@@ -251,8 +260,8 @@
final float easePercent = Interpolators.AGGRESSIVE_EASE.getInterpolation(percent);
// Calculate app icon size.
- float iconWidth = iconBounds.width() * mFloatingView.getScaleX();
- float iconHeight = iconBounds.height() * mFloatingView.getScaleY();
+ float iconWidth = bounds.width() * mFloatingView.getScaleX();
+ float iconHeight = bounds.height() * mFloatingView.getScaleY();
// Scale the app window to match the icon size.
float scaleX = iconWidth / mDeviceProfile.widthPx;
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 83cbf59..05ae021 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -82,7 +82,7 @@
@Override
public void onClick(View view) {
Rect sourceBounds = launcher.getViewBounds(view);
- Bundle opts = launcher.getActivityLaunchOptions(view, true);
+ Bundle opts = launcher.getActivityLaunchOptions(view, false);
InfoDropTarget.startDetailsActivityForInfo(itemInfo, launcher, sourceBounds, opts);
launcher.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view);