Merge "Rename Bubble#isClearable to isDismissable" into tm-qpr-dev am: f51c21d840 am: c8a3511d7e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21129950

Change-Id: I05db0cc2c0099152ab81255b6a3ce0e44101e86c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
András Kurucz
2023-01-31 16:59:20 +00:00
committed by Automerger Merge Worker
6 changed files with 22 additions and 24 deletions

View File

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

View File

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

View File

@@ -38,18 +38,18 @@ public class BubbleEntry {
private StatusBarNotification mSbn;
private Ranking mRanking;
private boolean mIsClearable;
private boolean mIsDismissable;
private boolean mShouldSuppressNotificationDot;
private boolean mShouldSuppressNotificationList;
private boolean mShouldSuppressPeek;
public BubbleEntry(@NonNull StatusBarNotification sbn,
Ranking ranking, boolean isClearable, boolean shouldSuppressNotificationDot,
Ranking ranking, boolean isDismissable, boolean shouldSuppressNotificationDot,
boolean shouldSuppressNotificationList, boolean shouldSuppressPeek) {
mSbn = sbn;
mRanking = ranking;
mIsClearable = isClearable;
mIsDismissable = isDismissable;
mShouldSuppressNotificationDot = shouldSuppressNotificationDot;
mShouldSuppressNotificationList = shouldSuppressNotificationList;
mShouldSuppressPeek = shouldSuppressPeek;
@@ -115,9 +115,9 @@ public class BubbleEntry {
return mRanking.canBubble();
}
/** @return true if this notification is clearable. */
public boolean isClearable() {
return mIsClearable;
/** @return true if this notification can be dismissed. */
public boolean isDismissable() {
return mIsDismissable;
}
/** @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 taskId: Int,
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_TASK_ID = "tid"
private const val ATTR_LOCUS = "l"
// TODO rename it to dismissable to follow NotificationEntry namings
private const val ATTR_CLEARABLE = "d"
private const val ATTR_DISMISSABLE = "d"
/**
* 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) }
serializer.attribute(null, ATTR_TASK_ID, bubble.taskId.toString())
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)
} catch (e: IOException) {
throw RuntimeException(e)
@@ -147,7 +145,7 @@ private fun readXmlEntry(parser: XmlPullParser): BubbleEntity? {
parser.getAttributeWithName(ATTR_TITLE),
parser.getAttributeWithName(ATTR_TASK_ID)?.toInt() ?: INVALID_TASK_ID,
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(
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,
null),
BubbleEntity(0, "com.example.messenger", "shortcut-2", "0k3", 120, 0, null,
@@ -44,7 +44,7 @@ class BubbleXmlHelperTest : ShellTestCase() {
private val user1Bubbles = listOf(
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,
null),
BubbleEntity(1, "com.example.messenger", "shortcut-2", "1k3", 120, 0, null,