Merge "Disable bubble experiment; use shortcut info from ranking" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b839af1f45
@@ -108,7 +108,6 @@ import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -162,14 +161,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
||||
// Used when ranking updates occur and we check if things should bubble / unbubble
|
||||
private NotificationListenerService.Ranking mTmpRanking;
|
||||
|
||||
// Saves notification keys of user created "fake" bubbles so that we can allow notifications
|
||||
// like these to bubble by default. Doesn't persist across reboots, not a long-term solution.
|
||||
private final HashSet<String> mUserCreatedBubbles;
|
||||
// If we're auto-bubbling bubbles via a whitelist, we need to track which notifs from that app
|
||||
// have been "demoted" back to a notification so that we don't auto-bubbles those again.
|
||||
// Doesn't persist across reboots, not a long-term solution.
|
||||
private final HashSet<String> mUserBlockedBubbles;
|
||||
|
||||
// Bubbles get added to the status bar view
|
||||
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
||||
private final ZenModeController mZenModeController;
|
||||
@@ -412,9 +403,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
||||
}
|
||||
});
|
||||
|
||||
mUserCreatedBubbles = new HashSet<>();
|
||||
mUserBlockedBubbles = new HashSet<>();
|
||||
|
||||
mBubbleIconFactory = new BubbleIconFactory(context);
|
||||
}
|
||||
|
||||
@@ -474,8 +462,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
||||
(entry != null && entry.isRowDismissed() && !isAppCancel)
|
||||
|| isClearAll || isUserDimiss || isSummaryCancel;
|
||||
|
||||
if (userRemovedNotif || isUserCreatedBubble(key)
|
||||
|| isSummaryOfUserCreatedBubble(entry)) {
|
||||
if (userRemovedNotif) {
|
||||
return handleDismissalInterception(entry);
|
||||
}
|
||||
|
||||
@@ -859,27 +846,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this bubble was explicitly created by the user via a SysUI affordance.
|
||||
*/
|
||||
boolean isUserCreatedBubble(String key) {
|
||||
return mUserCreatedBubbles.contains(key);
|
||||
}
|
||||
|
||||
boolean isSummaryOfUserCreatedBubble(NotificationEntry entry) {
|
||||
if (isSummaryOfBubbles(entry)) {
|
||||
List<Bubble> bubbleChildren =
|
||||
mBubbleData.getBubblesInGroup(entry.getSbn().getGroupKey());
|
||||
for (int i = 0; i < bubbleChildren.size(); i++) {
|
||||
// Check if any are user-created (i.e. experimental bubbles)
|
||||
if (isUserCreatedBubble(bubbleChildren.get(i).getKey())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the bubble with the given NotificationEntry.
|
||||
* <p>
|
||||
@@ -893,37 +859,19 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
||||
}
|
||||
|
||||
private void onEntryAdded(NotificationEntry entry) {
|
||||
boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
|
||||
boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey());
|
||||
boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
|
||||
mContext, entry, previouslyUserCreated, userBlocked);
|
||||
|
||||
if (mNotificationInterruptStateProvider.shouldBubbleUp(entry)
|
||||
&& (canLaunchInActivityView(mContext, entry) || wasAdjusted)) {
|
||||
if (wasAdjusted && !previouslyUserCreated) {
|
||||
// Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated
|
||||
mUserCreatedBubbles.add(entry.getKey());
|
||||
}
|
||||
&& canLaunchInActivityView(mContext, entry)) {
|
||||
updateBubble(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private void onEntryUpdated(NotificationEntry entry) {
|
||||
boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
|
||||
boolean userBlocked = mUserBlockedBubbles.contains(entry.getKey());
|
||||
boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
|
||||
mContext, entry, previouslyUserCreated, userBlocked);
|
||||
|
||||
boolean shouldBubble = mNotificationInterruptStateProvider.shouldBubbleUp(entry)
|
||||
&& (canLaunchInActivityView(mContext, entry) || wasAdjusted);
|
||||
&& canLaunchInActivityView(mContext, entry);
|
||||
if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.getKey())) {
|
||||
// It was previously a bubble but no longer a bubble -- lets remove it
|
||||
removeBubble(entry, DISMISS_NO_LONGER_BUBBLE);
|
||||
} else if (shouldBubble) {
|
||||
if (wasAdjusted && !previouslyUserCreated) {
|
||||
// Gotta treat the auto-bubbled / whitelisted packaged bubbles as usercreated
|
||||
mUserCreatedBubbles.add(entry.getKey());
|
||||
}
|
||||
updateBubble(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
|
||||
+ " mActivityViewStatus=" + mActivityViewStatus
|
||||
+ " bubble=" + getBubbleKey());
|
||||
}
|
||||
if (mBubble != null && !mBubbleController.isUserCreatedBubble(mBubble.getKey())) {
|
||||
if (mBubble != null) {
|
||||
// Must post because this is called from a binder thread.
|
||||
post(() -> mBubbleController.removeBubble(mBubble.getEntry(),
|
||||
BubbleController.DISMISS_TASK_FINISHED));
|
||||
|
||||
@@ -57,16 +57,13 @@ import java.util.List;
|
||||
public class BubbleExperimentConfig {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES;
|
||||
|
||||
private static final String SHORTCUT_DUMMY_INTENT = "bubble_experiment_shortcut_intent";
|
||||
private static PendingIntent sDummyShortcutIntent;
|
||||
|
||||
private static final int BUBBLE_HEIGHT = 10000;
|
||||
|
||||
private static final String ALLOW_ANY_NOTIF_TO_BUBBLE = "allow_any_notif_to_bubble";
|
||||
private static final boolean ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT = false;
|
||||
|
||||
private static final String ALLOW_MESSAGE_NOTIFS_TO_BUBBLE = "allow_message_notifs_to_bubble";
|
||||
private static final boolean ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT = true;
|
||||
private static final boolean ALLOW_MESSAGE_NOTIFS_TO_BUBBLE_DEFAULT = false;
|
||||
|
||||
private static final String ALLOW_SHORTCUTS_TO_BUBBLE = "allow_shortcuts_to_bubble";
|
||||
private static final boolean ALLOW_SHORTCUT_TO_BUBBLE_DEFAULT = false;
|
||||
|
||||
@@ -139,22 +139,11 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
|
||||
StatusBarNotification sbn = b.getEntry().getSbn();
|
||||
String packageName = sbn.getPackageName();
|
||||
|
||||
// Real shortcut info for this bubble
|
||||
String bubbleShortcutId = b.getEntry().getBubbleMetadata().getShortcutId();
|
||||
if (bubbleShortcutId != null) {
|
||||
info.shortcutInfo = BubbleExperimentConfig.getShortcutInfo(c, packageName,
|
||||
sbn.getUser(), bubbleShortcutId);
|
||||
} else {
|
||||
// Check for experimental shortcut
|
||||
String shortcutId = sbn.getNotification().getShortcutId();
|
||||
if (BubbleExperimentConfig.useShortcutInfoToBubble(c) && shortcutId != null) {
|
||||
info.shortcutInfo = BubbleExperimentConfig.getShortcutInfo(c,
|
||||
packageName,
|
||||
sbn.getUser(), shortcutId);
|
||||
}
|
||||
info.shortcutInfo = b.getEntry().getRanking().getShortcutInfo();
|
||||
}
|
||||
|
||||
|
||||
// App name & app icon
|
||||
PackageManager pm = c.getPackageManager();
|
||||
ApplicationInfo appInfo;
|
||||
|
||||
Reference in New Issue
Block a user