DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6382244 into stag-aosp-master
Bug: 151763422
Change-Id: Iaeff56dfa77dc2594d2572b6b60633d0d379caa7
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index 055ade5..fd36d4b 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -137,7 +137,8 @@
AUTOMATED = 1;
COMMAND = 2;
TIP = 3;
- // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST
+ SOFT_KEYBOARD = 4;
+ // HARD_KEYBOARD, ASSIST
}
enum Touch {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index 4d935e1..cac170c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -19,7 +19,6 @@
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
-import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import android.content.Context;
import android.graphics.Rect;
@@ -49,7 +48,6 @@
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.views.RecentsView;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;
import java.util.ArrayList;
@@ -210,12 +208,6 @@
}
}
- /** Closes system windows. */
- public static void closeSystemWindows() {
- ActivityManagerWrapper.getInstance()
- .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
- }
-
private static final class LauncherTaskViewController extends
TaskViewTouchController<Launcher> {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
index 1820729..2b369e7 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
@@ -80,7 +80,8 @@
if (!insets.equals(mInsets)) {
super.setInsets(insets);
}
- setBackground(insets.top == 0 ? null
+ setBackground(insets.top == 0 || !mAllowSysuiScrims
+ ? null
: Themes.getAttrDrawable(getContext(), R.attr.workspaceStatusBarScrim));
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index eb58b94..0790cf6 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -28,6 +28,7 @@
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_COUNT;
import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN;
+import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
@@ -58,6 +59,7 @@
import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
import com.android.quickstep.util.RemoteFadeOutAnimationListener;
import com.android.systemui.shared.system.ActivityCompat;
+import com.android.systemui.shared.system.ActivityManagerWrapper;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
@@ -252,5 +254,9 @@
return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
}
- public static void closeSystemWindows() {}
+ /** Closes system windows. */
+ public static void closeSystemWindows() {
+ ActivityManagerWrapper.getInstance()
+ .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
+ }
}
diff --git a/res/values/config.xml b/res/values/config.xml
index 0387184..9d36ee4 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -118,4 +118,7 @@
<!-- Recents -->
<item type="id" name="overview_panel"/>
+
+ <string-array name="live_wallpapers_remove_sysui_scrims">
+ </string-array>
</resources>
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index cd7444b..4b90e42 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -109,11 +109,11 @@
"Rotate launcher UI instead of using transposed layout");
public static final TogglableFlag FOLDER_NAME_SUGGEST = new TogglableFlag(
- "FOLDER_NAME_SUGGEST", false,
+ "FOLDER_NAME_SUGGEST", true,
"Suggests folder names instead of blank text.");
public static final TogglableFlag APP_SEARCH_IMPROVEMENTS = new TogglableFlag(
- "APP_SEARCH_IMPROVEMENTS", false,
+ "APP_SEARCH_IMPROVEMENTS", true,
"Adds localized title and keyword search and ranking");
public static final TogglableFlag ENABLE_PREDICTION_DISMISS = new TogglableFlag(
@@ -132,6 +132,7 @@
}
}
}
+ APP_SEARCH_IMPROVEMENTS.initialize(context);
}
static List<TogglableFlag> getTogglableFlags() {
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index cdc7061..0b6d8fb 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -556,7 +556,7 @@
@Override
public void setInsets(Rect insets) {
super.setInsets(insets);
- mWorkspaceScrim.onInsetsChanged(insets);
+ mWorkspaceScrim.onInsetsChanged(insets, mAllowSysuiScrims);
mOverviewScrim.onInsetsChanged(insets);
}
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 0bd2c9a..8df5e7d 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -17,6 +17,8 @@
package com.android.launcher3.folder;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
@@ -74,6 +76,7 @@
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.logging.LoggerUtils;
import com.android.launcher3.pageindicators.PageIndicatorDots;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -442,9 +445,6 @@
}
private void startAnimation(final AnimatorSet a) {
- if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
- mCurrentAnimator.cancel();
- }
final Workspace workspace = mLauncher.getWorkspace();
final CellLayout currentCellLayout =
(CellLayout) workspace.getChildAt(workspace.getCurrentPage());
@@ -550,6 +550,9 @@
// dropping. One resulting issue is that replaceFolderWithFinalItem() can be called twice.
mDeleteFolderOnDropCompleted = false;
+ if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
+ mCurrentAnimator.cancel();
+ }
AnimatorSet anim = new FolderAnimationManager(this, true /* isOpening */).getAnimator();
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -650,6 +653,9 @@
}
private void animateClosed() {
+ if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
+ mCurrentAnimator.cancel();
+ }
AnimatorSet a = new FolderAnimationManager(this, false /* isOpening */).getAnimator();
a.addListener(new AnimatorListenerAdapter() {
@Override
@@ -1340,6 +1346,9 @@
if (hasFocus) {
startEditingFolderName();
} else {
+ if (isEditingName()) {
+ logEditFolderLabel();
+ }
mFolderName.dispatchBackKey();
}
}
@@ -1517,4 +1526,39 @@
super.draw(canvas);
}
}
+
+ private void logEditFolderLabel() {
+ LauncherLogProto.LauncherEvent ev = new LauncherLogProto.LauncherEvent();
+ LauncherLogProto.Action action = new LauncherLogProto.Action();
+ action.type = LauncherLogProto.Action.Type.SOFT_KEYBOARD;
+ ev.action = action;
+
+ LauncherLogProto.Target edittext_target = new LauncherLogProto.Target();
+ edittext_target.type = LauncherLogProto.Target.Type.ITEM;
+ edittext_target.itemType = LauncherLogProto.ItemType.EDITTEXT;
+
+ LauncherLogProto.Target folder_target = new LauncherLogProto.Target();
+ folder_target.type = LauncherLogProto.Target.Type.CONTAINER;
+ folder_target.containerType = LauncherLogProto.ContainerType.FOLDER;
+ folder_target.pageIndex = mInfo.screenId;
+ folder_target.gridX = mInfo.cellX;
+ folder_target.gridY = mInfo.cellY;
+ folder_target.cardinality = mInfo.contents.size();
+
+ LauncherLogProto.Target parent_target = new LauncherLogProto.Target();
+ parent_target.type = LauncherLogProto.Target.Type.CONTAINER;
+ switch (mInfo.container) {
+ case CONTAINER_HOTSEAT:
+ parent_target.containerType = LauncherLogProto.ContainerType.HOTSEAT;
+ break;
+ case CONTAINER_DESKTOP:
+ parent_target.containerType = LauncherLogProto.ContainerType.WORKSPACE;
+ break;
+ default:
+ Log.e(TAG, String.format("Expected container to be either %s or %s but found %s.",
+ CONTAINER_HOTSEAT, CONTAINER_DESKTOP, mInfo.container));
+ }
+ ev.srcTarget = new LauncherLogProto.Target[]{edittext_target, folder_target, parent_target};
+ mLauncher.getUserEventDispatcher().dispatchUserEvent(ev, null);
+ }
}
diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
index 6740fa1..15ff207 100644
--- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
+++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
@@ -187,10 +187,13 @@
anim.start();
}
- public void onInsetsChanged(Rect insets) {
- mDrawTopScrim = mTopScrim != null && insets.top > 0;
- mDrawBottomScrim = mBottomMask != null &&
- !mLauncher.getDeviceProfile().isVerticalBarLayout();
+ /**
+ * Determines whether to draw the top and/or bottom scrim based on new insets.
+ */
+ public void onInsetsChanged(Rect insets, boolean allowSysuiScrims) {
+ mDrawTopScrim = allowSysuiScrims && mTopScrim != null && insets.top > 0;
+ mDrawBottomScrim = allowSysuiScrims && mBottomMask != null
+ && !mLauncher.getDeviceProfile().isVerticalBarLayout();
}
@Override
diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java
index 598792a..925b7ba 100644
--- a/src/com/android/launcher3/logging/LoggerUtils.java
+++ b/src/com/android/launcher3/logging/LoggerUtils.java
@@ -109,7 +109,7 @@
t.containerType == NAVBAR) {
str += " id=" + t.pageIndex;
} else if (t.containerType == ContainerType.FOLDER) {
- str += " grid(" + t.gridX + "," + t.gridY + ")";
+ str += "[PageIndex=" + t.pageIndex + ", grid(" + t.gridX + "," + t.gridY + ")]";
}
break;
default:
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index e43fc8a..a4f6a8e 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -23,7 +23,13 @@
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
import android.annotation.TargetApi;
+import android.app.WallpaperInfo;
+import android.app.WallpaperManager;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Insets;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -39,8 +45,11 @@
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.InsettableFrameLayout;
+import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha;
@@ -100,6 +109,14 @@
protected final T mActivity;
private final MultiValueAlpha mMultiValueAlpha;
+ private final WallpaperManager mWallpaperManager;
+ private final BroadcastReceiver mWallpaperChangeReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ onWallpaperChanged();
+ }
+ };
+ private final String[] mWallpapersWithoutSysuiScrims;
// All the touch controllers for the view
protected TouchController[] mControllers;
@@ -110,10 +127,15 @@
private TouchCompleteListener mTouchCompleteListener;
+ protected boolean mAllowSysuiScrims = true;
+
public BaseDragLayer(Context context, AttributeSet attrs, int alphaChannelCount) {
super(context, attrs);
mActivity = (T) ActivityContext.lookupContext(context);
mMultiValueAlpha = new MultiValueAlpha(this, alphaChannelCount);
+ mWallpaperManager = context.getSystemService(WallpaperManager.class);
+ mWallpapersWithoutSysuiScrims = getResources().getStringArray(
+ R.array.live_wallpapers_remove_sysui_scrims);
}
/**
@@ -513,4 +535,47 @@
}
return super.dispatchApplyWindowInsets(insets);
}
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mActivity.registerReceiver(mWallpaperChangeReceiver,
+ new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED));
+ onWallpaperChanged();
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mActivity.unregisterReceiver(mWallpaperChangeReceiver);
+ }
+
+ private void onWallpaperChanged() {
+ WallpaperInfo newWallpaperInfo = mWallpaperManager.getWallpaperInfo();
+ boolean oldAllowSysuiScrims = mAllowSysuiScrims;
+ mAllowSysuiScrims = computeAllowSysuiScrims(newWallpaperInfo);
+ if (mAllowSysuiScrims != oldAllowSysuiScrims) {
+ // Reapply insets so scrim can be removed or re-added if necessary.
+ setInsets(mInsets);
+ }
+ }
+
+ /**
+ * Determines whether we can scrim the status bar and nav bar for the given wallpaper by
+ * checking against a list of live wallpapers that we don't show the scrims on.
+ */
+ private boolean computeAllowSysuiScrims(@Nullable WallpaperInfo newWallpaperInfo) {
+ if (newWallpaperInfo == null) {
+ // New wallpaper is static, not live. Thus, blacklist isn't applicable.
+ return true;
+ }
+ ComponentName newWallpaper = newWallpaperInfo.getComponent();
+ for (String wallpaperWithoutScrim : mWallpapersWithoutSysuiScrims) {
+ if (newWallpaper.equals(ComponentName.unflattenFromString(wallpaperWithoutScrim))) {
+ // New wallpaper is blacklisted from showing a scrim.
+ return false;
+ }
+ }
+ return true;
+ }
}