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

Commit f2874b20 authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Fix noteOp ordering" into main

parents 84a4efe7 8b95b820
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -1734,12 +1734,6 @@ public class LocationProviderManager extends
            return null;
        }

        // lastly - note app ops
        if (!mAppOpsHelper.noteOpNoThrow(LocationPermissions.asAppOp(permissionLevel),
                identity)) {
            return null;
        }

        Location location = getPermittedLocation(
                getLastLocationUnsafe(
                        identity.getUserId(),
@@ -1748,11 +1742,19 @@ public class LocationProviderManager extends
                        Long.MAX_VALUE),
                permissionLevel);

        if (location != null && identity.getPid() == Process.myPid()) {
        if (location != null) {
            // lastly - note app ops
            if (!mAppOpsHelper.noteOpNoThrow(LocationPermissions.asAppOp(permissionLevel),
                    identity)) {
                return null;
            }

            // if delivering to the same process, make a copy of the location first (since
            // location is mutable)
            if (identity.getPid() == Process.myPid()) {
                location = new Location(location);
            }
        }

        return location;
    }