diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java index 2534498bdcc16..e24c2286013de 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java @@ -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); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt index e3aefa5bd8aae..e37c785f15f57 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleDataRepository.kt @@ -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 ) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java index 5f428269fb06b..afe19c4b7363e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleEntry.java @@ -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. */ diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt index f3abc271dad4b..9b2e263946057 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleEntity.kt @@ -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 ) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt index 14c053c58f1fa..48d8ccf401740 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelper.kt @@ -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 ) } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt index c02e2d1770299..3bfbcd26a5777 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/storage/BubbleXmlHelperTest.kt @@ -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,