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

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

Merge "rename renounce fine location data" into tm-dev

parents 87befadb d91b8125
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -43457,7 +43457,7 @@ package android.telephony {
    method public int getPhoneType();
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState(boolean, boolean);
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState(int);
    method @Nullable public android.telephony.SignalStrength getSignalStrength();
    method public int getSimCarrierId();
    method @Nullable public CharSequence getSimCarrierIdName();
@@ -43512,10 +43512,10 @@ package android.telephony {
    method @Deprecated public void listen(android.telephony.PhoneStateListener, int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void rebootModem();
    method public void registerTelephonyCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback);
    method public void registerTelephonyCallback(boolean, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback);
    method public void registerTelephonyCallback(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback);
    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestCellInfoUpdate(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
    method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(boolean, @NonNull android.telephony.NetworkScanRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyScanManager.NetworkScanCallback);
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(int, @NonNull android.telephony.NetworkScanRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyScanManager.NetworkScanCallback);
    method public void sendDialerSpecialCode(String);
    method public String sendEnvelopeWithStatus(String);
    method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler);
@@ -43625,6 +43625,9 @@ package android.telephony {
    field public static final String EXTRA_STATE_RINGING;
    field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID";
    field public static final String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER";
    field public static final int INCLUDE_LOCATION_DATA_COARSE = 1; // 0x1
    field public static final int INCLUDE_LOCATION_DATA_FINE = 2; // 0x2
    field public static final int INCLUDE_LOCATION_DATA_NONE = 0; // 0x0
    field public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU";
    field public static final int MULTISIM_ALLOWED = 0; // 0x0
    field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2
+5 −4
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.ims.ImsStreamMediaProfile;
import android.util.ArraySet;
import android.view.Surface;
@@ -837,10 +838,10 @@ public abstract class Connection extends Conferenceable {
            "android.telecom.extra.AUDIO_CODEC_BANDWIDTH_KHZ";

    /**
     * Last known cell identity key to be used to fill geo location header in case of an emergency
     * call. This entry will not be filled if call is not identified as an emergency call.
     * {@link Connection}. Only provided to the {@link ConnectionService} for the purpose
     * of placing an emergency call; will not be present in the {@link InCallService} layer.
     * Last known cell identity key {@link CellIdentity} to be used to fill geo location header
     * in case of an emergency  call. This entry will not be filled if call is not identified as
     * an emergency call. Only provided to the {@link ConnectionService}  for the purpose of
     * placing an emergency call; will not be present in the  {@link InCallService} layer.
     * The {@link ConnectionService}'s implementation will be logged for fine location access
     * when an outgoing call is placed in this case.
     */
+78 −34
Original line number Diff line number Diff line
@@ -8979,7 +8979,7 @@ public class TelephonyManager {
    public NetworkScan requestNetworkScan(
            NetworkScanRequest request, Executor executor,
            TelephonyScanManager.NetworkScanCallback callback) {
        return requestNetworkScan(false, request, executor, callback);
        return requestNetworkScan(INCLUDE_LOCATION_DATA_FINE, request, executor, callback);
    }
    /**
@@ -9004,9 +9004,8 @@ public class TelephonyManager {
     *     and MCC/MNC info.</li>
     * </ol>
     *
     * @param renounceFineLocationAccess Set this to true if the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and do not renounce the permission
     * @param includeLocationData Specifies if the caller would like to receive
     * location related information.
     * @param request Contains all the RAT with bands/channels that need to be scanned.
     * @param executor The executor through which the callback should be invoked. Since the scan
     *        request may trigger multiple callbacks and they must be invoked in the same order as
@@ -9021,7 +9020,8 @@ public class TelephonyManager {
            Manifest.permission.ACCESS_FINE_LOCATION
    })
    public @Nullable NetworkScan requestNetworkScan(
            boolean renounceFineLocationAccess, @NonNull NetworkScanRequest request,
            @IncludeLocationData int includeLocationData,
            @NonNull NetworkScanRequest request,
            @NonNull Executor executor,
            @NonNull TelephonyScanManager.NetworkScanCallback callback) {
        synchronized (sCacheLock) {
@@ -9029,7 +9029,8 @@ public class TelephonyManager {
                mTelephonyScanManager = new TelephonyScanManager();
            }
        }
        return mTelephonyScanManager.requestNetworkScan(getSubId(), renounceFineLocationAccess,
        return mTelephonyScanManager.requestNetworkScan(getSubId(),
                includeLocationData != INCLUDE_LOCATION_DATA_FINE,
                request, executor, callback,
                getOpPackageName(), getAttributionTag());
    }
@@ -12171,10 +12172,15 @@ public class TelephonyManager {
    })
    @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS)
    public @Nullable ServiceState getServiceState() {
        return getServiceState(getRenouncedPermissions()
                    .contains(Manifest.permission.ACCESS_FINE_LOCATION),
                               getRenouncedPermissions()
                    .contains(Manifest.permission.ACCESS_COARSE_LOCATION));
        if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION))  {
            if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION)) {
                return getServiceState(INCLUDE_LOCATION_DATA_NONE);
            } else {
                return getServiceState(INCLUDE_LOCATION_DATA_COARSE);
            }
        }
        return getServiceState(INCLUDE_LOCATION_DATA_FINE);
    }
    /**
@@ -12194,12 +12200,8 @@ public class TelephonyManager {
     * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges})
     * and {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}.
     * @param renounceFineLocationAccess Set this to true if the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and do not renounce the permission
     * @param renounceCoarseLocationAccess Set this to true if the caller would not like to
     * receive location related information which will be sent if the caller already possess
     * {@link Manifest.permission#ACCESS_COARSE_LOCATION} and do not renounce the permissions.
     * @param includeLocationData Specifies if the caller would like to receive
     * location related information.
     * May return {@code null} when the subscription is inactive or when there was an error
     * communicating with the phone process.
     */
@@ -12208,10 +12210,10 @@ public class TelephonyManager {
            Manifest.permission.READ_PHONE_STATE,
            Manifest.permission.ACCESS_COARSE_LOCATION
    })
    public @Nullable ServiceState getServiceState(boolean renounceFineLocationAccess,
            boolean renounceCoarseLocationAccess) {
        return getServiceStateForSubscriber(getSubId(), renounceFineLocationAccess,
                renounceCoarseLocationAccess);
    public @Nullable ServiceState getServiceState(@IncludeLocationData int includeLocationData) {
        return getServiceStateForSubscriber(getSubId(),
                includeLocationData != INCLUDE_LOCATION_DATA_FINE,
                includeLocationData == INCLUDE_LOCATION_DATA_NONE);
    }
    /**
@@ -16169,12 +16171,57 @@ public class TelephonyManager {
     */
    public void registerTelephonyCallback(@NonNull @CallbackExecutor Executor executor,
            @NonNull TelephonyCallback callback) {
        registerTelephonyCallback(
                getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION),
                getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION),
                executor, callback);
        if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_FINE_LOCATION))  {
            if (getRenouncedPermissions().contains(Manifest.permission.ACCESS_COARSE_LOCATION)) {
                registerTelephonyCallback(INCLUDE_LOCATION_DATA_NONE, executor, callback);
                return;
            } else {
                registerTelephonyCallback(INCLUDE_LOCATION_DATA_COARSE, executor, callback);
                return;
            }
        }
        registerTelephonyCallback(INCLUDE_LOCATION_DATA_FINE, executor, callback);
    }
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"INCLUDE_LOCATION_DATA_"}, value = {
            INCLUDE_LOCATION_DATA_NONE,
            INCLUDE_LOCATION_DATA_COARSE,
            INCLUDE_LOCATION_DATA_FINE})
    public @interface IncludeLocationData {}
    /**
     * Specifies to not include any location related data.
     *
     * Indicates whether the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and do not renounce the
     * permissions.
     */
    public static final int INCLUDE_LOCATION_DATA_NONE = 0;
    /**
     * Include coarse location data.
     *
     * Indicates whether the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and do not renounce the
     * permissions.
     */
    public static final int INCLUDE_LOCATION_DATA_COARSE = 1;
    /**
     * Include fine location data.
     *
     * Indicates whether the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and do not renounce the
     * permissions.
     */
    public static final int INCLUDE_LOCATION_DATA_FINE = 2;
    /**
     * Registers a callback object to receive notification of changes in specified telephony states.
     * <p>
@@ -16208,17 +16255,12 @@ public class TelephonyManager {
     * apps. To avoid confusion, calling this method supersede renouncing permissions with a
     * custom context.
     *
     * @param renounceFineLocationAccess Set this to true if the caller would not like to receive
     * location related information which will be sent if the caller already possess
     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and do not renounce the permissions.
     * @param renounceCoarseLocationAccess Set this to true if the caller would not like to
     * receive location related information which will be sent if the caller already possess
     * {@link Manifest.permission#ACCESS_COARSE_LOCATION} and do not renounce the permissions.
     * @param includeLocationData Specifies if the caller would like to receive
     * location related information.
     * @param executor The executor of where the callback will execute.
     * @param callback The {@link TelephonyCallback} object to register.
     */
    public void registerTelephonyCallback(boolean renounceFineLocationAccess,
            boolean renounceCoarseLocationAccess,
    public void registerTelephonyCallback(@IncludeLocationData int includeLocationData,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull TelephonyCallback callback) {
        if (mContext == null) {
@@ -16231,8 +16273,10 @@ public class TelephonyManager {
        mTelephonyRegistryMgr = (TelephonyRegistryManager)
                mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
        if (mTelephonyRegistryMgr != null) {
            mTelephonyRegistryMgr.registerTelephonyCallback(renounceFineLocationAccess,
                    renounceCoarseLocationAccess, executor, mSubId, getOpPackageName(),
            mTelephonyRegistryMgr.registerTelephonyCallback(
                    includeLocationData != INCLUDE_LOCATION_DATA_FINE,
                    includeLocationData == INCLUDE_LOCATION_DATA_NONE,
                    executor, mSubId, getOpPackageName(),
                    getAttributionTag(), callback, getITelephony() != null);
        } else {
            throw new IllegalStateException("telephony service is null.");