DO NOT MERGE Remove unused code
Test: build, atest SystemUITests
Fixes: 218099855
Change-Id: I27d331a8045f73747a1b2c0286776c73aeb9272f
Merged-In: I27d331a8045f73747a1b2c0286776c73aeb9272f
(cherry picked from commit 6ca8bb7e7e)
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2020 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.
|
||||
-->
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:startColor="#ff000000"
|
||||
android:endColor="#00000000"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -1,61 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2020 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.
|
||||
-->
|
||||
|
||||
<com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/foreground_service_dungeon"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:visibility="visible"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="bottom"
|
||||
android:visibility="visible"
|
||||
android:background="@drawable/notif_dungeon_bg_gradient"
|
||||
>
|
||||
|
||||
<!-- divider view -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/GM2_grey_200"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dungeon_title"
|
||||
android:layout_height="48dp"
|
||||
android:layout_width="match_parent"
|
||||
android:padding="8dp"
|
||||
android:text="Apps active in background"
|
||||
android:textColor="@color/GM2_grey_200"
|
||||
/>
|
||||
|
||||
<!-- List containing the actual foreground service notifications -->
|
||||
<LinearLayout
|
||||
android:id="@+id/entry_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical" >
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView>
|
||||
@@ -1,43 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2020 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.
|
||||
-->
|
||||
|
||||
<com.android.systemui.statusbar.notification.row.DungeonRow
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/foreground_service_dungeon_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:padding="8dp"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<com.android.systemui.statusbar.StatusBarIconView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="@color/GM2_grey_200"
|
||||
/>
|
||||
|
||||
</com.android.systemui.statusbar.notification.row.DungeonRow>
|
||||
@@ -45,7 +45,6 @@ import com.android.systemui.statusbar.notification.collection.legacy.VisualStabi
|
||||
import com.android.systemui.statusbar.notification.collection.render.NotifStackController;
|
||||
import com.android.systemui.statusbar.notification.collection.render.NotifStats;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
@@ -97,7 +96,6 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
|
||||
private final Optional<Bubbles> mBubblesOptional;
|
||||
private final DynamicPrivacyController mDynamicPrivacyController;
|
||||
private final KeyguardBypassController mBypassController;
|
||||
private final ForegroundServiceSectionController mFgsSectionController;
|
||||
private final NotifPipelineFlags mNotifPipelineFlags;
|
||||
private AssistantFeedbackController mAssistantFeedbackController;
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
@@ -129,7 +127,6 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
|
||||
KeyguardBypassController bypassController,
|
||||
Optional<Bubbles> bubblesOptional,
|
||||
DynamicPrivacyController privacyController,
|
||||
ForegroundServiceSectionController fgsSectionController,
|
||||
DynamicChildBindController dynamicChildBindController,
|
||||
LowPriorityInflationHelper lowPriorityInflationHelper,
|
||||
AssistantFeedbackController assistantFeedbackController,
|
||||
@@ -145,7 +142,6 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
|
||||
mVisualStabilityManager = visualStabilityManager;
|
||||
mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController;
|
||||
mEntryManager = notificationEntryManager;
|
||||
mFgsSectionController = fgsSectionController;
|
||||
mNotifPipelineFlags = notifPipelineFlags;
|
||||
Resources res = context.getResources();
|
||||
mAlwaysExpandNonGroupedNotification =
|
||||
@@ -417,8 +413,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
|
||||
&& mBubblesOptional.get().isBubbleNotificationSuppressedFromShade(
|
||||
ent.getKey(), ent.getSbn().getGroupKey());
|
||||
if (ent.isRowDismissed() || ent.isRowRemoved()
|
||||
|| isBubbleNotificationSuppressedFromShade
|
||||
|| mFgsSectionController.hasEntry(ent)) {
|
||||
|| isBubbleNotificationSuppressedFromShade) {
|
||||
// we want to suppress removed notifications because they could
|
||||
// temporarily become children if they were isolated before.
|
||||
return true;
|
||||
|
||||
@@ -60,7 +60,6 @@ import com.android.systemui.statusbar.notification.collection.legacy.Notificatio
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
|
||||
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
|
||||
import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.ManagedProfileController;
|
||||
import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl;
|
||||
@@ -198,7 +197,6 @@ public interface StatusBarDependenciesModule {
|
||||
KeyguardBypassController bypassController,
|
||||
Optional<Bubbles> bubblesOptional,
|
||||
DynamicPrivacyController privacyController,
|
||||
ForegroundServiceSectionController fgsSectionController,
|
||||
DynamicChildBindController dynamicChildBindController,
|
||||
LowPriorityInflationHelper lowPriorityInflationHelper,
|
||||
AssistantFeedbackController assistantFeedbackController,
|
||||
@@ -217,7 +215,6 @@ public interface StatusBarDependenciesModule {
|
||||
bypassController,
|
||||
bubblesOptional,
|
||||
privacyController,
|
||||
fgsSectionController,
|
||||
dynamicChildBindController,
|
||||
lowPriorityInflationHelper,
|
||||
assistantFeedbackController,
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.DeviceConfig
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags.NOTIFICATIONS_ALLOW_FGS_DISMISSAL
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.util.DeviceConfigProxy
|
||||
import javax.inject.Inject
|
||||
|
||||
private var sIsEnabled: Boolean? = null
|
||||
|
||||
/**
|
||||
* Feature controller for NOTIFICATIONS_ALLOW_FGS_DISMISSAL config.
|
||||
*/
|
||||
// TODO: this is really boilerplatey, make a base class that just wraps the device config
|
||||
@SysUISingleton
|
||||
class ForegroundServiceDismissalFeatureController @Inject constructor(
|
||||
val proxy: DeviceConfigProxy,
|
||||
val context: Context
|
||||
) {
|
||||
fun isForegroundServiceDismissalEnabled(): Boolean {
|
||||
return isEnabled(proxy)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isEnabled(proxy: DeviceConfigProxy): Boolean {
|
||||
if (sIsEnabled == null) {
|
||||
sIsEnabled = proxy.getBoolean(
|
||||
DeviceConfig.NAMESPACE_SYSTEMUI, NOTIFICATIONS_ALLOW_FGS_DISMISSAL, false)
|
||||
}
|
||||
|
||||
return sIsEnabled!!
|
||||
}
|
||||
@@ -111,7 +111,6 @@ public class NotificationEntryManager implements
|
||||
private final Lazy<NotificationRowBinder> mNotificationRowBinderLazy;
|
||||
private final Lazy<NotificationRemoteInputManager> mRemoteInputManagerLazy;
|
||||
private final LeakDetector mLeakDetector;
|
||||
private final ForegroundServiceDismissalFeatureController mFgsFeatureController;
|
||||
private final IStatusBarService mStatusBarService;
|
||||
private final NotifLiveDataStoreImpl mNotifLiveDataStore;
|
||||
private final DumpManager mDumpManager;
|
||||
@@ -159,7 +158,6 @@ public class NotificationEntryManager implements
|
||||
Lazy<NotificationRowBinder> notificationRowBinderLazy,
|
||||
Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
|
||||
LeakDetector leakDetector,
|
||||
ForegroundServiceDismissalFeatureController fgsFeatureController,
|
||||
IStatusBarService statusBarService,
|
||||
NotifLiveDataStoreImpl notifLiveDataStore,
|
||||
DumpManager dumpManager
|
||||
@@ -170,7 +168,6 @@ public class NotificationEntryManager implements
|
||||
mNotificationRowBinderLazy = notificationRowBinderLazy;
|
||||
mRemoteInputManagerLazy = notificationRemoteInputManagerLazy;
|
||||
mLeakDetector = leakDetector;
|
||||
mFgsFeatureController = fgsFeatureController;
|
||||
mStatusBarService = statusBarService;
|
||||
mNotifLiveDataStore = notifLiveDataStore;
|
||||
mDumpManager = dumpManager;
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.android.systemui.settings.UserContextProvider;
|
||||
import com.android.systemui.statusbar.NotificationListener;
|
||||
import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||
import com.android.systemui.statusbar.notification.AssistantFeedbackController;
|
||||
import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController;
|
||||
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManagerLogger;
|
||||
@@ -128,7 +127,6 @@ public interface NotificationsModule {
|
||||
Lazy<NotificationRowBinder> notificationRowBinderLazy,
|
||||
Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
|
||||
LeakDetector leakDetector,
|
||||
ForegroundServiceDismissalFeatureController fgsFeatureController,
|
||||
IStatusBarService statusBarService,
|
||||
NotifLiveDataStoreImpl notifLiveDataStore,
|
||||
DumpManager dumpManager) {
|
||||
@@ -139,7 +137,6 @@ public interface NotificationsModule {
|
||||
notificationRowBinderLazy,
|
||||
notificationRemoteInputManagerLazy,
|
||||
leakDetector,
|
||||
fgsFeatureController,
|
||||
statusBarService,
|
||||
notifLiveDataStore,
|
||||
dumpManager);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.row
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.statusbar.StatusBarIconView
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||
|
||||
class DungeonRow(context: Context, attrs: AttributeSet) : LinearLayout(context, attrs) {
|
||||
var entry: NotificationEntry? = null
|
||||
set(value) {
|
||||
field = value
|
||||
update()
|
||||
}
|
||||
|
||||
private fun update() {
|
||||
(findViewById(R.id.app_name) as TextView).apply {
|
||||
text = entry?.row?.appName
|
||||
}
|
||||
|
||||
(findViewById(R.id.icon) as StatusBarIconView).apply {
|
||||
set(entry?.icons?.statusBarIcon?.statusBarIcon)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.row
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
|
||||
import com.android.systemui.R
|
||||
|
||||
class ForegroundServiceDungeonView(context: Context, attrs: AttributeSet)
|
||||
: StackScrollerDecorView(context, attrs) {
|
||||
override fun findContentView(): View? {
|
||||
return findViewById(R.id.foreground_service_dungeon)
|
||||
}
|
||||
|
||||
override fun findSecondaryView(): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun setVisible(visible: Boolean, animate: Boolean) {
|
||||
// Visibility is controlled by the ForegroundServiceSectionController
|
||||
}
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.stack
|
||||
|
||||
import android.content.Context
|
||||
import android.service.notification.NotificationListenerService.REASON_CANCEL
|
||||
import android.service.notification.NotificationListenerService.REASON_CANCEL_ALL
|
||||
import android.service.notification.NotificationListenerService.REASON_CLICK
|
||||
import android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryListener
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||
import com.android.systemui.statusbar.notification.row.DungeonRow
|
||||
import com.android.systemui.util.Assert
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Controller for the bottom area of NotificationStackScrollLayout. It owns swiped-away foreground
|
||||
* service notifications and can reinstantiate them when requested.
|
||||
*/
|
||||
@SysUISingleton
|
||||
class ForegroundServiceSectionController @Inject constructor(
|
||||
val entryManager: NotificationEntryManager,
|
||||
val featureController: ForegroundServiceDismissalFeatureController
|
||||
) {
|
||||
private val TAG = "FgsSectionController"
|
||||
private var context: Context? = null
|
||||
|
||||
private val entries = mutableSetOf<NotificationEntry>()
|
||||
|
||||
private var entriesView: View? = null
|
||||
|
||||
init {
|
||||
if (featureController.isForegroundServiceDismissalEnabled()) {
|
||||
entryManager.addNotificationRemoveInterceptor(this::shouldInterceptRemoval)
|
||||
|
||||
entryManager.addNotificationEntryListener(object : NotificationEntryListener {
|
||||
override fun onPostEntryUpdated(entry: NotificationEntry) {
|
||||
if (entries.contains(entry)) {
|
||||
removeEntry(entry)
|
||||
addEntry(entry)
|
||||
update()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun shouldInterceptRemoval(
|
||||
key: String,
|
||||
entry: NotificationEntry?,
|
||||
reason: Int
|
||||
): Boolean {
|
||||
Assert.isMainThread()
|
||||
val isClearAll = reason == REASON_CANCEL_ALL
|
||||
val isUserDismiss = reason == REASON_CANCEL || reason == REASON_CLICK
|
||||
// REASON_APP_CANCEL and REASON_APP_CANCEL_ALL are ignored, because the
|
||||
// foreground service associated with it is gone.
|
||||
val isSummaryCancel = reason == REASON_GROUP_SUMMARY_CANCELED
|
||||
|
||||
if (entry == null) return false
|
||||
|
||||
// We only want to retain notifications that the user dismissed
|
||||
// TODO: centralize the entry.isClearable logic and this so that it's clear when a notif is
|
||||
// clearable
|
||||
if (isUserDismiss && !entry.sbn.isClearable) {
|
||||
if (!hasEntry(entry)) {
|
||||
addEntry(entry)
|
||||
update()
|
||||
}
|
||||
// TODO: This isn't ideal. Slightly better would at least be to have NEM update the
|
||||
// notif list when an entry gets intercepted
|
||||
entryManager.updateNotifications(
|
||||
"FgsSectionController.onNotificationRemoveRequested")
|
||||
return true
|
||||
} else if ((isClearAll || isSummaryCancel) && !entry.sbn.isClearable) {
|
||||
// In the case where a FGS notification is part of a group that is cleared or a clear
|
||||
// all, we actually want to stop its removal but also not put it into the dungeon
|
||||
return true
|
||||
} else if (hasEntry(entry)) {
|
||||
removeEntry(entry)
|
||||
update()
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun removeEntry(entry: NotificationEntry) {
|
||||
Assert.isMainThread()
|
||||
entries.remove(entry)
|
||||
}
|
||||
|
||||
private fun addEntry(entry: NotificationEntry) {
|
||||
Assert.isMainThread()
|
||||
entries.add(entry)
|
||||
}
|
||||
|
||||
fun hasEntry(entry: NotificationEntry): Boolean {
|
||||
Assert.isMainThread()
|
||||
return entries.contains(entry)
|
||||
}
|
||||
|
||||
fun initialize(context: Context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
fun createView(li: LayoutInflater): View {
|
||||
entriesView = li.inflate(R.layout.foreground_service_dungeon, null)
|
||||
// Start out gone
|
||||
entriesView!!.visibility = View.GONE
|
||||
return entriesView!!
|
||||
}
|
||||
|
||||
private fun update() {
|
||||
Assert.isMainThread()
|
||||
if (entriesView == null) {
|
||||
throw IllegalStateException("ForegroundServiceSectionController is trying to show " +
|
||||
"dismissed fgs notifications without having been initialized!")
|
||||
}
|
||||
|
||||
// TODO: these views should be recycled and not inflating on the main thread
|
||||
(entriesView!!.findViewById(R.id.entry_list) as LinearLayout).apply {
|
||||
removeAllViews()
|
||||
entries.sortedBy { it.ranking.rank }.forEach { entry ->
|
||||
val child = LayoutInflater.from(context)
|
||||
.inflate(R.layout.foreground_service_dungeon_row, null) as DungeonRow
|
||||
|
||||
child.entry = entry
|
||||
child.setOnClickListener {
|
||||
removeEntry(child.entry!!)
|
||||
update()
|
||||
entry.row.unDismiss()
|
||||
entry.row.resetTranslation()
|
||||
entryManager.updateNotifications("ForegroundServiceSectionController.onClick")
|
||||
}
|
||||
|
||||
addView(child)
|
||||
}
|
||||
}
|
||||
|
||||
if (entries.isEmpty()) {
|
||||
entriesView?.visibility = View.GONE
|
||||
} else {
|
||||
entriesView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,6 @@ import com.android.systemui.statusbar.notification.row.ActivatableNotificationVi
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.FooterView;
|
||||
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
|
||||
import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
|
||||
@@ -453,7 +452,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
private Interpolator mHideXInterpolator = Interpolators.FAST_OUT_SLOW_IN;
|
||||
|
||||
private final NotificationSectionsManager mSectionsManager;
|
||||
private ForegroundServiceDungeonView mFgsSectionView;
|
||||
private boolean mAnimateBottomOnLayout;
|
||||
private float mLastSentAppear;
|
||||
private float mLastSentExpandedHeight;
|
||||
@@ -614,14 +612,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
}
|
||||
|
||||
void initializeForegroundServiceSection(ForegroundServiceDungeonView fgsSectionView) {
|
||||
if (mFgsSectionView != null) {
|
||||
return;
|
||||
}
|
||||
mFgsSectionView = fgsSectionView;
|
||||
addView(mFgsSectionView, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the overexpansion of the panel to be applied to the view.
|
||||
*/
|
||||
@@ -5286,9 +5276,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
// incremented in the following "changeViewPosition" calls so that its value is correct for
|
||||
// subsequent calls.
|
||||
int offsetFromEnd = 1;
|
||||
if (mFgsSectionView != null) {
|
||||
changeViewPosition(mFgsSectionView, getChildCount() - offsetFromEnd++);
|
||||
}
|
||||
changeViewPosition(mFooterView, getChildCount() - offsetFromEnd++);
|
||||
changeViewPosition(mEmptyShadeView, getChildCount() - offsetFromEnd++);
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
|
||||
import com.android.systemui.statusbar.notification.ExpandAnimationParameters;
|
||||
import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController;
|
||||
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryListener;
|
||||
@@ -109,7 +108,6 @@ import com.android.systemui.statusbar.notification.logging.NotificationLogger;
|
||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGuts;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationSnooze;
|
||||
@@ -170,8 +168,6 @@ public class NotificationStackScrollLayoutController {
|
||||
private final NotificationEntryManager mNotificationEntryManager;
|
||||
private final IStatusBarService mIStatusBarService;
|
||||
private final UiEventLogger mUiEventLogger;
|
||||
private final ForegroundServiceDismissalFeatureController mFgFeatureController;
|
||||
private final ForegroundServiceSectionController mFgServicesSectionController;
|
||||
private final LayoutInflater mLayoutInflater;
|
||||
private final NotificationRemoteInputManager mRemoteInputManager;
|
||||
private final VisualStabilityManager mVisualStabilityManager;
|
||||
@@ -660,8 +656,6 @@ public class NotificationStackScrollLayoutController {
|
||||
LockscreenShadeTransitionController lockscreenShadeTransitionController,
|
||||
IStatusBarService iStatusBarService,
|
||||
UiEventLogger uiEventLogger,
|
||||
ForegroundServiceDismissalFeatureController fgFeatureController,
|
||||
ForegroundServiceSectionController fgServicesSectionController,
|
||||
LayoutInflater layoutInflater,
|
||||
NotificationRemoteInputManager remoteInputManager,
|
||||
VisualStabilityManager visualStabilityManager,
|
||||
@@ -709,8 +703,6 @@ public class NotificationStackScrollLayoutController {
|
||||
mNotificationEntryManager = notificationEntryManager;
|
||||
mIStatusBarService = iStatusBarService;
|
||||
mUiEventLogger = uiEventLogger;
|
||||
mFgFeatureController = fgFeatureController;
|
||||
mFgServicesSectionController = fgServicesSectionController;
|
||||
mLayoutInflater = layoutInflater;
|
||||
mRemoteInputManager = remoteInputManager;
|
||||
mVisualStabilityManager = visualStabilityManager;
|
||||
@@ -744,12 +736,6 @@ public class NotificationStackScrollLayoutController {
|
||||
mNotificationRoundnessManager.setShouldRoundPulsingViews(
|
||||
!mKeyguardBypassController.getBypassEnabled());
|
||||
|
||||
if (mFgFeatureController.isForegroundServiceDismissalEnabled()) {
|
||||
mView.initializeForegroundServiceSection(
|
||||
(ForegroundServiceDungeonView) mFgServicesSectionController.createView(
|
||||
mLayoutInflater));
|
||||
}
|
||||
|
||||
mSwipeHelper = mNotificationSwipeHelperBuilder
|
||||
.setSwipeDirection(SwipeHelper.X)
|
||||
.setNotificationCallback(mNotificationCallback)
|
||||
|
||||
@@ -54,7 +54,6 @@ import com.android.systemui.statusbar.notification.logging.NotificationLogger;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
|
||||
import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
@@ -121,7 +120,6 @@ public class NotificationViewHierarchyManagerTest extends SysuiTestCase {
|
||||
mock(KeyguardBypassController.class),
|
||||
Optional.of(mock(Bubbles.class)),
|
||||
mock(DynamicPrivacyController.class),
|
||||
mock(ForegroundServiceSectionController.class),
|
||||
mock(DynamicChildBindController.class),
|
||||
mock(LowPriorityInflationHelper.class),
|
||||
mock(AssistantFeedbackController.class),
|
||||
|
||||
@@ -201,7 +201,6 @@ public class NotificationEntryManagerTest extends SysuiTestCase {
|
||||
() -> mNotificationRowBinder,
|
||||
() -> mRemoteInputManager,
|
||||
mLeakDetector,
|
||||
mock(ForegroundServiceDismissalFeatureController.class),
|
||||
mock(IStatusBarService.class),
|
||||
NotifLiveDataStoreMocksKt.createNotifLiveDataStoreImplMock(),
|
||||
mock(DumpManager.class)
|
||||
|
||||
@@ -61,7 +61,6 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||
import com.android.systemui.statusbar.SbnBuilder;
|
||||
import com.android.systemui.statusbar.SmartReplyController;
|
||||
import com.android.systemui.statusbar.notification.ConversationNotificationProcessor;
|
||||
import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController;
|
||||
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationClicker;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryListener;
|
||||
@@ -191,7 +190,6 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase {
|
||||
() -> mRowBinder,
|
||||
() -> mRemoteInputManager,
|
||||
mLeakDetector,
|
||||
mock(ForegroundServiceDismissalFeatureController.class),
|
||||
mock(IStatusBarService.class),
|
||||
NotifLiveDataStoreMocksKt.createNotifLiveDataStoreImplMock(),
|
||||
mock(DumpManager.class)
|
||||
|
||||
@@ -58,7 +58,6 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||
import com.android.systemui.statusbar.RemoteInputController;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
|
||||
import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController;
|
||||
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotifCollection;
|
||||
@@ -68,7 +67,6 @@ import com.android.systemui.statusbar.notification.collection.legacy.VisualStabi
|
||||
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
|
||||
import com.android.systemui.statusbar.notification.collection.render.SectionHeaderController;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController.NotificationPanelEvent;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
||||
@@ -129,9 +127,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
|
||||
@Mock private IStatusBarService mIStatusBarService;
|
||||
@Mock private UiEventLogger mUiEventLogger;
|
||||
@Mock private LockscreenShadeTransitionController mLockscreenShadeTransitionController;
|
||||
@Mock private ForegroundServiceDismissalFeatureController mFgFeatureController;
|
||||
@Mock private ForegroundServiceSectionController mFgServicesSectionController;
|
||||
@Mock private ForegroundServiceDungeonView mForegroundServiceDungeonView;
|
||||
@Mock private LayoutInflater mLayoutInflater;
|
||||
@Mock private NotificationRemoteInputManager mRemoteInputManager;
|
||||
@Mock private VisualStabilityManager mVisualStabilityManager;
|
||||
@@ -151,8 +146,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
|
||||
|
||||
when(mNotificationSwipeHelperBuilder.build()).thenReturn(mNotificationSwipeHelper);
|
||||
when(mNotifPipelineFlags.isNewPipelineEnabled()).thenReturn(false);
|
||||
when(mFgServicesSectionController.createView(mLayoutInflater))
|
||||
.thenReturn(mForegroundServiceDungeonView);
|
||||
|
||||
mController = new NotificationStackScrollLayoutController(
|
||||
true,
|
||||
@@ -187,8 +180,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
|
||||
mLockscreenShadeTransitionController,
|
||||
mIStatusBarService,
|
||||
mUiEventLogger,
|
||||
mFgFeatureController,
|
||||
mFgServicesSectionController,
|
||||
mLayoutInflater,
|
||||
mRemoteInputManager,
|
||||
mVisualStabilityManager,
|
||||
@@ -398,22 +389,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
|
||||
verify(mUiEventLogger).log(NotificationPanelEvent.fromSelection(ROWS_ALL));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForegroundDismissEnabled() {
|
||||
when(mFgFeatureController.isForegroundServiceDismissalEnabled()).thenReturn(true);
|
||||
mController.attach(mNotificationStackScrollLayout);
|
||||
verify(mNotificationStackScrollLayout).initializeForegroundServiceSection(
|
||||
mForegroundServiceDungeonView);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForegroundDismissaDisabled() {
|
||||
when(mFgFeatureController.isForegroundServiceDismissalEnabled()).thenReturn(false);
|
||||
mController.attach(mNotificationStackScrollLayout);
|
||||
verify(mNotificationStackScrollLayout, never()).initializeForegroundServiceSection(
|
||||
any(ForegroundServiceDungeonView.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFooter_remoteInput() {
|
||||
ArgumentCaptor<RemoteInputController.Callback> callbackCaptor =
|
||||
|
||||
Reference in New Issue
Block a user