summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt1
-rw-r--r--telecomm/java/android/telecom/Connection.java11
-rw-r--r--telephony/common/com/android/internal/telephony/TelephonyPermissions.java11
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java27
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl9
5 files changed, 59 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 32adeefec2b9..b4eb62a20bc3 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -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_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_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 int PROPERTY_ASSISTED_DIALING = 512; // 0x200
field public static final int PROPERTY_CROSS_SIM = 8192; // 0x2000
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 9fec96b7f549..467084a716a0 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -837,6 +837,17 @@ 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.
+ * 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
* available for the current call.
* @hide
diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
index ce4363f66d1c..fcc23a924d85 100644
--- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
@@ -565,6 +565,17 @@ public final class TelephonyPermissions {
}
/**
+ * 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
* {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges.
*
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 61467504f940..1029214b0222 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -15809,4 +15809,31 @@ public class TelephonyManager {
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;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 6b33a6894365..2df5f53147bc 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -2509,4 +2509,13 @@ interface ITelephony {
* Unregister an IMS connection state callback
*/
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);
}