From b9bc1326d0c14d9b17faf6648ad307a6117175ed Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Mon, 22 Nov 2021 16:00:09 -0800 Subject: [PATCH 1/6] Add ALLOW_SLIPPERY_TOUCHES to make StatusBarTouchController slippery LauncherActivity uses FLAG_SLIPPERY for certain interactions. For example, when home screen is shown, and the user pulls down from not the top of the screen, and notification shade is getting displayed, then the touch should be getting transferred to the NotificationShade using FLAG_SLIPPERY. The newly introduced permission is added to launcher in order for this flag to be applied to the window. Bug: 206188649 Bug: 157929241 Test: reviewed logs, ensure that NexusLauncherActivity has FLAG_SLIPPERY Test: re-ran the performance regression test Change-Id: I8d05fa3663687b5382a59b0d47cdac404844c3b7 --- quickstep/AndroidManifest.xml | 1 + .../StatusBarTouchController.java | 21 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index 0f9227457a..e41fd74c31 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -35,6 +35,7 @@ + diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index fe69c9b87d..1bc789bd6e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -19,6 +19,7 @@ import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_UP; +import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN; @@ -47,17 +48,6 @@ public class StatusBarTouchController implements TouchController { private static final String TAG = "StatusBarController"; - /** - * Window flag: Enable touches to slide out of a window into neighboring - * windows in mid-gesture instead of being captured for the duration of - * the gesture. - * - * This flag changes the behavior of touch focus for this window only. - * Touches can slide out of the window but they cannot necessarily slide - * back in (unless the other window with touch focus permits it). - */ - private static final int FLAG_SLIPPERY = 0x20000000; - private final Launcher mLauncher; private final SystemUiProxy mSystemUiProxy; private final float mTouchSlop; @@ -140,6 +130,15 @@ public class StatusBarTouchController implements TouchController { return true; } + /** + * FLAG_SLIPPERY enables touches to slide out of a window into neighboring + * windows in mid-gesture instead of being captured for the duration of + * the gesture. + * + * This flag changes the behavior of touch focus for this window only. + * Touches can slide out of the window but they cannot necessarily slide + * back in (unless the other window with touch focus permits it). + */ private void setWindowSlippery(boolean enable) { Window w = mLauncher.getWindow(); WindowManager.LayoutParams wlp = w.getAttributes(); From 74fd7af92dd493f76a1800aba0fe1548dd570391 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 8 Dec 2021 10:43:48 +0000 Subject: [PATCH 2/6] Add content descriptions to task bar nav buttons Fixes: 209608812 Test: manual Change-Id: Iba50abfb2a3d33104b6d88574df0bc7b5daf1d3a --- quickstep/res/values/strings.xml | 10 ++++++++++ .../taskbar/NavbarButtonsViewController.java | 2 ++ .../taskbar/TaskbarNavButtonController.java | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml index fce49ddf0a..59997e99b6 100644 --- a/quickstep/res/values/strings.xml +++ b/quickstep/res/values/strings.xml @@ -233,6 +233,16 @@ Close Done + + Home + + Accessibility + + Back + + IME switcher + + Recents Move to top/left diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index ce1e8b6b6e..64769e2b3a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -433,6 +433,8 @@ public class NavbarButtonsViewController { @LayoutRes int layoutId) { ImageView buttonView = addButton(parent, id, layoutId); buttonView.setImageResource(drawableId); + buttonView.setContentDescription(parent.getContext().getString( + navButtonController.getButtonContentDescription(buttonType))); buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType)); buttonView.setOnLongClickListener(view -> navButtonController.onButtonLongClick(buttonType)); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index d23336505a..54893ae764 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -25,7 +25,9 @@ import android.os.Bundle; import android.os.Handler; import androidx.annotation.IntDef; +import androidx.annotation.StringRes; +import com.android.launcher3.R; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; import com.android.quickstep.OverviewCommandHelper; @@ -120,6 +122,23 @@ public class TaskbarNavButtonController { } } + public @StringRes int getButtonContentDescription(@TaskbarButton int buttonType) { + switch (buttonType) { + case BUTTON_HOME: + return R.string.taskbar_button_home; + case BUTTON_A11Y: + return R.string.taskbar_button_a11y; + case BUTTON_BACK: + return R.string.taskbar_button_back; + case BUTTON_IME_SWITCH: + return R.string.taskbar_button_ime_switcher; + case BUTTON_RECENTS: + return R.string.taskbar_button_recents; + default: + return 0; + } + } + /** * Checks if the user has long pressed back and recents buttons * "together" (within {@link #SCREEN_PIN_LONG_PRESS_THRESHOLD})ms From 7d20de28e395941b2d4adc020783b45a284269be Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Thu, 9 Dec 2021 01:18:59 +0800 Subject: [PATCH 3/6] Always draw background for task thumbnail Always draw background for task thumbnail because the task snapshot might be translucent or partially empty. For example, when drag-to-dismiss split screen, it will reparent tasks from dismissing split root to the bottom of display. Task thumbnail of those tasks might be partially empty because the snapshot was taken in new bounds inherits from display but with split screen content. Fix: 200096421 Test: drag to dismiss split, observed task thumbnail no longger been cropped. Change-Id: I5d04daa55a558f79ccf5127080088bd0698d06d8 --- .../android/quickstep/views/TaskThumbnailView.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java index da92551526..d83387705a 100644 --- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java @@ -307,14 +307,15 @@ public class TaskThumbnailView extends View { } } - // Draw the background in all cases, except when the thumbnail data is opaque + // Always draw the background since the snapshots might be translucent or partially empty + // (For example, tasks been reparented out of dismissing split root when drag-to-dismiss + // split screen). + canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint); + final boolean drawBackgroundOnly = mTask == null || mTask.isLocked || mBitmapShader == null || mThumbnailData == null; - if (drawBackgroundOnly || mThumbnailData.isTranslucent) { - canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint); - if (drawBackgroundOnly) { - return; - } + if (drawBackgroundOnly) { + return; } canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint); From 1c883d861ec1354c6a05b935d043277f65a9be24 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 1 Dec 2021 18:43:10 +0000 Subject: [PATCH 4/6] Add launcher grid spec for tablet - Introduced device_category to allow grids to be only enabled for certain device types. By default grids are enabled for all device types, so old OEM device_profiles aren't affected - Removed device_profiles_split.xml as a result and merged with device_profiles.xml - Added deviceType in InvariantDeviceProfile to replace isSplitDisplay and centralize the logic - Only has 6x5 grid with new default layout that works better for tablets Bug: 198575341 Test: manual Change-Id: I03f6727ce837ffeee6321b6d7c53942338d0cf30 --- res/values/attrs.xml | 10 +- res/xml/default_workspace_6x5.xml | 76 ++++++++++ res/xml/device_profiles.xml | 28 ++++ res/xml/device_profiles_split.xml | 137 ------------------ .../launcher3/InvariantDeviceProfile.java | 109 +++++++++----- .../launcher3/model/DeviceGridState.java | 20 +-- .../launcher3/provider/RestoreDbTask.java | 4 +- 7 files changed, 190 insertions(+), 194 deletions(-) create mode 100644 res/xml/default_workspace_6x5.xml delete mode 100644 res/xml/device_profiles_split.xml diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 08f0089438..08570eb7c2 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -154,7 +154,15 @@ - + + + + + + + + + diff --git a/res/xml/default_workspace_6x5.xml b/res/xml/default_workspace_6x5.xml new file mode 100644 index 0000000000..b078cfd7f8 --- /dev/null +++ b/res/xml/default_workspace_6x5.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml index e030f81098..b4bb43e9a9 100644 --- a/res/xml/device_profiles.xml +++ b/res/xml/device_profiles.xml @@ -133,4 +133,32 @@ + + + + + + \ No newline at end of file diff --git a/res/xml/device_profiles_split.xml b/res/xml/device_profiles_split.xml deleted file mode 100644 index 2fad0c9ab0..0000000000 --- a/res/xml/device_profiles_split.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 2ebedf71de..ff7a90cb2c 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -42,6 +42,7 @@ import android.util.TypedValue; import android.util.Xml; import android.view.Display; +import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -58,6 +59,8 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -70,6 +73,13 @@ public class InvariantDeviceProfile { public static final MainThreadInitializedObject INSTANCE = new MainThreadInitializedObject<>(InvariantDeviceProfile::new); + @Retention(RetentionPolicy.SOURCE) + @IntDef({TYPE_PHONE, TYPE_MULTI_DISPLAY, TYPE_TABLET}) + public @interface DeviceType{} + public static final int TYPE_PHONE = 0; + public static final int TYPE_MULTI_DISPLAY = 1; + public static final int TYPE_TABLET = 2; + private static final String KEY_IDP_GRID_NAME = "idp_grid_name"; private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48; @@ -106,7 +116,7 @@ public class InvariantDeviceProfile { public float[] iconTextSize; public int iconBitmapSize; public int fillResIconDpi; - public boolean isSplitDisplay; + public @DeviceType int deviceType; public PointF[] minCellSize; @@ -198,13 +208,21 @@ public class InvariantDeviceProfile { String gridName = getCurrentGridName(context); // Get the display info based on default display and interpolate it to existing display + Info defaultInfo = DisplayController.INSTANCE.get(context).getInfo(); + @DeviceType int defaultDeviceType = getDeviceType(defaultInfo); DisplayOption defaultDisplayOption = invDistWeightedInterpolate( - DisplayController.INSTANCE.get(context).getInfo(), - getPredefinedDeviceProfiles(context, gridName, false, false), false); + defaultInfo, + getPredefinedDeviceProfiles(context, gridName, defaultDeviceType, + /*allowDisabledGrid=*/false), + defaultDeviceType); Info myInfo = new Info(context, display); + @DeviceType int deviceType = getDeviceType(myInfo); DisplayOption myDisplayOption = invDistWeightedInterpolate( - myInfo, getPredefinedDeviceProfiles(context, gridName, false, false), false); + myInfo, + getPredefinedDeviceProfiles(context, gridName, deviceType, + /*allowDisabledGrid=*/false), + deviceType); DisplayOption result = new DisplayOption(defaultDisplayOption.grid) .add(myDisplayOption); @@ -220,7 +238,7 @@ public class InvariantDeviceProfile { System.arraycopy(defaultDisplayOption.borderSpaces, 0, result.borderSpaces, 0, COUNT_SIZES); - initGrid(context, myInfo, result, false); + initGrid(context, myInfo, result, deviceType); } /** @@ -246,6 +264,18 @@ public class InvariantDeviceProfile { } } + private static @DeviceType int getDeviceType(Info displayInfo) { + // Each screen has two profiles (portrait/landscape), so devices with four or more + // supported profiles implies two or more internal displays. + if (displayInfo.supportedBounds.size() >= 4 && ENABLE_TWO_PANEL_HOME.get()) { + return TYPE_MULTI_DISPLAY; + } else if (displayInfo.supportedBounds.stream().allMatch(displayInfo::isTablet)) { + return TYPE_TABLET; + } else { + return TYPE_PHONE; + } + } + public static String getCurrentGridName(Context context) { return Utilities.isGridOptionsEnabled(context) ? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null) : null; @@ -253,23 +283,19 @@ public class InvariantDeviceProfile { private String initGrid(Context context, String gridName) { Info displayInfo = DisplayController.INSTANCE.get(context).getInfo(); - // Each screen has two profiles (portrait/landscape), so devices with four or more - // supported profiles implies two or more internal displays. - boolean isSplitDisplay = - displayInfo.supportedBounds.size() >= 4 && ENABLE_TWO_PANEL_HOME.get(); + @DeviceType int deviceType = getDeviceType(displayInfo); ArrayList allOptions = - getPredefinedDeviceProfiles(context, gridName, isSplitDisplay, + getPredefinedDeviceProfiles(context, gridName, deviceType, RestoreDbTask.isPending(context)); DisplayOption displayOption = - invDistWeightedInterpolate(displayInfo, allOptions, isSplitDisplay); - initGrid(context, displayInfo, displayOption, isSplitDisplay); + invDistWeightedInterpolate(displayInfo, allOptions, deviceType); + initGrid(context, displayInfo, displayOption, deviceType); return displayOption.grid.name; } - private void initGrid( - Context context, Info displayInfo, DisplayOption displayOption, - boolean isSplitDisplay) { + private void initGrid(Context context, Info displayInfo, DisplayOption displayOption, + @DeviceType int deviceType) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); GridOption closestProfile = displayOption.grid; numRows = closestProfile.numRows; @@ -281,7 +307,7 @@ public class InvariantDeviceProfile { numFolderColumns = closestProfile.numFolderColumns; isScalable = closestProfile.isScalable; devicePaddingId = closestProfile.devicePaddingId; - this.isSplitDisplay = isSplitDisplay; + this.deviceType = deviceType; mExtraAttrs = closestProfile.extraAttrs; @@ -303,11 +329,11 @@ public class InvariantDeviceProfile { horizontalMargin = displayOption.horizontalMargin; numShownHotseatIcons = closestProfile.numHotseatIcons; - numDatabaseHotseatIcons = isSplitDisplay + numDatabaseHotseatIcons = deviceType == TYPE_MULTI_DISPLAY ? closestProfile.numDatabaseHotseatIcons : closestProfile.numHotseatIcons; numAllAppsColumns = closestProfile.numAllAppsColumns; - numDatabaseAllAppsColumns = isSplitDisplay + numDatabaseAllAppsColumns = deviceType == TYPE_MULTI_DISPLAY ? closestProfile.numDatabaseAllAppsColumns : closestProfile.numAllAppsColumns; if (!Utilities.isGridOptionsEnabled(context)) { @@ -327,7 +353,7 @@ public class InvariantDeviceProfile { defaultWallpaperSize = new Point(displayInfo.currentSize); for (WindowBounds bounds : displayInfo.supportedBounds) { localSupportedProfiles.add(new DeviceProfile.Builder(context, this, displayInfo) - .setUseTwoPanels(isSplitDisplay) + .setUseTwoPanels(deviceType == TYPE_MULTI_DISPLAY) .setWindowBounds(bounds).build()); // Wallpaper size should be the maximum of the all possible sizes Launcher expects @@ -350,11 +376,6 @@ public class InvariantDeviceProfile { defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null); } - @Nullable - public TypedValue getAttrValue(int attr) { - return mExtraAttrs == null ? null : mExtraAttrs.get(attr); - } - public void addOnChangeListener(OnIDPChangeListener listener) { mChangeListeners.add(listener); } @@ -389,12 +410,11 @@ public class InvariantDeviceProfile { } } - private static ArrayList getPredefinedDeviceProfiles( - Context context, String gridName, boolean isSplitDisplay, boolean allowDisabledGrid) { + private static ArrayList getPredefinedDeviceProfiles(Context context, + String gridName, @DeviceType int deviceType, boolean allowDisabledGrid) { ArrayList profiles = new ArrayList<>(); - int xmlResource = isSplitDisplay ? R.xml.device_profiles_split : R.xml.device_profiles; - try (XmlResourceParser parser = context.getResources().getXml(xmlResource)) { + try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) { final int depth = parser.getDepth(); int type; while (((type = parser.next()) != XmlPullParser.END_TAG || @@ -402,8 +422,8 @@ public class InvariantDeviceProfile { if ((type == XmlPullParser.START_TAG) && GridOption.TAG_NAME.equals(parser.getName())) { - GridOption gridOption = - new GridOption(context, Xml.asAttributeSet(parser), isSplitDisplay); + GridOption gridOption = new GridOption(context, Xml.asAttributeSet(parser), + deviceType); if (gridOption.isEnabled || allowDisabledGrid) { final int displayDepth = parser.getDepth(); while (((type = parser.next()) != XmlPullParser.END_TAG @@ -450,9 +470,8 @@ public class InvariantDeviceProfile { */ public List parseAllGridOptions(Context context) { List result = new ArrayList<>(); - int xmlResource = isSplitDisplay ? R.xml.device_profiles_split : R.xml.device_profiles; - try (XmlResourceParser parser = context.getResources().getXml(xmlResource)) { + try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) { final int depth = parser.getDepth(); int type; while (((type = parser.next()) != XmlPullParser.END_TAG @@ -460,7 +479,7 @@ public class InvariantDeviceProfile { if ((type == XmlPullParser.START_TAG) && GridOption.TAG_NAME.equals(parser.getName())) { GridOption option = - new GridOption(context, Xml.asAttributeSet(parser), isSplitDisplay); + new GridOption(context, Xml.asAttributeSet(parser), deviceType); if (option.isEnabled) { result.add(option); } @@ -514,12 +533,12 @@ public class InvariantDeviceProfile { } private static DisplayOption invDistWeightedInterpolate( - Info displayInfo, ArrayList points, boolean isSplitDisplay) { + Info displayInfo, ArrayList points, @DeviceType int deviceType) { int minWidthPx = Integer.MAX_VALUE; int minHeightPx = Integer.MAX_VALUE; for (WindowBounds bounds : displayInfo.supportedBounds) { boolean isTablet = displayInfo.isTablet(bounds); - if (isTablet && isSplitDisplay) { + if (isTablet && deviceType == TYPE_MULTI_DISPLAY) { // For split displays, take half width per page minWidthPx = Math.min(minWidthPx, bounds.availableSize.x / 2); minHeightPx = Math.min(minHeightPx, bounds.availableSize.y); @@ -643,6 +662,12 @@ public class InvariantDeviceProfile { public static final String TAG_NAME = "grid-option"; + private static final int DEVICE_CATEGORY_PHONE = 1 << 0; + private static final int DEVICE_CATEGORY_TABLET = 1 << 1; + private static final int DEVICE_CATEGORY_MULTI_DISPLAY = 1 << 2; + private static final int DEVICE_CATEGORY_ALL = + DEVICE_CATEGORY_PHONE | DEVICE_CATEGORY_TABLET | DEVICE_CATEGORY_MULTI_DISPLAY; + public final String name; public final int numRows; public final int numColumns; @@ -666,7 +691,7 @@ public class InvariantDeviceProfile { private final SparseArray extraAttrs; - public GridOption(Context context, AttributeSet attrs, boolean isSplitDisplay) { + public GridOption(Context context, AttributeSet attrs, @DeviceType int deviceType) { TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.GridDisplayOption); name = a.getString(R.styleable.GridDisplayOption_name); @@ -674,7 +699,7 @@ public class InvariantDeviceProfile { numColumns = a.getInt(R.styleable.GridDisplayOption_numColumns, 0); dbFile = a.getString(R.styleable.GridDisplayOption_dbFile); - defaultLayoutId = a.getResourceId(isSplitDisplay && a.hasValue( + defaultLayoutId = a.getResourceId(deviceType == TYPE_MULTI_DISPLAY && a.hasValue( R.styleable.GridDisplayOption_defaultSplitDisplayLayoutId) ? R.styleable.GridDisplayOption_defaultSplitDisplayLayoutId : R.styleable.GridDisplayOption_defaultLayoutId, 0); @@ -701,7 +726,15 @@ public class InvariantDeviceProfile { devicePaddingId = a.getResourceId( R.styleable.GridDisplayOption_devicePaddingId, 0); - isEnabled = a.getBoolean(R.styleable.GridDisplayOption_gridEnabled, true); + int deviceCategory = a.getInt(R.styleable.GridDisplayOption_deviceCategory, + DEVICE_CATEGORY_ALL); + isEnabled = (deviceType == TYPE_PHONE + && ((deviceCategory & DEVICE_CATEGORY_PHONE) == DEVICE_CATEGORY_PHONE)) + || (deviceType == TYPE_TABLET + && ((deviceCategory & DEVICE_CATEGORY_TABLET) == DEVICE_CATEGORY_TABLET)) + || (deviceType == TYPE_MULTI_DISPLAY + && ((deviceCategory & DEVICE_CATEGORY_MULTI_DISPLAY) + == DEVICE_CATEGORY_MULTI_DISPLAY)); a.recycle(); extraAttrs = Themes.createValueMap(context, attrs, diff --git a/src/com/android/launcher3/model/DeviceGridState.java b/src/com/android/launcher3/model/DeviceGridState.java index 0fc4c2d716..01ebc5347b 100644 --- a/src/com/android/launcher3/model/DeviceGridState.java +++ b/src/com/android/launcher3/model/DeviceGridState.java @@ -16,6 +16,9 @@ package com.android.launcher3.model; +import static com.android.launcher3.InvariantDeviceProfile.DeviceType; +import static com.android.launcher3.InvariantDeviceProfile.TYPE_MULTI_DISPLAY; +import static com.android.launcher3.InvariantDeviceProfile.TYPE_PHONE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_2; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_3; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_4; @@ -25,15 +28,11 @@ import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; -import androidx.annotation.IntDef; - import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.util.IntSet; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.Locale; import java.util.Objects; @@ -46,13 +45,6 @@ public class DeviceGridState { public static final String KEY_HOTSEAT_COUNT = "migration_src_hotseat_count"; public static final String KEY_DEVICE_TYPE = "migration_src_device_type"; - @Retention(RetentionPolicy.SOURCE) - @IntDef({TYPE_PHONE, TYPE_MULTI_DISPLAY, TYPE_TABLET}) - public @interface DeviceType{} - public static final int TYPE_PHONE = 0; - public static final int TYPE_MULTI_DISPLAY = 1; - public static final int TYPE_TABLET = 2; - private static final IntSet COMPATIBLE_TYPES = IntSet.wrap(TYPE_PHONE, TYPE_MULTI_DISPLAY); public static boolean deviceTypeCompatible(@DeviceType int typeA, @DeviceType int typeB) { @@ -67,11 +59,7 @@ public class DeviceGridState { public DeviceGridState(InvariantDeviceProfile idp) { mGridSizeString = String.format(Locale.ENGLISH, "%d,%d", idp.numColumns, idp.numRows); mNumHotseat = idp.numDatabaseHotseatIcons; - mDeviceType = idp.supportedProfiles.size() > 2 - ? TYPE_MULTI_DISPLAY - : idp.supportedProfiles.stream().allMatch(dp -> dp.isTablet) - ? TYPE_TABLET - : TYPE_PHONE; + mDeviceType = idp.deviceType; } public DeviceGridState(Context context) { diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java index 8f607a1797..4c0930bb32 100644 --- a/src/com/android/launcher3/provider/RestoreDbTask.java +++ b/src/com/android/launcher3/provider/RestoreDbTask.java @@ -16,8 +16,8 @@ package com.android.launcher3.provider; -import static com.android.launcher3.model.DeviceGridState.TYPE_MULTI_DISPLAY; -import static com.android.launcher3.model.DeviceGridState.TYPE_PHONE; +import static com.android.launcher3.InvariantDeviceProfile.TYPE_MULTI_DISPLAY; +import static com.android.launcher3.InvariantDeviceProfile.TYPE_PHONE; import static com.android.launcher3.provider.LauncherDbUtils.dropTable; import android.app.backup.BackupManager; From 43c2c6c05cc6d98d267eaea234c208ed2b02dbe9 Mon Sep 17 00:00:00 2001 From: Steve Elliott Date: Fri, 3 Dec 2021 16:32:19 -0500 Subject: [PATCH 5/6] add post_notification permission to manifest so the package can send notifications on T+ Bug: 194833441 Change-Id: I9e93e64939c1bb8281519ad2a959165e74556ab2 --- AndroidManifest-common.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index c581415337..02b83fe889 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -42,6 +42,7 @@ +