Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 890c64d2 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Handle footer visibility in the new stack.

Also remove some utility extensions that we're not using anymore.

Bug: 293167744
Test: NotificationListViewModelTest
Flag: ACONFIG com.android.systemui.notifications_footer_view_refactor STAGING

Change-Id: I8f506c47d9458a34e0ff85227a61d2c80c32d3ab
parent 7a92cfa3
Loading
Loading
Loading
Loading
+0 −48
Original line number Diff line number Diff line
@@ -24,17 +24,12 @@ import androidx.annotation.DimenRes
import androidx.annotation.LayoutRes
import com.android.settingslib.Utils
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.onDensityOrFontScaleChanged
import com.android.systemui.statusbar.policy.onThemeChanged
import com.android.systemui.util.kotlin.emitOnStart
import com.android.systemui.util.view.bindLatest
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge

@@ -91,46 +86,3 @@ constructor(
            .map { layoutInflater.inflate(id, root, attachToRoot) as T }
    }
}

/**
 * Perform an inflation right away, then re-inflate whenever the device configuration changes, and
 * call [onInflate] on the resulting view each time. Disposes of the [DisposableHandle] returned by
 * [onInflate] when done.
 *
 * This never completes unless cancelled, it just suspends and waits for updates. It runs on a
 * background thread using [backgroundDispatcher].
 *
 * For parameters [resource], [root] and [attachToRoot], see [LayoutInflater.inflate].
 *
 * An example use-case of this is when a view needs to be re-inflated whenever a configuration
 * change occurs, which would require the ViewBinder to then re-bind the new view. For example, the
 * code in the parent view's binder would look like:
 * ```
 * parentView.repeatWhenAttached {
 *     configurationState
 *         .reinflateAndBindLatest(
 *             R.layout.my_layout,
 *             parentView,
 *             attachToRoot = false,
 *             coroutineScope = lifecycleScope,
 *             configurationController.onThemeChanged,
 *         ) { view: ChildView ->
 *             ChildViewBinder.bind(view, childViewModel)
 *         }
 * }
 * ```
 *
 * In turn, the bind method (passed through [onInflate]) uses [repeatWhenAttached], which returns a
 * [DisposableHandle].
 */
suspend fun <T : View> ConfigurationState.reinflateAndBindLatest(
    @LayoutRes resource: Int,
    root: ViewGroup?,
    attachToRoot: Boolean,
    backgroundDispatcher: CoroutineDispatcher,
    onInflate: (T) -> DisposableHandle?,
) {
    inflateLayout<T>(resource, root, attachToRoot)
        .flowOn(backgroundDispatcher)
        .bindLatest(onInflate)
}
+1 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 * Copyright (C) 2024 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.
+1 −1
Original line number Diff line number Diff line
@@ -1345,7 +1345,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
        updateClockAppearance();
        mQsController.updateQsState();
        if (!KeyguardShadeMigrationNssl.isEnabled()) {
        if (!KeyguardShadeMigrationNssl.isEnabled() && !FooterViewRefactor.isEnabled()) {
            mNotificationStackScrollLayoutController.updateFooter();
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ internal constructor(
            if (FooterViewRefactor.isEnabled) {
                activeNotificationsInteractor.setNotifStats(notifStats)
            }
            // TODO(b/293167744): This shouldn't be done if the footer flag is on, once the footer
            //  visibility is handled in the new stack.
            // TODO(b/293167744): This shouldn't be done if the footer flag is on, once the silent
            //  section clear action is handled in the new stack.
            controller.setNotifStats(notifStats)
            if (NotificationIconContainerRefactor.isEnabled || FooterViewRefactor.isEnabled) {
                renderListInteractor.setRenderedList(entries)
+1 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 * Copyright (C) 2024 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.
Loading