Merge "Removing unnecessary logging" into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 85daeff..5777fb9 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -274,7 +274,7 @@
public void onOverlayScrollChanged(float progress) {
// Round out the progress to dedupe frequent, non-perceptable updates
int progressI = (int) (progress * 256);
- float progressF = progressI / 256f;
+ float progressF = Utilities.boundToRange(progressI / 256f, 0f, 1f);
if (Float.compare(mOverlayScrollProgress, progressF) == 0) {
return;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java
index d14e8ef..0e12e30 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java
@@ -14,35 +14,18 @@
package com.android.launcher3.uioverrides.plugins;
-import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
-
import android.content.Context;
-import android.os.Looper;
import com.android.launcher3.Utilities;
import com.android.systemui.shared.plugins.PluginInitializer;
public class PluginInitializerImpl implements PluginInitializer {
@Override
- public Looper getBgLooper() {
- return MODEL_EXECUTOR.getLooper();
- }
-
- @Override
- public void onPluginManagerInit() {
- }
-
- @Override
- public String[] getWhitelistedPlugins(Context context) {
+ public String[] getPrivilegedPlugins(Context context) {
return new String[0];
}
@Override
- public PluginEnablerImpl getPluginEnabler(Context context) {
- return new PluginEnablerImpl(context);
- }
-
- @Override
public void handleWtfs() {
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java
index 2e422b7..15f89ad 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java
@@ -16,6 +16,8 @@
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
+import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -24,6 +26,7 @@
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.systemui.plugins.Plugin;
import com.android.systemui.plugins.PluginListener;
+import com.android.systemui.shared.plugins.PluginInstanceManager;
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.shared.plugins.PluginManagerImpl;
import com.android.systemui.shared.plugins.PluginPrefs;
@@ -31,6 +34,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
public class PluginManagerWrapper {
@@ -47,8 +51,14 @@
private PluginManagerWrapper(Context c) {
mContext = c;
PluginInitializerImpl pluginInitializer = new PluginInitializerImpl();
- mPluginManager = new PluginManagerImpl(c, pluginInitializer);
- mPluginEnabler = pluginInitializer.getPluginEnabler(c);
+ mPluginEnabler = new PluginEnablerImpl(c);
+ PluginInstanceManager.Factory instanceManagerFactory = new PluginInstanceManager.Factory(
+ c, c.getPackageManager(), MODEL_EXECUTOR.getLooper(), pluginInitializer);
+
+ mPluginManager = new PluginManagerImpl(c, instanceManagerFactory,
+ pluginInitializer.isDebuggable(),
+ Optional.ofNullable(Thread.getDefaultUncaughtExceptionHandler()), mPluginEnabler,
+ new PluginPrefs(c), pluginInitializer.getPrivilegedPlugins(c));
}
public PluginEnablerImpl getPluginEnabler() {
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index 19cad53..3239b00 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -106,7 +106,9 @@
boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow();
mActivity.getRootView().setForceHideBackArrow(true);
- mActivity.setHintUserWillBeActive();
+ if (!TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
+ mActivity.setHintUserWillBeActive();
+ }
if (!canUseWorkspaceView || appCanEnterPip) {
return new LauncherHomeAnimationFactory();
diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
index 65be624..b83e26e 100644
--- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
+++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
@@ -17,7 +17,6 @@
import android.content.Context;
import android.content.res.Resources;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -86,12 +85,7 @@
mSpeedSomewhatFast = res.getDimension(R.dimen.motion_pause_detector_speed_somewhat_fast);
mSpeedFast = res.getDimension(R.dimen.motion_pause_detector_speed_fast);
mForcePauseTimeout = new Alarm();
- mForcePauseTimeout.setOnAlarmListener(alarm -> {
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "onAlarm");
- }
- updatePaused(true /* isPaused */);
- });
+ mForcePauseTimeout.setOnAlarmListener(alarm -> updatePaused(true /* isPaused */));
mMakePauseHarderToTrigger = makePauseHarderToTrigger;
mVelocityProvider = new SystemVelocityProvider(axis);
}
@@ -128,9 +122,6 @@
long timeoutMs = TestProtocol.sForcePauseTimeout != null
? TestProtocol.sForcePauseTimeout
: mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT;
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "setAlarm: " + timeoutMs);
- }
mForcePauseTimeout.setAlarm(timeoutMs);
float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex));
if (mPreviousVelocity != null) {
@@ -172,9 +163,6 @@
}
}
}
- if (TestProtocol.sDebugTracing) {
- Log.d(TestProtocol.MOTION_PAUSE_TIMEOUT, "checkMotionPaused: " + isPaused);
- }
updatePaused(isPaused);
}
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index e4f5a19..45e7e69 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -59,7 +59,6 @@
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.FailureWatcher;
-import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.quickstep.views.RecentsView;
import org.junit.After;
@@ -215,7 +214,6 @@
// b/143488140
//@NavigationModeSwitch
@Test
- @ScreenRecord // b/187080582
public void testOverview() {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index 67840d1..bc8602c 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -49,6 +49,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
/**
* Test rule that allows executing a test with Quickstep on and then Quickstep off.
@@ -182,17 +183,12 @@
};
targetContext.getMainExecutor().execute(() ->
SYS_UI_NAVIGATION_MODE.addModeChangeListener(listener));
- // b/139137636
-// latch.await(60, TimeUnit.SECONDS);
+ latch.await(60, TimeUnit.SECONDS);
targetContext.getMainExecutor().execute(() ->
SYS_UI_NAVIGATION_MODE.removeModeChangeListener(listener));
- Wait.atMost(() -> "Navigation mode didn't change to " + expectedMode,
- () -> currentSysUiNavigationMode() == expectedMode, WAIT_TIME_MS,
- launcher);
- // b/139137636
-// assertTrue(launcher, "Navigation mode didn't change to " + expectedMode,
-// currentSysUiNavigationMode() == expectedMode, description);
+ assertTrue(launcher, "Navigation mode didn't change to " + expectedMode,
+ currentSysUiNavigationMode() == expectedMode, description);
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 164e755..177d744 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -37,7 +37,6 @@
import com.android.launcher3.tapl.OverviewActions;
import com.android.launcher3.tapl.OverviewTask;
import com.android.launcher3.ui.TaplTestsLauncher3;
-import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.views.RecentsView;
@@ -158,14 +157,7 @@
@Test
@NavigationModeSwitch
@PortraitLandscape
- @ScreenRecord //b/193125090
public void testOverviewActions() throws Exception {
- // Experimenting for b/165029151:
- final Overview overview = mLauncher.pressHome().switchToOverview();
- if (overview.hasTasks()) overview.dismissAllTasks();
- mLauncher.pressHome();
- //
-
startTestAppsWithCheck();
OverviewActions actionsView =
mLauncher.pressHome().switchToOverview().getOverviewActions();
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index c05016d..2c01163 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -152,6 +152,12 @@
<attr name="demoModeLayoutId" format="reference" />
<attr name="isScalable" format="boolean" />
<attr name="devicePaddingId" format="reference" />
+ <attr name="gridEnabled" format="integer" >
+ <!-- Enable on all devices; default value -->
+ <enum name="all_displays" value="0" />
+ <!-- Enable on single display devices only -->
+ <enum name="single_display" value="1" />
+ </attr>
</declare-styleable>
@@ -177,11 +183,20 @@
<attr name="borderSpacingDps" format="float" />
<attr name="iconImageSize" format="float" />
- <!-- landscapeIconSize defaults to iconSize, if not specified -->
+ <!-- landscapeIconSize defaults to iconImageSize, if not specified -->
<attr name="landscapeIconSize" format="float" />
+ <!-- twoPanelPortraitIconSize defaults to iconImageSize, if not specified -->
+ <attr name="twoPanelPortraitIconSize" format="float" />
+ <!-- twoPanelLandscapeIconSize defaults to landscapeIconSize, if not specified -->
+ <attr name="twoPanelLandscapeIconSize" format="float" />
+
<attr name="iconTextSize" format="float" />
<!-- landscapeIconTextSize defaults to iconTextSize, if not specified -->
<attr name="landscapeIconTextSize" format="float" />
+ <!-- twoPanelPortraitIconTextSize defaults to iconTextSize, if not specified -->
+ <attr name="twoPanelPortraitIconTextSize" format="float" />
+ <!-- twoPanelLandscapeIconTextSize defaults to landscapeIconTextSize, if not specified -->
+ <attr name="twoPanelLandscapeIconTextSize" format="float" />
<!-- If set, this display option is used to determine the default grid -->
<attr name="canBeDefault" format="boolean|integer" >
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 7acec1f..eb058e8 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -612,12 +612,30 @@
iconScale = Math.min(1f, scale);
cellScaleToFit = scale;
-
// Workspace
final boolean isVerticalLayout = isVerticalBarLayout();
- float invIconSizeDp = isLandscape ? inv.landscapeIconSize : inv.iconSize;
+ float invIconSizeDp;
+ float invIconTextSizeSp;
+
+ if (isTwoPanels) {
+ if (isLandscape) {
+ invIconSizeDp = inv.twoPanelLandscapeIconSize;
+ invIconTextSizeSp = inv.twoPanelLandscapeIconTextSize;
+ } else {
+ invIconSizeDp = inv.twoPanelPortraitIconSize;
+ invIconTextSizeSp = inv.twoPanelPortraitIconTextSize;
+ }
+ } else {
+ if (isLandscape) {
+ invIconSizeDp = inv.landscapeIconSize;
+ invIconTextSizeSp = inv.landscapeIconTextSize;
+ } else {
+ invIconSizeDp = inv.iconSize;
+ invIconTextSizeSp = inv.iconTextSize;
+ }
+ }
+
iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics, iconScale));
- float invIconTextSizeSp = isLandscape ? inv.landscapeIconTextSize : inv.iconTextSize;
iconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * iconScale);
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 10b3f98..1fc8958 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -35,6 +35,7 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.util.Xml;
@@ -68,6 +69,8 @@
private static final int DEFAULT_TRUE = -1;
private static final int DEFAULT_SPLIT_DISPLAY = 2;
+ private static final int GRID_ENABLED_ALL_DISPLAYS = 0;
+ private static final int GRID_ENABLED_SINGLE_DISPLAY = 1;
private static final String KEY_IDP_GRID_NAME = "idp_grid_name";
@@ -94,12 +97,17 @@
public int numFolderColumns;
public float iconSize;
public float landscapeIconSize;
+ public float twoPanelPortraitIconSize;
+ public float twoPanelLandscapeIconSize;
public float landscapeIconTextSize;
+ public float twoPanelPortraitIconTextSize;
+ public float twoPanelLandscapeIconTextSize;
public int iconBitmapSize;
public int fillResIconDpi;
public float iconTextSize;
public float allAppsIconSize;
public float allAppsIconTextSize;
+ public boolean isSplitDisplay;
public float minCellHeight;
public float minCellWidth;
@@ -157,9 +165,13 @@
numFolderColumns = p.numFolderColumns;
iconSize = p.iconSize;
landscapeIconSize = p.landscapeIconSize;
+ twoPanelPortraitIconSize = p.twoPanelPortraitIconSize;
+ twoPanelLandscapeIconSize = p.twoPanelLandscapeIconSize;
iconBitmapSize = p.iconBitmapSize;
iconTextSize = p.iconTextSize;
landscapeIconTextSize = p.landscapeIconTextSize;
+ twoPanelPortraitIconTextSize = p.twoPanelPortraitIconTextSize;
+ twoPanelLandscapeIconTextSize = p.twoPanelLandscapeIconTextSize;
numShownHotseatIcons = p.numShownHotseatIcons;
numDatabaseHotseatIcons = p.numDatabaseHotseatIcons;
numAllAppsColumns = p.numAllAppsColumns;
@@ -272,14 +284,19 @@
numFolderColumns = closestProfile.numFolderColumns;
isScalable = closestProfile.isScalable;
devicePaddingId = closestProfile.devicePaddingId;
+ this.isSplitDisplay = isSplitDisplay;
mExtraAttrs = closestProfile.extraAttrs;
iconSize = displayOption.iconSize;
landscapeIconSize = displayOption.landscapeIconSize;
+ twoPanelPortraitIconSize = displayOption.twoPanelPortraitIconSize;
+ twoPanelLandscapeIconSize = displayOption.twoPanelLandscapeIconSize;
iconBitmapSize = ResourceUtils.pxFromDp(iconSize, metrics);
iconTextSize = displayOption.iconTextSize;
landscapeIconTextSize = displayOption.landscapeIconTextSize;
+ twoPanelPortraitIconTextSize = displayOption.twoPanelPortraitIconTextSize;
+ twoPanelLandscapeIconTextSize = displayOption.twoPanelLandscapeIconTextSize;
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
minCellHeight = displayOption.minCellHeight;
@@ -378,16 +395,19 @@
if ((type == XmlPullParser.START_TAG)
&& GridOption.TAG_NAME.equals(parser.getName())) {
- GridOption gridOption = new GridOption(context, Xml.asAttributeSet(parser));
- final int displayDepth = parser.getDepth();
- while (((type = parser.next()) != XmlPullParser.END_TAG ||
- parser.getDepth() > displayDepth)
- && type != XmlPullParser.END_DOCUMENT) {
- if ((type == XmlPullParser.START_TAG) && "display-option".equals(
- parser.getName())) {
- profiles.add(new DisplayOption(gridOption, context,
- Xml.asAttributeSet(parser),
- isSplitDisplay ? DEFAULT_SPLIT_DISPLAY : DEFAULT_TRUE));
+ GridOption gridOption =
+ new GridOption(context, Xml.asAttributeSet(parser), isSplitDisplay);
+ if (gridOption.isEnabled) {
+ final int displayDepth = parser.getDepth();
+ while (((type = parser.next()) != XmlPullParser.END_TAG
+ || parser.getDepth() > displayDepth)
+ && type != XmlPullParser.END_DOCUMENT) {
+ if ((type == XmlPullParser.START_TAG) && "display-option".equals(
+ parser.getName())) {
+ profiles.add(new DisplayOption(gridOption, context,
+ Xml.asAttributeSet(parser),
+ isSplitDisplay ? DEFAULT_SPLIT_DISPLAY : DEFAULT_TRUE));
+ }
}
}
}
@@ -399,7 +419,7 @@
ArrayList<DisplayOption> filteredProfiles = new ArrayList<>();
if (!TextUtils.isEmpty(gridName)) {
for (DisplayOption option : profiles) {
- if (gridName.equals(option.grid.name)) {
+ if (gridName.equals(option.grid.name) && option.grid.isEnabled) {
filteredProfiles.add(option);
}
}
@@ -418,6 +438,32 @@
return filteredProfiles;
}
+ /**
+ * @return all the grid options that can be shown on the device
+ */
+ public List<GridOption> parseAllGridOptions(Context context) {
+ List<GridOption> result = new ArrayList<>();
+ try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) {
+ final int depth = parser.getDepth();
+ int type;
+ while (((type = parser.next()) != XmlPullParser.END_TAG
+ || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
+ if ((type == XmlPullParser.START_TAG)
+ && GridOption.TAG_NAME.equals(parser.getName())) {
+ GridOption option =
+ new GridOption(context, Xml.asAttributeSet(parser), isSplitDisplay);
+ if (option.isEnabled) {
+ result.add(option);
+ }
+ }
+ }
+ } catch (IOException | XmlPullParserException e) {
+ Log.e(TAG, "Error parsing device profile", e);
+ return Collections.emptyList();
+ }
+ return result;
+ }
+
private int getLauncherIconDensity(int requiredSize) {
// Densities typically defined by an app.
int[] densityBuckets = new int[] {
@@ -579,6 +625,7 @@
public final String name;
public final int numRows;
public final int numColumns;
+ public final boolean isEnabled;
private final int numFolderRows;
private final int numFolderColumns;
@@ -598,7 +645,7 @@
private final SparseArray<TypedValue> extraAttrs;
- public GridOption(Context context, AttributeSet attrs) {
+ public GridOption(Context context, AttributeSet attrs, boolean isSplitDisplay) {
TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.GridDisplayOption);
name = a.getString(R.styleable.GridDisplayOption_name);
@@ -631,6 +678,12 @@
devicePaddingId = a.getResourceId(
R.styleable.GridDisplayOption_devicePaddingId, 0);
+ final int enabledInt =
+ a.getInteger(R.styleable.GridDisplayOption_gridEnabled,
+ GRID_ENABLED_ALL_DISPLAYS);
+ isEnabled = enabledInt == GRID_ENABLED_ALL_DISPLAYS
+ || enabledInt == GRID_ENABLED_SINGLE_DISPLAY && !isSplitDisplay;
+
a.recycle();
extraAttrs = Themes.createValueMap(context, attrs,
IntArray.wrap(R.styleable.GridDisplayOption));
@@ -653,7 +706,11 @@
private float iconSize;
private float iconTextSize;
private float landscapeIconSize;
+ private float twoPanelPortraitIconSize;
+ private float twoPanelLandscapeIconSize;
private float landscapeIconTextSize;
+ private float twoPanelPortraitIconTextSize;
+ private float twoPanelLandscapeIconTextSize;
private float allAppsIconSize;
private float allAppsIconTextSize;
@@ -676,9 +733,19 @@
iconSize = a.getFloat(R.styleable.ProfileDisplayOption_iconImageSize, 0);
landscapeIconSize = a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconSize,
iconSize);
+ twoPanelPortraitIconSize = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelPortraitIconSize, iconSize);
+ twoPanelLandscapeIconSize = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelLandscapeIconSize,
+ landscapeIconSize);
iconTextSize = a.getFloat(R.styleable.ProfileDisplayOption_iconTextSize, 0);
landscapeIconTextSize = a.getFloat(
R.styleable.ProfileDisplayOption_landscapeIconTextSize, iconTextSize);
+ twoPanelPortraitIconTextSize = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelPortraitIconTextSize, iconTextSize);
+ twoPanelLandscapeIconTextSize = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelLandscapeIconTextSize,
+ landscapeIconTextSize);
allAppsIconSize = a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconSize,
iconSize);
@@ -704,9 +771,13 @@
private DisplayOption multiply(float w) {
iconSize *= w;
landscapeIconSize *= w;
+ twoPanelPortraitIconSize *= w;
+ twoPanelLandscapeIconSize *= w;
allAppsIconSize *= w;
iconTextSize *= w;
landscapeIconTextSize *= w;
+ twoPanelPortraitIconTextSize *= w;
+ twoPanelLandscapeIconTextSize *= w;
allAppsIconTextSize *= w;
minCellHeight *= w;
minCellWidth *= w;
@@ -717,9 +788,13 @@
private DisplayOption add(DisplayOption p) {
iconSize += p.iconSize;
landscapeIconSize += p.landscapeIconSize;
+ twoPanelPortraitIconSize += p.twoPanelPortraitIconSize;
+ twoPanelLandscapeIconSize += p.twoPanelLandscapeIconSize;
allAppsIconSize += p.allAppsIconSize;
iconTextSize += p.iconTextSize;
landscapeIconTextSize += p.landscapeIconTextSize;
+ twoPanelPortraitIconTextSize += p.twoPanelPortraitIconTextSize;
+ twoPanelLandscapeIconTextSize += p.twoPanelLandscapeIconTextSize;
allAppsIconTextSize += p.allAppsIconTextSize;
minCellHeight += p.minCellHeight;
minCellWidth += p.minCellWidth;
diff --git a/src/com/android/launcher3/graphics/GridCustomizationsProvider.java b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
index e4f5539..fc8d855 100644
--- a/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
+++ b/src/com/android/launcher3/graphics/GridCustomizationsProvider.java
@@ -9,7 +9,6 @@
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.pm.PackageManager;
-import android.content.res.XmlResourceParser;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
@@ -23,23 +22,13 @@
import android.os.Messenger;
import android.util.ArrayMap;
import android.util.Log;
-import android.util.Xml;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.InvariantDeviceProfile.GridOption;
-import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.Executors;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
/**
* Exposes various launcher grid options and allows the caller to change them.
* APIs:
@@ -94,7 +83,7 @@
MatrixCursor cursor = new MatrixCursor(new String[] {
KEY_NAME, KEY_ROWS, KEY_COLS, KEY_PREVIEW_COUNT, KEY_IS_DEFAULT});
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(getContext());
- for (GridOption gridOption : parseAllGridOptions()) {
+ for (GridOption gridOption : idp.parseAllGridOptions(getContext())) {
cursor.newRow()
.add(KEY_NAME, gridOption.name)
.add(KEY_ROWS, gridOption.numRows)
@@ -116,25 +105,6 @@
}
}
- private List<GridOption> parseAllGridOptions() {
- List<GridOption> result = new ArrayList<>();
- try (XmlResourceParser parser = getContext().getResources().getXml(R.xml.device_profiles)) {
- final int depth = parser.getDepth();
- int type;
- while (((type = parser.next()) != XmlPullParser.END_TAG ||
- parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
- if ((type == XmlPullParser.START_TAG)
- && GridOption.TAG_NAME.equals(parser.getName())) {
- result.add(new GridOption(getContext(), Xml.asAttributeSet(parser)));
- }
- }
- } catch (IOException | XmlPullParserException e) {
- Log.e(TAG, "Error parsing device profile", e);
- return Collections.emptyList();
- }
- return result;
- }
-
@Override
public String getType(Uri uri) {
return "vnd.android.cursor.dir/launcher_grid";
@@ -155,9 +125,10 @@
switch (uri.getPath()) {
case KEY_DEFAULT_GRID: {
String gridName = values.getAsString(KEY_NAME);
+ InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(getContext());
// Verify that this is a valid grid option
GridOption match = null;
- for (GridOption option : parseAllGridOptions()) {
+ for (GridOption option : idp.parseAllGridOptions(getContext())) {
if (option.name.equals(gridName)) {
match = option;
break;
@@ -167,8 +138,7 @@
return 0;
}
- InvariantDeviceProfile.INSTANCE.get(getContext())
- .setCurrentGrid(getContext(), gridName);
+ idp.setCurrentGrid(getContext(), gridName);
return 1;
}
case ICON_THEMED:
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index bb726f8..55995f2 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -270,13 +270,13 @@
CellLayout leftPanel = mRootView.findViewById(R.id.workspace_left);
leftPanel.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.top,
- mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
+ mDp.workspacePadding.right,
mDp.workspacePadding.bottom);
mWorkspaceScreens.put(LEFT_PANEL_ID, leftPanel);
}
CellLayout firstScreen = mRootView.findViewById(R.id.workspace);
- firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
+ firstScreen.setPadding(mDp.workspacePadding.left,
mDp.workspacePadding.top,
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
mDp.workspacePadding.bottom);
diff --git a/src/com/android/launcher3/testing/TestLogging.java b/src/com/android/launcher3/testing/TestLogging.java
index 6cdd3ca..103b565 100644
--- a/src/com/android/launcher3/testing/TestLogging.java
+++ b/src/com/android/launcher3/testing/TestLogging.java
@@ -17,6 +17,7 @@
package com.android.launcher3.testing;
import android.util.Log;
+import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -48,17 +49,24 @@
}
}
+ private static void registerEventNotFromTest(InputEvent event) {
+ if (!sHadEventsNotFromTest && event.getDeviceId() != -1) {
+ sHadEventsNotFromTest = true;
+ Log.d(TestProtocol.PERMANENT_DIAG_TAG, "First event not from test: " + event);
+ }
+ }
+
public static void recordKeyEvent(String sequence, String message, KeyEvent event) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
recordEventSlow(sequence, message + ": " + event);
- if (event.getDeviceId() != -1) sHadEventsNotFromTest = true;
+ registerEventNotFromTest(event);
}
}
public static void recordMotionEvent(String sequence, String message, MotionEvent event) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS && event.getAction() != MotionEvent.ACTION_MOVE) {
recordEventSlow(sequence, message + ": " + event);
- if (event.getDeviceId() != -1) sHadEventsNotFromTest = true;
+ registerEventNotFromTest(event);
}
}
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 38cbbe7..1c5b31b 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -118,6 +118,5 @@
public static final String WORK_PROFILE_REMOVED = "b/159671700";
public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015";
public static final String THIRD_PARTY_LAUNCHER_NOT_SET = "b/187080582";
- public static final String MOTION_PAUSE_TIMEOUT = "b/194114179";
public static final String TASK_VIEW_ID_CRASH = "b/195430732";
}
diff --git a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
index d3a0190..57a6d3f 100644
--- a/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/PendingAppWidgetHostView.java
@@ -85,7 +85,7 @@
setBackgroundResource(R.drawable.pending_widget_bg);
setWillNotDraw(false);
- updateAppWidget(null);
+ super.updateAppWidget(null);
setOnClickListener(ItemClickHandler.INSTANCE);
if (info.pendingItemInfo == null) {
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index a8ed154..bd444db 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -483,6 +483,20 @@
mAppWidgetHostViewPreview.measure(
makeMeasureSpec(MAX_MEASURE_SPEC_DIMENSION, MeasureSpec.UNSPECIFIED),
makeMeasureSpec(MAX_MEASURE_SPEC_DIMENSION, MeasureSpec.UNSPECIFIED));
+ if (mRemoteViewsPreview != null) {
+ // If RemoteViews contains multiple sizes, the best fit sized RemoteViews will be
+ // selected in onLayout. To work out the right measurement, let's layout and then
+ // measure again.
+ mAppWidgetHostViewPreview.layout(
+ /* left= */ 0,
+ /* top= */ 0,
+ /* right= */ mTargetPreviewWidth,
+ /* bottom= */ mTargetPreviewHeight);
+ mAppWidgetHostViewPreview.measure(
+ makeMeasureSpec(mTargetPreviewWidth, MeasureSpec.UNSPECIFIED),
+ makeMeasureSpec(mTargetPreviewHeight, MeasureSpec.UNSPECIFIED));
+
+ }
View widgetContent = mAppWidgetHostViewPreview.getChildAt(0);
int appWidgetContentWidth = widgetContent.getMeasuredWidth();
int appWidgetContentHeight = widgetContent.getMeasuredHeight();
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 4beb617..881f50c 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -36,7 +36,6 @@
import com.android.launcher3.tapl.AppIconMenuItem;
import com.android.launcher3.tapl.Widgets;
import com.android.launcher3.tapl.Workspace;
-import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.launcher3.views.OptionsPopupView;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
@@ -97,7 +96,6 @@
}
@Test
- @ScreenRecord //b/187080582
public void testDevicePressMenu() throws Exception {
mDevice.pressMenu();
mDevice.waitForIdle();
diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
index 60529a4..0b60ffc 100644
--- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
+++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
@@ -44,7 +44,7 @@
@Override
public void evaluate() throws Throwable {
try {
- base.evaluate();
+ FailureWatcher.super.apply(base, description).evaluate();
} finally {
if (mLauncher.hadNontestEvents()) {
throw new AssertionError(
diff --git a/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java b/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java
index 2b2fef4..08953fc 100644
--- a/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java
+++ b/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java
@@ -21,7 +21,6 @@
import android.content.ComponentName;
import android.content.pm.ActivityInfo;
-import android.util.Log;
import androidx.annotation.Nullable;
import androidx.test.InstrumentationRegistry;
@@ -103,8 +102,6 @@
*/
public static ShellCommandRule setDefaultLauncher() {
final ActivityInfo launcher = getLauncherInMyProcess();
- Log.d("b/187080582", "Launcher: " + new ComponentName(launcher.packageName, launcher.name)
- .flattenToString());
return new ShellCommandRule(getLauncherCommand(launcher), null, true, () ->
Assert.assertEquals("Setting default launcher failed",
new ComponentName(launcher.packageName, launcher.name)
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index b036049..8d05b70 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -768,9 +768,6 @@
try (LauncherInstrumentation.Closable c1 = addContextLayer(
"Swiped up from context menu to home")) {
waitUntilLauncherObjectGone(CONTEXT_MENU_RES_ID);
- // Swiping up can temporarily bring Nexus Launcher if the current
- // Launcher is a Launcher3 one. Wait for the current launcher to reappear.
- SystemClock.sleep(5000); // b/187080582
waitForLauncherObject(getAnyObjectSelector());
}
}