Handle MSIM behavior for VM notifications and CFI.

Implement correct behavior for voicemail notifications, also known
as message waiting indicator (MWI) and call forwarding (CFI).

- Don't instantiate CallNotifier with a Phone object.
+ Change updateMwi and updateCfi to take the subscription id as a
parameter so the notification can be shown on a per-SIM basis.
+ Change phone state listener to be subscription-specific.
+ Register/unregister phone state listeners on subscription changes.
+ Update Cfi according to subscription-specific changes.
+ Use subscription ids as a tag on the voicemail/call forwarding
notifications so they can be shown/canceled with greater precision.

Tested:
+ Voicemail ringtone on Sprout for different SIMs.
+ Voicemail vibration on Sprout for different SIMs.
+ Call forwarding notifications on Sprout for different SIMs.
+ Remove/place SIM on Shamu to see notifications disappear/reappear.

TBD:
+ Voicemail notifications just dial the voicemail schema right now.
Need to ascertain whether we can dial a specific number, and what
happens if the number is the same for different SIMs.

Bug: 18232725
Change-Id: Ie15c3d640e8da217fa8778b2d9d904d76bf0c586
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index fe40b17..03827ce 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -48,6 +48,7 @@
 import android.preference.PreferenceManager;
 import android.provider.Settings.System;
 import android.telephony.ServiceState;
+import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.util.Log;
 
@@ -402,8 +403,7 @@
             // asynchronous events from the telephony layer (like
             // launching the incoming-call UI when an incoming call comes
             // in.)
-            notifier = CallNotifier.init(this, phone, callLogger, callStateMonitor,
-                    bluetoothManager);
+            notifier = CallNotifier.init(this, callLogger, callStateMonitor, bluetoothManager);
 
             // register for ICC status
             IccCard sim = phone.getIccCard();
@@ -492,17 +492,8 @@
         return getInstance().phone;
     }
 
-    /**
-     * Returns a list of the currently active phones for the Telephony package.
-     */
-    public static List<Phone> getPhones() {
-        int[] subIds = SubscriptionController.getInstance().getActiveSubIdList();
-        List<Phone> phones = new ArrayList<Phone>(subIds.length);
-
-        for (int i = 0; i < subIds.length; i++) {
-            phones.add(PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subIds[i])));
-        }
-        return phones;
+    public static Phone getPhone(int subId) {
+        return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
     }
 
     /* package */ BluetoothManager getBluetoothManager() {