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

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

Merge "Create AppForegroundHelper"

parents 7c0436c1 b6375a4f
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.location.LocationManager;
import android.location.LocationManagerInternal;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
@@ -32,6 +32,7 @@ import android.widget.Toast;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.location.GpsNetInitiatedHandler;
import com.android.internal.location.GpsNetInitiatedHandler;
import com.android.server.LocalServices;


/**
/**
 * This activity is shown to the user for him/her to accept or deny network-initiated
 * This activity is shown to the user for him/her to accept or deny network-initiated
@@ -137,9 +138,8 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
    // Respond to NI Handler under GnssLocationProvider, 1 = accept, 2 = deny
    // Respond to NI Handler under GnssLocationProvider, 1 = accept, 2 = deny
    private void sendUserResponse(int response) {
    private void sendUserResponse(int response) {
        if (DEBUG) Log.d(TAG, "sendUserResponse, response: " + response);
        if (DEBUG) Log.d(TAG, "sendUserResponse, response: " + response);
        LocationManager locationManager = (LocationManager)
        LocationManagerInternal lm = LocalServices.getService(LocationManagerInternal.class);
            this.getSystemService(Context.LOCATION_SERVICE);
        lm.sendNiResponse(notificationId, response);
        locationManager.sendNiResponse(notificationId, response);
    }
    }


    @UnsupportedAppUsage
    @UnsupportedAppUsage
+0 −2
Original line number Original line Diff line number Diff line
@@ -69,8 +69,6 @@ interface ILocationManager
        double upperRightLatitude, double upperRightLongitude, int maxResults,
        double upperRightLatitude, double upperRightLongitude, int maxResults,
        in GeocoderParams params, out List<Address> addrs);
        in GeocoderParams params, out List<Address> addrs);


    boolean sendNiResponse(int notifId, int userResponse);

    boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener,
    boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener,
             String packageName, String featureId, String listenerIdentifier);
             String packageName, String featureId, String listenerIdentifier);
    void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections,
    void injectGnssMeasurementCorrections(in GnssMeasurementCorrections corrections,
+0 −15
Original line number Original line Diff line number Diff line
@@ -2397,21 +2397,6 @@ public class LocationManager {
        }
        }
    }
    }


    /**
     * Used by NetInitiatedActivity to report user response
     * for network initiated GPS fix requests.
     *
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    public boolean sendNiResponse(int notifId, int userResponse) {
        try {
            return mService.sendNiResponse(notifId, userResponse);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    private void checkPendingIntent(PendingIntent pendingIntent) {
    private void checkPendingIntent(PendingIntent pendingIntent) {
        Preconditions.checkArgument(pendingIntent != null, "invalid null pending intent");
        Preconditions.checkArgument(pendingIntent != null, "invalid null pending intent");
        if (!pendingIntent.isTargetedToPackage()) {
        if (!pendingIntent.isTargetedToPackage()) {
+15 −0
Original line number Original line Diff line number Diff line
@@ -41,4 +41,19 @@ public abstract class LocationManagerInternal {
     * @throws IllegalArgumentException if provider is null
     * @throws IllegalArgumentException if provider is null
     */
     */
    public abstract void requestSetProviderAllowed(@NonNull String provider, boolean allowed);
    public abstract void requestSetProviderAllowed(@NonNull String provider, boolean allowed);

    /**
     * Returns true if the given package belongs to a location provider, and so should be afforded
     * some special privileges.
     *
     * @param packageName The package name to check
     * @return True is the given package belongs to a location provider, false otherwise
     */
    public abstract boolean isProviderPackage(@NonNull String packageName);

    /**
     * Should only be used by GNSS code.
     */
    // TODO: there is no reason for this to exist as part of any API. move all the logic into gnss
    public abstract void sendNiResponse(int notifId, int userResponse);
}
}
+184 −227

File changed.

Preview size limit exceeded, changes collapsed.

Loading