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

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

Merge "Fix an issue that appOps was called before location delivery check."

parents 153a235d 8486fc70
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -3210,18 +3210,6 @@ public class LocationManagerService extends ILocationManager.Stub {
                continue;
            }

            if (!reportLocationAccessNoThrow(
                    receiver.mCallerIdentity.mPid,
                    receiver.mCallerIdentity.mUid,
                    receiver.mCallerIdentity.mPackageName,
                    receiver.mAllowedResolutionLevel)) {
                if (D) {
                    Log.d(TAG, "skipping loc update for no op app: " +
                            receiver.mCallerIdentity.mPackageName);
                }
                continue;
            }

            Location notifyLocation;
            if (receiver.mAllowedResolutionLevel < RESOLUTION_LEVEL_FINE) {
                notifyLocation = coarseLocation;  // use coarse location
@@ -3238,6 +3226,20 @@ public class LocationManagerService extends ILocationManager.Stub {
                    } else {
                        lastLoc.set(notifyLocation);
                    }
                    // Report location access before delivering location to the client. This will
                    // note location delivery to appOps, so it should be called only when a
                    // location is really being delivered to the client.
                    if (!reportLocationAccessNoThrow(
                            receiver.mCallerIdentity.mPid,
                            receiver.mCallerIdentity.mUid,
                            receiver.mCallerIdentity.mPackageName,
                            receiver.mAllowedResolutionLevel)) {
                        if (D) {
                            Log.d(TAG, "skipping loc update for no op app: "
                                    + receiver.mCallerIdentity.mPackageName);
                        }
                        continue;
                    }
                    if (!receiver.callLocationChangedLocked(notifyLocation)) {
                        Slog.w(TAG, "RemoteException calling onLocationChanged on "
                                + receiver);