Merge "Fix cellinfo stop to refresh" into sc-dev
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index b74787a..b5ee6ca 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -9909,6 +9909,21 @@
}
/**
+ * Get the EAB contact from the EAB database.
+ */
+ @Override
+ public String getContactFromEab(String contact) {
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(), "getContactFromEab");
+ enforceModifyPermission();
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return EabUtil.getContactFromEab(getDefaultPhone().getContext(), contact);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
* Remove the EAB contacts from the EAB database.
*/
@Override
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index f1ba3ee..3130913 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -114,6 +114,7 @@
private static final String D2D_SEND = "send";
private static final String RCS_UCE_COMMAND = "uce";
+ private static final String UCE_GET_EAB_CONTACT = "get-eab-contact";
private static final String UCE_REMOVE_EAB_CONTACT = "remove-eab-contact";
// Take advantage of existing methods that already contain permissions checks when possible.
@@ -304,6 +305,12 @@
private void onHelpUce() {
PrintWriter pw = getOutPrintWriter();
pw.println("User Capability Exchange Commands:");
+ pw.println(" uce get-eab-contact [PHONE_NUMBER]");
+ pw.println(" Get the EAB contacts from the EAB database.");
+ pw.println(" Options are:");
+ pw.println(" PHONE_NUMBER: The phone numbers to be removed from the EAB databases");
+ pw.println(" Expected output format :");
+ pw.println(" [PHONE_NUMBER],[RAW_CONTACT_ID],[CONTACT_ID],[DATA_ID]");
pw.println(" uce remove-eab-contact [-s SLOT_ID] [PHONE_NUMBER]");
pw.println(" Remove the EAB contacts from the EAB database.");
pw.println(" Options are:");
@@ -1622,6 +1629,8 @@
switch (arg) {
case UCE_REMOVE_EAB_CONTACT:
return handleRemovingEabContactCommand();
+ case UCE_GET_EAB_CONTACT:
+ return handleGettingEabContactCommand();
}
return -1;
}
@@ -1651,6 +1660,28 @@
return result;
}
+ private int handleGettingEabContactCommand() {
+ String phoneNumber = getNextArgRequired();
+ if (TextUtils.isEmpty(phoneNumber)) {
+ return -1;
+ }
+ String result = "";
+ try {
+ result = mInterface.getContactFromEab(phoneNumber);
+
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "uce get-eab-contact, error " + e.getMessage());
+ getErrPrintWriter().println("Exception: " + e.getMessage());
+ return -1;
+ }
+
+ if (VDBG) {
+ Log.v(LOG_TAG, "uce get-eab-contact, result: " + result);
+ }
+ getOutPrintWriter().println(result);
+ return 0;
+ }
+
private int handleSrcSetDeviceEnabledCommand() {
String enabledStr = getNextArg();
if (enabledStr == null) {
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 0a0ab96..c41bf1a 100755
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -1133,19 +1133,21 @@
@Override
public void onCallFilteringCompleted(boolean isBlocked, boolean isInContacts) {
if (isImsConnection()) {
- ImsPhone imsPhone = (ImsPhone) getPhone().getImsPhone();
+ ImsPhone imsPhone = (getPhone() instanceof ImsPhone) ? (ImsPhone) getPhone() : null;
if (imsPhone != null
&& imsPhone.getCallComposerStatus() == TelephonyManager.CALL_COMPOSER_STATUS_ON
&& !isBlocked && isInContacts) {
ImsPhoneConnection originalConnection = (ImsPhoneConnection) mOriginalConnection;
ImsCallProfile profile = originalConnection.getImsCall().getCallProfile();
+ String serverUrl = CallComposerPictureManager.sTestMode
+ ? CallComposerPictureManager.FAKE_SERVER_URL
+ : profile.getCallExtra(ImsCallProfile.EXTRA_PICTURE_URL);
if (profile != null
- && !TextUtils.isEmpty(
- profile.getCallExtra(ImsCallProfile.EXTRA_PICTURE_URL))) {
+ && !TextUtils.isEmpty(serverUrl)) {
CallComposerPictureManager manager = CallComposerPictureManager
.getInstance(getPhone().getContext(), getPhone().getSubId());
manager.handleDownloadFromServer(new CallComposerPictureTransfer.Factory() {},
- profile.getCallExtra(ImsCallProfile.EXTRA_PICTURE_URL),
+ serverUrl,
(result) -> {
if (result.first != null) {
Bundle newExtras = new Bundle();