Snap for 11865526 from 38ad424a17 to 24Q3-release

Change-Id: I11cd41b53577d8be6169c5c84c20814950ae35cb
This commit is contained in:
Android Build Coastguard Worker
2024-05-21 01:21:50 +00:00
10 changed files with 54 additions and 76 deletions
@@ -424,14 +424,15 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
* @see android.view.WindowInsets.Type#systemBars()
*/
public int getContentHeightToReportToApps() {
if ((mActivity.isPhoneMode() && !mActivity.isThreeButtonNav())
|| DisplayController.isTransientTaskbar(mActivity)) {
if (mActivity.isUserSetupComplete() && (mActivity.isPhoneGestureNavMode()
|| DisplayController.isTransientTaskbar(mActivity))) {
return getStashedHeight();
}
if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
DeviceProfile dp = mActivity.getDeviceProfile();
if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && dp.isTaskbarPresent) {
if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && (dp.isTaskbarPresent
|| mActivity.isPhoneGestureNavMode())) {
// We always show the back button in SUW but in portrait the SUW layout may not
// be wide enough to support overlapping the nav bar with its content.
// We're sending different res values in portrait vs landscape
@@ -31,8 +31,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
import static java.lang.Math.abs;
import android.annotation.BinderThread;
import android.annotation.Nullable;
import android.app.Notification;
@@ -47,7 +45,6 @@ import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -67,7 +64,6 @@ import com.android.launcher3.R;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Executors.SimpleThreadFactory;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
@@ -153,8 +149,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
private BubbleStashedHandleViewController mBubbleStashedHandleViewController;
private BubblePinController mBubblePinController;
// Keep track of bubble bar bounds sent to shell to avoid sending duplicate updates
private final Rect mLastSentBubbleBarBounds = new Rect();
// Cache last sent top coordinate to avoid sending duplicate updates to shell
private int mLastSentBubbleBarTop;
/**
* Similar to {@link BubbleBarUpdate} but rather than {@link BubbleInfo}s it uses
@@ -445,9 +441,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
info.getFlags() | Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION);
mSelectedBubble.getView().updateDotVisibility(true /* animate */);
}
Rect bounds = getExpandedBubbleBarDisplayBounds();
mLastSentBubbleBarBounds.set(bounds);
mSystemUiProxy.showBubble(getSelectedBubbleKey(), bounds);
mLastSentBubbleBarTop = mBarView.getRestingTopPositionOnScreen();
mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTop);
} else {
Log.w(TAG, "Trying to show the selected bubble but it's null");
}
@@ -636,42 +631,14 @@ public class BubbleBarController extends IBubblesListener.Stub {
return mIconFactory.createBadgedIconBitmap(drawable).icon;
}
private void onBubbleBarBoundsChanged(Rect newBounds) {
Rect displayBounds = convertToDisplayBounds(newBounds);
// Only send bounds over if they changed
if (!displayBounds.equals(mLastSentBubbleBarBounds)) {
mLastSentBubbleBarBounds.set(displayBounds);
mSystemUiProxy.setBubbleBarBounds(displayBounds);
private void onBubbleBarBoundsChanged() {
int newTop = mBarView.getRestingTopPositionOnScreen();
if (newTop != mLastSentBubbleBarTop) {
mLastSentBubbleBarTop = newTop;
mSystemUiProxy.updateBubbleBarTopOnScreen(newTop);
}
}
/**
* Get bounds of the bubble bar as if it would be expanded.
* Calculates the bounds instead of retrieving current view location as the view may be
* animating.
*/
private Rect getExpandedBubbleBarDisplayBounds() {
return convertToDisplayBounds(mBarView.getBubbleBarBounds());
}
private Rect convertToDisplayBounds(Rect currentBarBounds) {
Point displaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize;
Rect displayBounds = new Rect();
// currentBarBounds is only useful for distance from left or right edge.
// It contains the current bounds, calculate the expanded bounds.
if (mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl())) {
displayBounds.left = currentBarBounds.left;
displayBounds.right = (int) (currentBarBounds.left + mBarView.expandedWidth());
} else {
displayBounds.left = (int) (currentBarBounds.right - mBarView.expandedWidth());
displayBounds.right = currentBarBounds.right;
}
final int translation = (int) abs(mBubbleStashController.getBubbleBarTranslationY());
displayBounds.top = displaySize.y - currentBarBounds.height() - translation;
displayBounds.bottom = displaySize.y - translation;
return displayBounds;
}
/** Interface for checking whether the IME is visible. */
public interface ImeVisibilityChecker {
/** Whether the IME is visible. */
@@ -43,6 +43,7 @@ import androidx.dynamicanimation.animation.SpringForce;
import com.android.launcher3.R;
import com.android.launcher3.anim.SpringAnimationBuilder;
import com.android.launcher3.util.DisplayController;
import com.android.wm.shell.common.bubbles.BubbleBarLocation;
import java.util.List;
@@ -553,6 +554,15 @@ public class BubbleBarView extends FrameLayout {
setAlpha(1f);
}
/**
* Get bubble bar top coordinate on screen when bar is resting
*/
public int getRestingTopPositionOnScreen() {
int displayHeight = DisplayController.INSTANCE.get(getContext()).getInfo().currentSize.y;
int bubbleBarHeight = getBubbleBarBounds().height();
return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY();
}
/**
* Updates the bounds with translation that may have been applied and returns the result.
*/
@@ -93,8 +93,6 @@ public class BubbleBarViewController {
@Nullable
private BubbleBarBoundsChangeListener mBoundsChangeListener;
private final Rect mPreviousBubbleBarBounds = new Rect();
public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) {
mActivity = activity;
mBarView = barView;
@@ -122,12 +120,8 @@ public class BubbleBarViewController {
mBarView.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
Rect bubbleBarBounds = mBarView.getBubbleBarBounds();
if (!bubbleBarBounds.equals(mPreviousBubbleBarBounds)) {
mPreviousBubbleBarBounds.set(bubbleBarBounds);
if (mBoundsChangeListener != null) {
mBoundsChangeListener.onBoundsChanged(bubbleBarBounds);
}
if (mBoundsChangeListener != null) {
mBoundsChangeListener.onBoundsChanged();
}
});
@@ -497,7 +491,7 @@ public class BubbleBarViewController {
* that a bubble is being dragged to dismiss.
* @param bubbleView dragged bubble view
*/
public void onDragStart(@NonNull BubbleView bubbleView) {
public void onBubbleDragStart(@NonNull BubbleView bubbleView) {
if (bubbleView.getBubble() == null) return;
mSystemUiProxy.startBubbleDrag(bubbleView.getBubble().getKey());
@@ -507,20 +501,19 @@ public class BubbleBarViewController {
/**
* Notifies SystemUI to expand the selected bubble when the bubble is released.
*/
public void onDragRelease(BubbleBarLocation location) {
// TODO(b/330585402): send new bubble bar bounds to shell for the animation
mSystemUiProxy.stopBubbleDrag(location);
public void onBubbleDragRelease(BubbleBarLocation location) {
mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen());
}
/**
* Notifies {@link BubbleBarView} that drag and all animations are finished.
*/
public void onDragBubbleEnded() {
public void onBubbleDragEnd() {
mBarView.setDraggedBubble(null);
}
/** Notifies that dragging the bubble bar ended. */
public void onDragBubbleBarEnded() {
public void onBubbleBarDragEnd() {
// we may have changed the bubble bar translation Y value from the value it had at the
// beginning of the drag, so update the translation Y animator state
mBubbleBarTranslationY.updateValue(mBarView.getTranslationY());
@@ -576,6 +569,6 @@ public class BubbleBarViewController {
*/
public interface BubbleBarBoundsChangeListener {
/** Called when bounds have changed */
void onBoundsChanged(Rect newBounds);
void onBoundsChanged();
}
}
@@ -97,7 +97,7 @@ public class BubbleDragController {
@Override
void onDragStart() {
mBubblePinController.setListener(mLocationChangeListener);
mBubbleBarViewController.onDragStart(bubbleView);
mBubbleBarViewController.onBubbleDragStart(bubbleView);
mBubblePinController.onDragStart(
mBubbleBarViewController.getBubbleBarLocation().isOnLeft(
bubbleView.isLayoutRtl()));
@@ -113,7 +113,7 @@ public class BubbleDragController {
@Override
protected void onDragRelease() {
mBubblePinController.onDragEnd();
mBubbleBarViewController.onDragRelease(mReleasedLocation);
mBubbleBarViewController.onBubbleDragRelease(mReleasedLocation);
}
@Override
@@ -124,7 +124,7 @@ public class BubbleDragController {
@Override
void onDragEnd() {
mBubbleBarController.updateBubbleBarLocation(mReleasedLocation);
mBubbleBarViewController.onDragBubbleEnded();
mBubbleBarViewController.onBubbleDragEnd();
mBubblePinController.setListener(null);
}
@@ -192,7 +192,7 @@ public class BubbleDragController {
bubbleBarView.setIsDragging(false);
// Restoring the initial pivot for the bubble bar view
bubbleBarView.setRelativePivot(initialRelativePivot.x, initialRelativePivot.y);
mBubbleBarViewController.onDragBubbleBarEnded();
mBubbleBarViewController.onBubbleBarDragEnd();
mBubbleBarPinController.setListener(null);
}
@@ -761,12 +761,12 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable {
/**
* Tells SysUI to show the bubble with the provided key.
* @param key the key of the bubble to show.
* @param bubbleBarBounds bounds of the bubble bar in display coordinates
* @param top top coordinate of bubble bar on screen
*/
public void showBubble(String key, Rect bubbleBarBounds) {
public void showBubble(String key, int top) {
if (mBubbles != null) {
try {
mBubbles.showBubble(key, bubbleBarBounds);
mBubbles.showBubble(key, top);
} catch (RemoteException e) {
Log.w(TAG, "Failed call showBubble");
}
@@ -815,12 +815,14 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable {
/**
* Tells SysUI when the bubble stops being dragged.
* Should be called only when the bubble bar is expanded.
*
* @param location location of the bubble bar
* @param top new top coordinate for bubble bar on screen
*/
public void stopBubbleDrag(BubbleBarLocation location) {
public void stopBubbleDrag(BubbleBarLocation location, int top) {
if (mBubbles == null) return;
try {
mBubbles.stopBubbleDrag(location);
mBubbles.stopBubbleDrag(location, top);
} catch (RemoteException e) {
Log.w(TAG, "Failed call stopBubbleDrag");
}
@@ -864,16 +866,17 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable {
}
/**
* Tells SysUI the bounds for the bubble bar
* @param bubbleBarBounds bounds of the bubble bar in display coordinates
* Tells SysUI the top coordinate of bubble bar on screen
*
* @param topOnScreen top coordinate for bubble bar on screen
*/
public void setBubbleBarBounds(Rect bubbleBarBounds) {
public void updateBubbleBarTopOnScreen(int topOnScreen) {
try {
if (mBubbles != null) {
mBubbles.setBubbleBarBounds(bubbleBarBounds);
mBubbles.updateBubbleBarTopOnScreen(topOnScreen);
}
} catch (RemoteException e) {
Log.w(TAG, "Failed call setBubbleBarBounds");
Log.w(TAG, "Failed call updateBubbleBarTopOnScreen");
}
}
+1 -1
View File
@@ -50,9 +50,9 @@
android:id="@+id/action_btn"
android:layout_width="@dimen/x_icon_size"
android:layout_height="@dimen/x_icon_size"
android:scaleType="centerInside"
android:layout_gravity="center"
android:contentDescription="@string/accessibility_close"
android:padding="@dimen/x_icon_padding"
android:background="@android:color/transparent"
android:src="@drawable/ic_remove_no_shadow" />
</FrameLayout>
-1
View File
@@ -167,7 +167,6 @@
<!-- (x) icon button inside work edu card -->
<dimen name="rounded_button_width">24dp</dimen>
<dimen name="x_icon_size">16dp</dimen>
<dimen name="x_icon_padding">4dp</dimen>
<!-- rounded button shown inside card views, and snack bars -->
<dimen name="padded_rounded_button_height">48dp</dimen>
@@ -19,6 +19,7 @@ package com.android.launcher3;
import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED;
import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD;
import static com.android.launcher3.LauncherPrefs.WORK_EDU_STEP;
import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD;
import static com.android.launcher3.icons.cache.BaseIconCache.EMPTY_CLASS_NAME;
import static com.android.launcher3.model.PackageUpdatedTask.OP_UPDATE;
@@ -276,6 +277,9 @@ public class LauncherModel implements InstallSessionTracker.Callback {
enqueueModelUpdateTask(new PackageUpdatedTask(
PackageUpdatedTask.OP_USER_AVAILABILITY_CHANGE, user));
}
if (Intent.ACTION_MANAGED_PROFILE_REMOVED.equals(action)) {
LauncherPrefs.get(mApp.getContext()).put(WORK_EDU_STEP, 0);
}
}
/**
@@ -101,6 +101,7 @@ public class UserCache implements SafeCloseable {
mUserChangeReceiver.register(mContext,
Intent.ACTION_MANAGED_PROFILE_AVAILABLE,
Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE,
Intent.ACTION_MANAGED_PROFILE_REMOVED,
ACTION_PROFILE_ADDED,
ACTION_PROFILE_REMOVED,
ACTION_PROFILE_UNLOCKED,