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

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

Merge "Clear calling identity from location providers"

parents 4364e00f 747cbec1
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.location;

import android.content.Context;
import android.location.Location;
import android.os.Binder;
import android.os.Bundle;
import android.os.WorkSource;

@@ -80,7 +81,12 @@ public abstract class AbstractLocationProvider {
     * any thread.
     */
    protected void setEnabled(boolean enabled) {
        long identity = Binder.clearCallingIdentity();
        try {
            mLocationProviderManager.onSetEnabled(enabled);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**
@@ -88,21 +94,36 @@ public abstract class AbstractLocationProvider {
     * any thread.
     */
    protected void setProperties(ProviderProperties properties) {
        long identity = Binder.clearCallingIdentity();
        try {
            mLocationProviderManager.onSetProperties(properties);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**
     * Call this method to report a new location. May be called from any thread.
     */
    protected void reportLocation(Location location) {
        long identity = Binder.clearCallingIdentity();
        try {
            mLocationProviderManager.onReportLocation(location);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**
     * Call this method to report a new location. May be called from any thread.
     */
    protected void reportLocation(List<Location> locations) {
        long identity = Binder.clearCallingIdentity();
        try {
            mLocationProviderManager.onReportLocation(locations);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**