Bubbles API council feedback
* un-deprecate getIntent/getIcon/setIntent/setIcon
* deprecate createIntentBubble & createShortcutBubble and make them
constructor methods & deprecate existing constructor
* clarify when intent / icon / shortcut id will be null or not
* use NPE instead of illegal argument exception
* use illegal state exception when using setIcon/setIntent on a builder
created with shortcut method
* updates usages of getBubbleIntent/getBubbleIcon to be getIntent/getIcon
* updates builder constructor usages as well
Fixes: 149911930
Test: treehugger
Change-Id: Ic85a475d463cb22cea7d7939fea4cf72465491b4
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
index 4240209c..ed74da8 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
@@ -417,7 +417,7 @@
PendingIntent getBubbleIntent() {
Notification.BubbleMetadata data = mEntry.getBubbleMetadata();
if (data != null) {
- return data.getBubbleIntent();
+ return data.getIntent();
}
return null;
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index b39dd1a..c9ce8a1 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -1305,7 +1305,7 @@
*/
static boolean canLaunchInActivityView(Context context, NotificationEntry entry) {
PendingIntent intent = entry.getBubbleMetadata() != null
- ? entry.getBubbleMetadata().getBubbleIntent()
+ ? entry.getBubbleMetadata().getIntent()
: null;
if (entry.getBubbleMetadata() != null
&& entry.getBubbleMetadata().getShortcutId() != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
index b33eeba..41dbb48 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExperimentConfig.java
@@ -256,8 +256,7 @@
}
}
if (intent != null) {
- return new Notification.BubbleMetadata.Builder()
- .createIntentBubble(intent, icon)
+ return new Notification.BubbleMetadata.Builder(intent, icon)
.setDesiredHeight(BUBBLE_HEIGHT)
.build();
}
@@ -265,9 +264,8 @@
}
static Notification.BubbleMetadata createForShortcut(String shortcutId) {
- return new Notification.BubbleMetadata.Builder()
+ return new Notification.BubbleMetadata.Builder(shortcutId)
.setDesiredHeight(BUBBLE_HEIGHT)
- .createShortcutBubble(shortcutId)
.build();
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java
index 3b818db..9f573c3 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleIconFactory.java
@@ -57,7 +57,7 @@
int density = context.getResources().getConfiguration().densityDpi;
return launcherApps.getShortcutIconDrawable(shortcutInfo, density);
} else {
- Icon ic = metadata.getBubbleIcon();
+ Icon ic = metadata.getIcon();
if (ic != null) {
return ic.loadDrawable(context);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
index 46d5044..324bc92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
@@ -156,7 +156,7 @@
if (entry.getBubbleMetadata() == null
|| (entry.getBubbleMetadata().getShortcutId() == null
- && entry.getBubbleMetadata().getBubbleIntent() == null)) {
+ && entry.getBubbleMetadata().getIntent() == null)) {
if (DEBUG) {
Log.d(TAG, "No bubble up: notification: " + sbn.getKey()
+ " doesn't have valid metadata");