Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7434eb52 authored by Ivan Tkachenko's avatar Ivan Tkachenko Committed by Automerger Merge Worker
Browse files

Merge "App Bubble custom icon support" into udc-dev am: 24b93414 am: 4bb54480

parents 0db0d7ff 4bb54480
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -206,12 +206,14 @@ public class Bubble implements BubbleViewProvider {

    public Bubble(Intent intent,
            UserHandle user,
            @Nullable Icon icon,
            Executor mainExecutor) {
        mKey = KEY_APP_BUBBLE;
        mGroupKey = null;
        mLocusId = null;
        mFlags = 0;
        mUser = user;
        mIcon = icon;
        mShowBubbleUpdateDot = false;
        mMainExecutor = mainExecutor;
        mTaskId = INVALID_TASK_ID;
+6 −4
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Icon;
import android.os.Binder;
import android.os.Handler;
import android.os.RemoteException;
@@ -1034,8 +1035,9 @@ public class BubbleController implements ConfigurationChangeListener {
     *
     * @param intent the intent to display in the bubble expanded view.
     * @param user the {@link UserHandle} of the user to start this activity for.
     * @param icon the {@link Icon} to use for the bubble view.
     */
    public void showOrHideAppBubble(Intent intent, UserHandle user) {
    public void showOrHideAppBubble(Intent intent, UserHandle user, @Nullable Icon icon) {
        if (intent == null || intent.getPackage() == null) {
            Log.w(TAG, "App bubble failed to show, invalid intent: " + intent
                    + ((intent != null) ? " with package: " + intent.getPackage() : " "));
@@ -1063,7 +1065,7 @@ public class BubbleController implements ConfigurationChangeListener {
            }
        } else {
            // App bubble does not exist, lets add and expand it
            Bubble b = new Bubble(intent, user, mMainExecutor);
            Bubble b = new Bubble(intent, user, icon, mMainExecutor);
            b.setShouldAutoExpand(true);
            inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false);
        }
@@ -1871,9 +1873,9 @@ public class BubbleController implements ConfigurationChangeListener {
        }

        @Override
        public void showOrHideAppBubble(Intent intent, UserHandle user) {
        public void showOrHideAppBubble(Intent intent, UserHandle user, @Nullable Icon icon) {
            mMainExecutor.execute(
                    () -> BubbleController.this.showOrHideAppBubble(intent, user));
                    () -> BubbleController.this.showOrHideAppBubble(intent, user, icon));
        }

        @Override
+3 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.app.NotificationChannel;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.graphics.drawable.Icon;
import android.hardware.HardwareBuffer;
import android.os.UserHandle;
import android.service.notification.NotificationListenerService;
@@ -135,8 +136,9 @@ public interface Bubbles {
     *
     * @param intent the intent to display in the bubble expanded view.
     * @param user the {@link UserHandle} of the user to start this activity for.
     * @param icon the {@link Icon} to use for the bubble view.
     */
    void showOrHideAppBubble(Intent intent, UserHandle user);
    void showOrHideAppBubble(Intent intent, UserHandle user, @Nullable Icon icon);

    /** @return true if the specified {@code taskId} corresponds to app bubble's taskId. */
    boolean isAppBubbleTaskId(int taskId);
+2 −1
Original line number Diff line number Diff line
@@ -185,7 +185,8 @@ public class BubbleDataTest extends ShellTestCase {

        Intent appBubbleIntent = new Intent(mContext, BubblesTestActivity.class);
        appBubbleIntent.setPackage(mContext.getPackageName());
        mAppBubble = new Bubble(appBubbleIntent, new UserHandle(1), mMainExecutor);
        mAppBubble = new Bubble(appBubbleIntent, new UserHandle(1), mock(Icon.class),
                mMainExecutor);

        mPositioner = new TestableBubblePositioner(mContext,
                mock(WindowManager.class));
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ constructor(
            logDebug { "onShowNoteTask - start: $info on user#${user.identifier}" }
            when (info.launchMode) {
                is NoteTaskLaunchMode.AppBubble -> {
                    bubbles.showOrHideAppBubble(intent, userTracker.userHandle)
                    // TODO: provide app bubble icon
                    bubbles.showOrHideAppBubble(intent, userTracker.userHandle, null /* icon */)
                    // App bubble logging happens on `onBubbleExpandChanged`.
                    logDebug { "onShowNoteTask - opened as app bubble: $info" }
                }
Loading