Snap for 13382171 from 4c4db8ceb5 to 25Q3-release
Change-Id: Ia48f77b64c487c93430140ca20f95eb86fdf9539
This commit is contained in:
commit
d456060304
6 files changed
+50
-15
No files matched your search
@@ -248,6 +248,7 @@ public class TaskbarControllers {
|
||||
}, () -> uiController.onBubbleBarLocationUpdated(null));
|
||||
// Notify that the ui controller has changed
|
||||
navbarButtonsViewController.onUiControllerChanged();
|
||||
taskbarViewController.onUiControllerChanged();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -350,26 +350,32 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mIconLongClickListener = mControllerCallbacks.getIconOnLongClickListener();
|
||||
|
||||
mAllAppsButtonContainer.setUpCallbacks(callbacks);
|
||||
if (mTaskbarDividerContainer != null
|
||||
&& mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) {
|
||||
mTaskbarDividerContainer.setUpCallbacks(callbacks);
|
||||
}
|
||||
if (mTaskbarOverflowView != null) {
|
||||
mTaskbarOverflowView.setOnClickListener(
|
||||
mControllerCallbacks.getOverflowOnClickListener());
|
||||
mTaskbarOverflowView.setOnLongClickListener(
|
||||
mControllerCallbacks.getOverflowOnLongClickListener());
|
||||
}
|
||||
if (Flags.showTaskbarPinningPopupFromAnywhere()
|
||||
&& mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) {
|
||||
setOnTouchListener(mControllerCallbacks.getTaskbarTouchListener());
|
||||
}
|
||||
|
||||
if (Flags.taskbarOverflow()) {
|
||||
mMaxNumIcons = calculateMaxNumIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void updatePinningPopupEventHandlers() {
|
||||
boolean supportsPinningPopup =
|
||||
mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup();
|
||||
if (mTaskbarDividerContainer != null) {
|
||||
mTaskbarDividerContainer.setUpCallbacks(
|
||||
supportsPinningPopup ? mControllerCallbacks : null);
|
||||
}
|
||||
|
||||
if (Flags.showTaskbarPinningPopupFromAnywhere()) {
|
||||
setOnTouchListener(
|
||||
supportsPinningPopup ? mControllerCallbacks.getTaskbarTouchListener() : null);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAndRecycle(View view) {
|
||||
removeView(view);
|
||||
view.setOnClickListener(null);
|
||||
|
||||
@@ -266,6 +266,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
|
||||
mTaskbarView.init(TaskbarViewCallbacksFactory.newInstance(mActivity).create(
|
||||
mActivity, mControllers, mTaskbarView));
|
||||
// Pinning popup feature availability depends on taskbar controllers, wait for the
|
||||
// controllers state initialization before evaluating the feature.
|
||||
mControllers.runAfterInit(mTaskbarView::updatePinningPopupEventHandlers);
|
||||
mTaskbarView.getLayoutParams().height = mActivity.isPhoneMode()
|
||||
? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_phone_size)
|
||||
: mActivity.getDeviceProfile().taskbarHeight;
|
||||
@@ -302,6 +305,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a new ui controller is set.
|
||||
*/
|
||||
public void onUiControllerChanged() {
|
||||
// Pinning availability may depend on UI state when home has "locked" pinned taskbar.
|
||||
mTaskbarView.updatePinningPopupEventHandlers();
|
||||
}
|
||||
|
||||
/** Adjusts start aligned taskbar layout accordingly to the bubble bar position. */
|
||||
@Override
|
||||
public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
|
||||
|
||||
+3
-3
@@ -67,8 +67,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
fun setUpCallbacks(callbacks: TaskbarViewCallbacks) {
|
||||
setOnLongClickListener(callbacks.taskbarDividerLongClickListener)
|
||||
setOnTouchListener(callbacks.taskbarDividerRightClickListener)
|
||||
fun setUpCallbacks(callbacks: TaskbarViewCallbacks?) {
|
||||
setOnLongClickListener(callbacks?.taskbarDividerLongClickListener)
|
||||
setOnTouchListener(callbacks?.taskbarDividerRightClickListener)
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -41,7 +41,9 @@ private constructor(private val taskbarActivityContext: TaskbarActivityContext)
|
||||
get() = taskbarActivityContext.deviceProfile.isLandscape
|
||||
|
||||
val supportsPinningPopup: Boolean
|
||||
get() = !hasNavButtons
|
||||
// TODO(b/381535785): Allow pinning for desktop taskbar when desktop mode transient behavior
|
||||
// gets updated to retain pinned UI, but translate the taskbar offscreen.
|
||||
get() = !hasNavButtons && !taskbarActivityContext.isTaskbarShowingDesktopTasks
|
||||
|
||||
fun onDestroy() {
|
||||
taskbarFeatureEvaluator = null
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.dagger.LauncherBaseAppComponent;
|
||||
import com.android.launcher3.testing.shared.ResourceUtils;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.WindowBounds;
|
||||
|
||||
@@ -142,15 +143,29 @@ public class WindowManagerProxy {
|
||||
WindowMetrics windowMetrics = displayInfoContext.getSystemService(WindowManager.class)
|
||||
.getMaximumWindowMetrics();
|
||||
Rect insets = new Rect();
|
||||
normalizeWindowInsets(displayInfoContext, windowMetrics.getWindowInsets(), insets);
|
||||
// NOTE: Unable to use `normalizeWindowInsets(Context, WidnowInsets, Rect)` because
|
||||
// uses DisplayController instance to determine whether taskbar is shown on home, and this
|
||||
// method gets called while initializing DisaplayController.
|
||||
normalizeWindowInsets(displayInfoContext,
|
||||
showLockedTaskbarOnHome(displayInfoContext) || showDesktopTaskbarForFreeformDisplay(
|
||||
displayInfoContext), windowMetrics.getWindowInsets(), insets);
|
||||
return new WindowBounds(windowMetrics.getBounds(), insets, info.rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an updated insets, accounting for various Launcher UI specific overrides like taskbar
|
||||
*/
|
||||
public WindowInsets normalizeWindowInsets(Context context, WindowInsets oldInsets,
|
||||
public WindowInsets normalizeWindowInsets(Context context,
|
||||
WindowInsets oldInsets,
|
||||
Rect outInsets) {
|
||||
return normalizeWindowInsets(context,
|
||||
DisplayController.showLockedTaskbarOnHome(context)
|
||||
|| DisplayController.showDesktopTaskbarForFreeformDisplay(context),
|
||||
oldInsets, outInsets);
|
||||
}
|
||||
|
||||
WindowInsets normalizeWindowInsets(Context context, boolean taskbarShownOnHome,
|
||||
WindowInsets oldInsets, Rect outInsets) {
|
||||
if (!mTaskbarDrawnInProcess) {
|
||||
outInsets.set(oldInsets.getSystemWindowInsetLeft(), oldInsets.getSystemWindowInsetTop(),
|
||||
oldInsets.getSystemWindowInsetRight(), oldInsets.getSystemWindowInsetBottom());
|
||||
@@ -202,7 +217,7 @@ public class WindowManagerProxy {
|
||||
|
||||
// Override the tappable insets to be 0 on the bottom for gesture nav (otherwise taskbar
|
||||
// would count towards it). This is used for the bottom protection in All Apps for example.
|
||||
if (isGesture) {
|
||||
if (isGesture && !taskbarShownOnHome) {
|
||||
Insets oldTappableInsets = oldInsets.getInsets(WindowInsets.Type.tappableElement());
|
||||
Insets newTappableInsets = Insets.of(oldTappableInsets.left, oldTappableInsets.top,
|
||||
oldTappableInsets.right, 0);
|
||||
|
||||
Reference in new issue
Block a user