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

Commit 2d4186ab authored by Selim Cinek's avatar Selim Cinek Committed by Automerger Merge Worker
Browse files

Merge changes I06d91234,I8a195b3e into rvc-dev am: 5a538248

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11936027

Change-Id: I05fb27b45464ee7fc6e5033a7460350448742ca6
parents aea7bfca 5a538248
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ class KeyguardMediaController @Inject constructor(
    fun attach(mediaView: MediaHeaderView) {
        view = mediaView
        // First let's set the desired state that we want for this host
        mediaHost.visibleChangedListener = { updateVisibility() }
        mediaHost.addVisibilityChangeListener { updateVisibility() }
        mediaHost.expansion = 0.0f
        mediaHost.showsOnlyActiveMedia = true
        mediaHost.falsingProtectionNeeded = true
+9 −2
Original line number Diff line number Diff line
@@ -227,6 +227,10 @@ class MediaHierarchyManager @Inject constructor(
    fun register(mediaObject: MediaHost): UniqueObjectHostView {
        val viewHost = createUniqueObjectHost()
        mediaObject.hostView = viewHost
        mediaObject.addVisibilityChangeListener {
            // Never animate because of a visibility change, only state changes should do that
            updateDesiredLocation(forceNoAnimation = true)
        }
        mediaHosts[mediaObject.location] = mediaObject
        if (mediaObject.location == desiredLocation) {
            // In case we are overriding a view that is already visible, make sure we attach it
@@ -260,8 +264,10 @@ class MediaHierarchyManager @Inject constructor(
    /**
     * Updates the location that the view should be in. If it changes, an animation may be triggered
     * going from the old desired location to the new one.
     *
     * @param forceNoAnimation optional parameter telling the system not to animate
     */
    private fun updateDesiredLocation() {
    private fun updateDesiredLocation(forceNoAnimation: Boolean = false) {
        val desiredLocation = calculateLocation()
        if (desiredLocation != this.desiredLocation) {
            if (this.desiredLocation >= 0) {
@@ -270,7 +276,8 @@ class MediaHierarchyManager @Inject constructor(
            val isNewView = this.desiredLocation == -1
            this.desiredLocation = desiredLocation
            // Let's perform a transition
            val animate = shouldAnimateTransition(desiredLocation, previousLocation)
            val animate = !forceNoAnimation &&
                    shouldAnimateTransition(desiredLocation, previousLocation)
            val (animDuration, delay) = getAnimationParams(previousLocation, desiredLocation)
            val host = getHost(desiredLocation)
            mediaCarouselController.onDesiredLocationChanged(desiredLocation, host, animate,
+9 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package com.android.systemui.media

import android.graphics.PointF
import android.graphics.Rect
import android.util.ArraySet
import android.view.View
import android.view.View.OnAttachStateChangeListener
import com.android.systemui.util.animation.MeasurementInput
@@ -20,7 +21,7 @@ class MediaHost @Inject constructor(
    lateinit var hostView: UniqueObjectHostView
    var location: Int = -1
        private set
    var visibleChangedListener: ((Boolean) -> Unit)? = null
    private var visibleChangedListeners: ArraySet<(Boolean) -> Unit> = ArraySet()

    private val tmpLocationOnScreen: IntArray = intArrayOf(0, 0)

@@ -58,6 +59,10 @@ class MediaHost @Inject constructor(
        }
    }

    fun addVisibilityChangeListener(listener: (Boolean) -> Unit) {
        visibleChangedListeners.add(listener)
    }

    /**
     * Initialize this MediaObject and create a host view.
     * All state should already be set on this host before calling this method in order to avoid
@@ -116,7 +121,9 @@ class MediaHost @Inject constructor(
        val newVisibility = if (visible) View.VISIBLE else View.GONE
        if (newVisibility != hostView.visibility) {
            hostView.visibility = newVisibility
            visibleChangedListener?.invoke(visible)
            visibleChangedListeners.forEach {
                it.invoke(visible)
            }
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
        mMediaTotalBottomMargin = getResources().getDimensionPixelSize(
                R.dimen.quick_settings_bottom_margin_media);
        mMediaHost = mediaHost;
        mMediaHost.setVisibleChangedListener((visible) -> {
        mMediaHost.addVisibilityChangeListener((visible) -> {
            onMediaVisibilityChanged(visible);
            return null;
        });
+5 −1
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    private final KeyguardBypassController mKeyguardBypassController;
    private final DynamicPrivacyController mDynamicPrivacyController;
    private final SysuiStatusBarStateController mStatusbarStateController;
    private final KeyguardMediaController mKeyguardMediaController;

    private ExpandHelper mExpandHelper;
    private final NotificationSwipeHelper mSwipeHelper;
@@ -672,6 +673,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        initializeForegroundServiceSection(fgsFeatureController);
        mUiEventLogger = uiEventLogger;
        mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener);
        mKeyguardMediaController = keyguardMediaController;
        keyguardMediaController.setVisibilityChangedListener((visible) -> {
            if (visible) {
                generateAddAnimation(keyguardMediaController.getView(), false /*fromMoreCard */);
@@ -6638,7 +6640,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        /* Only ever called as a consequence of a lockscreen expansion gesture. */
        @Override
        public boolean onDraggedDown(View startingChild, int dragLengthY) {
            if (mStatusBarState == StatusBarState.KEYGUARD && hasActiveNotifications()) {
            boolean canDragDown = hasActiveNotifications()
                    || mKeyguardMediaController.getView().getVisibility() == VISIBLE;
            if (mStatusBarState == StatusBarState.KEYGUARD && canDragDown) {
                mLockscreenGestureLogger.write(
                        MetricsEvent.ACTION_LS_SHADE,
                        (int) (dragLengthY / mDisplayMetrics.density),
Loading