Snap for 13444741 from af24c515c9 to 25Q3-release
Change-Id: I08a402957b6936ae1376525a2f24ef0353add1db
This commit is contained in:
commit
cba3ea52b1
26 files changed
+318
-157
No files matched your search
@@ -476,6 +476,17 @@ flag {
|
||||
bug: "395145453"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "external_data_access"
|
||||
namespace: "launcher"
|
||||
description: "For LauncherProvider bug fixes and new static permissions as part of the cross oem backup / restore effort."
|
||||
bug: "395145453"
|
||||
is_fixed_read_only: true
|
||||
metadata {
|
||||
purpose: PURPOSE_BUGFIX
|
||||
}
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "gsf_res"
|
||||
namespace: "launcher"
|
||||
|
||||
@@ -27,16 +27,19 @@ import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.FloatingHeaderRow;
|
||||
import com.android.launcher3.allapps.FloatingHeaderView;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
/**
|
||||
* A view which shows a horizontal divider
|
||||
@@ -53,8 +56,8 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
private final TextPaint mPaint = new TextPaint();
|
||||
private DividerType mDividerType = DividerType.NONE;
|
||||
|
||||
private final @ColorInt int mStrokeColor;
|
||||
private final @ColorInt int mAllAppsLabelTextColor;
|
||||
private @ColorInt int mStrokeColor;
|
||||
private @ColorInt int mAllAppsLabelTextColor;
|
||||
private final AccessibilityManager mAccessibilityManager;
|
||||
|
||||
private Layout mAllAppsLabelLayout;
|
||||
@@ -84,8 +87,9 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height)
|
||||
};
|
||||
|
||||
mStrokeColor = context.getColor(R.color.materialColorOutlineVariant);
|
||||
|
||||
mStrokeColor = Flags.allAppsBlur()
|
||||
? Themes.getAttrColor(context, R.attr.bottomSheetDragHandleColor)
|
||||
: context.getColor(R.color.materialColorOutlineVariant);
|
||||
mAllAppsLabelTextColor = context.getColor(R.color.materialColorOnSurfaceVariant);
|
||||
|
||||
mAccessibilityManager = AccessibilityManager.getInstance(context);
|
||||
@@ -99,6 +103,19 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
updateDividerType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTheme(ContextThemeWrapper contextThemeWrapper) {
|
||||
mStrokeColor = Themes.getAttrColor(contextThemeWrapper, R.attr.bottomSheetDragHandleColor);
|
||||
mAllAppsLabelTextColor =
|
||||
contextThemeWrapper.getColor(R.color.materialColorOnSurfaceVariant);
|
||||
if (mDividerType == DividerType.LINE) {
|
||||
mPaint.setColor(mStrokeColor);
|
||||
} else if (mDividerType == DividerType.ALL_APPS_LABEL) {
|
||||
mPaint.setColor(mAllAppsLabelTextColor);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/** {@code true} if all apps label should be shown in place of divider. */
|
||||
public void setShowAllAppsLabel(boolean showAllAppsLabel) {
|
||||
if (mAccessibilityManager.isEnabled() && !Utilities.isRunningInTestHarness()) {
|
||||
|
||||
@@ -32,8 +32,10 @@ import android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER
|
||||
import android.view.InsetsSource.FLAG_SUPPRESS_SCRIM
|
||||
import android.view.Surface
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowInsets.Type.mandatorySystemGestures
|
||||
import android.view.WindowInsets.Type.navigationBars
|
||||
@@ -42,6 +44,7 @@ import android.view.WindowInsets.Type.tappableElement
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD
|
||||
import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.core.graphics.toRegion
|
||||
import com.android.app.tracing.traceSection
|
||||
import com.android.internal.policy.GestureNavigationSettingsObserver
|
||||
@@ -51,6 +54,14 @@ import com.android.launcher3.anim.AlphaUpdateListener
|
||||
import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION
|
||||
import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate
|
||||
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DEFAULT_TOUCH_REGION
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DRAG_LAYER_INVISIBLE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.FULLSCREEN_TASKBAR_WINDOW
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.ICONS_INVISIBLE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.PHONE_MODE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.SYSTEM_DRAG_IN_PROGRESS
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.TRANSIENT_IN_OVERVIEW
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.UI_CONTROLLER_UNTOUCHABLE
|
||||
import com.android.launcher3.testing.shared.ResourceUtils
|
||||
import com.android.launcher3.util.Executors
|
||||
import java.io.PrintWriter
|
||||
@@ -84,7 +95,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
context,
|
||||
this::onTaskbarOrBubblebarWindowHeightOrInsetsChanged,
|
||||
)
|
||||
private val debugTouchableRegion = DebugTouchableRegion()
|
||||
@VisibleForTesting val debugTouchableRegion = DebugTouchableRegion()
|
||||
|
||||
// Initialized in init.
|
||||
private lateinit var controllers: TaskbarControllers
|
||||
@@ -352,6 +363,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
*/
|
||||
fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
|
||||
insetsInfo.touchableRegion.setEmpty()
|
||||
val touchableInsets: Int
|
||||
val bubbleBarVisible =
|
||||
controllers.bubbleControllers.isPresent &&
|
||||
controllers.bubbleControllers.get().bubbleBarViewController.isBubbleBarVisible()
|
||||
@@ -362,32 +374,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
(!controllers.navbarButtonsViewController.isImeVisible ||
|
||||
!controllers.navbarButtonsViewController.isImeRenderingNavButtons)
|
||||
) {
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME)
|
||||
debugTouchableRegion.lastSetTouchableReason =
|
||||
"Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons"
|
||||
touchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
debugTouchableRegion.lastSetTouchableReason = PHONE_MODE
|
||||
} else if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is invisible"
|
||||
} else if (
|
||||
controllers.navbarButtonsViewController.isImeVisible &&
|
||||
controllers.taskbarStashController.isStashed
|
||||
) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Stashed over IME"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = DRAG_LAYER_INVISIBLE
|
||||
} else if (!controllers.uiController.isTaskbarTouchable) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is not touchable"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = UI_CONTROLLER_UNTOUCHABLE
|
||||
} else if (controllers.taskbarDragController.isSystemDragInProgress) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "System drag is in progress"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = SYSTEM_DRAG_IN_PROGRESS
|
||||
} else if (context.isTaskbarWindowFullscreen) {
|
||||
// Intercept entire fullscreen window.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is fullscreen"
|
||||
touchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
debugTouchableRegion.lastSetTouchableReason = FULLSCREEN_TASKBAR_WINDOW
|
||||
context.dragLayer.getBoundsInWindow(debugTouchableRegion.lastSetTouchableBounds, false)
|
||||
} else if (
|
||||
controllers.taskbarViewController.areIconsVisible() ||
|
||||
@@ -414,24 +418,26 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
region.addBoundsToRegion(bubbleBarBounds)
|
||||
}
|
||||
insetsInfo.touchableRegion.set(region)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Transient Taskbar is in Overview"
|
||||
debugTouchableRegion.lastSetTouchableReason = TRANSIENT_IN_OVERVIEW
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(region.bounds)
|
||||
} else {
|
||||
insetsInfo.touchableRegion.set(defaultTouchableRegion)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Using default touchable region"
|
||||
debugTouchableRegion.lastSetTouchableReason = DEFAULT_TOUCH_REGION
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(defaultTouchableRegion.bounds)
|
||||
}
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
} else {
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason =
|
||||
"Icons are not visible, but other components such as 3 buttons might be"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = ICONS_INVISIBLE
|
||||
}
|
||||
// Always have nav buttons be touchable
|
||||
controllers.navbarButtonsViewController.addVisibleButtonsRegion(
|
||||
context.dragLayer,
|
||||
insetsInfo.touchableRegion,
|
||||
)
|
||||
|
||||
insetsInfo.setTouchableInsets(touchableInsets)
|
||||
debugTouchableRegion.lastSetTouchableInsets = touchableInsets
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(insetsInfo.touchableRegion.bounds)
|
||||
}
|
||||
|
||||
@@ -463,12 +469,42 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
}
|
||||
pw.println()
|
||||
}
|
||||
pw.println("$prefix\tlastSetTouchableBounds=${debugTouchableRegion.lastSetTouchableBounds}")
|
||||
pw.println("$prefix\tlastSetTouchableReason=${debugTouchableRegion.lastSetTouchableReason}")
|
||||
pw.println("$prefix\tdebugTouchableRegion=$debugTouchableRegion")
|
||||
}
|
||||
|
||||
class DebugTouchableRegion {
|
||||
|
||||
companion object {
|
||||
const val PHONE_MODE =
|
||||
"Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons"
|
||||
const val DRAG_LAYER_INVISIBLE = "Taskbar is invisible"
|
||||
const val UI_CONTROLLER_UNTOUCHABLE = "Taskbar is not touchable"
|
||||
const val SYSTEM_DRAG_IN_PROGRESS = "System drag is in progress"
|
||||
const val FULLSCREEN_TASKBAR_WINDOW = "Taskbar is fullscreen"
|
||||
const val TRANSIENT_IN_OVERVIEW = "Transient Taskbar is in Overview"
|
||||
const val DEFAULT_TOUCH_REGION = "Using default touchable region"
|
||||
const val ICONS_INVISIBLE =
|
||||
"Icons are not visible, but other components such as 3 buttons might be"
|
||||
}
|
||||
|
||||
val lastSetTouchableBounds = Rect()
|
||||
var lastSetTouchableReason = ""
|
||||
var lastSetTouchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
|
||||
override fun toString(): String {
|
||||
return "{lastSetTouchableBounds=$lastSetTouchableBounds" +
|
||||
", lastSetTouchableReason=\"$lastSetTouchableReason\"" +
|
||||
", lastSetTouchableInsets=${touchableInsetsToString()}"
|
||||
}
|
||||
|
||||
private fun touchableInsetsToString(): String {
|
||||
return when (lastSetTouchableInsets) {
|
||||
TOUCHABLE_INSETS_FRAME -> "TOUCHABLE_INSETS_FRAME"
|
||||
TOUCHABLE_INSETS_CONTENT -> "TOUCHABLE_INSETS_CONTENT"
|
||||
TOUCHABLE_INSETS_VISIBLE -> "TOUCHABLE_INSETS_VISIBLE"
|
||||
TOUCHABLE_INSETS_REGION -> "TOUCHABLE_INSETS_REGION"
|
||||
else -> "Unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,11 +268,13 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
if (mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()
|
||||
&& !Flags.allAppsBlur()) {
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
if (!mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
// Always use an opaque scrim if there's no sheet.
|
||||
return context.getResources().getColor(R.color.materialColorSurfaceDim);
|
||||
}
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
|
||||
return Flags.allAppsBlur() ? Themes.getAttrColor(context, R.attr.allAppsScrimColor)
|
||||
: context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -123,8 +123,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
private BubbleCreator mBubbleCreator;
|
||||
private BubbleBarLocationListener mBubbleBarLocationListener;
|
||||
|
||||
// Cache last sent top coordinate to avoid sending duplicate updates to shell
|
||||
private int mLastSentBubbleBarTop;
|
||||
private int mLastSentBubbleBarTopToScreenBottom;
|
||||
|
||||
private boolean mIsImeVisible = false;
|
||||
|
||||
@@ -554,8 +553,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
/** Tells WMShell to show the currently selected bubble. */
|
||||
public void showSelectedBubble() {
|
||||
if (getSelectedBubbleKey() != null) {
|
||||
mLastSentBubbleBarTop = mBarView.getRestingTopPositionOnScreen();
|
||||
mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTop);
|
||||
mLastSentBubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom();
|
||||
mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTopToScreenBottom);
|
||||
} else {
|
||||
Log.w(TAG, "Trying to show the selected bubble but it's null");
|
||||
}
|
||||
@@ -653,10 +652,10 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
}
|
||||
|
||||
private void onBubbleBarBoundsChanged(boolean forceUpdate) {
|
||||
int newTop = mBarView.getRestingTopPositionOnScreen();
|
||||
if (newTop != mLastSentBubbleBarTop || forceUpdate) {
|
||||
mLastSentBubbleBarTop = newTop;
|
||||
mSystemUiProxy.updateBubbleBarTopOnScreen(newTop);
|
||||
int bubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom();
|
||||
if (bubbleBarTopToScreenBottom != mLastSentBubbleBarTopToScreenBottom || forceUpdate) {
|
||||
mLastSentBubbleBarTopToScreenBottom = bubbleBarTopToScreenBottom;
|
||||
mSystemUiProxy.updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -652,13 +652,15 @@ public class BubbleBarView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bubble bar top coordinate on screen when bar is resting
|
||||
*/
|
||||
public int getRestingTopPositionOnScreen() {
|
||||
int displayHeight = mController.getScreenHeight();
|
||||
/** Get the distance between the bubble bar top coordinate and the bottom of the screen */
|
||||
public int getTopToScreenBottom() {
|
||||
// the bottom of the bubble bar is aligned with the bottom of the screen. the distance
|
||||
// between the top of the bubble bar and the bottom of the screen is the height of the
|
||||
// bubble bar minus the y translation. since the bubble bar is always above the bottom of
|
||||
// the screen, the translation is negative and the overall result is a positive value that
|
||||
// represents the distance
|
||||
int bubbleBarHeight = getBubbleBarBounds().height();
|
||||
return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY();
|
||||
return bubbleBarHeight - (int) mController.getBubbleBarTranslationY();
|
||||
}
|
||||
|
||||
/** Returns the bounds with translation that may have been applied. */
|
||||
@@ -1672,9 +1674,6 @@ public class BubbleBarView extends FrameLayout {
|
||||
/** Interface for BubbleBarView to communicate with its controller. */
|
||||
public interface Controller {
|
||||
|
||||
/** Returns the screen height. */
|
||||
int getScreenHeight();
|
||||
|
||||
/** Returns the translation Y that the bubble bar should have. */
|
||||
float getBubbleBarTranslationY();
|
||||
|
||||
|
||||
@@ -280,11 +280,6 @@ public class BubbleBarViewController {
|
||||
: PINNING_PERSISTENT;
|
||||
mBubbleBarPinning.updateValue(pinningValue);
|
||||
mBarView.setController(new BubbleBarView.Controller() {
|
||||
@Override
|
||||
public int getScreenHeight() {
|
||||
return mActivity.getScreenSize().y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBubbleBarTranslationY() {
|
||||
return mBubbleStashController.getBubbleBarTranslationY();
|
||||
@@ -741,7 +736,8 @@ public class BubbleBarViewController {
|
||||
public boolean isEventOverBubbleBar(MotionEvent event) {
|
||||
if (!isBubbleBarVisible()) return false;
|
||||
final Rect bounds = getBubbleBarBounds();
|
||||
final int bubbleBarTopOnScreen = mBarView.getRestingTopPositionOnScreen();
|
||||
final int bubbleBarTopOnScreen =
|
||||
mActivity.getScreenSize().y - mBarView.getTopToScreenBottom();
|
||||
final float x = event.getX();
|
||||
return event.getRawY() >= bubbleBarTopOnScreen && x >= bounds.left && x <= bounds.right;
|
||||
}
|
||||
@@ -1359,7 +1355,7 @@ public class BubbleBarViewController {
|
||||
* Notifies SystemUI to expand the selected bubble when the bubble is released.
|
||||
*/
|
||||
public void onBubbleDragRelease(BubbleBarLocation location) {
|
||||
mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen());
|
||||
mSystemUiProxy.stopBubbleDrag(location, mBarView.getTopToScreenBottom());
|
||||
}
|
||||
|
||||
/** Handle given bubble being dismissed */
|
||||
|
||||
+1
@@ -64,6 +64,7 @@ constructor(
|
||||
}
|
||||
|
||||
fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) {
|
||||
animator?.cancel()
|
||||
flyout?.let(container::removeView)
|
||||
val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Display;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
@@ -463,10 +464,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
if (!Flags.allAppsBlur() && !enableOverviewBackgroundWallpaperBlur()) {
|
||||
return;
|
||||
}
|
||||
getTheme().applyStyle(getBlurStyleResId(), true);
|
||||
int blurStyleResId = getBlurStyleResId();
|
||||
getTheme().applyStyle(blurStyleResId, true);
|
||||
if (Flags.allAppsBlur()) {
|
||||
getAppsView().getContext().getTheme().applyStyle(getBlurStyleResId(), true);
|
||||
getAppsView().onThemeChanged();
|
||||
getAppsView().onThemeChanged(
|
||||
new ContextThemeWrapper(getApplicationContext(), blurStyleResId));
|
||||
}
|
||||
if (enableOverviewBackgroundWallpaperBlur()) {
|
||||
getScrimView().setBackgroundColor(
|
||||
|
||||
@@ -204,9 +204,12 @@ public class AllAppsState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public int getWorkspaceScrimColor(Launcher launcher) {
|
||||
if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet() && !Flags.allAppsBlur()) {
|
||||
return launcher.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
if (!launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
// Always use an opaque scrim if there's no sheet.
|
||||
return launcher.getResources().getColor(R.color.materialColorSurfaceDim);
|
||||
}
|
||||
return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
|
||||
|
||||
return Flags.allAppsBlur() ? Themes.getAttrColor(launcher, R.attr.allAppsScrimColor)
|
||||
: launcher.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,6 @@ import androidx.annotation.VisibleForTesting;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.window.WindowManagerProxy;
|
||||
import com.android.quickstep.util.DesktopTask;
|
||||
import com.android.quickstep.util.ExternalDisplaysKt;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
@@ -50,7 +48,6 @@ import com.android.wm.shell.Flags;
|
||||
import com.android.wm.shell.recents.IRecentTasksListener;
|
||||
import com.android.wm.shell.shared.GroupedTaskInfo;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
import com.android.wm.shell.shared.split.SplitBounds;
|
||||
|
||||
import kotlin.collections.ArraysKt;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
@@ -71,10 +68,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* Manages the recent task list from the system, caching it as necessary.
|
||||
*/
|
||||
// TODO: b/401602554 - Consider letting [DesktopTasksController] notify [RecentTasksController] of
|
||||
// desk changes to trigger [IRecentTasksListener.onRecentTasksChanged()], instead of implementing
|
||||
// [DesktopVisibilityListener].
|
||||
public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityListener {
|
||||
public class RecentTasksList {
|
||||
|
||||
private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0);
|
||||
|
||||
@@ -82,7 +76,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList
|
||||
private final KeyguardManager mKeyguardManager;
|
||||
private final LooperExecutor mMainThreadExecutor;
|
||||
private final SystemUiProxy mSysUiProxy;
|
||||
private final DesktopVisibilityController mDesktopVisibilityController;
|
||||
|
||||
// The list change id, increments as the task list changes in the system
|
||||
private int mChangeId;
|
||||
@@ -101,14 +94,12 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList
|
||||
public RecentTasksList(Context context, LooperExecutor mainThreadExecutor,
|
||||
KeyguardManager keyguardManager, SystemUiProxy sysUiProxy,
|
||||
TopTaskTracker topTaskTracker,
|
||||
DesktopVisibilityController desktopVisibilityController,
|
||||
DaggerSingletonTracker tracker) {
|
||||
mContext = context;
|
||||
mMainThreadExecutor = mainThreadExecutor;
|
||||
mKeyguardManager = keyguardManager;
|
||||
mChangeId = 1;
|
||||
mSysUiProxy = sysUiProxy;
|
||||
mDesktopVisibilityController = desktopVisibilityController;
|
||||
final IRecentTasksListener recentTasksListener = new IRecentTasksListener.Stub() {
|
||||
@Override
|
||||
public void onRecentTasksChanged() throws RemoteException {
|
||||
@@ -161,13 +152,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList
|
||||
tracker.addCloseable(
|
||||
() -> mSysUiProxy.unregisterRecentTasksListener(recentTasksListener));
|
||||
|
||||
if (DesktopModeStatus.enableMultipleDesktops(mContext)) {
|
||||
mDesktopVisibilityController.registerDesktopVisibilityListener(
|
||||
this);
|
||||
tracker.addCloseable(
|
||||
() -> mDesktopVisibilityController.unregisterDesktopVisibilityListener(this));
|
||||
}
|
||||
|
||||
// We may receive onRunningTaskAppeared events later for tasks which have already been
|
||||
// included in the list returned by mSysUiProxy.getRunningTasks(), or may receive
|
||||
// onRunningTaskVanished for tasks not included in the returned list. These cases will be
|
||||
@@ -306,27 +290,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList
|
||||
return mRunningTasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeskAdded(int displayId, int deskId) {
|
||||
onRecentTasksChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeskRemoved(int displayId, int deskId) {
|
||||
onRecentTasksChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveDeskChanged(int displayId, int newActiveDesk, int oldActiveDesk) {
|
||||
// Should desk activation changes lead to the invalidation of the loaded tasks? The cases
|
||||
// are:
|
||||
// - Switching from one active desk to another.
|
||||
// - Switching from out of a desk session into an active desk.
|
||||
// - Switching from an active desk to a non-desk session.
|
||||
// These changes don't affect the list of desks, nor their contents, so let's ignore them
|
||||
// for now.
|
||||
}
|
||||
|
||||
private void onRunningTaskAppeared(RunningTaskInfo taskInfo) {
|
||||
// Make sure this task is not already in the list
|
||||
for (RunningTaskInfo existingTask : mRunningTasks) {
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.graphics.ThemeManager;
|
||||
import com.android.launcher3.graphics.ThemeManager.ThemeChangeListener;
|
||||
import com.android.launcher3.icons.IconProvider;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
@@ -116,14 +115,12 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe
|
||||
DisplayController displayController,
|
||||
LockedUserState lockedUserState,
|
||||
Lazy<ThemeManager> themeManagerLazy,
|
||||
DesktopVisibilityController desktopVisibilityController,
|
||||
DaggerSingletonTracker tracker
|
||||
) {
|
||||
// Lazily inject the ThemeManager and access themeManager once the device is
|
||||
// unlocked. See b/393248495 for details.
|
||||
this(context, new IconProvider(context), systemUiProxy, topTaskTracker,
|
||||
displayController, lockedUserState, themeManagerLazy, desktopVisibilityController,
|
||||
tracker);
|
||||
displayController, lockedUserState, themeManagerLazy, tracker);
|
||||
}
|
||||
|
||||
@SuppressLint("VisibleForTests")
|
||||
@@ -134,7 +131,6 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe
|
||||
DisplayController displayController,
|
||||
LockedUserState lockedUserState,
|
||||
Lazy<ThemeManager> themeManagerLazy,
|
||||
DesktopVisibilityController desktopVisibilityController,
|
||||
DaggerSingletonTracker tracker) {
|
||||
this(context,
|
||||
new RecentTasksList(
|
||||
@@ -142,7 +138,7 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe
|
||||
MAIN_EXECUTOR,
|
||||
context.getSystemService(KeyguardManager.class),
|
||||
systemUiProxy,
|
||||
topTaskTracker, desktopVisibilityController, tracker),
|
||||
topTaskTracker, tracker),
|
||||
new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider, displayController),
|
||||
new TaskThumbnailCache(context, RECENTS_MODEL_EXECUTOR),
|
||||
iconProvider,
|
||||
|
||||
@@ -588,10 +588,13 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
* Tells SysUI to show the bubble with the provided key.
|
||||
*
|
||||
* @param key the key of the bubble to show.
|
||||
* @param top top coordinate of bubble bar on screen
|
||||
* @param bubbleBarTopToScreenBottom distance between the top coordinate of bubble bar and the
|
||||
* bottom of the screen
|
||||
*/
|
||||
fun showBubble(key: String?, top: Int) =
|
||||
executeWithErrorLog({ "Failed call showBubble" }) { bubbles?.showBubble(key, top) }
|
||||
fun showBubble(key: String?, bubbleBarTopToScreenBottom: Int) =
|
||||
executeWithErrorLog({ "Failed call showBubble" }) {
|
||||
bubbles?.showBubble(key, bubbleBarTopToScreenBottom)
|
||||
}
|
||||
|
||||
/** Tells SysUI to remove all bubbles. */
|
||||
fun removeAllBubbles() =
|
||||
@@ -617,11 +620,12 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
* expanded.
|
||||
*
|
||||
* @param location location of the bubble bar
|
||||
* @param top new top coordinate for bubble bar on screen
|
||||
* @param bubbleBarTopToScreenBottom distance between the new top coordinate for bubble bar and
|
||||
* the bottom of the screen
|
||||
*/
|
||||
fun stopBubbleDrag(location: BubbleBarLocation?, top: Int) =
|
||||
fun stopBubbleDrag(location: BubbleBarLocation?, bubbleBarTopToScreenBottom: Int) =
|
||||
executeWithErrorLog({ "Failed call stopBubbleDrag" }) {
|
||||
bubbles?.stopBubbleDrag(location, top)
|
||||
bubbles?.stopBubbleDrag(location, bubbleBarTopToScreenBottom)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -657,13 +661,12 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells SysUI the top coordinate of bubble bar on screen
|
||||
*
|
||||
* @param topOnScreen top coordinate for bubble bar on screen
|
||||
* Tells SysUI the distance between the top coordinate of the bubble bar and the bottom of the
|
||||
* screen
|
||||
*/
|
||||
fun updateBubbleBarTopOnScreen(topOnScreen: Int) =
|
||||
executeWithErrorLog({ "Failed call updateBubbleBarTopOnScreen" }) {
|
||||
bubbles?.updateBubbleBarTopOnScreen(topOnScreen)
|
||||
fun updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom: Int) =
|
||||
executeWithErrorLog({ "Failed call updateBubbleBarTopToScreenBottom" }) {
|
||||
bubbles?.updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -678,13 +678,6 @@ public final class TaskViewUtils {
|
||||
// interfere with a rapid swipe up to home in the live tile + running task case.
|
||||
@Override
|
||||
public void onAnimationSuccess(Animator animation) {
|
||||
// If we're relaunching the desktop tile when already entering Overview from
|
||||
// desktop, no need to change the launcher visibility and taskbar visibility
|
||||
// below.
|
||||
boolean launchingLiveDesktop = v instanceof DesktopTaskView desktopTaskView
|
||||
&& desktopTaskView.isRunningTask()
|
||||
&& recentsView.getRemoteTargetHandles() != null;
|
||||
|
||||
recentsView.finishRecentsAnimation(false /* toRecents */, () -> {
|
||||
recentsView.post(() -> {
|
||||
stateManager.moveToRestState();
|
||||
@@ -695,7 +688,9 @@ public final class TaskViewUtils {
|
||||
// that launcher is still visible.
|
||||
TaskbarUIController controller = recentsView.getSizeStrategy()
|
||||
.getTaskbarController();
|
||||
if (controller != null && !launchingLiveDesktop) {
|
||||
// If we're launching the desktop tile in Overview, no need to change
|
||||
// the launcher visibility and taskbar visibility below.
|
||||
if (controller != null && !(v instanceof DesktopTaskView)) {
|
||||
boolean launcherVisible = true;
|
||||
for (RemoteAnimationTarget target : appTargets) {
|
||||
launcherVisible &= target.isTranslucent;
|
||||
|
||||
-2
@@ -127,8 +127,6 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
|
||||
bubbleBarView.setPadding(0, paddingTop, 0, 0)
|
||||
bubbleBarView.setController(
|
||||
object : BubbleBarView.Controller {
|
||||
override fun getScreenHeight(): Int = 0
|
||||
|
||||
override fun getBubbleBarTranslationY(): Float = 0f
|
||||
|
||||
override fun onBubbleBarTouched() {}
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import android.animation.AnimatorTestRule
|
||||
import android.view.ViewTreeObserver
|
||||
import com.android.launcher3.taskbar.TaskbarControllerTestUtil.runOnMainSync
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DEFAULT_TOUCH_REGION
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.FULLSCREEN_TASKBAR_WINDOW
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.ICONS_INVISIBLE
|
||||
import com.android.launcher3.taskbar.rules.TaskbarModeRule.Mode.TRANSIENT
|
||||
import com.android.launcher3.taskbar.rules.TaskbarModeRule.TaskbarMode
|
||||
import com.android.launcher3.taskbar.rules.TaskbarUnitTestRule
|
||||
import com.android.launcher3.taskbar.rules.TaskbarUnitTestRule.InjectController
|
||||
import com.android.launcher3.taskbar.rules.TaskbarWindowSandboxContext
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit
|
||||
import com.android.launcher3.util.LauncherMultivalentJUnit.EmulatedDevices
|
||||
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(LauncherMultivalentJUnit::class)
|
||||
@EmulatedDevices(["pixelFoldable2023", "pixelTablet2023"])
|
||||
class TaskbarInsetsControllerTest {
|
||||
|
||||
@get:Rule(order = 0) val context = TaskbarWindowSandboxContext.create()
|
||||
@get:Rule(order = 1) val animatorTestRule = AnimatorTestRule(this)
|
||||
@get:Rule(order = 2) val taskbarUnitTestRule = TaskbarUnitTestRule(this, context)
|
||||
|
||||
@InjectController lateinit var taskbarInsetsController: TaskbarInsetsController
|
||||
@InjectController lateinit var taskbarStashController: TaskbarStashController
|
||||
|
||||
private val taskbarContext by taskbarUnitTestRule::activityContext
|
||||
|
||||
@Test
|
||||
fun imeShowing_taskbarWindowUntouchable() {
|
||||
runOnMainSync { taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false) }
|
||||
runOnMainSync {
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason)
|
||||
.isEqualTo(ICONS_INVISIBLE)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets)
|
||||
.isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableBounds.isEmpty)
|
||||
.isTrue()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TaskbarMode(TRANSIENT)
|
||||
fun imeShowing_transientTaskbarUnstashed_taskbarWindowTouchable() {
|
||||
runOnMainSync {
|
||||
taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false)
|
||||
taskbarStashController.updateAndAnimateTransientTaskbar(false)
|
||||
animatorTestRule.advanceTimeBy(taskbarStashController.stashDuration)
|
||||
}
|
||||
runOnMainSync {
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason)
|
||||
.isEqualTo(DEFAULT_TOUCH_REGION)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets)
|
||||
.isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableBounds.isEmpty)
|
||||
.isFalse()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun windowFullscreen_entireTaskbarWindowTouchable() {
|
||||
runOnMainSync { taskbarContext.setTaskbarWindowFullscreen(true) }
|
||||
runOnMainSync {
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason)
|
||||
.isEqualTo(FULLSCREEN_TASKBAR_WINDOW)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets)
|
||||
.isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun windowFullscreen_imeShowing_entireTaskbarWindowTouchable() {
|
||||
runOnMainSync {
|
||||
taskbarContext.setTaskbarWindowFullscreen(true)
|
||||
taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false)
|
||||
}
|
||||
runOnMainSync {
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason)
|
||||
.isEqualTo(FULLSCREEN_TASKBAR_WINDOW)
|
||||
assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets)
|
||||
.isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
-2
@@ -394,8 +394,6 @@ class PersistentBubbleStashControllerTest {
|
||||
bubbleBarView.layoutParams = FrameLayout.LayoutParams(0, 0)
|
||||
bubbleBarView.setController(
|
||||
object : BubbleBarView.Controller {
|
||||
override fun getScreenHeight(): Int = 0
|
||||
|
||||
override fun getBubbleBarTranslationY(): Float = 0f
|
||||
|
||||
override fun onBubbleBarTouched() {}
|
||||
|
||||
-2
@@ -559,8 +559,6 @@ class TransientBubbleStashControllerTest {
|
||||
FrameLayout.LayoutParams(BUBBLE_BAR_WIDTH, BUBBLE_BAR_HEIGHT)
|
||||
bubbleBarView.setController(
|
||||
object : BubbleBarView.Controller {
|
||||
override fun getScreenHeight(): Int = 0
|
||||
|
||||
override fun getBubbleBarTranslationY(): Float = 0f
|
||||
|
||||
override fun onBubbleBarTouched() {}
|
||||
|
||||
@@ -48,7 +48,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.LooperExecutor;
|
||||
@@ -106,7 +105,6 @@ public class RecentTasksListTest {
|
||||
|
||||
mRecentTasksList = new RecentTasksList(mContext, mainThreadExecutor,
|
||||
mockKeyguardManager, mSystemUiProxy, mTopTaskTracker,
|
||||
mock(DesktopVisibilityController.class),
|
||||
mock(DaggerSingletonTracker.class));
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -1398,8 +1398,6 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView = BubbleBarView(context)
|
||||
bubbleBarView.setController(
|
||||
object : BubbleBarView.Controller {
|
||||
override fun getScreenHeight(): Int = 0
|
||||
|
||||
override fun getBubbleBarTranslationY(): Float = 0f
|
||||
|
||||
override fun onBubbleBarTouched() {}
|
||||
|
||||
@@ -94,9 +94,15 @@ public class LauncherProvider extends ContentProvider {
|
||||
@Override
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
int rowId = executeControllerTask(controller -> {
|
||||
// 1. Ensure that externally added items have a valid item id
|
||||
int id = controller.generateNewItemId();
|
||||
values.put(LauncherSettings.Favorites._ID, id);
|
||||
// 1. Ensure that externally added items have a valid item id. Don't update Folder ids
|
||||
// because items inside the folder need to reference the original ID as their container
|
||||
// id, or else be deleted.
|
||||
if (Flags.externalDataAccess() && values.containsKey(Favorites._ID)
|
||||
&& Favorites.ITEM_TYPE_FOLDER != values.getAsInteger(Favorites.ITEM_TYPE)
|
||||
&& Favorites.ITEM_TYPE_APP_PAIR != values.getAsInteger(Favorites.ITEM_TYPE)) {
|
||||
int id = controller.generateNewItemId();
|
||||
values.put(LauncherSettings.Favorites._ID, id);
|
||||
}
|
||||
|
||||
// 2. In the case of an app widget, and if no app widget id is specified, we
|
||||
// attempt allocate and bind the widget.
|
||||
|
||||
@@ -50,6 +50,7 @@ import android.os.UserManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -857,13 +858,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
}
|
||||
|
||||
/** Refresh the UI according to the current theme. */
|
||||
public void onThemeChanged() {
|
||||
public void onThemeChanged(ContextThemeWrapper contextThemeWrapper) {
|
||||
updateHeaderScroll(getActiveRecyclerView().computeVerticalScrollOffset());
|
||||
invalidateHeader();
|
||||
forAllRecyclerViews(RecyclerView::invalidateItemDecorations);
|
||||
getSearchUiManager().onThemeChanged();
|
||||
getFloatingHeaderView().getTabLayout().updateTheme();
|
||||
mBottomSheetHandle.setBackground(getContext().getDrawable(
|
||||
getFloatingHeaderView().updateTheme(contextThemeWrapper);
|
||||
mBottomSheetHandle.setBackground(contextThemeWrapper.getDrawable(
|
||||
R.drawable.bg_rounded_corner_bottom_sheet_handle));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
@@ -60,4 +61,7 @@ public interface FloatingHeaderRow {
|
||||
default boolean isVisible() {
|
||||
return shouldDraw();
|
||||
}
|
||||
|
||||
/** Update colors using the provided theme wrapper. */
|
||||
default void updateTheme(ContextThemeWrapper contextThemeWrapper) {}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -275,6 +276,14 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
mTabLayout.setVisibility(mTabsHidden ? GONE : visibility);
|
||||
}
|
||||
|
||||
/** Update colors using the provided theme wrapper. */
|
||||
void updateTheme(ContextThemeWrapper contextThemeWrapper) {
|
||||
getTabLayout().updateTheme(contextThemeWrapper);
|
||||
for (FloatingHeaderRow row : mAllRows) {
|
||||
row.updateTheme(contextThemeWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns whether search bar has multi-line support, and is currently in multi-line state. */
|
||||
private boolean isSearchBarMultiline() {
|
||||
return Flags.multilineSearchBar() && mSearchBarOffset > 0;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.touch;
|
||||
|
||||
import static com.android.app.animation.Interpolators.DECELERATED_EASE;
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE;
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED_DECELERATE;
|
||||
@@ -34,8 +33,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PR
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
@@ -64,7 +65,9 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD);
|
||||
|
||||
// Depth to apply behind All Apps when it's presented on a sheet.
|
||||
private static final Interpolator ALL_APPS_SHEET_DEPTH = DECELERATED_EASE;
|
||||
private static final Interpolator ALL_APPS_SHEET_DEPTH = createAllAppsSheetDepthInterpolator();
|
||||
// Scale to apply behind All Apps when it's presented on a sheet.
|
||||
private static final Interpolator ALL_APPS_SHEET_SCALE = createAllAppsSheetScaleInterpolator();
|
||||
|
||||
// ---- Custom interpolators for NORMAL -> ALL_APPS on phones only. ----
|
||||
|
||||
@@ -203,15 +206,15 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
*/
|
||||
public static void applyAllAppsToNormalConfig(Launcher launcher, StateAnimationConfig config) {
|
||||
if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE,
|
||||
Interpolators.reverse(ALL_APPS_SCRIM_RESPONDER));
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME);
|
||||
if (!config.isUserControlled()) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED);
|
||||
}
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(
|
||||
ANIM_WORKSPACE_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE));
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE));
|
||||
config.setInterpolator(ANIM_DEPTH, Interpolators.reverse(ALL_APPS_SHEET_DEPTH));
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(ALL_APPS_SHEET_DEPTH));
|
||||
if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) {
|
||||
// On phones without blur, reveal the workspace and hotseat when leaving All Apps.
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT);
|
||||
@@ -253,13 +256,13 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
Launcher launcher, StateAnimationConfig config) {
|
||||
if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SCRIM_RESPONDER);
|
||||
if (!config.isUserControlled()) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED);
|
||||
}
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_SCALE);
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_SCALE);
|
||||
config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SHEET_DEPTH);
|
||||
if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) {
|
||||
// On phones without blur, hide the workspace and hotseat when entering All Apps.
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, FINAL_FRAME);
|
||||
@@ -292,6 +295,24 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
}
|
||||
}
|
||||
|
||||
private static Interpolator createAllAppsSheetDepthInterpolator() {
|
||||
Path path = new Path();
|
||||
path.moveTo(0f, 0f);
|
||||
path.cubicTo(0.016f, 0f, 0.04f, 0.1f, 0.08f, 0.1f);
|
||||
path.cubicTo(0.218f, 0.1f, 0.218f, 1f, 1f, 1f);
|
||||
|
||||
return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.83f);
|
||||
}
|
||||
|
||||
private static Interpolator createAllAppsSheetScaleInterpolator() {
|
||||
Path path = new Path();
|
||||
path.moveTo(0f, 0f);
|
||||
path.cubicTo(0.025f, 0f, 0.0625f, 0.2f, 0.125f, 0.2f);
|
||||
path.cubicTo(0.3875f, 0.2f, 0.125f, 1f, 1f, 1f);
|
||||
|
||||
return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.53f);
|
||||
}
|
||||
|
||||
/** Creates an interpolator that is 0 until the threshold, then follows given interpolator. */
|
||||
private static Interpolator thresholdInterpolator(float threshold, Interpolator interpolator) {
|
||||
return progress -> progress <= threshold ? 0 : interpolator.getInterpolation(progress);
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.workprofile;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@@ -47,10 +48,10 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
|
||||
}
|
||||
|
||||
/** Update the buttons background to match the theme. */
|
||||
public void updateTheme() {
|
||||
public void updateTheme(ContextThemeWrapper contextThemeWrapper) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
Button tab = (Button) getChildAt(i);
|
||||
tab.setBackground(getContext().getDrawable(R.drawable.all_apps_tabs_background));
|
||||
tab.setBackground(contextThemeWrapper.getDrawable(R.drawable.all_apps_tabs_background));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user