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

Commit 4ece5732 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/25642237', 'googleplex-android-review.googlesource.com/25714889', 'googleplex-android-review.googlesource.com/25715089'] into 24Q1-release.

Change-Id: I4bd88ecdde0dce33b4e240d6cdc1a4ba2bac8a23
parents ddeb99ae b1755e9e
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -293,32 +293,6 @@ public class RestrictedLockUtilsInternal extends RestrictedLockUtils {
        return null;
    }

    /**
     * Checks whether add user is disabled on the device
     *
     * @param context {@link Context} for the calling user.
     *
     *
     * @param userId User to check enforced admin status for.
     *
     * @return EnforcedAdmin Object containing the enforced admin component and admin user details,
     * or {@code null} If adding user is not disabled.
     */
    public static EnforcedAdmin checkIfAddUserDisallowed(Context context, int userId) {
        final UserManager um = UserManager.get(context);
        if (!um.hasUserRestriction(UserManager.DISALLOW_ADD_USER, UserHandle.of(userId))) {
            // Restriction is not enforced.
            return null;
        }
        EnforcedAdmin enforcedAdmin = checkIfRestrictionEnforced(context,
                UserManager.DISALLOW_ADD_USER, userId);
        if (enforcedAdmin != null) {
            return enforcedAdmin;
        }
        return EnforcedAdmin.createDefaultEnforcedAdminWithRestriction(
                UserManager.DISALLOW_ADD_USER);
    }

    /**
     * Check if an application is suspended.
     *
+1 −7
Original line number Diff line number Diff line
@@ -32,11 +32,8 @@ import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn

/**
 * Assists in creating sub-flows for a KeyguardTransition. Call [setup] once for a transition, and
@@ -68,8 +65,6 @@ constructor(
         * in the range of [0, 1]. View animations should begin and end within a subset of this
         * range. This function maps the [startTime] and [duration] into [0, 1], when this subset is
         * valid.
         *
         * Will produce a [SharedFlow], so that identical animations can use the same value.
         */
        fun sharedFlow(
            duration: Duration,
@@ -80,7 +75,7 @@ constructor(
            onFinish: (() -> Float)? = null,
            interpolator: Interpolator = LINEAR,
            name: String? = null
        ): SharedFlow<Float> {
        ): Flow<Float> {
            if (!duration.isPositive()) {
                throw IllegalArgumentException("duration must be a positive number: $duration")
            }
@@ -137,7 +132,6 @@ constructor(
                    value
                }
                .filterNotNull()
                .shareIn(scope, SharingStarted.WhileSubscribed())
        }

        /**
+3 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConn
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
@@ -48,7 +49,7 @@ class FullMobileConnectionRepository(
    override val subId: Int,
    startingIsCarrierMerged: Boolean,
    override val tableLogBuffer: TableLogBuffer,
    subscriptionModel: StateFlow<SubscriptionModel?>,
    subscriptionModel: Flow<SubscriptionModel?>,
    private val defaultNetworkName: NetworkNameModel,
    private val networkNameSeparator: String,
    @Application scope: CoroutineScope,
@@ -331,7 +332,7 @@ class FullMobileConnectionRepository(
        fun build(
            subId: Int,
            startingIsCarrierMerged: Boolean,
            subscriptionModel: StateFlow<SubscriptionModel?>,
            subscriptionModel: Flow<SubscriptionModel?>,
            defaultNetworkName: NetworkNameModel,
            networkNameSeparator: String,
        ): FullMobileConnectionRepository {
+2 −2
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ import kotlinx.coroutines.withContext
class MobileConnectionRepositoryImpl(
    override val subId: Int,
    private val context: Context,
    subscriptionModel: StateFlow<SubscriptionModel?>,
    subscriptionModel: Flow<SubscriptionModel?>,
    defaultNetworkName: NetworkNameModel,
    networkNameSeparator: String,
    connectivityManager: ConnectivityManager,
@@ -448,7 +448,7 @@ class MobileConnectionRepositoryImpl(
        fun build(
            subId: Int,
            mobileLogger: TableLogBuffer,
            subscriptionModel: StateFlow<SubscriptionModel?>,
            subscriptionModel: Flow<SubscriptionModel?>,
            defaultNetworkName: NetworkNameModel,
            networkNameSeparator: String,
        ): MobileConnectionRepository {
+4 −4
Original line number Diff line number Diff line
@@ -357,10 +357,10 @@ constructor(

    @VisibleForTesting fun getSubIdRepoCache() = subIdRepositoryCache

    private fun subscriptionModelForSubId(subId: Int): StateFlow<SubscriptionModel?> {
        return subscriptions
            .map { list -> list.firstOrNull { model -> model.subscriptionId == subId } }
            .stateIn(scope, SharingStarted.WhileSubscribed(), null)
    private fun subscriptionModelForSubId(subId: Int): Flow<SubscriptionModel?> {
        return subscriptions.map { list ->
            list.firstOrNull { model -> model.subscriptionId == subId }
        }
    }

    private fun createRepositoryForSubId(subId: Int): FullMobileConnectionRepository {