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

Commit bea3ef17 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix NPE in removeGeofence" into qt-dev am: 365e2c0d am:...

Merge "Merge "Fix NPE in removeGeofence" into qt-dev am: 365e2c0d am: e9d99347" into qt-r1-dev-plus-aosp
parents 1cb6282a efe13f82
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2361,7 +2361,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                    mRealRequest,
                    mReceiver.isListener(),
                    mReceiver.isPendingIntent(),
                    /* radius= */ 0,
                    /* geofence= */ null,
                    mActivityManager.getPackageImportance(packageName));

            // remove from mRecordsByProvider
@@ -2541,7 +2541,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                        LocationStatsEnums.USAGE_STARTED,
                        LocationStatsEnums.API_REQUEST_LOCATION_UPDATES,
                        packageName, request, listener != null, intent != null,
                        /* radius= */ 0,
                        /* geofence= */ null,
                        mActivityManager.getPackageImportance(packageName));

                Receiver receiver;
@@ -2844,7 +2844,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                        request,
                        /* hasListener= */ false,
                        intent != null,
                        geofence.getRadius(),
                        geofence,
                        mActivityManager.getPackageImportance(packageName));
            }

@@ -2876,7 +2876,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                        /* LocationRequest= */ null,
                        /* hasListener= */ false,
                        intent != null,
                        geofence.getRadius(),
                        geofence,
                        mActivityManager.getPackageImportance(packageName));
            }
            mGeofenceManager.removeFence(geofence, intent);
@@ -2973,7 +2973,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                            /* LocationRequest= */ null,
                            /* hasListener= */ true,
                            /* hasIntent= */ false,
                            /* radius */ 0,
                            /* geofence= */ null,
                            mActivityManager.getPackageImportance(packageName));
                }
                if (isThrottlingExemptLocked(callerIdentity)
@@ -3014,7 +3014,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                            /* LocationRequest= */ null,
                            /* hasListener= */ true,
                            /* hasIntent= */ false,
                            /* radius= */ 0,
                            /* geofence= */ null,
                            mActivityManager.getPackageImportance(
                                    linkedListener.mCallerIdentity.mPackageName));
                }
+8 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server;

import android.app.ActivityManager;
import android.location.Geofence;
import android.location.LocationManager;
import android.location.LocationRequest;
import android.os.SystemClock;
@@ -180,13 +181,14 @@ class LocationUsageLogger {
    public void logLocationApiUsage(int usageType, int apiInUse,
            String packageName, LocationRequest locationRequest,
            boolean hasListener, boolean hasIntent,
            float radius, int activityImportance) {
            Geofence geofence, int activityImportance) {
        try {
            if (!checkApiUsageLogCap()) {
                return;
            }

            boolean isLocationRequestNull = locationRequest == null;
            boolean isGeofenceNull = geofence == null;
            if (D) {
                Log.d(TAG, "log API Usage to statsd. usageType: " + usageType + ", apiInUse: "
                        + apiInUse + ", packageName: " + (packageName == null ? "" : packageName)
@@ -194,7 +196,8 @@ class LocationUsageLogger {
                        + (isLocationRequestNull ? "" : locationRequest.toString())
                        + ", hasListener: " + hasListener
                        + ", hasIntent: " + hasIntent
                        + ", radius: " + radius
                        + ", geofence: "
                        + (isGeofenceNull ? "" : geofence.toString())
                        + ", importance: " + activityImportance);
            }

@@ -219,7 +222,9 @@ class LocationUsageLogger {
                        ? LocationStatsEnums.EXPIRATION_UNKNOWN
                        : getBucketizedExpireIn(locationRequest.getExpireAt()),
                    getCallbackType(apiInUse, hasListener, hasIntent),
                    bucketizeRadiusToStatsdEnum(radius),
                    isGeofenceNull
                        ? LocationStatsEnums.RADIUS_UNKNOWN
                        : bucketizeRadiusToStatsdEnum(geofence.getRadius()),
                    categorizeActivityImportance(activityImportance));
        } catch (Exception e) {
            // Swallow exceptions to avoid crashing LMS.