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

Commit 89a8ce93 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix carrier privileged exemption to consider all sim cards" into rvc-dev am: 13fb7d50

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/PackageInstaller/+/11761693

Change-Id: I1f4d67c731bc95deaeb36acd5aed295d51d59c71
parents d03db573 13fb7d50
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -24,26 +24,27 @@ import com.android.permissioncontroller.PermissionControllerApplication
 * A LiveData which represents the carrier privileged status for a package
 *
 * @param app The current application
 * @param uid The uid of the package
 * @param packageName The name of the package
 */
class CarrierPrivilegedStatusLiveData private constructor(
    private val app: Application,
    private val uid: Int
    private val packageName: String
) : SmartUpdateMediatorLiveData<Int>() {

    val telephonyManager = app.getSystemService(TelephonyManager::class.java)!!

    override fun onUpdate() {
        value = telephonyManager.getCarrierPrivilegeStatus(uid)
        value = telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName)
    }

    /**
     * Repository for [CarrierPrivilegedStatusLiveData].
     * <p> Key value is a package uid, value is its corresponding LiveData.
     * <p> Key value is a package name, value is its corresponding LiveData of
     * [android.telephony.Annotation.CarrierPrivilegeStatus]
     */
    companion object
        : DataRepository<Int, CarrierPrivilegedStatusLiveData>() {
        override fun newValue(key: Int): CarrierPrivilegedStatusLiveData {
        : DataRepository<String, CarrierPrivilegedStatusLiveData>() {
        override fun newValue(key: String): CarrierPrivilegedStatusLiveData {
            return CarrierPrivilegedStatusLiveData(PermissionControllerApplication.get(), key)
        }
    }
+1 −2
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ import com.android.permissioncontroller.permission.utils.Utils.PROPERTY_AUTO_REV
import com.android.permissioncontroller.permission.utils.Utils.PROPERTY_AUTO_REVOKE_UNUSED_THRESHOLD_MILLIS
import com.android.permissioncontroller.permission.utils.application
import com.android.permissioncontroller.permission.utils.forEachInParallel
import com.android.permissioncontroller.permission.utils.getUid
import com.android.permissioncontroller.permission.utils.updatePermissionFlags
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.GlobalScope
@@ -461,7 +460,7 @@ suspend fun isPackageAutoRevokePermanentlyExempt(
        }
        return true
    }
    val carrierPrivilegedStatus = CarrierPrivilegedStatusLiveData[user.getUid(pkg.uid)]
    val carrierPrivilegedStatus = CarrierPrivilegedStatusLiveData[pkg.packageName]
            .getInitializedValue()
    if (carrierPrivilegedStatus != CARRIER_PRIVILEGE_STATUS_HAS_ACCESS &&
            carrierPrivilegedStatus != CARRIER_PRIVILEGE_STATUS_NO_ACCESS) {