Merge "Add support for testing in portrait mode" into ub-launcher3-master
diff --git a/proguard.flags b/proguard.flags
index a312b91..bb52a6c 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -2,80 +2,6 @@
*;
}
--keep class com.android.launcher3.allapps.AllAppsBackgroundDrawable {
- public void setAlpha(int);
- public int getAlpha();
-}
-
--keep class com.android.launcher3.BaseRecyclerViewFastScrollBar {
- public void setThumbWidth(int);
- public int getThumbWidth();
- public void setTrackWidth(int);
- public int getTrackWidth();
-}
-
--keep class com.android.launcher3.BaseRecyclerViewFastScrollPopup {
- public void setAlpha(float);
- public float getAlpha();
-}
-
--keep class com.android.launcher3.ButtonDropTarget {
- public int getTextColor();
-}
-
--keep class com.android.launcher3.CellLayout {
- public float getBackgroundAlpha();
- public void setBackgroundAlpha(float);
-}
-
--keep class com.android.launcher3.CellLayout$LayoutParams {
- public void setWidth(int);
- public int getWidth();
- public void setHeight(int);
- public int getHeight();
- public void setX(int);
- public int getX();
- public void setY(int);
- public int getY();
-}
-
--keep class com.android.launcher3.views.BaseDragLayer$LayoutParams {
- public void setWidth(int);
- public int getWidth();
- public void setHeight(int);
- public int getHeight();
- public void setX(int);
- public int getX();
- public void setY(int);
- public int getY();
-}
-
--keep class com.android.launcher3.FastBitmapDrawable {
- public void setDesaturation(float);
- public float getDesaturation();
- public void setBrightness(float);
- public float getBrightness();
-}
-
--keep class com.android.launcher3.MemoryDumpActivity {
- *;
-}
-
--keep class com.android.launcher3.PreloadIconDrawable {
- public float getAnimationProgress();
- public void setAnimationProgress(float);
-}
-
--keep class com.android.launcher3.pageindicators.CaretDrawable {
- public float getCaretProgress();
- public void setCaretProgress(float);
-}
-
--keep class com.android.launcher3.Workspace {
- public float getBackgroundAlpha();
- public void setBackgroundAlpha(float);
-}
-
# Proguard will strip new callbacks in LauncherApps.Callback from
# WrappedCallback if compiled against an older SDK. Don't let this happen.
-keep class com.android.launcher3.compat.** {
diff --git a/res/values/config.xml b/res/values/config.xml
index 9f97478..0efaccf 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -101,9 +101,6 @@
<!-- View ID used by cell layout to jail its content -->
<item type="id" name="cell_layout_jail_id" />
- <!-- Tag id used for view scrim -->
- <item type="id" name="view_scrim" />
-
<!-- View IDs to store item highlight information -->
<item type="id" name="view_unhighlight_background" />
<item type="id" name="view_highlighted" />
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 0f5317b..8e2ffe9 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -1,5 +1,10 @@
package com.android.launcher3;
+import static com.android.launcher3.LauncherAnimUtils.LAYOUT_HEIGHT;
+import static com.android.launcher3.LauncherAnimUtils.LAYOUT_WIDTH;
+import static com.android.launcher3.views.BaseDragLayer.LAYOUT_X;
+import static com.android.launcher3.views.BaseDragLayer.LAYOUT_Y;
+
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
@@ -429,10 +434,10 @@
requestLayout();
} else {
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(lp,
- PropertyValuesHolder.ofInt("width", lp.width, newWidth),
- PropertyValuesHolder.ofInt("height", lp.height, newHeight),
- PropertyValuesHolder.ofInt("x", lp.x, newX),
- PropertyValuesHolder.ofInt("y", lp.y, newY));
+ PropertyValuesHolder.ofInt(LAYOUT_WIDTH, lp.width, newWidth),
+ PropertyValuesHolder.ofInt(LAYOUT_HEIGHT, lp.height, newHeight),
+ PropertyValuesHolder.ofInt(LAYOUT_X, lp.x, newX),
+ PropertyValuesHolder.ofInt(LAYOUT_Y, lp.y, newY));
mFirstFrameAnimatorHelper.addTo(oa).addUpdateListener(a -> requestLayout());
AnimatorSet set = new AnimatorSet();
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index dd63ebc..2b0da43 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -33,6 +33,7 @@
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.util.Property;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -55,6 +56,20 @@
public abstract class ButtonDropTarget extends TextView
implements DropTarget, DragController.DragListener, OnClickListener {
+ private static final Property<ButtonDropTarget, Integer> TEXT_COLOR =
+ new Property<ButtonDropTarget, Integer>(Integer.TYPE, "textColor") {
+
+ @Override
+ public Integer get(ButtonDropTarget target) {
+ return target.getTextColor();
+ }
+
+ @Override
+ public void set(ButtonDropTarget target, Integer value) {
+ target.setTextColor(value);
+ }
+ };
+
private static final int[] sTempCords = new int[2];
private static final int DRAG_VIEW_DROP_DURATION = 285;
@@ -206,7 +221,7 @@
});
mCurrentColorAnim.play(anim1);
- mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, "textColor", targetColor));
+ mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, TEXT_COLOR, targetColor));
mCurrentColorAnim.start();
}
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index f6f1496..a42238e 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -2678,38 +2678,6 @@
public String toString() {
return "(" + this.cellX + ", " + this.cellY + ")";
}
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getX() {
- return x;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getY() {
- return y;
- }
}
// This class stores info for two purposes:
diff --git a/src/com/android/launcher3/InsettableFrameLayout.java b/src/com/android/launcher3/InsettableFrameLayout.java
index 1db1fc0..faa18b8 100644
--- a/src/com/android/launcher3/InsettableFrameLayout.java
+++ b/src/com/android/launcher3/InsettableFrameLayout.java
@@ -68,7 +68,7 @@
}
public static class LayoutParams extends FrameLayout.LayoutParams {
- boolean ignoreInsets = false;
+ public boolean ignoreInsets = false;
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index ac07e88..aad3449 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -19,6 +19,7 @@
import android.graphics.drawable.Drawable;
import android.util.Property;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
public class LauncherAnimUtils {
/**
@@ -64,4 +65,30 @@
public static int blockedFlingDurationFactor(float velocity) {
return (int) Utilities.boundToRange(Math.abs(velocity) / 2, 2f, 6f);
}
+
+ public static final Property<LayoutParams, Integer> LAYOUT_WIDTH =
+ new Property<LayoutParams, Integer>(Integer.TYPE, "width") {
+ @Override
+ public Integer get(LayoutParams lp) {
+ return lp.width;
+ }
+
+ @Override
+ public void set(LayoutParams lp, Integer width) {
+ lp.width = width;
+ }
+ };
+
+ public static final Property<LayoutParams, Integer> LAYOUT_HEIGHT =
+ new Property<LayoutParams, Integer>(Integer.TYPE, "height") {
+ @Override
+ public Integer get(LayoutParams lp) {
+ return lp.height;
+ }
+
+ @Override
+ public void set(LayoutParams lp, Integer height) {
+ lp.height = height;
+ }
+ };
}
diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java
index 8589b7e..1f80226 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -88,6 +88,11 @@
@Override
public boolean onPreferenceStartFragment(
PreferenceFragment preferenceFragment, Preference pref) {
+ if (getFragmentManager().isStateSaved()) {
+ // Sometimes onClick can come after onPause because of being posted on the handler.
+ // Skip starting new fragments in that case.
+ return false;
+ }
Fragment f = Fragment.instantiate(this, pref.getFragment(), pref.getExtras());
if (f instanceof DialogFragment) {
((DialogFragment) f).show(getFragmentManager(), pref.getKey());
@@ -241,8 +246,7 @@
* Content observer which listens for system badging setting changes,
* and updates the launcher badging setting subtext accordingly.
*/
- private static class IconBadgingObserver extends SettingsObserver.Secure
- implements Preference.OnPreferenceClickListener {
+ private static class IconBadgingObserver extends SettingsObserver.Secure {
private final ButtonPreference mBadgingPref;
private final ContentResolver mResolver;
@@ -275,16 +279,11 @@
}
}
mBadgingPref.setWidgetFrameVisible(!serviceEnabled);
- mBadgingPref.setOnPreferenceClickListener(serviceEnabled ? null : this);
+ mBadgingPref.setFragment(
+ serviceEnabled ? null : NotificationAccessConfirmation.class.getName());
mBadgingPref.setSummary(summary);
}
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- new NotificationAccessConfirmation().show(mFragmentManager, "notification_access");
- return true;
- }
}
public static class NotificationAccessConfirmation
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 353916f..b5a770f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -671,9 +671,6 @@
private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
final boolean stripEmptyScreens) {
// XXX: Do we need to update LM workspace screens below?
- PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
- PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);
-
final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
mRemoveEmptyScreenRunnable = new Runnable() {
@@ -692,7 +689,7 @@
}
};
- ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
+ ObjectAnimator oa = ObjectAnimator.ofFloat(cl, ALPHA, 0f);
oa.setDuration(duration);
oa.setStartDelay(delay);
oa.addListener(new AnimatorListenerAdapter() {
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 6d2d3cb..f005ce7 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -47,7 +47,6 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
-import com.android.launcher3.graphics.ViewScrim;
import com.android.launcher3.graphics.WorkspaceAndHotseatScrim;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.uioverrides.UiFactory;
@@ -125,15 +124,6 @@
}
@Override
- protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
- ViewScrim scrim = ViewScrim.get(child);
- if (scrim != null) {
- scrim.draw(canvas, getWidth(), getHeight());
- }
- return super.drawChild(canvas, child, drawingTime);
- }
-
- @Override
protected boolean findActiveController(MotionEvent ev) {
if (mActivity.getStateManager().getState().disableInteraction) {
// You Shall Not Pass!!!
diff --git a/src/com/android/launcher3/graphics/ColorScrim.java b/src/com/android/launcher3/graphics/ColorScrim.java
deleted file mode 100644
index 5c1081a..0000000
--- a/src/com/android/launcher3/graphics/ColorScrim.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2018 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.graphics;
-
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.view.View;
-import android.view.animation.Interpolator;
-
-import com.android.launcher3.R;
-import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.uioverrides.WallpaperColorInfo;
-
-import androidx.core.graphics.ColorUtils;
-
-/**
- * Simple scrim which draws a color
- */
-public class ColorScrim extends ViewScrim {
-
- private final int mColor;
- private final Interpolator mInterpolator;
- private int mCurrentColor;
-
- public ColorScrim(View view, int color, Interpolator interpolator) {
- super(view);
- mColor = color;
- mInterpolator = interpolator;
- }
-
- @Override
- protected void onProgressChanged() {
- mCurrentColor = ColorUtils.setAlphaComponent(mColor,
- Math.round(mInterpolator.getInterpolation(mProgress) * Color.alpha(mColor)));
- }
-
- @Override
- public void draw(Canvas canvas, int width, int height) {
- if (mProgress > 0) {
- canvas.drawColor(mCurrentColor);
- }
- }
-
- public static ColorScrim createExtractedColorScrim(View view) {
- WallpaperColorInfo colors = WallpaperColorInfo.getInstance(view.getContext());
- int alpha = view.getResources().getInteger(R.integer.extracted_color_gradient_alpha);
- ColorScrim scrim = new ColorScrim(view, ColorUtils.setAlphaComponent(
- colors.getSecondaryColor(), alpha), Interpolators.LINEAR);
- scrim.attach();
- return scrim;
- }
-}
diff --git a/src/com/android/launcher3/graphics/ViewScrim.java b/src/com/android/launcher3/graphics/ViewScrim.java
deleted file mode 100644
index e1727e0..0000000
--- a/src/com/android/launcher3/graphics/ViewScrim.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2018 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.graphics;
-
-import android.graphics.Canvas;
-import android.util.Property;
-import android.view.View;
-import android.view.ViewParent;
-
-import com.android.launcher3.R;
-
-/**
- * A utility class that can be used to draw a scrim behind a view
- */
-public abstract class ViewScrim<T extends View> {
-
- public static Property<ViewScrim, Float> PROGRESS =
- new Property<ViewScrim, Float>(Float.TYPE, "progress") {
- @Override
- public Float get(ViewScrim viewScrim) {
- return viewScrim.mProgress;
- }
-
- @Override
- public void set(ViewScrim object, Float value) {
- object.setProgress(value);
- }
- };
-
- protected final T mView;
- protected float mProgress = 0;
-
- public ViewScrim(T view) {
- mView = view;
- }
-
- public void attach() {
- mView.setTag(R.id.view_scrim, this);
- }
-
- public void setProgress(float progress) {
- if (mProgress != progress) {
- mProgress = progress;
- onProgressChanged();
- invalidate();
- }
- }
-
- public abstract void draw(Canvas canvas, int width, int height);
-
- protected void onProgressChanged() { }
-
- public void invalidate() {
- ViewParent parent = mView.getParent();
- if (parent != null) {
- ((View) parent).invalidate();
- }
- }
-
- public static ViewScrim get(View view) {
- return (ViewScrim) view.getTag(R.id.view_scrim);
- }
-}
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index e8a879f..1faca15 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.util.Property;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -42,6 +43,32 @@
public abstract class BaseDragLayer<T extends Context & ActivityContext>
extends InsettableFrameLayout {
+ public static final Property<LayoutParams, Integer> LAYOUT_X =
+ new Property<LayoutParams, Integer>(Integer.TYPE, "x") {
+ @Override
+ public Integer get(LayoutParams lp) {
+ return lp.x;
+ }
+
+ @Override
+ public void set(LayoutParams lp, Integer x) {
+ lp.x = x;
+ }
+ };
+
+ public static final Property<LayoutParams, Integer> LAYOUT_Y =
+ new Property<LayoutParams, Integer>(Integer.TYPE, "y") {
+ @Override
+ public Integer get(LayoutParams lp) {
+ return lp.y;
+ }
+
+ @Override
+ public void set(LayoutParams lp, Integer y) {
+ lp.y = y;
+ }
+ };
+
protected final int[] mTmpXY = new int[2];
protected final Rect mHitRect = new Rect();
@@ -307,38 +334,6 @@
public LayoutParams(ViewGroup.LayoutParams lp) {
super(lp);
}
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getX() {
- return x;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getY() {
- return y;
- }
}
protected void onLayout(boolean changed, int l, int t, int r, int b) {
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 20c8876..48c18f8 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.widget;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import android.content.Context;
@@ -31,13 +33,16 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.dragndrop.DragOptions;
-import com.android.launcher3.graphics.ColorScrim;
import com.android.launcher3.touch.ItemLongClickListener;
+import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.AbstractSlideInView;
+import com.android.launcher3.views.BaseDragLayer;
+
+import androidx.core.graphics.ColorUtils;
/**
* Base class for various widgets popup
@@ -49,11 +54,11 @@
/* Touch handling related member variables. */
private Toast mWidgetInstructionToast;
- protected final ColorScrim mColorScrim;
+ protected final View mColorScrim;
public BaseWidgetSheet(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mColorScrim = ColorScrim.createExtractedColorScrim(this);
+ mColorScrim = createColorScrim(context);
}
@Override
@@ -80,9 +85,14 @@
return true;
}
+ protected void attachToContainer() {
+ getPopupContainer().addView(mColorScrim);
+ getPopupContainer().addView(this);
+ }
+
protected void setTranslationShift(float translationShift) {
super.setTranslationShift(translationShift);
- mColorScrim.setProgress(1 - mTranslationShift);
+ mColorScrim.setAlpha(1 - mTranslationShift);
}
private boolean beginDraggingWidget(WidgetCell v) {
@@ -115,6 +125,7 @@
protected void onCloseComplete() {
super.onCloseComplete();
+ getPopupContainer().removeView(mColorScrim);
clearNavBarColor();
}
@@ -148,4 +159,19 @@
protected SystemUiController getSystemUiController() {
return mLauncher.getSystemUiController();
}
+
+ private static View createColorScrim(Context context) {
+ View view = new View(context);
+ view.forceHasOverlappingRendering(false);
+
+ WallpaperColorInfo colors = WallpaperColorInfo.getInstance(context);
+ int alpha = context.getResources().getInteger(R.integer.extracted_color_gradient_alpha);
+ view.setBackgroundColor(ColorUtils.setAlphaComponent(colors.getSecondaryColor(), alpha));
+
+ BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(MATCH_PARENT, MATCH_PARENT);
+ lp.ignoreInsets = true;
+ view.setLayoutParams(lp);
+
+ return view;
+ }
}
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 4ba6b5b..4bd6234 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -70,8 +70,7 @@
R.string.widgets_bottom_sheet_title, mOriginalItemInfo.title));
onWidgetsBound();
-
- getPopupContainer().addView(this);
+ attachToContainer();
mIsOpen = false;
animateOpen();
}
diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java
index f7ff69a..1112686 100644
--- a/src/com/android/launcher3/widget/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java
@@ -220,8 +220,8 @@
public static WidgetsFullSheet show(Launcher launcher, boolean animate) {
WidgetsFullSheet sheet = (WidgetsFullSheet) launcher.getLayoutInflater()
.inflate(R.layout.widgets_full_sheet, launcher.getDragLayer(), false);
+ sheet.attachToContainer();
sheet.mIsOpen = true;
- sheet.getPopupContainer().addView(sheet);
sheet.open(animate);
return sheet;
}
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
index ea47503..a11f6df 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -42,6 +42,7 @@
/**
* Clicks the icon to launch its app.
*/
+ @Deprecated
public Background launch() {
LauncherInstrumentation.log("AppIcon.launch before click");
LauncherInstrumentation.assertTrue(
@@ -50,6 +51,20 @@
return new Background(mLauncher);
}
+ /**
+ * Clicks the icon to launch its app.
+ */
+ public Background launch(String packageName) {
+ LauncherInstrumentation.log("AppIcon.launch before click");
+ LauncherInstrumentation.assertTrue(
+ "Launching an app didn't open a new window: " + mIcon.getText(),
+ mIcon.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS));
+ LauncherInstrumentation.assertTrue(
+ "App didn't start: " + packageName, mLauncher.getDevice().wait(Until.hasObject(
+ By.pkg(packageName).depth(0)), LauncherInstrumentation.WAIT_TIME_MS));
+ return new Background(mLauncher);
+ }
+
UiObject2 getIcon() {
return mIcon;
}