Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +17 −15 Original line number Diff line number Diff line Loading @@ -19,13 +19,11 @@ import android.annotation.IntDef import android.os.Parcel import android.os.Parcelable /** * The location of the bubble bar. */ /** The location of the bubble bar. */ enum class BubbleBarLocation : Parcelable { /** * Place bubble bar at the default location for the chosen system language. * If an RTL language is used, it is on the left. Otherwise on the right. * Place bubble bar at the default location for the chosen system language. If an RTL language * is used, it is on the left. Otherwise on the right. */ DEFAULT, /** Default bubble bar location is overridden. Place bubble bar on the left. */ Loading @@ -33,9 +31,7 @@ enum class BubbleBarLocation : Parcelable { /** Default bubble bar location is overridden. Place bubble bar on the right. */ RIGHT; /** * Returns whether bubble bar is pinned to the left edge or right edge. */ /** Returns whether bubble bar is pinned to the left edge or right edge. */ fun isOnLeft(isRtl: Boolean): Boolean { if (this == DEFAULT) { return isRtl Loading @@ -53,7 +49,8 @@ enum class BubbleBarLocation : Parcelable { companion object { @JvmField val CREATOR = object : Parcelable.Creator<BubbleBarLocation> { val CREATOR = object : Parcelable.Creator<BubbleBarLocation> { override fun createFromParcel(parcel: Parcel): BubbleBarLocation { return parcel.readString()?.let { valueOf(it) } ?: DEFAULT } Loading @@ -71,7 +68,9 @@ enum class BubbleBarLocation : Parcelable { second: BubbleBarLocation?, isRtl: Boolean ): Boolean { return first != null && second != null && first.isOnLeft(isRtl) != second.isOnLeft(isRtl) return first != null && second != null && first.isOnLeft(isRtl) != second.isOnLeft(isRtl) } } Loading Loading @@ -114,4 +113,7 @@ enum class BubbleBarLocation : Parcelable { const val DRAG_TASK = 8 } } /** A request to update the location of the bubble bar. */ data class UpdateLocationRequest(val location: BubbleBarLocation, @UpdateSource val source: Int) } libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +32 −13 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ import com.android.wm.shell.shared.annotations.ShellBackgroundThread; import com.android.wm.shell.shared.annotations.ShellMainThread; import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateLocationRequest; import com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateSource; import com.android.wm.shell.shared.bubbles.BubbleBarUpdate; import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; Loading Loading @@ -1676,7 +1677,11 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; Bubble b = mBubbleData.getOrCreateBubble(info); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - shortcut=%s", info); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } /** Loading @@ -1689,7 +1694,11 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; Bubble b = mBubbleData.getOrCreateBubble(intent, user); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", intent); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } /** Loading @@ -1704,20 +1713,31 @@ public class BubbleController implements ConfigurationChangeListener, Bubble b = mBubbleData.getOrCreateBubble(pendingIntent, user); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - pendingIntent=%s", pendingIntent); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } void expandStackAndSelectAppBubble(Bubble b, @Nullable BubbleBarLocation bubbleBarLocation, @UpdateSource int source) { void expandStackAndSelectAppBubble(Bubble b) { expandStackAndSelectAppBubble(b, /* updateLocationRequest= */ null); } void expandStackAndSelectAppBubble(Bubble b, @Nullable UpdateLocationRequest updateLocationRequest) { if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; BubbleBarLocation updateLocation = isShowingAsBubbleBar() ? bubbleBarLocation : null; if (updateLocation != null) { BubbleBarLocation location = isShowingAsBubbleBar() && updateLocationRequest != null ? updateLocationRequest.getLocation() : null; if (location != null) { // does not update the bubble bar location of the bubble bar, just expanded view updateExpandedViewForBubbleBarLocation(updateLocation, source); updateExpandedViewForBubbleBarLocation(location, updateLocationRequest.getSource()); } if (b.isInflated()) { // mBubbleData should be updated with the new location to update the bubble bar location mBubbleData.setSelectedBubbleAndExpandStack(b, updateLocation); mBubbleData.setSelectedBubbleAndExpandStack(b, location); } else { b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); Loading @@ -1725,10 +1745,9 @@ public class BubbleController implements ConfigurationChangeListener, ensureBubbleViewsAndWindowCreated(); mBubbleTransitions.startLaunchIntoOrConvertToBubble(b, mExpandedViewManager, mBubbleTaskViewFactory, mBubblePositioner, mStackView, mLayerView, mBubbleIconFactory, mInflateSynchronously, bubbleBarLocation); mBubbleIconFactory, mInflateSynchronously, location); } else { inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false, updateLocation); inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false, location); } } } Loading Loading @@ -2391,7 +2410,7 @@ public class BubbleController implements ConfigurationChangeListener, b.setIsBubble(isBubble); if (b.isApp() && isBubble) { Bubble bubble = mBubbleData.getOrCreateBubble(null, b); expandStackAndSelectAppBubble(bubble, null, UpdateSource.DRAG_BUBBLE); expandStackAndSelectAppBubble(bubble); return; } mSysuiProxy.getPendingOrActiveEntry(b.getKey(), (entry) -> { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleMultitaskingDelegate.java +2 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; import static com.android.wm.shell.bubbles.Bubbles.DISMISS_NO_LONGER_BUBBLE; import static com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateSource.A11Y_ACTION_BUBBLE; import android.annotation.BinderThread; import android.annotation.Nullable; Loading Loading @@ -97,8 +96,7 @@ public class BubbleMultitaskingDelegate extends IMultitaskingDelegate.Stub { Slog.d(TAG, "Created a collapsed bubble"); } } else { mController.expandStackAndSelectAppBubble(b, null /* bubbleBarLocation */, A11Y_ACTION_BUBBLE); // Any update source - location doesn't change mController.expandStackAndSelectAppBubble(b); if (DEBUG) { Slog.d(TAG, "Created an expanded bubble"); } Loading Loading @@ -126,8 +124,7 @@ public class BubbleMultitaskingDelegate extends IMultitaskingDelegate.Stub { } } else { final Bubble bubble = getBubbleWithToken(token); mController.expandStackAndSelectAppBubble(bubble, null /* bubbleBarLocation */, A11Y_ACTION_BUBBLE); mController.expandStackAndSelectAppBubble(bubble); if (DEBUG) { Slog.d(TAG, "Expanded bubbles"); } Loading Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +17 −15 Original line number Diff line number Diff line Loading @@ -19,13 +19,11 @@ import android.annotation.IntDef import android.os.Parcel import android.os.Parcelable /** * The location of the bubble bar. */ /** The location of the bubble bar. */ enum class BubbleBarLocation : Parcelable { /** * Place bubble bar at the default location for the chosen system language. * If an RTL language is used, it is on the left. Otherwise on the right. * Place bubble bar at the default location for the chosen system language. If an RTL language * is used, it is on the left. Otherwise on the right. */ DEFAULT, /** Default bubble bar location is overridden. Place bubble bar on the left. */ Loading @@ -33,9 +31,7 @@ enum class BubbleBarLocation : Parcelable { /** Default bubble bar location is overridden. Place bubble bar on the right. */ RIGHT; /** * Returns whether bubble bar is pinned to the left edge or right edge. */ /** Returns whether bubble bar is pinned to the left edge or right edge. */ fun isOnLeft(isRtl: Boolean): Boolean { if (this == DEFAULT) { return isRtl Loading @@ -53,7 +49,8 @@ enum class BubbleBarLocation : Parcelable { companion object { @JvmField val CREATOR = object : Parcelable.Creator<BubbleBarLocation> { val CREATOR = object : Parcelable.Creator<BubbleBarLocation> { override fun createFromParcel(parcel: Parcel): BubbleBarLocation { return parcel.readString()?.let { valueOf(it) } ?: DEFAULT } Loading @@ -71,7 +68,9 @@ enum class BubbleBarLocation : Parcelable { second: BubbleBarLocation?, isRtl: Boolean ): Boolean { return first != null && second != null && first.isOnLeft(isRtl) != second.isOnLeft(isRtl) return first != null && second != null && first.isOnLeft(isRtl) != second.isOnLeft(isRtl) } } Loading Loading @@ -114,4 +113,7 @@ enum class BubbleBarLocation : Parcelable { const val DRAG_TASK = 8 } } /** A request to update the location of the bubble bar. */ data class UpdateLocationRequest(val location: BubbleBarLocation, @UpdateSource val source: Int) }
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +32 −13 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ import com.android.wm.shell.shared.annotations.ShellBackgroundThread; import com.android.wm.shell.shared.annotations.ShellMainThread; import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateLocationRequest; import com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateSource; import com.android.wm.shell.shared.bubbles.BubbleBarUpdate; import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; Loading Loading @@ -1676,7 +1677,11 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; Bubble b = mBubbleData.getOrCreateBubble(info); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - shortcut=%s", info); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } /** Loading @@ -1689,7 +1694,11 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; Bubble b = mBubbleData.getOrCreateBubble(intent, user); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", intent); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } /** Loading @@ -1704,20 +1713,31 @@ public class BubbleController implements ConfigurationChangeListener, Bubble b = mBubbleData.getOrCreateBubble(pendingIntent, user); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - pendingIntent=%s", pendingIntent); expandStackAndSelectAppBubble(b, bubbleBarLocation, UpdateSource.APP_ICON_DRAG); UpdateLocationRequest updateLocationRequest = bubbleBarLocation == null ? null : new UpdateLocationRequest(bubbleBarLocation, UpdateSource.APP_ICON_DRAG); expandStackAndSelectAppBubble(b, updateLocationRequest); } void expandStackAndSelectAppBubble(Bubble b, @Nullable BubbleBarLocation bubbleBarLocation, @UpdateSource int source) { void expandStackAndSelectAppBubble(Bubble b) { expandStackAndSelectAppBubble(b, /* updateLocationRequest= */ null); } void expandStackAndSelectAppBubble(Bubble b, @Nullable UpdateLocationRequest updateLocationRequest) { if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return; BubbleBarLocation updateLocation = isShowingAsBubbleBar() ? bubbleBarLocation : null; if (updateLocation != null) { BubbleBarLocation location = isShowingAsBubbleBar() && updateLocationRequest != null ? updateLocationRequest.getLocation() : null; if (location != null) { // does not update the bubble bar location of the bubble bar, just expanded view updateExpandedViewForBubbleBarLocation(updateLocation, source); updateExpandedViewForBubbleBarLocation(location, updateLocationRequest.getSource()); } if (b.isInflated()) { // mBubbleData should be updated with the new location to update the bubble bar location mBubbleData.setSelectedBubbleAndExpandStack(b, updateLocation); mBubbleData.setSelectedBubbleAndExpandStack(b, location); } else { b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); Loading @@ -1725,10 +1745,9 @@ public class BubbleController implements ConfigurationChangeListener, ensureBubbleViewsAndWindowCreated(); mBubbleTransitions.startLaunchIntoOrConvertToBubble(b, mExpandedViewManager, mBubbleTaskViewFactory, mBubblePositioner, mStackView, mLayerView, mBubbleIconFactory, mInflateSynchronously, bubbleBarLocation); mBubbleIconFactory, mInflateSynchronously, location); } else { inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false, updateLocation); inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false, location); } } } Loading Loading @@ -2391,7 +2410,7 @@ public class BubbleController implements ConfigurationChangeListener, b.setIsBubble(isBubble); if (b.isApp() && isBubble) { Bubble bubble = mBubbleData.getOrCreateBubble(null, b); expandStackAndSelectAppBubble(bubble, null, UpdateSource.DRAG_BUBBLE); expandStackAndSelectAppBubble(bubble); return; } mSysuiProxy.getPendingOrActiveEntry(b.getKey(), (entry) -> { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleMultitaskingDelegate.java +2 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; import static com.android.wm.shell.bubbles.Bubbles.DISMISS_NO_LONGER_BUBBLE; import static com.android.wm.shell.shared.bubbles.BubbleBarLocation.UpdateSource.A11Y_ACTION_BUBBLE; import android.annotation.BinderThread; import android.annotation.Nullable; Loading Loading @@ -97,8 +96,7 @@ public class BubbleMultitaskingDelegate extends IMultitaskingDelegate.Stub { Slog.d(TAG, "Created a collapsed bubble"); } } else { mController.expandStackAndSelectAppBubble(b, null /* bubbleBarLocation */, A11Y_ACTION_BUBBLE); // Any update source - location doesn't change mController.expandStackAndSelectAppBubble(b); if (DEBUG) { Slog.d(TAG, "Created an expanded bubble"); } Loading Loading @@ -126,8 +124,7 @@ public class BubbleMultitaskingDelegate extends IMultitaskingDelegate.Stub { } } else { final Bubble bubble = getBubbleWithToken(token); mController.expandStackAndSelectAppBubble(bubble, null /* bubbleBarLocation */, A11Y_ACTION_BUBBLE); mController.expandStackAndSelectAppBubble(bubble); if (DEBUG) { Slog.d(TAG, "Expanded bubbles"); } Loading