Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +9 −8 Original line number Diff line number Diff line Loading @@ -1028,19 +1028,21 @@ public class BubbleController implements ConfigurationChangeListener { * the bubble or bubble stack. * * Some notes: * - Only one app bubble is supported at a time * - Only one app bubble is supported at a time, regardless of users. Multi-users support is * tracked in b/273533235. * - Calling this method with a different intent than the existing app bubble will do nothing * * @param intent the intent to display in the bubble expanded view. * @param user the {@link UserHandle} of the user to start this activity for. */ public void showOrHideAppBubble(Intent intent) { public void showOrHideAppBubble(Intent intent, UserHandle user) { if (intent == null || intent.getPackage() == null) { Log.w(TAG, "App bubble failed to show, invalid intent: " + intent + ((intent != null) ? " with package: " + intent.getPackage() : " ")); return; } PackageManager packageManager = getPackageManagerForUser(mContext, mCurrentUserId); PackageManager packageManager = getPackageManagerForUser(mContext, user.getIdentifier()); if (!isResizableActivity(intent, packageManager, KEY_APP_BUBBLE)) return; Bubble existingAppBubble = mBubbleData.getBubbleInStackWithKey(KEY_APP_BUBBLE); Loading @@ -1061,7 +1063,7 @@ public class BubbleController implements ConfigurationChangeListener { } } else { // App bubble does not exist, lets add and expand it Bubble b = new Bubble(intent, UserHandle.of(mCurrentUserId), mMainExecutor); Bubble b = new Bubble(intent, user, mMainExecutor); b.setShouldAutoExpand(true); inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false); } Loading Loading @@ -1869,10 +1871,9 @@ public class BubbleController implements ConfigurationChangeListener { } @Override public void showOrHideAppBubble(Intent intent) { mMainExecutor.execute(() -> { BubbleController.this.showOrHideAppBubble(intent); }); public void showOrHideAppBubble(Intent intent, UserHandle user) { mMainExecutor.execute( () -> BubbleController.this.showOrHideAppBubble(intent, user)); } @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +7 −2 Original line number Diff line number Diff line Loading @@ -236,12 +236,17 @@ public class BubbleExpandedView extends LinearLayout { fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); if (mBubble.isAppBubble()) { PendingIntent pi = PendingIntent.getActivity(mContext, 0, Context context = mContext.createContextAsUser( mBubble.getUser(), Context.CONTEXT_RESTRICTED); PendingIntent pi = PendingIntent.getActivity( context, /* requestCode= */ 0, mBubble.getAppBubbleIntent() .addFlags(FLAG_ACTIVITY_NEW_DOCUMENT) .addFlags(FLAG_ACTIVITY_MULTIPLE_TASK), PendingIntent.FLAG_IMMUTABLE, null); /* options= */ null); mTaskView.startActivity(pi, /* fillInIntent= */ null, options, launchBounds); } else if (!mIsOverflow && mBubble.hasMetadataShortcutId()) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java +4 −2 Original line number Diff line number Diff line Loading @@ -129,12 +129,14 @@ public interface Bubbles { * the bubble or bubble stack. * * Some notes: * - Only one app bubble is supported at a time * - Only one app bubble is supported at a time, regardless of users. Multi-users support is * tracked in b/273533235. * - Calling this method with a different intent than the existing app bubble will do nothing * * @param intent the intent to display in the bubble expanded view. * @param user the {@link UserHandle} of the user to start this activity for. */ void showOrHideAppBubble(Intent intent); void showOrHideAppBubble(Intent intent, UserHandle user); /** @return true if the specified {@code taskId} corresponds to app bubble's taskId. */ boolean isAppBubbleTaskId(int taskId); Loading packages/SystemUI/src/com/android/systemui/notetask/NoteTaskController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -129,8 +129,7 @@ constructor( logDebug { "onShowNoteTask - start: $info" } when (info.launchMode) { is NoteTaskLaunchMode.AppBubble -> { // TODO(b/267634412, b/268351693): Should use `showOrHideAppBubbleAsUser` bubbles.showOrHideAppBubble(intent) bubbles.showOrHideAppBubble(intent, userTracker.userHandle) // App bubble logging happens on `onBubbleExpandChanged`. logDebug { "onShowNoteTask - opened as app bubble: $info" } } Loading packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -232,7 +232,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { verifyZeroInteractions(context) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading Loading @@ -366,7 +366,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { createNoteTaskController().showNoteTask(entryPoint = NoteTaskEntryPoint.QUICK_AFFORDANCE) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading @@ -389,7 +389,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { createNoteTaskController().showNoteTask(entryPoint = NoteTaskEntryPoint.QUICK_AFFORDANCE) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +9 −8 Original line number Diff line number Diff line Loading @@ -1028,19 +1028,21 @@ public class BubbleController implements ConfigurationChangeListener { * the bubble or bubble stack. * * Some notes: * - Only one app bubble is supported at a time * - Only one app bubble is supported at a time, regardless of users. Multi-users support is * tracked in b/273533235. * - Calling this method with a different intent than the existing app bubble will do nothing * * @param intent the intent to display in the bubble expanded view. * @param user the {@link UserHandle} of the user to start this activity for. */ public void showOrHideAppBubble(Intent intent) { public void showOrHideAppBubble(Intent intent, UserHandle user) { if (intent == null || intent.getPackage() == null) { Log.w(TAG, "App bubble failed to show, invalid intent: " + intent + ((intent != null) ? " with package: " + intent.getPackage() : " ")); return; } PackageManager packageManager = getPackageManagerForUser(mContext, mCurrentUserId); PackageManager packageManager = getPackageManagerForUser(mContext, user.getIdentifier()); if (!isResizableActivity(intent, packageManager, KEY_APP_BUBBLE)) return; Bubble existingAppBubble = mBubbleData.getBubbleInStackWithKey(KEY_APP_BUBBLE); Loading @@ -1061,7 +1063,7 @@ public class BubbleController implements ConfigurationChangeListener { } } else { // App bubble does not exist, lets add and expand it Bubble b = new Bubble(intent, UserHandle.of(mCurrentUserId), mMainExecutor); Bubble b = new Bubble(intent, user, mMainExecutor); b.setShouldAutoExpand(true); inflateAndAdd(b, /* suppressFlyout= */ true, /* showInShade= */ false); } Loading Loading @@ -1869,10 +1871,9 @@ public class BubbleController implements ConfigurationChangeListener { } @Override public void showOrHideAppBubble(Intent intent) { mMainExecutor.execute(() -> { BubbleController.this.showOrHideAppBubble(intent); }); public void showOrHideAppBubble(Intent intent, UserHandle user) { mMainExecutor.execute( () -> BubbleController.this.showOrHideAppBubble(intent, user)); } @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +7 −2 Original line number Diff line number Diff line Loading @@ -236,12 +236,17 @@ public class BubbleExpandedView extends LinearLayout { fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); if (mBubble.isAppBubble()) { PendingIntent pi = PendingIntent.getActivity(mContext, 0, Context context = mContext.createContextAsUser( mBubble.getUser(), Context.CONTEXT_RESTRICTED); PendingIntent pi = PendingIntent.getActivity( context, /* requestCode= */ 0, mBubble.getAppBubbleIntent() .addFlags(FLAG_ACTIVITY_NEW_DOCUMENT) .addFlags(FLAG_ACTIVITY_MULTIPLE_TASK), PendingIntent.FLAG_IMMUTABLE, null); /* options= */ null); mTaskView.startActivity(pi, /* fillInIntent= */ null, options, launchBounds); } else if (!mIsOverflow && mBubble.hasMetadataShortcutId()) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java +4 −2 Original line number Diff line number Diff line Loading @@ -129,12 +129,14 @@ public interface Bubbles { * the bubble or bubble stack. * * Some notes: * - Only one app bubble is supported at a time * - Only one app bubble is supported at a time, regardless of users. Multi-users support is * tracked in b/273533235. * - Calling this method with a different intent than the existing app bubble will do nothing * * @param intent the intent to display in the bubble expanded view. * @param user the {@link UserHandle} of the user to start this activity for. */ void showOrHideAppBubble(Intent intent); void showOrHideAppBubble(Intent intent, UserHandle user); /** @return true if the specified {@code taskId} corresponds to app bubble's taskId. */ boolean isAppBubbleTaskId(int taskId); Loading
packages/SystemUI/src/com/android/systemui/notetask/NoteTaskController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -129,8 +129,7 @@ constructor( logDebug { "onShowNoteTask - start: $info" } when (info.launchMode) { is NoteTaskLaunchMode.AppBubble -> { // TODO(b/267634412, b/268351693): Should use `showOrHideAppBubbleAsUser` bubbles.showOrHideAppBubble(intent) bubbles.showOrHideAppBubble(intent, userTracker.userHandle) // App bubble logging happens on `onBubbleExpandChanged`. logDebug { "onShowNoteTask - opened as app bubble: $info" } } Loading
packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -232,7 +232,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { verifyZeroInteractions(context) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading Loading @@ -366,7 +366,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { createNoteTaskController().showNoteTask(entryPoint = NoteTaskEntryPoint.QUICK_AFFORDANCE) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading @@ -389,7 +389,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { createNoteTaskController().showNoteTask(entryPoint = NoteTaskEntryPoint.QUICK_AFFORDANCE) val intentCaptor = argumentCaptor<Intent>() verify(bubbles).showOrHideAppBubble(capture(intentCaptor)) verify(bubbles).showOrHideAppBubble(capture(intentCaptor), eq(userTracker.userHandle)) intentCaptor.value.let { intent -> assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE) assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME) Loading