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

Commit b619a8b8 authored by Nate Myren's avatar Nate Myren
Browse files

Ensure location package state set correctly

Ensures that the extra package does not accidentally fail to fall
through and uses the location provider state

Fixes: 145969187
Test: navigate to location permissions while location is enabled, but
location history is not. Location history should be listed as "deny"

Change-Id: I3ec95480ffde881453ab5c4f10d964f4f2ec277c
parent f68abebd
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -265,8 +265,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)