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

Commit 1c80dbba authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

7530: fix compilation errors.

parent e29e96b2
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.util.Log;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.listeners.ListenerExecutor;
@@ -823,7 +824,7 @@ public class LocationManager {
        Preconditions.checkArgument(lastLocationRequest != null,
                "invalid null last location request");

        Log.d("AP-FakeLocation", "LocationManager::getLastKnownLocation")
        Log.d("AP-FakeLocation", "LocationManager::getLastKnownLocation");
        try {
            return mService.getLastLocation(provider, lastLocationRequest,
                    mContext.getPackageName(), mContext.getAttributionTag());
@@ -1482,7 +1483,7 @@ public class LocationManager {
            @NonNull LocationRequest locationRequest,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull LocationListener listener) {
        Log.d("AP-FakeLocation", "LocationManager::requestLocationIpdates")
        Log.d("AP-FakeLocation", "LocationManager::requestLocationIpdates");
        Preconditions.checkArgument(provider != null, "invalid null provider");
        Preconditions.checkArgument(locationRequest != null, "invalid null location request");

@@ -1532,7 +1533,7 @@ public class LocationManager {
    public void requestLocationUpdates(@NonNull String provider,
            @NonNull LocationRequest locationRequest,
            @NonNull PendingIntent pendingIntent) {
        Log.d("AP-FakeLocation", "LocatonManager::requestLocationUpdates (pendingIntent)")
        Log.d("AP-FakeLocation", "LocatonManager::requestLocationUpdates (pendingIntent)");
        Preconditions.checkArgument(provider != null, "invalid null provider");
        Preconditions.checkArgument(locationRequest != null, "invalid null location request");
        Preconditions.checkArgument(pendingIntent != null, "invalid null pending intent");
+2 −5
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@

package com.android.server.location;

package foundation.e.privacymodules.fakelocationdemo.aosp;

import android.content.Context;
import android.location.Location;
import android.location.LocationResult;
@@ -31,7 +29,6 @@ import android.util.Log;
import java.util.ArrayList;
import java.util.List;


public class FakeLocationResolver {
    private static final String FAKE_LOCATIONS_URI = "content://foundation.e.advancedprivacy.fakelocations";

@@ -43,7 +40,7 @@ public class FakeLocationResolver {
        int uid = identity.getUid();
        String packageName = identity.getPackageName();

        if (context == null || packageName == null || uid < 0) {
        if (baseLocations == null || context == null || packageName == null || uid < 0) {
            Log.w("AP-FakeLocation", "FakeLocationResolver::fakeLocations invalid parameters");
            return baseLocations;
        }
@@ -58,7 +55,7 @@ public class FakeLocationResolver {
        int uid = identity.getUid();
        String packageName = identity.getPackageName();

        if (context == null || packageName == null || uid < 0) {
        if (baseLocation == null || context == null || packageName == null || uid < 0) {
            Log.w("AP-FakeLocation", "FakeLocationResolver::fakeLocation invalid parameters");
            return baseLocation;
        }
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.os.SystemClock;
import android.os.WorkSource;
import android.stats.location.LocationStatsEnums;
import android.util.ArraySet;
import android.util.Log;

import com.android.internal.annotations.GuardedBy;
import com.android.server.PendingIntentUtils;
+28 −22
Original line number Diff line number Diff line
@@ -201,9 +201,11 @@ public class LocationProviderManager extends
        public void deliverOnLocationChanged(LocationResult locationResult,
                @Nullable IRemoteCallback onCompleteCallback) throws RemoteException {

            if (locationResult != null) {
                Location trueLoc = locationResult.getLastLocation();
            String locStr = (trueLoc != null)  trueLoc.longitude + " ; " + trueLoc.latitude ? "loc NULL";
                String locStr = (trueLoc != null) ? trueLoc.getLongitude() + " ; " + trueLoc.getLatitude() : "loc NULL";
                Log.d("AP-FakeLocation", "LocationProviderManager::LocationListenerTransport::deliverOnLocationChanged : " + locStr);
            }
            mListener.onLocationChanged(locationResult.asList(), onCompleteCallback);
        }

@@ -234,10 +236,11 @@ public class LocationProviderManager extends
        public void deliverOnLocationChanged(LocationResult locationResult,
                @Nullable IRemoteCallback onCompleteCallback)
                throws PendingIntent.CanceledException {

            if (locationResult != null) {
                Location trueLoc = locationResult.getLastLocation();
            String locStr = (trueLoc != null)  trueLoc.longitude + " ; " + trueLoc.latitude ? "loc NULL";
                String locStr = (trueLoc != null) ? trueLoc.getLongitude() + " ; " + trueLoc.getLatitude() : "loc NULL";
                Log.d("AP-FakeLocation", "LocationProviderManager::LocationLPendingIntentTransport::deliverOnLocationChanged : " + locStr);
            }

            BroadcastOptions options = BroadcastOptions.makeBasic();
            options.setDontSendToRestrictedApps(true);
@@ -320,9 +323,11 @@ public class LocationProviderManager extends
        public void deliverOnLocationChanged(@Nullable LocationResult locationResult,
                @Nullable IRemoteCallback onCompleteCallback)
                throws RemoteException {
            if (locationResult != null) {
                Location trueLoc = locationResult.getLastLocation();
            String locStr = (trueLoc != null)  trueLoc.longitude + " ; " + trueLoc.latitude ? "loc NULL";
                String locStr = (trueLoc != null) ? trueLoc.getLongitude() + " ; " + trueLoc.getLatitude() : "loc NULL";
                Log.d("AP-FakeLocation", "LocationProviderManager::GetCurrentLocationTransport::deliverOnLocationChanged : " + locStr);
            }

            // ILocationCallback doesn't currently support completion callbacks
            Preconditions.checkState(onCompleteCallback == null);
@@ -986,10 +991,10 @@ public class LocationProviderManager extends
                    CallerIdentity identity = getIdentity();
                    Location trueLoc = locationResult.getLastLocation();
                    if (trueLoc != null) {
                        Log.d("AP-FakeLocation", "LocationRegistration...operate, true location for " + identity.getPackageName() + " is " + trueLoc.longitude + " ; " + trueLoc.latitude);
                        Log.d("AP-FakeLocation", "LocationRegistration...operate, true location for " + identity.getPackageName() + " is " + trueLoc.getLongitude() + " ; " + trueLoc.getLatitude());
                    }

                    LocationResult fakedLocationResult = FakeLocationResolver.fakeLocation(mContext, locationResult, getIdentity()));
                    LocationResult fakedLocationResult = FakeLocationResolver.fakeLocations(mContext, locationResult, getIdentity());

                    if (getIdentity().getPid() == Process.myPid()) {
                        deliverLocationResult = fakedLocationResult.deepCopy();
@@ -1293,18 +1298,19 @@ public class LocationProviderManager extends
                public void operate(LocationTransport listener) throws Exception {
                    // if delivering to the same process, make a copy of the location first (since
                    // location is mutable)
                    LocationResult deliverLocationResult;
                    if (locationResult != null) {
                        Log.d("AP-FakeLocation", "LocationProviderManager::GetCurrentLocationListenerRegistration::acceptLocationChange, ListenerOperation::operate, fakeLocation");
                        Location trueLoc = locationResult.getLastLocation();
                        CallerIdentity identity = getIdentity();
                        if (trueLoc != null) {
                        Log.d("AP-FakeLocation", "LocationRegistration...operate, true location for " + identity.getPackageName() + " is " + trueLoc.longitude + " ; " + trueLoc.latitude);
                            Log.d("AP-FakeLocation", "LocationRegistration...operate, true location for " + identity.getPackageName() + " is " + trueLoc.getLongitude() + " ; " + trueLoc.getLatitude());
                        }
                    }

                    LocationResult fakedLocationResult = FakeLocationResolver.fakeLocation(mContext, locationResult, getIdentity()));
                    LocationResult fakedLocationResult = FakeLocationResolver.fakeLocations(mContext, locationResult, getIdentity());

                    LocationResult deliverLocationResult;
                    if (getIdentity().getPid() == Process.myPid() && locationResult != null) {
                    if (getIdentity().getPid() == Process.myPid() && fakedLocationResult != null) {
                        deliverLocationResult = fakedLocationResult.deepCopy();
                    } else {
                        deliverLocationResult = fakedLocationResult;
@@ -1689,7 +1695,7 @@ public class LocationProviderManager extends
                        Long.MAX_VALUE),
                permissionLevel);

        String locStr = (location != null) location.longitude + " ; " + location.latitude else "NO LOC";
        String locStr = (location != null) ? location.getLongitude() + " ; " + location.getLatitude() : "NO LOC";
        Log.d("AP-FakeLocation", "LocatonProviderManager::getLastLocation " + identity.getPackageName() + " true location: " + locStr);

        location = FakeLocationResolver.fakeLocation(mContext, location, identity);
@@ -1865,7 +1871,7 @@ public class LocationProviderManager extends

    public void registerLocationRequest(LocationRequest request, CallerIdentity callerIdentity,
            @PermissionLevel int permissionLevel, PendingIntent pendingIntent) {
        Log.d("AP-FakeLocation", "LocatonProviderManager::registerLocationRequest (pendingIntent) " + identity.getPackageName());
        Log.d("AP-FakeLocation", "LocatonProviderManager::registerLocationRequest (pendingIntent) " + callerIdentity.getPackageName());

        LocationPendingIntentRegistration registration = new LocationPendingIntentRegistration(
                request,