Merge "Rename Bubble#isClearable to isDismissable" into tm-qpr-dev

This commit is contained in:
András Kurucz
2023-01-31 09:45:57 +00:00
committed by Android (Google) Code Review
6 changed files with 22 additions and 24 deletions

View File

@@ -126,7 +126,7 @@ public class Bubble implements BubbleViewProvider {
private Icon mIcon; private Icon mIcon;
private boolean mIsBubble; private boolean mIsBubble;
private boolean mIsTextChanged; private boolean mIsTextChanged;
private boolean mIsClearable; private boolean mIsDismissable;
private boolean mShouldSuppressNotificationDot; private boolean mShouldSuppressNotificationDot;
private boolean mShouldSuppressNotificationList; private boolean mShouldSuppressNotificationList;
private boolean mShouldSuppressPeek; private boolean mShouldSuppressPeek;
@@ -181,7 +181,7 @@ public class Bubble implements BubbleViewProvider {
@VisibleForTesting(visibility = PRIVATE) @VisibleForTesting(visibility = PRIVATE)
public Bubble(@NonNull final String key, @NonNull final ShortcutInfo shortcutInfo, public Bubble(@NonNull final String key, @NonNull final ShortcutInfo shortcutInfo,
final int desiredHeight, final int desiredHeightResId, @Nullable final String title, final int desiredHeight, final int desiredHeightResId, @Nullable final String title,
int taskId, @Nullable final String locus, boolean isClearable, Executor mainExecutor, int taskId, @Nullable final String locus, boolean isDismissable, Executor mainExecutor,
final Bubbles.BubbleMetadataFlagListener listener) { final Bubbles.BubbleMetadataFlagListener listener) {
Objects.requireNonNull(key); Objects.requireNonNull(key);
Objects.requireNonNull(shortcutInfo); Objects.requireNonNull(shortcutInfo);
@@ -190,7 +190,7 @@ public class Bubble implements BubbleViewProvider {
mKey = key; mKey = key;
mGroupKey = null; mGroupKey = null;
mLocusId = locus != null ? new LocusId(locus) : null; mLocusId = locus != null ? new LocusId(locus) : null;
mIsClearable = isClearable; mIsDismissable = isDismissable;
mFlags = 0; mFlags = 0;
mUser = shortcutInfo.getUserHandle(); mUser = shortcutInfo.getUserHandle();
mPackageName = shortcutInfo.getPackage(); mPackageName = shortcutInfo.getPackage();
@@ -248,8 +248,8 @@ public class Bubble implements BubbleViewProvider {
} }
@Hide @Hide
public boolean isClearable() { public boolean isDismissable() {
return mIsClearable; return mIsDismissable;
} }
/** /**
@@ -533,7 +533,7 @@ public class Bubble implements BubbleViewProvider {
mDeleteIntent = entry.getBubbleMetadata().getDeleteIntent(); mDeleteIntent = entry.getBubbleMetadata().getDeleteIntent();
} }
mIsClearable = entry.isClearable(); mIsDismissable = entry.isDismissable();
mShouldSuppressNotificationDot = entry.shouldSuppressNotificationDot(); mShouldSuppressNotificationDot = entry.shouldSuppressNotificationDot();
mShouldSuppressNotificationList = entry.shouldSuppressNotificationList(); mShouldSuppressNotificationList = entry.shouldSuppressNotificationList();
mShouldSuppressPeek = entry.shouldSuppressPeek(); mShouldSuppressPeek = entry.shouldSuppressPeek();
@@ -612,7 +612,7 @@ public class Bubble implements BubbleViewProvider {
* Whether this notification should be shown in the shade. * Whether this notification should be shown in the shade.
*/ */
boolean showInShade() { boolean showInShade() {
return !shouldSuppressNotification() || !mIsClearable; return !shouldSuppressNotification() || !mIsDismissable;
} }
/** /**
@@ -877,7 +877,7 @@ public class Bubble implements BubbleViewProvider {
pw.print(" desiredHeight: "); pw.println(getDesiredHeightString()); pw.print(" desiredHeight: "); pw.println(getDesiredHeightString());
pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification()); pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification());
pw.print(" autoExpand: "); pw.println(shouldAutoExpand()); pw.print(" autoExpand: "); pw.println(shouldAutoExpand());
pw.print(" isClearable: "); pw.println(mIsClearable); pw.print(" isDismissable: "); pw.println(mIsDismissable);
pw.println(" bubbleMetadataFlagListener null: " + (mBubbleMetadataFlagListener == null)); pw.println(" bubbleMetadataFlagListener null: " + (mBubbleMetadataFlagListener == null));
if (mExpandedView != null) { if (mExpandedView != null) {
mExpandedView.dump(pw); mExpandedView.dump(pw);

View File

@@ -110,7 +110,7 @@ internal class BubbleDataRepository(
b.title, b.title,
b.taskId, b.taskId,
b.locusId?.id, b.locusId?.id,
b.isClearable b.isDismissable
) )
} }
} }
@@ -206,7 +206,7 @@ internal class BubbleDataRepository(
entity.title, entity.title,
entity.taskId, entity.taskId,
entity.locus, entity.locus,
entity.isClearable, entity.isDismissable,
mainExecutor, mainExecutor,
bubbleMetadataFlagListener bubbleMetadataFlagListener
) )

View File

@@ -38,18 +38,18 @@ public class BubbleEntry {
private StatusBarNotification mSbn; private StatusBarNotification mSbn;
private Ranking mRanking; private Ranking mRanking;
private boolean mIsClearable; private boolean mIsDismissable;
private boolean mShouldSuppressNotificationDot; private boolean mShouldSuppressNotificationDot;
private boolean mShouldSuppressNotificationList; private boolean mShouldSuppressNotificationList;
private boolean mShouldSuppressPeek; private boolean mShouldSuppressPeek;
public BubbleEntry(@NonNull StatusBarNotification sbn, public BubbleEntry(@NonNull StatusBarNotification sbn,
Ranking ranking, boolean isClearable, boolean shouldSuppressNotificationDot, Ranking ranking, boolean isDismissable, boolean shouldSuppressNotificationDot,
boolean shouldSuppressNotificationList, boolean shouldSuppressPeek) { boolean shouldSuppressNotificationList, boolean shouldSuppressPeek) {
mSbn = sbn; mSbn = sbn;
mRanking = ranking; mRanking = ranking;
mIsClearable = isClearable; mIsDismissable = isDismissable;
mShouldSuppressNotificationDot = shouldSuppressNotificationDot; mShouldSuppressNotificationDot = shouldSuppressNotificationDot;
mShouldSuppressNotificationList = shouldSuppressNotificationList; mShouldSuppressNotificationList = shouldSuppressNotificationList;
mShouldSuppressPeek = shouldSuppressPeek; mShouldSuppressPeek = shouldSuppressPeek;
@@ -115,9 +115,9 @@ public class BubbleEntry {
return mRanking.canBubble(); return mRanking.canBubble();
} }
/** @return true if this notification is clearable. */ /** @return true if this notification can be dismissed. */
public boolean isClearable() { public boolean isDismissable() {
return mIsClearable; return mIsDismissable;
} }
/** @return true if {@link Policy#SUPPRESSED_EFFECT_BADGE} set for this notification. */ /** @return true if {@link Policy#SUPPRESSED_EFFECT_BADGE} set for this notification. */

View File

@@ -28,5 +28,5 @@ data class BubbleEntity(
val title: String? = null, val title: String? = null,
val taskId: Int, val taskId: Int,
val locus: String? = null, val locus: String? = null,
val isClearable: Boolean = false val isDismissable: Boolean = false
) )

View File

@@ -43,9 +43,7 @@ private const val ATTR_DESIRED_HEIGHT_RES_ID = "hid"
private const val ATTR_TITLE = "t" private const val ATTR_TITLE = "t"
private const val ATTR_TASK_ID = "tid" private const val ATTR_TASK_ID = "tid"
private const val ATTR_LOCUS = "l" private const val ATTR_LOCUS = "l"
private const val ATTR_DISMISSABLE = "d"
// TODO rename it to dismissable to follow NotificationEntry namings
private const val ATTR_CLEARABLE = "d"
/** /**
* Writes the bubbles in xml format into given output stream. * Writes the bubbles in xml format into given output stream.
@@ -87,7 +85,7 @@ private fun writeXmlEntry(serializer: XmlSerializer, bubble: BubbleEntity) {
bubble.title?.let { serializer.attribute(null, ATTR_TITLE, it) } bubble.title?.let { serializer.attribute(null, ATTR_TITLE, it) }
serializer.attribute(null, ATTR_TASK_ID, bubble.taskId.toString()) serializer.attribute(null, ATTR_TASK_ID, bubble.taskId.toString())
bubble.locus?.let { serializer.attribute(null, ATTR_LOCUS, it) } bubble.locus?.let { serializer.attribute(null, ATTR_LOCUS, it) }
serializer.attribute(null, ATTR_CLEARABLE, bubble.isClearable.toString()) serializer.attribute(null, ATTR_DISMISSABLE, bubble.isDismissable.toString())
serializer.endTag(null, TAG_BUBBLE) serializer.endTag(null, TAG_BUBBLE)
} catch (e: IOException) { } catch (e: IOException) {
throw RuntimeException(e) throw RuntimeException(e)
@@ -147,7 +145,7 @@ private fun readXmlEntry(parser: XmlPullParser): BubbleEntity? {
parser.getAttributeWithName(ATTR_TITLE), parser.getAttributeWithName(ATTR_TITLE),
parser.getAttributeWithName(ATTR_TASK_ID)?.toInt() ?: INVALID_TASK_ID, parser.getAttributeWithName(ATTR_TASK_ID)?.toInt() ?: INVALID_TASK_ID,
parser.getAttributeWithName(ATTR_LOCUS), parser.getAttributeWithName(ATTR_LOCUS),
parser.getAttributeWithName(ATTR_CLEARABLE)?.toBoolean() ?: false parser.getAttributeWithName(ATTR_DISMISSABLE)?.toBoolean() ?: false
) )
} }

View File

@@ -35,7 +35,7 @@ class BubbleXmlHelperTest : ShellTestCase() {
private val user0Bubbles = listOf( private val user0Bubbles = listOf(
BubbleEntity(0, "com.example.messenger", "shortcut-1", "0k1", 120, 0, null, 1, BubbleEntity(0, "com.example.messenger", "shortcut-1", "0k1", 120, 0, null, 1,
isClearable = true), isDismissable = true),
BubbleEntity(10, "com.example.chat", "alice and bob", "0k2", 0, 16537428, "title", 2, BubbleEntity(10, "com.example.chat", "alice and bob", "0k2", 0, 16537428, "title", 2,
null), null),
BubbleEntity(0, "com.example.messenger", "shortcut-2", "0k3", 120, 0, null, BubbleEntity(0, "com.example.messenger", "shortcut-2", "0k3", 120, 0, null,
@@ -44,7 +44,7 @@ class BubbleXmlHelperTest : ShellTestCase() {
private val user1Bubbles = listOf( private val user1Bubbles = listOf(
BubbleEntity(1, "com.example.messenger", "shortcut-1", "1k1", 120, 0, null, 3, BubbleEntity(1, "com.example.messenger", "shortcut-1", "1k1", 120, 0, null, 3,
isClearable = true), isDismissable = true),
BubbleEntity(12, "com.example.chat", "alice and bob", "1k2", 0, 16537428, "title", 4, BubbleEntity(12, "com.example.chat", "alice and bob", "1k2", 0, 16537428, "title", 4,
null), null),
BubbleEntity(1, "com.example.messenger", "shortcut-2", "1k3", 120, 0, null, BubbleEntity(1, "com.example.messenger", "shortcut-2", "1k3", 120, 0, null,