Provide last known cell id for emergency call
Provide last known cell id to connection service for emergency calls. Bug: 198533763 Test: unit test Change-Id: If9dc2eaa62a0536f5d3befd719a7a7c573bb73e8
This commit is contained in:
parent
7b0e82975a
commit
8330df01a7
|
@ -56,6 +56,7 @@
|
|||
<uses-permission android:name="android.permission.READ_BLOCKED_NUMBERS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_BLOCKED_NUMBERS"/>
|
||||
<uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
|
||||
<uses-permission android:name="com.android.phone.permission.ACCESS_LAST_KNOWN_CELL_ID"/>
|
||||
|
||||
<permission android:name="android.permission.BROADCAST_CALLLOG_INFO"
|
||||
android:label="Broadcast the call type/duration information"
|
||||
|
|
|
@ -45,6 +45,8 @@ import android.telecom.PhoneAccountHandle;
|
|||
import android.telecom.StatusHints;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telecom.VideoProfile;
|
||||
import android.telephony.CellIdentity;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.telecom.IConnectionService;
|
||||
|
@ -1197,6 +1199,24 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
|
|||
}
|
||||
}
|
||||
|
||||
private CellIdentity getLastKnownCellIdentity() {
|
||||
TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||
if (telephonyManager != null) {
|
||||
CellIdentity lastKnownCellIdentity = telephonyManager.getLastKnownCellIdentity();
|
||||
try {
|
||||
mAppOpsManager.noteOp(AppOpsManager.OP_FINE_LOCATION,
|
||||
mContext.getPackageManager().getPackageUid(
|
||||
getComponentName().getPackageName(), 0),
|
||||
getComponentName().getPackageName());
|
||||
} catch (PackageManager.NameNotFoundException nameNotFoundException) {
|
||||
Log.e(this, nameNotFoundException, "could not find the package -- %s",
|
||||
getComponentName().getPackageName());
|
||||
}
|
||||
return lastKnownCellIdentity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a conference for a new outgoing call or attach to an existing incoming call.
|
||||
*/
|
||||
|
@ -1316,6 +1336,11 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
|
|||
Log.piiHandle(call.getHandle()) + " via:" +
|
||||
getComponentName().getPackageName());
|
||||
|
||||
if (call.isEmergencyCall()) {
|
||||
extras.putParcelable(Connection.EXTRA_LAST_KNOWN_CELL_IDENTITY,
|
||||
getLastKnownCellIdentity());
|
||||
}
|
||||
|
||||
ConnectionRequest connectionRequest = new ConnectionRequest.Builder()
|
||||
.setAccountHandle(call.getTargetPhoneAccount())
|
||||
.setAddress(call.getHandle())
|
||||
|
|
Loading…
Reference in New Issue