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

Commit 21804ecb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "New Pipeline: Show media on lockscreen"

parents a8693ecd 8fac557d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
  -->

<!-- Layout for media controls on the lockscreen -->
<com.android.systemui.statusbar.notification.stack.MediaHeaderView
<com.android.systemui.statusbar.notification.stack.MediaContainerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
+3 −3
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.notification.stack.MediaHeaderView
import com.android.systemui.statusbar.notification.stack.MediaContainerView
import com.android.systemui.statusbar.phone.KeyguardBypassController
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.util.Utils
@@ -96,14 +96,14 @@ class KeyguardMediaController @Inject constructor(
    /**
     * single pane media container placed at the top of the notifications list
     */
    var singlePaneContainer: MediaHeaderView? = null
    var singlePaneContainer: MediaContainerView? = null
        private set
    private var splitShadeContainer: ViewGroup? = null

    /**
     * Attaches media container in single pane mode, situated at the top of the notifications list
     */
    fun attachSinglePaneContainer(mediaView: MediaHeaderView?) {
    fun attachSinglePaneContainer(mediaView: MediaContainerView?) {
        val needsListener = singlePaneContainer == null
        singlePaneContainer = mediaView
        if (needsListener) {
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.provider.DeviceConfig

import com.android.internal.annotations.VisibleForTesting
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags.NOTIFICATIONS_USE_PEOPLE_FILTERING
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING
import com.android.systemui.statusbar.notification.stack.BUCKET_FOREGROUND_SERVICE
import com.android.systemui.statusbar.notification.stack.BUCKET_HEADS_UP
@@ -37,6 +38,7 @@ private var sUsePeopleFiltering: Boolean? = null
/**
 * Feature controller for the NOTIFICATIONS_USE_PEOPLE_FILTERING config.
 */
@SysUISingleton
class NotificationSectionsFeatureManager @Inject constructor(
    val proxy: DeviceConfigProxy,
    val context: Context
+58 −0
Original line number Diff line number Diff line
/*
 * 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.collection.render

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.android.systemui.R
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.notification.stack.MediaContainerView
import javax.inject.Inject

@SysUISingleton
class MediaContainerController @Inject constructor(
    private val layoutInflater: LayoutInflater
) : NodeController {

    override val nodeLabel = "MediaContainer"
    var mediaContainerView: MediaContainerView? = null
        private set

    fun reinflateView(parent: ViewGroup) {
        var oldPos = -1
        mediaContainerView?.let { _view ->
            _view.transientContainer?.removeView(_view)
            if (_view.parent === parent) {
                oldPos = parent.indexOfChild(_view)
                parent.removeView(_view)
            }
        }
        val inflated = layoutInflater.inflate(
                R.layout.keyguard_media_container,
                parent,
                false /* attachToRoot */)
                as MediaContainerView
        if (oldPos != -1) {
            parent.addView(inflated, oldPos)
        }
        mediaContainerView = inflated
    }

    override val view: View
        get() = mediaContainerView!!
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.notification.collection.render

import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager
import com.android.systemui.statusbar.notification.collection.GroupEntry
import com.android.systemui.statusbar.notification.collection.ListEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntry
@@ -32,6 +33,8 @@ import com.android.systemui.util.traceSection
 * need to present in the shade, notably the section headers.
 */
class NodeSpecBuilder(
    private val mediaContainerController: MediaContainerController,
    private val sectionsFeatureManager: NotificationSectionsFeatureManager,
    private val viewBarn: NotifViewBarn
) {
    fun buildNodeSpec(
@@ -39,6 +42,13 @@ class NodeSpecBuilder(
        notifList: List<ListEntry>
    ): NodeSpec = traceSection("NodeSpecBuilder.buildNodeSpec") {
        val root = NodeSpecImpl(null, rootController)

        // The media container should be added as the first child of the root node
        // TODO: Perhaps the node spec building process should be more of a pipeline of its own?
        if (sectionsFeatureManager.isMediaControlsEnabled()) {
            root.children.add(NodeSpecImpl(root, mediaContainerController))
        }

        var currentSection: NotifSection? = null
        val prevSections = mutableSetOf<NotifSection?>()

Loading