Merge "Provide last known cell id for emergency call"

This commit is contained in:
Sooraj Sasindran
2021-12-08 19:19:54 +00:00
committed by Gerrit Code Review
5 changed files with 59 additions and 0 deletions

View File

@@ -40069,6 +40069,7 @@ package android.telecom {
field public static final String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS"; field public static final String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS";
field public static final String EXTRA_IS_RTT_AUDIO_PRESENT = "android.telecom.extra.IS_RTT_AUDIO_PRESENT"; field public static final String EXTRA_IS_RTT_AUDIO_PRESENT = "android.telecom.extra.IS_RTT_AUDIO_PRESENT";
field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
field public static final String EXTRA_LAST_KNOWN_CELL_IDENTITY = "android.telecom.extra.LAST_KNOWN_CELL_IDENTITY";
field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE"; field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE";
field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200 field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200
field public static final int PROPERTY_CROSS_SIM = 8192; // 0x2000 field public static final int PROPERTY_CROSS_SIM = 8192; // 0x2000

View File

@@ -821,6 +821,17 @@ public abstract class Connection extends Conferenceable {
public static final String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ = public static final String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ =
"android.telecom.extra.AUDIO_CODEC_BANDWIDTH_KHZ"; "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.
* The {@link ConnectionService}'s implementation will be logged for fine location access
* when an outgoing call is placed in this case.
*/
public static final String EXTRA_LAST_KNOWN_CELL_IDENTITY =
"android.telecom.extra.LAST_KNOWN_CELL_IDENTITY";
/** /**
* Boolean connection extra key used to indicate whether device to device communication is * Boolean connection extra key used to indicate whether device to device communication is
* available for the current call. * available for the current call.

View File

@@ -564,6 +564,17 @@ public final class TelephonyPermissions {
enforceCallingOrSelfCarrierPrivilege(context, subId, message); enforceCallingOrSelfCarrierPrivilege(context, subId, message);
} }
/**
* Check if the caller (or self, if not processing an IPC) has ACCESS_LAST_KNOWN_CELL_ID
* permission
*
* @return true if caller has ACCESS_LAST_KNOWN_CELL_ID permission else false.
*/
public static boolean checkLastKnownCellIdAccessPermission(Context context) {
return context.checkCallingOrSelfPermission("android.permission.ACCESS_LAST_KNOWN_CELL_ID")
== PackageManager.PERMISSION_GRANTED;
}
/** /**
* Ensure the caller (or self, if not processing an IPC) has * Ensure the caller (or self, if not processing an IPC) has
* {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges. * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges.

View File

@@ -15805,4 +15805,31 @@ public class TelephonyManager {
ex.rethrowAsRuntimeException(); ex.rethrowAsRuntimeException();
} }
} }
/**
* Get last known cell identity.
* Require {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and
* com.android.phone.permission.ACCESS_LAST_KNOWN_CELL_ID, otherwise throws SecurityException.
* If there is current registered network this value will be same as the registered cell
* identity. If the device goes out of service the previous cell identity is cached and
* will be returned. If the cache age of the Cell identity is more than 24 hours
* it will be cleared and null will be returned.
* @return last known cell identity {@CellIdentity}.
* @hide
*/
@RequiresPermission(allOf = {Manifest.permission.ACCESS_FINE_LOCATION,
"com.android.phone.permission.ACCESS_LAST_KNOWN_CELL_ID"})
public @Nullable CellIdentity getLastKnownCellIdentity() {
try {
ITelephony telephony = getITelephony();
if (telephony == null) {
throw new IllegalStateException("telephony service is null.");
}
return telephony.getLastKnownCellIdentity(getSubId(), getOpPackageName(),
getAttributionTag());
} catch (RemoteException ex) {
ex.rethrowAsRuntimeException();
}
return null;
}
} }

View File

@@ -2509,4 +2509,13 @@ interface ITelephony {
* Unregister an IMS connection state callback * Unregister an IMS connection state callback
*/ */
void unregisterImsStateCallback(in IImsStateCallback cb); void unregisterImsStateCallback(in IImsStateCallback cb);
/**
* return last known cell identity
* @param subId user preferred subId.
* @param callingPackage the name of the package making the call.
* @param callingFeatureId The feature in the package.
*/
CellIdentity getLastKnownCellIdentity(int subId, String callingPackage,
String callingFeatureId);
} }