diff options
author | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-06 10:04:42 -0600 |
---|---|---|
committer | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-06 10:05:30 -0600 |
commit | 0c062179a89e047d778925412632473005a2ec43 (patch) | |
tree | 639916800e76ccf6b5e9b371d3a1c0cb083486d0 | |
parent | b0838b261a6fb447fe9c4cf2513236a0736be209 (diff) | |
parent | 09bdbebdd2c93123a5d418de56053cc1c279afee (diff) | |
download | android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.tar.gz android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.tar.bz2 android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.zip |
Merge tag 'android-10.0.0_r37' into staging/lineage-17.1_merge-android-10.0.0_r37lineage-17.1
Android 10.0.0 Release 37 (QQ3A.200605.001)
* tag 'android-10.0.0_r37':
[DO NOT MERGE] Enable APP_SEARCH_IMPROVEMENTS flag.
Ensure current animation is cancelled before building new folder animation.
Fixes ag/10573640 on qt-future-dev branch.
[DO NOT MERGE] Adds basic smart-folder logging.
[DO NOT MERGE] Support blacklisting live wallpapers from showing sysui scrims
Import translations. DO NOT MERGE
Revert "[DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag"
[DO NOT MERGE] Initiailize APP_SEARCH_IMRPOVEMENT flag outside DEBUG builds.
[DO NOT MERGE] Adds fling gesture suppression to Launcher
Dismisses system overlays for Home intent.
[DO NOT MERGE] Fix some visual jumps when swiping home
[DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag Bug: 150788630
[DO NOT MERGE] Prevent hotseat touch hijack
Change-Id: I2316620bda33d83d668c8727e728af09db3e3e4c
18 files changed, 198 insertions, 33 deletions
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 055ade58e..fd36d4ba5 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -137,7 +137,8 @@ message Action { 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/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 5cce53ebf..e5d2b411a 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -386,6 +386,10 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten // rounding at the end of the animation. float startRadius = mClipAnimationHelper.getCurrentCornerRadius(); float endRadius = startRect.width() / 6f; + + float startTransformProgress = mTransformParams.getProgress(); + float endTransformProgress = 1; + // We want the window alpha to be 0 once this threshold is met, so that the // FolderIconView can be seen morphing into the icon shape. final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f; @@ -409,7 +413,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten public void onUpdate(RectF currentRect, float progress) { homeAnim.setPlayFraction(progress); - mTransformParams.setProgress(progress) + mTransformParams.setProgress( + Utilities.mapRange(progress, startTransformProgress, endTransformProgress)) .setCurrentRectAndTargetAlpha(currentRect, getWindowAlpha(progress)); if (isFloatingIconView) { mTransformParams.setCornerRadius(endRadius * progress + startRadius diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index f32182600..2fa789fd6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -563,9 +563,13 @@ public class TouchInteractionService extends Service implements // not interrupt it. QuickSwitch assumes that interruption can only happen if the // next gesture is also quick switch. mUncheckedConsumer = - new AssistantTouchConsumer(this, mISystemUiProxy, + new AssistantTouchConsumer( + this, + mISystemUiProxy, mOverviewComponentObserver.getActivityControlHelper(), - InputConsumer.NO_OP, mInputMonitorCompat); + InputConsumer.NO_OP, + mInputMonitorCompat, + mOverviewComponentObserver.assistantGestureIsConstrained()); } else { mUncheckedConsumer = InputConsumer.NO_OP; } @@ -612,8 +616,13 @@ public class TouchInteractionService extends Service implements final ActivityControlHelper activityControl = mOverviewComponentObserver.getActivityControlHelper(); if (canTriggerAssistantAction(event)) { - base = new AssistantTouchConsumer(this, mISystemUiProxy, activityControl, base, - mInputMonitorCompat); + base = new AssistantTouchConsumer( + this, + mISystemUiProxy, + activityControl, + base, + mInputMonitorCompat, + mOverviewComponentObserver.assistantGestureIsConstrained()); } if ((mSystemUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0) { 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 182072957..2b369e7bf 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 @@ public class RecentsRootView extends BaseDragLayer<RecentsActivity> { 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/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java index 346969e59..d4cdaf040 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java @@ -91,14 +91,16 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private final ISystemUiProxy mSysUiProxy; private final Context mContext; private final GestureDetector mGestureDetector; + private final boolean mIsAssistGestureConstrained; public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy, ActivityControlHelper activityControlHelper, InputConsumer delegate, - InputMonitorCompat inputMonitor) { + InputMonitorCompat inputMonitor, boolean isAssistGestureConstrained) { super(delegate, inputMonitor); final Resources res = context.getResources(); mContext = context; mSysUiProxy = systemUiProxy; + mIsAssistGestureConstrained = isAssistGestureConstrained; mDragDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); mFlingDistThreshold = res.getDimension(R.dimen.gestures_assistant_fling_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); @@ -273,10 +275,11 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private class AssistantGestureListener extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - if (isValidAssistantGestureAngle(velocityX, -velocityY) - && mDistance >= mFlingDistThreshold - && !mLaunchedAssistant - && mState != STATE_DELEGATE_ACTIVE) { + if (!mIsAssistGestureConstrained + && isValidAssistantGestureAngle(velocityX, -velocityY) + && mDistance >= mFlingDistThreshold + && !mLaunchedAssistant + && mState != STATE_DELEGATE_ACTIVE) { mLastProgress = 1; try { mSysUiProxy.onAssistantGestureCompletion( diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java index a12ae7a45..68007da40 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -402,6 +402,10 @@ public class ClipAnimationHelper { return this; } + public float getProgress() { + return progress; + } + public TransformParams setCornerRadius(float cornerRadius) { this.cornerRadius = cornerRadius; return this; diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java index c02df9386..0790cf6b0 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_COUNT; 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.Mode; 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; @@ -251,4 +253,10 @@ public class UiFactory extends RecentsUiFactory { Person[] persons = si.getPersons(); return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons; } + + /** Closes system windows. */ + public static void closeSystemWindows() { + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); + } } diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 88a4eb6d1..93a6127ed 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED; import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter; import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import android.content.BroadcastReceiver; @@ -107,6 +108,10 @@ public final class OverviewComponentObserver { } } + public boolean assistantGestureIsConstrained() { + return (mSystemUiStateFlags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0; + } + /** * Update overview intent and {@link ActivityControlHelper} based off the current launcher home * component. diff --git a/res/values/config.xml b/res/values/config.xml index 7e0588a19..93b780bdd 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/Launcher.java b/src/com/android/launcher3/Launcher.java index 0ebecce2b..68c8f1e25 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1405,6 +1405,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (!internalStateHandled) { // In all these cases, only animate if we're already on home AbstractFloatingView.closeAllOpenViews(this, isStarted()); + UiFactory.closeSystemWindows(); if (!isInState(NORMAL)) { // Only change state, if not already the same. This prevents cancelling any diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 37ee24850..2d5b04058 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -26,14 +26,18 @@ import android.os.Process; import android.text.Selection; import android.text.SpannableStringBuilder; import android.util.AttributeSet; -import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; - +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.dynamicanimation.animation.DynamicAnimation; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.AppInfo; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; @@ -45,11 +49,11 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; @@ -60,13 +64,6 @@ import com.android.launcher3.views.BottomUserEducationView; import com.android.launcher3.views.RecyclerViewFastScroller; import com.android.launcher3.views.SpringRelativeLayout; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.dynamicanimation.animation.DynamicAnimation; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - /** * The all apps view container. */ @@ -200,7 +197,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo // The AllAppsContainerView houses the QSB and is hence visible from the Workspace // Overview states. We shouldn't intercept for the scrubber in these cases. - if (!mLauncher.isInState(LauncherState.ALL_APPS)) return false; + if (!mLauncher.isInState(LauncherState.ALL_APPS)) { + mTouchHandler = null; + return false; + } if (ev.getAction() == MotionEvent.ACTION_DOWN) { AllAppsRecyclerView rv = getActiveRecyclerView(); @@ -219,6 +219,16 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public boolean onTouchEvent(MotionEvent ev) { + if (ev.getAction() == MotionEvent.ACTION_DOWN) { + AllAppsRecyclerView rv = getActiveRecyclerView(); + if (rv != null && rv.getScrollbar() + .isHitInParent(ev.getX(), ev.getY(), mFastScrollerOffset)) { + mTouchHandler = rv.getScrollbar(); + } else { + mTouchHandler = null; + } + } + if (mTouchHandler != null) { mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); return true; diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 06d947815..65cf1216d 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -116,7 +116,7 @@ public abstract class BaseFlags { "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( @@ -135,6 +135,7 @@ public abstract class BaseFlags { } } } + 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 cdc70611d..0b6d8fb6a 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -556,7 +556,7 @@ public class DragLayer extends BaseDragLayer<Launcher> { @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 0bd2c9af7..8df5e7d03 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.DragLayer; 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 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } 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 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo // 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 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } 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 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo if (hasFocus) { startEditingFolderName(); } else { + if (isEditingName()) { + logEditFolderLabel(); + } mFolderName.dispatchBackKey(); } } @@ -1517,4 +1526,39 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo 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 6740fa16e..15ff207bd 100644 --- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java +++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java @@ -187,10 +187,13 @@ public class WorkspaceAndHotseatScrim extends Scrim { 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 598792abc..925b7ba28 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -109,7 +109,7 @@ public class LoggerUtils { 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 e43fc8a01..a4f6a8ef5 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -23,7 +23,13 @@ import static android.view.MotionEvent.ACTION_UP; 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.WindowInsets; 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 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext> 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 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext> 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 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext> } 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; + } } diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java index 467ae02d5..f2b5ed219 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java @@ -101,4 +101,6 @@ public class UiFactory { public static Person[] getPersons(ShortcutInfo si) { return Utilities.EMPTY_PERSON_ARRAY; } + + public static void closeSystemWindows() {} } |