diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java index b71e3adae8acf..ed9b904e5238d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java @@ -43,6 +43,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.InstanceId; import com.android.systemui.shared.system.SysUiStatsLog; import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.systemui.statusbar.phone.StatusBar; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -623,7 +624,8 @@ class Bubble implements BubbleViewProvider { private int getUid(final Context context) { if (mAppUid != -1) return mAppUid; - final PackageManager pm = context.getPackageManager(); + final PackageManager pm = StatusBar.getPackageManagerForUser(context, + mUser.getIdentifier()); if (pm == null) return -1; try { final ApplicationInfo info = pm.getApplicationInfo(mShortcutInfo.getPackage(), 0); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 5deae925ba30e..fb819f04e0e1f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -1386,10 +1386,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } } } - mDataRepository.removeBubbles(mCurrentUserId, bubblesToBeRemovedFromRepository); + mDataRepository.removeBubbles(bubblesToBeRemovedFromRepository); if (update.addedBubble != null && mStackView != null) { - mDataRepository.addBubble(mCurrentUserId, update.addedBubble); + mDataRepository.addBubble(update.addedBubble); mStackView.addBubble(update.addedBubble); } @@ -1400,7 +1400,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // At this point, the correct bubbles are inflated in the stack. // Make sure the order in bubble data is reflected in bubble row. if (update.orderChanged && mStackView != null) { - mDataRepository.addBubbles(mCurrentUserId, update.bubbles); + mDataRepository.addBubbles(update.bubbles); mStackView.updateBubbleOrder(update.bubbles); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt index db64a13f3df34..a363208e8f101 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleDataRepository.kt @@ -16,7 +16,6 @@ package com.android.systemui.bubbles import android.annotation.SuppressLint -import android.annotation.UserIdInt import android.content.pm.LauncherApps import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER @@ -51,31 +50,31 @@ internal class BubbleDataRepository @Inject constructor( * Adds the bubble in memory, then persists the snapshot after adding the bubble to disk * asynchronously. */ - fun addBubble(@UserIdInt userId: Int, bubble: Bubble) = addBubbles(userId, listOf(bubble)) + fun addBubble(bubble: Bubble) = addBubbles(listOf(bubble)) /** * Adds the bubble in memory, then persists the snapshot after adding the bubble to disk * asynchronously. */ - fun addBubbles(@UserIdInt userId: Int, bubbles: List) { + fun addBubbles(bubbles: List) { if (DEBUG) Log.d(TAG, "adding ${bubbles.size} bubbles") - val entities = transform(userId, bubbles).also(volatileRepository::addBubbles) + val entities = transform(bubbles).also(volatileRepository::addBubbles) if (entities.isNotEmpty()) persistToDisk() } /** * Removes the bubbles from memory, then persists the snapshot to disk asynchronously. */ - fun removeBubbles(@UserIdInt userId: Int, bubbles: List) { + fun removeBubbles(bubbles: List) { if (DEBUG) Log.d(TAG, "removing ${bubbles.size} bubbles") - val entities = transform(userId, bubbles).also(volatileRepository::removeBubbles) + val entities = transform(bubbles).also(volatileRepository::removeBubbles) if (entities.isNotEmpty()) persistToDisk() } - private fun transform(userId: Int, bubbles: List): List { + private fun transform(bubbles: List): List { return bubbles.mapNotNull { b -> BubbleEntity( - userId, + b.user.identifier, b.packageName, b.metadataShortcutId ?: return@mapNotNull null, b.key, diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java index 1929fc4e9dbfe..a6cf69a0f0a9b 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleViewInfoTask.java @@ -48,6 +48,7 @@ import com.android.internal.graphics.ColorUtils; import com.android.launcher3.icons.BitmapInfo; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.systemui.statusbar.phone.StatusBar; import java.lang.ref.WeakReference; import java.util.List; @@ -146,7 +147,8 @@ public class BubbleViewInfoTask extends AsyncTask