Merge "Release mediaplayer completely after destroying test call"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a2c0b91..ef04eb0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -200,6 +200,8 @@
                   android:process=":ui">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
+                <action android:name="android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index eb3248e..bd6e2d2 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -36,11 +36,13 @@
 import android.telecom.PhoneAccountHandle;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.AtomicFile;
 import android.util.Base64;
 import android.util.Xml;
 
+
 // TODO: Needed for move to system service: import com.android.internal.R;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.FastXmlSerializer;
@@ -136,15 +138,15 @@
      */
     public int getSubscriptionIdForPhoneAccount(PhoneAccountHandle accountHandle) {
         PhoneAccount account = getPhoneAccountInternal(accountHandle);
-        if (account == null
-                || !account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
-                || !TextUtils.isDigitsOnly(accountHandle.getId())
-                || !isVisibleForUser(accountHandle)) {
-            // Since no decimals or negative numbers can be valid subscription ids, only a string of
-            // numbers can be subscription id
-            return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
+        if (account != null
+                && account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
+                && isVisibleForUser(accountHandle)) {
+            TelephonyManager tm =
+                    (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+            return tm.getSubIdForPhoneAccount(account);
         }
-        return Integer.parseInt(accountHandle.getId());
+        return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
     }
 
     /**