summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Miko <amiko@google.com> 2025-03-20 08:42:22 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-20 08:42:22 -0700
commitc9e4e62d44a1f24f2215cc95dff03165ec00aeb2 (patch)
tree6b5771ac8eb79bb2b344848cbbfff8758e8a4d5d
parentfa3aaa18b696d08dd4c7d5a8faf40d780b211532 (diff)
parentf9240382c6f6faa07350aecd7eeeddfc68444dec (diff)
Merge "Convert BundleEntry to Kotlin" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.java110
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt64
2 files changed, 64 insertions, 110 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.java
index 8fc6cbe7c9e7..e69de29bb2d1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.java
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2025 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.statusbar.notification.collection;
-
-import static android.app.NotificationChannel.NEWS_ID;
-import static android.app.NotificationChannel.PROMOTIONS_ID;
-import static android.app.NotificationChannel.RECS_ID;
-import static android.app.NotificationChannel.SOCIAL_MEDIA_ID;
-
-import android.app.Notification;
-import android.content.Context;
-import android.os.Build;
-import android.service.notification.StatusBarNotification;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-
-import com.android.systemui.statusbar.notification.icon.IconPack;
-import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection;
-import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import kotlinx.coroutines.flow.MutableStateFlow;
-import kotlinx.coroutines.flow.StateFlow;
-import kotlinx.coroutines.flow.StateFlowKt;
-
-/**
- * Class to represent notifications bundled by classification.
- */
-public class BundleEntry extends PipelineEntry {
-
- // TODO(b/394483200): move NotificationEntry's implementation to PipelineEntry?
- private final MutableStateFlow<Boolean> mSensitive = StateFlowKt.MutableStateFlow(false);
-
- // TODO (b/389839319): implement the row
- private ExpandableNotificationRow mRow;
-
- private final List<ListEntry> mChildren = new ArrayList<>();
-
- private final List<ListEntry> mUnmodifiableChildren = Collections.unmodifiableList(mChildren);
-
- public BundleEntry(String key) {
- super(key);
- }
-
- void addChild(ListEntry child) {
- mChildren.add(child);
- }
-
- @NonNull
- public List<ListEntry> getChildren() {
- return mUnmodifiableChildren;
- }
-
- void clearChildren() {
- mChildren.clear();
- }
-
- /**
- * @return Null because bundles do not have an associated NotificationEntry.
- */
- @Nullable
- @Override
- public NotificationEntry getRepresentativeEntry() {
- return null;
- }
-
- @Nullable
- @Override
- public PipelineEntry getParent() {
- return null;
- }
-
- @Override
- public boolean wasAttachedInPreviousPass() {
- return false;
- }
-
- @Nullable
- public ExpandableNotificationRow getRow() {
- return mRow;
- }
-
- public static final List<BundleEntry> ROOT_BUNDLES = List.of(
- new BundleEntry(PROMOTIONS_ID),
- new BundleEntry(SOCIAL_MEDIA_ID),
- new BundleEntry(NEWS_ID),
- new BundleEntry(RECS_ID));
-
- public MutableStateFlow<Boolean> isSensitive() {
- return mSensitive;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt
new file mode 100644
index 000000000000..0da76c333a1f
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.statusbar.notification.collection
+
+import android.app.NotificationChannel
+import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
+import java.util.Collections
+import kotlinx.coroutines.flow.MutableStateFlow
+
+/** Class to represent notifications bundled by classification. */
+class BundleEntry(key: String) : PipelineEntry(key) {
+ // TODO(b/394483200): move NotificationEntry's implementation to PipelineEntry?
+ val isSensitive: MutableStateFlow<Boolean> = MutableStateFlow(false)
+
+ // TODO (b/389839319): implement the row
+ val row: ExpandableNotificationRow? = null
+
+ private val _children: MutableList<ListEntry> = ArrayList()
+ val children: List<ListEntry> = Collections.unmodifiableList(_children)
+
+ fun addChild(child: ListEntry) {
+ _children.add(child)
+ }
+
+ fun clearChildren() {
+ _children.clear()
+ }
+
+ /** @return Null because bundles do not have an associated NotificationEntry. */
+ override fun getRepresentativeEntry(): NotificationEntry? {
+ return null
+ }
+
+ override fun getParent(): PipelineEntry? {
+ return null
+ }
+
+ override fun wasAttachedInPreviousPass(): Boolean {
+ return false
+ }
+
+ companion object {
+ val ROOT_BUNDLES: List<BundleEntry> =
+ listOf(
+ BundleEntry(NotificationChannel.PROMOTIONS_ID),
+ BundleEntry(NotificationChannel.SOCIAL_MEDIA_ID),
+ BundleEntry(NotificationChannel.NEWS_ID),
+ BundleEntry(NotificationChannel.RECS_ID),
+ )
+ }
+}