diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-12-03 22:25:20 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-12-03 22:25:20 +0000 |
commit | d4b96fbe346b5acea6208f8b88ce117e01f04169 (patch) | |
tree | 28d9d5de863264a6337ecf96c4fb0b77c04bd858 | |
parent | f18f397533bad063320160938e22696383907ba3 (diff) | |
parent | 7b467addea1fc397b81dc4e9d1105068706d7baf (diff) | |
download | Launcher3-android13-d4-s2-release.tar.gz |
Snap for 9366140 from 7b467addea1fc397b81dc4e9d1105068706d7baf to tm-d4-releaseandroid-13.0.0_r48android-13.0.0_r47android-13.0.0_r46android13-d4-s2-releaseandroid13-d4-s1-releaseandroid13-d4-release
Change-Id: I6ab77f266dbb3aa16138310a32a7e5a08e744634
12 files changed, 64 insertions, 26 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<Launcher> 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/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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@android:color/system_neutral1_50" android:state_selected="true"/> - <item android:color="@android:color/system_neutral2_700"/> + <item android:color="@android:color/system_neutral2_700" android:state_selected="true"/> + <item android:color="@android:color/system_accent2_100"/> </selector>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@android:color/system_neutral1_800"/> +</selector>
\ No newline at end of file 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; } } 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<T extends View & PageIndicator> extends PagedView<T> } 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/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<WidgetItem> itemProvider) { 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<PageIndicatorDots> 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); } 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) { |