From f6cb65f63a57c0a2a7a51d1f49b0346889b48cdd Mon Sep 17 00:00:00 2001 From: Rajat Jain Date: Thu, 22 Sep 2022 17:18:20 +0000 Subject: [PATCH 1/5] Low contrast for Personal and Work Tab in launcher There is low contrast between font and background of Personal and Work Tab in Launcher which makes it difficult to read text Bug: 235573969 Test: manual test Change-Id: Idfbb7a27cc48de145cf2962facad06bf34ac35f8 --- res/color-night-v31/all_apps_tab_text.xml | 4 ++-- .../all_apps_tabs_background.xml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 res/color-night-v31/all_apps_tabs_background.xml diff --git a/res/color-night-v31/all_apps_tab_text.xml b/res/color-night-v31/all_apps_tab_text.xml index 83237b49e5..54b95aee8d 100644 --- a/res/color-night-v31/all_apps_tab_text.xml +++ b/res/color-night-v31/all_apps_tab_text.xml @@ -14,6 +14,6 @@ limitations under the License. --> - - + + \ No newline at end of file diff --git a/res/color-night-v31/all_apps_tabs_background.xml b/res/color-night-v31/all_apps_tabs_background.xml new file mode 100644 index 0000000000..9213274d5c --- /dev/null +++ b/res/color-night-v31/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file From 8820a2181b9368c8446856c4f968d75c91c041dd Mon Sep 17 00:00:00 2001 From: Sihua Ma Date: Tue, 29 Nov 2022 14:50:53 -0800 Subject: [PATCH 2/5] Replace title of system services with more specific ones Before: https://screenshot.googleplex.com/8f5tGuw8c8zi6nX Now: https://screenshot.googleplex.com/4SXGMoiZmYJ3auF Fix: 258307358 Test: Manual Change-Id: I549cbdbb99f0168c87cc1c122cad9aceb3231591 --- .../launcher3/dragndrop/AddItemActivity.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java index 5a49f4ad41..a610548560 100644 --- a/src/com/android/launcher3/dragndrop/AddItemActivity.java +++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java @@ -23,6 +23,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_START; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; +import static com.android.launcher3.widget.WidgetSections.NO_CATEGORY; import android.annotation.TargetApi; import android.app.ActivityOptions; @@ -63,10 +64,11 @@ import com.android.launcher3.R; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.WidgetItem; +import com.android.launcher3.model.WidgetsModel; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.PackageItemInfo; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.util.PackageManagerHelper; -import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.views.AbstractSlideInView; import com.android.launcher3.views.BaseDragLayer; @@ -80,6 +82,7 @@ import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.WidgetCellPreview; import com.android.launcher3.widget.WidgetImageView; import com.android.launcher3.widget.WidgetManagerHelper; +import com.android.launcher3.widget.WidgetSections; import java.util.function.Supplier; @@ -142,7 +145,7 @@ public class AddItemActivity extends BaseActivity mAccessibilityManager = getApplicationContext().getSystemService(AccessibilityManager.class); - PackageUserKey targetApp = null; + final PackageItemInfo targetApp; switch (mRequest.getRequestType()) { case PinItemRequest.REQUEST_TYPE_SHORTCUT: targetApp = setupShortcut(); @@ -150,6 +153,9 @@ public class AddItemActivity extends BaseActivity case PinItemRequest.REQUEST_TYPE_APPWIDGET: targetApp = setupWidget(); break; + default: + targetApp = null; + break; } if (targetApp == null) { // TODO: show error toast? @@ -157,7 +163,7 @@ public class AddItemActivity extends BaseActivity return; } ApplicationInfo info = new PackageManagerHelper(this) - .getApplicationInfo(targetApp.mPackageName, targetApp.mUser, 0); + .getApplicationInfo(targetApp.packageName, targetApp.user, 0); if (info == null) { finish(); return; @@ -177,7 +183,10 @@ public class AddItemActivity extends BaseActivity // Set the label synchronously instead of via IconCache as this is the first thing // user sees TextView widgetAppName = findViewById(R.id.widget_appName); - widgetAppName.setText(info.loadLabel(getPackageManager())); + WidgetSections.WidgetSection section = targetApp.widgetCategory == NO_CATEGORY ? null + : WidgetSections.getWidgetSections(this).get(targetApp.widgetCategory); + widgetAppName.setText(section == null ? info.loadLabel(getPackageManager()) + : getString(section.mSectionTitle)); mSlideInView = findViewById(R.id.add_item_bottom_sheet); mSlideInView.addOnCloseListener(this); @@ -266,19 +275,18 @@ public class AddItemActivity extends BaseActivity } } - private PackageUserKey setupShortcut() { + private PackageItemInfo setupShortcut() { PinShortcutRequestActivityInfo shortcutInfo = new PinShortcutRequestActivityInfo(mRequest, this); mWidgetCell.getWidgetView().setTag(new PendingAddShortcutInfo(shortcutInfo)); applyWidgetItemAsync( () -> new WidgetItem(shortcutInfo, mApp.getIconCache(), getPackageManager())); - return new PackageUserKey( - mRequest.getShortcutInfo().getPackage(), + return new PackageItemInfo(mRequest.getShortcutInfo().getPackage(), mRequest.getShortcutInfo().getUserHandle()); } - private PackageUserKey setupWidget() { - LauncherAppWidgetProviderInfo widgetInfo = LauncherAppWidgetProviderInfo + private PackageItemInfo setupWidget() { + final LauncherAppWidgetProviderInfo widgetInfo = LauncherAppWidgetProviderInfo .fromProviderInfo(this, mRequest.getAppWidgetProviderInfo(this)); if (widgetInfo.minSpanX > mIdp.numColumns || widgetInfo.minSpanY > mIdp.numRows) { // Cannot add widget @@ -297,7 +305,8 @@ public class AddItemActivity extends BaseActivity mWidgetCell.getWidgetView().setTag(pendingInfo); applyWidgetItemAsync(() -> new WidgetItem(widgetInfo, mIdp, mApp.getIconCache())); - return new PackageUserKey(widgetInfo.provider.getPackageName(), widgetInfo.getUser()); + return WidgetsModel.newPendingItemInfo(this, widgetInfo.getComponent(), + widgetInfo.getUser()); } private void applyWidgetItemAsync(final Supplier itemProvider) { From 1aff9578fdcd8051506ad1888eda758523d18b52 Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Thu, 1 Dec 2022 16:40:06 -0800 Subject: [PATCH 3/5] [Toast] Add a new type for AppSearch latency logging. Bug: 261075521 Test: local Change-Id: If480d326349027d0fe6e1208c68e49f1900cd3bf --- src/com/android/launcher3/logging/StatsLogManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 0e42d58ce8..24d8c9dc5e 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -779,7 +779,8 @@ public class StatsLogManager implements ResourceBasedOverride { FAIL(4), COLD_USERWAITING(5), ATOMIC(6), - CONTROLLED(7); + CONTROLLED(7), + CACHED(8); private final int mId; LatencyType(int id) { From 2ceb3b508870219cf8b78b0dd8c5b2079eb42f46 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 1 Dec 2022 15:36:43 -0800 Subject: [PATCH 4/5] Adding screen ID parameter in CellLayoutLayoutParams Bug: 188081026 Test: launcher compiles, this test doesn't change existing logic only the model Change-Id: I7bcf6452d5ecb9b50914defc311ad06839220c92 --- .../launcher3/hybridhotseat/HotseatEduDialog.java | 2 +- src/com/android/launcher3/CellLayout.java | 2 +- src/com/android/launcher3/Workspace.java | 2 +- src/com/android/launcher3/WorkspaceLayoutManager.java | 2 +- .../launcher3/celllayout/CellLayoutLayoutParams.java | 11 ++++++++++- src/com/android/launcher3/folder/FolderPagedView.java | 2 +- .../launcher3/graphics/LauncherPreviewRenderer.java | 2 +- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java index 80bdb6f153..ba412c9909 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java @@ -193,7 +193,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements I icon.setEnabled(false); icon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); icon.verifyHighRes(); - CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1); + CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1, -1); mSampleHotseat.addViewToCellLayout(icon, i, info.getViewId(), lp, true); } } diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 9c5e906c9a..fdc52b5e3d 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -267,7 +267,7 @@ public class CellLayout extends ViewGroup { mDragCell[0] = mDragCell[1] = -1; mDragCellSpan[0] = mDragCellSpan[1] = -1; for (int i = 0; i < mDragOutlines.length; i++) { - mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0); + mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0, -1); } mDragOutlinePaint.setColor(Themes.getAttrColor(context, R.attr.workspaceTextColor)); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 27c9e98e16..fd670c1707 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -582,7 +582,7 @@ public class Workspace extends PagedView } int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns; - CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1); + CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1, FIRST_SCREEN_ID); lp.canReorder = false; if (!firstPage.addViewToCellLayout( mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) { diff --git a/src/com/android/launcher3/WorkspaceLayoutManager.java b/src/com/android/launcher3/WorkspaceLayoutManager.java index 0b3a62f710..91e12faa1d 100644 --- a/src/com/android/launcher3/WorkspaceLayoutManager.java +++ b/src/com/android/launcher3/WorkspaceLayoutManager.java @@ -114,7 +114,7 @@ public interface WorkspaceLayoutManager { ViewGroup.LayoutParams genericLp = child.getLayoutParams(); CellLayoutLayoutParams lp; if (genericLp == null || !(genericLp instanceof CellLayoutLayoutParams)) { - lp = new CellLayoutLayoutParams(x, y, spanX, spanY); + lp = new CellLayoutLayoutParams(x, y, spanX, spanY, screenId); } else { lp = (CellLayoutLayoutParams) genericLp; lp.cellX = x; diff --git a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java index b14ae8d136..abd4682701 100644 --- a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java +++ b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java @@ -28,6 +28,9 @@ import androidx.annotation.Nullable; * Represents the logic of where a view is in a CellLayout and its size */ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams { + + public int screenId = -1; + /** * Horizontal location of the item in the grid. */ @@ -106,14 +109,20 @@ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams { this.cellY = source.cellY; this.cellHSpan = source.cellHSpan; this.cellVSpan = source.cellVSpan; + this.screenId = source.screenId; + this.tmpCellX = source.tmpCellX; + this.tmpCellY = source.tmpCellY; + this.useTmpCoords = source.useTmpCoords; } - public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) { + public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan, + int screenId) { super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT); this.cellX = cellX; this.cellY = cellY; this.cellHSpan = cellHSpan; this.cellVSpan = cellVSpan; + this.screenId = screenId; } /** diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index b87ab17cb3..141388f3c5 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -223,7 +223,7 @@ public class FolderPagedView extends PagedView implements Cli CellLayoutLayoutParams lp = (CellLayoutLayoutParams) textView.getLayoutParams(); if (lp == null) { textView.setLayoutParams(new CellLayoutLayoutParams( - item.cellX, item.cellY, item.spanX, item.spanY)); + item.cellX, item.cellY, item.spanX, item.spanY, item.screenId)); } else { lp.cellX = item.cellX; lp.cellY = item.cellY; diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 2361907ed4..772913db8f 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -534,7 +534,7 @@ public class LauncherPreviewRenderer extends ContextWrapper View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false); CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, firstScreen.getCountX(), - 1); + 1, FIRST_SCREEN_ID); lp.canReorder = false; firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true); } From 5bf936ac16886a0af5870bd6dcaf5ee9931d51e9 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 1 Dec 2022 11:51:12 -0800 Subject: [PATCH 5/5] Preventing the text on ButtonDropTarget.resizeTextToFit size to go below 0 Bug: 260984829 Test: atest HomeScreenEditStateImageTest Change-Id: I4aba76de512aedf5b4c921593fe43099700eb773 --- src/com/android/launcher3/ButtonDropTarget.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java index 5abe3d3af6..ee3e278b8d 100644 --- a/src/com/android/launcher3/ButtonDropTarget.java +++ b/src/com/android/launcher3/ButtonDropTarget.java @@ -423,14 +423,15 @@ public abstract class ButtonDropTarget extends TextView float textSize = Utilities.pxToSp(getTextSize()); int availableWidth = getMeasuredWidth(); - while (textSize > minSize) { - if (isTextTruncated(availableWidth)) { - textSize -= step; + while (isTextTruncated(availableWidth)) { + textSize -= step; + if (textSize < minSize) { + textSize = minSize; setTextSize(textSize); - } else { - return textSize; + break; } + setTextSize(textSize); } - return minSize; + return textSize; } }