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

Commit 86c39bc3 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26909021',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26909021', 'googleplex-android-review.googlesource.com/26968636', 'googleplex-android-review.googlesource.com/26970063'] into 24Q2-release.

Change-Id: Ica24dd1bd4de67fefdb5602bfa2ea3f0a1f96755
parents d7ca88dd d3715a17
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1645,6 +1645,8 @@
    <string name="accessibility_phone_two_bars">Phone two bars.</string>
    <!-- Content description of the phone signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_phone_three_bars">Phone three bars.</string>
    <!-- Content description of the phone signal when it is four bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_phone_four_bars">Phone four bars.</string>
    <!-- Content description of the phone signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_phone_signal_full">Phone signal full.</string>

+53 −0
Original line number Diff line number Diff line
@@ -33,6 +33,59 @@ public class AccessibilityContentDescriptions {
        R.string.accessibility_phone_signal_full
    };

    /**
     * @param level int in range [0-4] that describes the signal level
     * @return the appropriate content description for that signal strength, or 0 if the param is
     *         invalid
     */
    public static int getDescriptionForLevel(int level) {
        if (level > 4 || level < 0) {
            return 0;
        }

        return PHONE_SIGNAL_STRENGTH[level];
    }

    public static final int[] PHONE_SIGNAL_STRENGTH_INFLATED = {
            PHONE_SIGNAL_STRENGTH_NONE,
            R.string.accessibility_phone_one_bar,
            R.string.accessibility_phone_two_bars,
            R.string.accessibility_phone_three_bars,
            R.string.accessibility_phone_four_bars,
            R.string.accessibility_phone_signal_full
    };

    /**
     * @param level int in range [0-5] that describes the inflated signal level
     * @return the appropriate content description for that signal strength, or 0 if the param is
     *         invalid
     */
    public static int getDescriptionForInflatedLevel(int level) {
        if (level > 5 || level < 0) {
            return 0;
        }

        return PHONE_SIGNAL_STRENGTH_INFLATED[level];
    }

    /**
     * @param level int in range [0-5] that describes the inflated signal level
     * @param numberOfLevels one of (4, 5) that describes the default number of levels, or the
     *                       inflated number of levels. The level param should be relative to the
     *                       number of levels. This won't do any inflation.
     * @return the appropriate content description for that signal strength, or 0 if the param is
     *         invalid
     */
    public static int getDescriptionForLevel(int level, int numberOfLevels) {
        if (numberOfLevels == 5) {
            return getDescriptionForLevel(level);
        } else if (numberOfLevels == 6) {
            return getDescriptionForInflatedLevel(level);
        } else {
            return 0;
        }
    }

    public static final int[] DATA_CONNECTION_STRENGTH = {
        R.string.accessibility_no_data,
        R.string.accessibility_data_one_bar,
+0 −43
Original line number Diff line number Diff line
@@ -18,18 +18,12 @@ package com.android.systemui.media.controls.ui.controller

import android.content.Context
import android.content.res.Configuration
import android.database.ContentObserver
import android.net.Uri
import android.os.Handler
import android.os.UserHandle
import android.provider.Settings
import android.view.View
import android.view.ViewGroup
import androidx.annotation.VisibleForTesting
import com.android.systemui.Dumpable
import com.android.systemui.Flags.migrateClocksToBlueprint
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dump.DumpManager
import com.android.systemui.media.controls.ui.view.MediaHost
import com.android.systemui.media.controls.ui.view.MediaHostState
@@ -43,7 +37,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.SplitShadeStateController
import com.android.systemui.util.asIndenting
import com.android.systemui.util.println
import com.android.systemui.util.settings.SecureSettings
import com.android.systemui.util.withIncreasedIndent
import java.io.PrintWriter
import javax.inject.Inject
@@ -61,8 +54,6 @@ constructor(
    private val bypassController: KeyguardBypassController,
    private val statusBarStateController: SysuiStatusBarStateController,
    private val context: Context,
    private val secureSettings: SecureSettings,
    @Main private val handler: Handler,
    configurationController: ConfigurationController,
    private val splitShadeStateController: SplitShadeStateController,
    private val logger: KeyguardMediaControllerLogger,
@@ -91,26 +82,6 @@ constructor(
            }
        )

        val settingsObserver: ContentObserver =
            object : ContentObserver(handler) {
                override fun onChange(selfChange: Boolean, uri: Uri?) {
                    if (uri == lockScreenMediaPlayerUri) {
                        allowMediaPlayerOnLockScreen =
                            secureSettings.getBoolForUser(
                                Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN,
                                true,
                                UserHandle.USER_CURRENT
                            )
                        refreshMediaPosition(reason = "allowMediaPlayerOnLockScreen changed")
                    }
                }
            }
        secureSettings.registerContentObserverForUser(
            Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN,
            settingsObserver,
            UserHandle.USER_ALL
        )

        // First let's set the desired state that we want for this host
        mediaHost.expansion = MediaHostState.EXPANDED
        mediaHost.showsOnlyActiveMedia = true
@@ -156,16 +127,6 @@ constructor(
        private set
    private var splitShadeContainer: ViewGroup? = null

    /** Track the media player setting status on lock screen. */
    private var allowMediaPlayerOnLockScreen: Boolean =
        secureSettings.getBoolForUser(
            Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN,
            true,
            UserHandle.USER_CURRENT
        )
    private val lockScreenMediaPlayerUri =
        secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN)

    /**
     * Attaches media container in single pane mode, situated at the top of the notifications list
     */
@@ -229,14 +190,12 @@ constructor(
        // mediaHost.visible required for proper animations handling
        val isMediaHostVisible = mediaHost.visible
        val isBypassNotEnabled = !bypassController.bypassEnabled
        val currentAllowMediaPlayerOnLockScreen = allowMediaPlayerOnLockScreen
        val useSplitShade = useSplitShade
        val shouldBeVisibleForSplitShade = shouldBeVisibleForSplitShade()
        visible =
            isMediaHostVisible &&
                isBypassNotEnabled &&
                keyguardOrUserSwitcher &&
                currentAllowMediaPlayerOnLockScreen &&
                shouldBeVisibleForSplitShade
        logger.logRefreshMediaPosition(
            reason = reason,
@@ -246,7 +205,6 @@ constructor(
            keyguardOrUserSwitcher = keyguardOrUserSwitcher,
            mediaHostVisible = isMediaHostVisible,
            bypassNotEnabled = isBypassNotEnabled,
            currentAllowMediaPlayerOnLockScreen = currentAllowMediaPlayerOnLockScreen,
            shouldBeVisibleForSplitShade = shouldBeVisibleForSplitShade,
        )
        val currActiveContainer = activeContainer
@@ -321,7 +279,6 @@ constructor(
                println("Self", this@KeyguardMediaController)
                println("visible", visible)
                println("useSplitShade", useSplitShade)
                println("allowMediaPlayerOnLockScreen", allowMediaPlayerOnLockScreen)
                println("bypassController.bypassEnabled", bypassController.bypassEnabled)
                println("isDozeWakeUpAnimationWaiting", isDozeWakeUpAnimationWaiting)
                println("singlePaneContainer", singlePaneContainer)
+2 −5
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ constructor(@KeyguardMediaControllerLog private val logBuffer: LogBuffer) {
        keyguardOrUserSwitcher: Boolean,
        mediaHostVisible: Boolean,
        bypassNotEnabled: Boolean,
        currentAllowMediaPlayerOnLockScreen: Boolean,
        shouldBeVisibleForSplitShade: Boolean,
    ) {
        logBuffer.log(
@@ -50,8 +49,7 @@ constructor(@KeyguardMediaControllerLog private val logBuffer: LogBuffer) {
                bool3 = keyguardOrUserSwitcher
                bool4 = mediaHostVisible
                int2 = if (bypassNotEnabled) 1 else 0
                str2 = currentAllowMediaPlayerOnLockScreen.toString()
                str3 = shouldBeVisibleForSplitShade.toString()
                str2 = shouldBeVisibleForSplitShade.toString()
            },
            {
                "refreshMediaPosition(reason=$str1, " +
@@ -60,8 +58,7 @@ constructor(@KeyguardMediaControllerLog private val logBuffer: LogBuffer) {
                    "keyguardOrUserSwitcher=$bool3, " +
                    "mediaHostVisible=$bool4, " +
                    "bypassNotEnabled=${int2 == 1}, " +
                    "currentAllowMediaPlayerOnLockScreen=$str2, " +
                    "shouldBeVisibleForSplitShade=$str3)"
                    "shouldBeVisibleForSplitShade=$str2)"
            }
        )
    }
+19 −7
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ constructor(
) {

    /** Track the media player setting status on lock screen. */
    private var allowMediaPlayerOnLockScreen: Boolean = true
    private var allowMediaPlayerOnLockScreen: Boolean = getMediaLockScreenSetting()
    private val lockScreenMediaPlayerUri =
        secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN)

@@ -485,6 +485,7 @@ constructor(
                        mediaCarouselController.logSmartspaceImpression(qsExpanded)
                    }
                    updateUserVisibility()
                    mediaCarouselController.updateHostVisibility()
                }

                override fun onDozeAmountChanged(linear: Float, eased: Float) {
@@ -569,12 +570,8 @@ constructor(
            object : ContentObserver(handler) {
                override fun onChange(selfChange: Boolean, uri: Uri?) {
                    if (uri == lockScreenMediaPlayerUri) {
                        allowMediaPlayerOnLockScreen =
                            secureSettings.getBoolForUser(
                                Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN,
                                true,
                                UserHandle.USER_CURRENT
                            )
                        allowMediaPlayerOnLockScreen = getMediaLockScreenSetting()
                        mediaCarouselController.updateHostVisibility()
                    }
                }
            }
@@ -595,6 +592,14 @@ constructor(
        }
    }

    private fun getMediaLockScreenSetting(): Boolean {
        return secureSettings.getBoolForUser(
            Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN,
            true,
            UserHandle.USER_CURRENT
        )
    }

    private fun updateConfiguration() {
        distanceForFullShadeTransition =
            context.resources.getDimensionPixelSize(
@@ -634,6 +639,13 @@ constructor(
        mediaCarouselController.closeGuts()
    }

    /** Return true if the carousel should be hidden because lockscreen is currently visible */
    fun isLockedAndHidden(): Boolean {
        return !allowMediaPlayerOnLockScreen &&
            (statusbarState == StatusBarState.SHADE_LOCKED ||
                statusbarState == StatusBarState.KEYGUARD)
    }

    private fun createUniqueObjectHost(): UniqueObjectHostView {
        val viewHost = UniqueObjectHostView(context)
        viewHost.addOnAttachStateChangeListener(
Loading