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

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

Merge "Ensure location package state set correctly" into rvc-dev

parents 31c8a137 b619a8b8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -264,8 +264,12 @@ class AppPermGroupUiInfoLiveData private constructor(
    }

    private fun getIsSpecialLocationState(): Boolean? {
        if (!isSpecialLocation) {
            return null
        }

        val userContext = Utils.getUserContext(app, user)
        if (isSpecialLocation) {
        if (LocationUtils.isLocationGroupAndProvider(userContext, permGroupName, packageName)) {
            return LocationUtils.isLocationEnabled(userContext)
        }
        // The permission of the extra location controller package is determined by the
+6 −6
Original line number Diff line number Diff line
@@ -117,16 +117,16 @@ class LightAppPermGroupLiveData private constructor(
        // Determine if this app permission group is a special location package or provider
        var specialLocationGrant: Boolean? = null
        val userContext = Utils.getUserContext(app, user)
        if (isSpecialLocation) {
            specialLocationGrant = LocationUtils.isLocationEnabled(app)
        }
        // The permission of the extra location controller package is determined by the status of
        // the controller package itself.
        if (LocationUtils.isLocationGroupAndControllerExtraPackage(app, permGroupName,
        if (LocationUtils.isLocationGroupAndProvider(userContext, permGroupName, packageName)) {
            specialLocationGrant = LocationUtils.isLocationEnabled(userContext)
        } else if (LocationUtils.isLocationGroupAndControllerExtraPackage(app, permGroupName,
                packageName)) {
            // The permission of the extra location controller package is determined by the status
            // of the controller package itself.
            specialLocationGrant = LocationUtils.isExtraLocationControllerPackageEnabled(
                userContext)
        }

        val hasInstallToRuntimeSplit = hasInstallToRuntimeSplit(packageInfo, permissionMap)
        value = LightAppPermGroup(packageInfo, permGroup.groupInfo, permissionMap,
            hasInstallToRuntimeSplit, specialLocationGrant)