Tidy up visuals/behaviors for MSIM notifications.
+ If MSIM device, show subscription display name on voicemail
or call forwarding notifications instead of some of the normal
title/summary text.
+ Use subscription colors to tint notification backgrounds.
+ Use PhoneAccountHandle to specify SIM to call with for voicemail
notifications.
+ Move code for getting PhoneAccountHandle from Phone into PhoneUtils
and update references throughout telephony. This assumes we only need
to do the conversion for PSTN phones; this seems to be a safe
assumption given how the notification manager previously got the
default Phone from the phone factory.
Bug: 18232725
Change-Id: I62574643de1d61ef716e06fb733467ce2f607586
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index b3d64db..0c8b62c 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -33,6 +33,7 @@
import android.os.RemoteException;
import android.os.SystemProperties;
import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
import android.telecom.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -57,6 +58,7 @@
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.sip.SipPhone;
import com.android.phone.CallGatewayManager.RawGatewayInfo;
+import com.android.services.telephony.TelephonyConnectionService;
import java.util.Arrays;
import java.util.List;
@@ -2434,4 +2436,18 @@
return context.getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
}
+
+ public static PhoneAccountHandle makePstnPhoneAccountHandle(Phone phone) {
+ return makePstnPhoneAccountHandleWithPrefix(phone, "", false);
+ }
+
+ public static PhoneAccountHandle makePstnPhoneAccountHandleWithPrefix(
+ Phone phone, String prefix, boolean isEmergency) {
+ ComponentName pstnConnectionServiceName =
+ new ComponentName(phone.getContext(), TelephonyConnectionService.class);
+ // TODO: Should use some sort of special hidden flag to decorate this account as
+ // an emergency-only account
+ String id = isEmergency ? "E" : prefix + String.valueOf(phone.getSubId());
+ return new PhoneAccountHandle(pstnConnectionServiceName, id);
+ }
}