Merge tag 'LA.UM.5.6.r1-04000-89xx.0' of https://source.codeaurora.org/quic/la/platform/packages/services/Telecomm into HEAD

"LA.UM.5.6.r1-04000-89xx.0"
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..2aa5ce1
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=review.blissroms.com
+port=29418
+project=platform_packages_services_Telecomm.git
+defaultbranch=n7.1-caf
diff --git a/res/mipmap-hdpi/ic_launcher_phone.png b/res/mipmap-hdpi/ic_launcher_phone.png
index 47d7894..aa3f099 100644
--- a/res/mipmap-hdpi/ic_launcher_phone.png
+++ b/res/mipmap-hdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_phone.png b/res/mipmap-mdpi/ic_launcher_phone.png
index 3b333cf..712e6e2 100644
--- a/res/mipmap-mdpi/ic_launcher_phone.png
+++ b/res/mipmap-mdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_phone.png b/res/mipmap-xhdpi/ic_launcher_phone.png
index 020c2fa..5b9aff0 100644
--- a/res/mipmap-xhdpi/ic_launcher_phone.png
+++ b/res/mipmap-xhdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_launcher_phone.png b/res/mipmap-xxhdpi/ic_launcher_phone.png
index 1594e4e..4e204d4 100644
--- a/res/mipmap-xxhdpi/ic_launcher_phone.png
+++ b/res/mipmap-xxhdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_launcher_phone.png b/res/mipmap-xxxhdpi/ic_launcher_phone.png
index 8c92ac1..3efbee9 100644
--- a/res/mipmap-xxxhdpi/ic_launcher_phone.png
+++ b/res/mipmap-xxxhdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/values/aosip_config.xml b/res/values/aosip_config.xml
new file mode 100644
index 0000000..18698df
--- /dev/null
+++ b/res/values/aosip_config.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Pure Nexus Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <!-- Class name for the default in-call UI Service [DO NOT TRANSLATE] -->
+    <string-array name="incall_default_classes" translatable="false">
+        <item>com.android.dialer/com.android.incallui.InCallServiceImpl</item>
+        <item>com.google.android.dialer/com.android.incallui.InCallServiceImpl</item>
+    </string-array>
+
+    <!-- Class name for the default main dialer activity [DO NOT TRANSLATE] -->
+    <string-array name="dialer_default_classes" translatable="false">
+        <item>com.android.dialer/com.android.dialer.DialtactsActivity</item>
+        <item>com.google.android.dialer/com.google.android.dialer.extensions.GoogleDialtactsActivity</item>
+    </string-array>
+</resources>
diff --git a/src/com/android/server/telecom/AsyncRingtonePlayer.java b/src/com/android/server/telecom/AsyncRingtonePlayer.java
index d2a7614..95a98ce 100644
--- a/src/com/android/server/telecom/AsyncRingtonePlayer.java
+++ b/src/com/android/server/telecom/AsyncRingtonePlayer.java
@@ -36,6 +36,7 @@
     private static final int EVENT_PLAY = 1;
     private static final int EVENT_STOP = 2;
     private static final int EVENT_REPEAT = 3;
+    private static final int EVENT_INCREASE_VOLUME = 4;
 
     // The interval in which to restart the ringer.
     private static final int RESTART_RINGER_MILLIS = 3000;
@@ -45,13 +46,18 @@
 
     /** The current ringtone. Only used by the ringtone thread. */
     private Ringtone mRingtone;
+    private float mIncrementAmount;
+    private float mCurrentIncrementVolume;
 
     /** Plays the ringtone. */
-    public void play(RingtoneFactory factory, Call incomingCall) {
+    public void play(RingtoneFactory factory, Call incomingCall,
+            float incStartVolume, int incRampUpTime) {
         Log.d(this, "Posting play.");
         SomeArgs args = SomeArgs.obtain();
         args.arg1 = factory;
         args.arg2 = incomingCall;
+        args.argi1 = Math.round(incStartVolume * 100F);
+        args.argi2 = incRampUpTime;
         postMessage(EVENT_PLAY, true /* shouldCreateHandler */, args);
     }
 
@@ -104,6 +110,15 @@
                     case EVENT_STOP:
                         handleStop();
                         break;
+                    case EVENT_INCREASE_VOLUME:
+                        mCurrentIncrementVolume += mIncrementAmount;
+                        Log.d(AsyncRingtonePlayer.this, "Increasing ringtone volume to "
+                                + Math.round(mCurrentIncrementVolume * 100F) + "%");
+                        mRingtone.setVolume(mCurrentIncrementVolume);
+                        if (mCurrentIncrementVolume < 1F) {
+                            sendEmptyMessageDelayed(EVENT_INCREASE_VOLUME, 1000);
+                        }
+                        break;
                 }
             }
         };
@@ -115,6 +130,8 @@
     private void handlePlay(SomeArgs args) {
         RingtoneFactory factory = (RingtoneFactory) args.arg1;
         Call incomingCall = (Call) args.arg2;
+        float incStartVolume = (float) args.argi1 / 100F;
+        int incRampUpTime = args.argi2;
         args.recycle();
         // don't bother with any of this if there is an EVENT_STOP waiting.
         if (mHandler.hasMessages(EVENT_STOP)) {
@@ -143,6 +160,18 @@
             }
         }
 
+        if (incRampUpTime > 0) {
+            Log.d(this, "Starting ringtone volume at " + Math.round(incStartVolume * 100F) + "%");
+            mRingtone.setVolume(incStartVolume);
+
+            mIncrementAmount = (1F - incStartVolume) / (float) incRampUpTime;
+            mCurrentIncrementVolume = incStartVolume;
+
+            mHandler.sendEmptyMessageDelayed(EVENT_INCREASE_VOLUME, 1000);
+        } else {
+            mRingtone.setVolume(1F);
+        }
+
         handleRepeat();
     }
 
@@ -183,6 +212,7 @@
             // At the time that STOP is handled, there should be no need for repeat messages in the
             // queue.
             mHandler.removeMessages(EVENT_REPEAT);
+            mHandler.removeMessages(EVENT_INCREASE_VOLUME);
 
             if (mHandler.hasMessages(EVENT_PLAY)) {
                 Log.v(this, "Keeping alive ringtone thread for subsequent play request.");
diff --git a/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java b/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
index 2cff4dc..fc9c590 100644
--- a/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
+++ b/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
@@ -276,13 +276,11 @@
                 long token = Binder.clearCallingIdentity();
                 try {
                     Log.i(TAG, "queryPhoneState");
-                    if (isDsdaEnabled()) {
-                        if (mBluetoothDsda != null) {
-                            try {
-                                mBluetoothDsda.processQueryPhoneState();
-                            } catch (RemoteException e) {
-                                Log.i(TAG, "DSDA Service not found exception " + e);
-                            }
+                    if (isDsdaEnabled() && (mBluetoothDsda != null)) {
+                        try {
+                            mBluetoothDsda.processQueryPhoneState();
+                        } catch (RemoteException e) {
+                            Log.i(TAG, "DSDA Service not found exception " + e);
                         }
                     } else {
                         updateHeadsetWithCallState(true /* force */, null);
@@ -981,7 +979,7 @@
      * @ param call is specified call for which Headset is to be updated.
      */
     private void updateHeadsetWithCallState(boolean force, Call call) {
-        if (isDsdaEnabled() && (call != null)) {
+        if (isDsdaEnabled() && (call != null) && (mBluetoothDsda != null)) {
             Log.d(TAG, "DSDA call operation, handle it separately");
             updateDsdaServiceWithCallState(call);
         } else {
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 2870b4a..816808a 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -796,7 +796,7 @@
             // call, it will remain so for the rest of it's lifetime.
             if (!mIsEmergencyCall) {
                 mIsEmergencyCall = mHandle != null && TelephonyUtil.isLocalEmergencyNumber(
-                        mHandle.getSchemeSpecificPart());
+                        mContext, mHandle.getSchemeSpecificPart());
             }
             startCallerInfoLookup();
             for (Listener l : mListeners) {
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 33cf329..a015a1a 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -629,9 +629,7 @@
         mTimeoutsAdapter = timeoutsAdapter;
 
         Resources resources = mContext.getResources();
-        mSystemInCallComponentName = new ComponentName(
-                resources.getString(R.string.ui_default_package),
-                resources.getString(R.string.incall_default_class));
+        mSystemInCallComponentName = TelephonyUtil.getInCallComponentName(context);
 
         mSystemStateProvider.addListener(mSystemStateListener);
     }
diff --git a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
index 6f22596..e1895bf 100644
--- a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
@@ -118,7 +118,7 @@
                         Log.v(this, "Call cancelled (null number), returning...");
                         endEarly = true;
                     } else if (TelephonyUtil.isPotentialLocalEmergencyNumber(
-                            resultNumber)) {
+                            mPhoneNumberUtilsAdapter, mContext, resultNumber)) {
                         Log.w(this, "Cannot modify outgoing call to emergency number %s.",
                                 resultNumber);
                         endEarly = true;
@@ -416,10 +416,8 @@
 
     private void launchSystemDialer(Uri handle) {
         Intent systemDialerIntent = new Intent();
-        final Resources resources = mContext.getResources();
-        systemDialerIntent.setClassName(
-                resources.getString(R.string.ui_default_package),
-                resources.getString(R.string.dialer_default_class));
+        systemDialerIntent.setComponent(
+                TelephonyUtil.getDialerComponentName(mContext));
         systemDialerIntent.setAction(Intent.ACTION_DIAL);
         systemDialerIntent.setData(handle);
         systemDialerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -443,7 +441,7 @@
      */
     private boolean isPotentialEmergencyNumber(String number) {
         Log.v(this, "Checking restrictions for number : %s", Log.pii(number));
-        return (number != null) && TelephonyUtil.isPotentialLocalEmergencyNumber(number);
+        return (number != null) && TelephonyUtil.isPotentialLocalEmergencyNumber(mPhoneNumberUtilsAdapter, mContext, number);
     }
 
     /**
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index 58c469d..a8a5c4f 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -69,6 +69,7 @@
 import java.lang.Integer;
 import java.lang.SecurityException;
 import java.lang.String;
+import java.lang.IllegalArgumentException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -235,6 +236,10 @@
         DefaultPhoneAccountHandle defaultPhoneAccountHandle = mState.defaultOutgoingAccountHandles
                 .get(userHandle);
         if (defaultPhoneAccountHandle == null) {
+            if (TelephonyManager.getDefault().getPhoneCount() > 1 &&
+                       getAllPhoneAccounts(userHandle).size() == 1) {
+                return getUserSelectedVoicePhoneAccount();
+            }
             return null;
         }
         // Make sure the account is still registered and owned by the user.
@@ -247,6 +252,36 @@
         return null;
     }
 
+    PhoneAccountHandle getUserSelectedVoicePhoneAccount() {
+        long voiceSubId = SubscriptionManager.getDefaultVoiceSubscriptionId();
+        PhoneAccountHandle prefPhoneAccount = null;
+
+        Log.i(this, "getUserSelVoicePhoneAccount, voice subId = " + voiceSubId);
+        for (int i = 0; i < mState.accounts.size(); i++) {
+            String id = mState.accounts.get(i).getAccountHandle().getId();
+
+            // emergency account present return it
+            if (id.equals("E")) {
+                Log.i(this, "getUserSelVoicePhoneAccount, emergency account ");
+                return mState.accounts.get(i).getAccountHandle();
+            }
+
+            try {
+                long subId = Long.parseLong(id);
+                Log.i(this, "getUserSelectedVoicePhoneAccount, voice subId = "
+                             + voiceSubId + " subId = " + subId + " mId = " + id);
+                if (subId == voiceSubId) {
+                    prefPhoneAccount = mState.accounts.get(i).getAccountHandle();
+                    break;
+                }
+            } catch (IllegalArgumentException e) {
+                Log.w(this, "getUserSelectedVoicePhoneAccount, accountHandle ID = " + id);
+            }
+        }
+
+        return prefPhoneAccount;
+    }
+
     /**
      * @return The {@link DefaultPhoneAccountHandle} containing the user-selected default calling
      * account and group Id for the {@link UserHandle} specified.
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 262f437..5937bb3 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -18,12 +18,14 @@
 
 import android.app.Notification;
 import android.app.NotificationManager;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.media.AudioAttributes;
 import android.media.AudioManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Vibrator;
+import android.provider.Settings;
 
 import com.android.internal.annotations.VisibleForTesting;
 
@@ -122,11 +124,23 @@
         if (isRingerAudible) {
             mRingingCall = foregroundCall;
             Log.event(foregroundCall, Log.Events.START_RINGER);
+
+            float startVolume = 0;
+            int rampUpTime = 0;
+
+            final ContentResolver cr = mContext.getContentResolver();
+            if (Settings.System.getInt(cr, Settings.System.INCREASING_RING, 0) != 0) {
+                startVolume = Settings.System.getFloat(cr,
+                    Settings.System.INCREASING_RING_START_VOLUME, 0.1f);
+                rampUpTime = Settings.System.getInt(cr,
+                    Settings.System.INCREASING_RING_RAMP_UP_TIME, 20);
+            }
+
             // Because we wait until a contact info query to complete before processing a
             // call (for the purposes of direct-to-voicemail), the information about custom
             // ringtones should be available by the time this code executes. We can safely
             // request the custom ringtone from the call and expect it to be current.
-            mRingtonePlayer.play(mRingtoneFactory, foregroundCall);
+            mRingtonePlayer.play(mRingtoneFactory, foregroundCall, startVolume, rampUpTime);
         } else {
             Log.i(this, "startRingingOrCallWaiting, skipping because volume is 0");
         }
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index c93a752..a8e6717 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -595,10 +595,7 @@
             try {
                 Log.startSession("TSI.gDPA");
                 // No need to synchronize
-                Resources resources = mContext.getResources();
-                return new ComponentName(
-                        resources.getString(R.string.ui_default_package),
-                        resources.getString(R.string.dialer_default_class));
+                return TelephonyUtil.getDialerComponentName(mContext);
             } finally {
                 Log.endSession();
             }
@@ -632,7 +629,12 @@
         public String getSystemDialerPackage() {
             try {
                 Log.startSession("TSI.gSDP");
-                return mContext.getResources().getString(R.string.ui_default_package);
+                String dialerPackage = null;
+                ComponentName component = TelephonyUtil.getDialerComponentName(mContext);
+                if (component != null) {
+                    dialerPackage = component.getPackageName();
+                }
+                return dialerPackage;
             } finally {
                 Log.endSession();
             }
diff --git a/src/com/android/server/telecom/TelephonyUtil.java b/src/com/android/server/telecom/TelephonyUtil.java
index f2c5340..f9439e6 100644
--- a/src/com/android/server/telecom/TelephonyUtil.java
+++ b/src/com/android/server/telecom/TelephonyUtil.java
@@ -18,9 +18,14 @@
 
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
 import android.net.Uri;
 import android.os.ServiceManager;
 import android.os.RemoteException;
+import android.telecom.InCallService;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telephony.PhoneNumberUtils;
@@ -34,6 +39,10 @@
 import java.util.Comparator;
 import java.util.List;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * Utilities to deal with the system telephony services. The system telephony services are treated
  * differently from 3rd party services in some situations (emergency calls, audio focus, etc...).
@@ -75,35 +84,38 @@
     }
 
     public static boolean shouldProcessAsEmergency(Context context, Uri handle) {
-        return handle != null && isLocalEmergencyNumber(handle.getSchemeSpecificPart());
+        return handle != null && isLocalEmergencyNumber(context, handle.getSchemeSpecificPart());
     }
 
-    public static boolean isLocalEmergencyNumber(String address) {
+    public static boolean isLocalEmergencyNumber(Context context, String address) {
         IExtTelephony mIExtTelephony =
             IExtTelephony.Stub.asInterface(ServiceManager.getService("extphone"));
-        boolean result = false;
-        try {
-            result = mIExtTelephony.isLocalEmergencyNumber(address);
-        }catch (RemoteException ex) {
-            Log.e(LOG_TAG, ex, "RemoteException");
-        } catch (NullPointerException ex) {
-            Log.e(LOG_TAG, ex, "NullPointerException");
+        if (mIExtTelephony == null) {
+            return PhoneNumberUtils.isLocalEmergencyNumber(context, address);
         }
-        return result;
+
+        try {
+            return mIExtTelephony.isLocalEmergencyNumber(address);
+        } catch (RemoteException ex) {
+            Log.e(LOG_TAG, ex, "RemoteException");
+            return PhoneNumberUtils.isLocalEmergencyNumber(context, address);
+        }
     }
 
-    public static boolean isPotentialLocalEmergencyNumber(String address) {
+    public static boolean isPotentialLocalEmergencyNumber(
+            PhoneNumberUtilsAdapter adapter, Context context, String address) {
         IExtTelephony mIExtTelephony =
             IExtTelephony.Stub.asInterface(ServiceManager.getService("extphone"));
-        boolean result = false;
-        try {
-            result = mIExtTelephony.isPotentialLocalEmergencyNumber(address);
-        }catch (RemoteException ex) {
-            Log.e(LOG_TAG, ex, "RemoteException");
-        } catch (NullPointerException ex) {
-            Log.e(LOG_TAG, ex, "NullPointerException");
+        if (mIExtTelephony == null) {
+            return adapter.isPotentialLocalEmergencyNumber(context, address);
         }
-        return result;
+
+        try {
+            return mIExtTelephony.isPotentialLocalEmergencyNumber(address);
+        } catch (RemoteException ex) {
+            Log.e(LOG_TAG, ex, "RemoteException");
+            return adapter.isPotentialLocalEmergencyNumber(context, address);
+        }
     }
 
     public static void sortSimPhoneAccounts(Context context, List<PhoneAccount> accounts) {
@@ -156,4 +168,38 @@
     private static String nullToEmpty(String str) {
         return str == null ? "" : str;
     }
+
+    static ComponentName getDialerComponentName(Context context) {
+        Resources resources = context.getResources();
+        PackageManager packageManager = context.getPackageManager();
+        Intent i = new Intent(Intent.ACTION_DIAL);
+        List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(i, 0);
+        List<String> entries = Arrays.asList(resources.getStringArray(
+                R.array.dialer_default_classes));
+        for (ResolveInfo info : resolveInfo) {
+            ComponentName componentName = new ComponentName(info.activityInfo.packageName,
+                    info.activityInfo.name);
+            if (entries.contains(componentName.flattenToString())) {
+                return componentName;
+            }
+        }
+        return null;
+    }
+
+    static ComponentName getInCallComponentName(Context context) {
+        Resources resources = context.getResources();
+        PackageManager packageManager = context.getPackageManager();
+        Intent i = new Intent(InCallService.SERVICE_INTERFACE);
+        List<ResolveInfo> resolveInfo = packageManager.queryIntentServices(i, 0);
+        List<String> entries = Arrays.asList(resources.getStringArray(
+                R.array.incall_default_classes));
+        for (ResolveInfo info : resolveInfo) {
+            ComponentName componentName = new ComponentName(info.serviceInfo.packageName,
+                    info.serviceInfo.name);
+            if (entries.contains(componentName.flattenToString())) {
+                return componentName;
+            }
+        }
+        return null;
+    }
 }
diff --git a/src/com/android/server/telecom/TtyManager.java b/src/com/android/server/telecom/TtyManager.java
index aec29be..25284e4 100644
--- a/src/com/android/server/telecom/TtyManager.java
+++ b/src/com/android/server/telecom/TtyManager.java
@@ -16,9 +16,6 @@
 
 package com.android.server.telecom;
 
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -38,17 +35,12 @@
     private final WiredHeadsetManager mWiredHeadsetManager;
     private int mPreferredTtyMode = TelecomManager.TTY_MODE_OFF;
     private int mCurrentTtyMode = TelecomManager.TTY_MODE_OFF;
-    protected NotificationManager mNotificationManager;
-
-    static final int HEADSET_PLUGIN_NOTIFICATION = 1000;
 
     TtyManager(Context context, WiredHeadsetManager wiredHeadsetManager) {
         mContext = context;
         mWiredHeadsetManager = wiredHeadsetManager;
         mWiredHeadsetManager.addListener(this);
 
-        mNotificationManager =
-                (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
         mPreferredTtyMode = Settings.Secure.getInt(
                 mContext.getContentResolver(),
                 Settings.Secure.PREFERRED_TTY_MODE,
@@ -75,12 +67,6 @@
     public void onWiredHeadsetPluggedInChanged(boolean oldIsPluggedIn, boolean newIsPluggedIn) {
         Log.v(this, "onWiredHeadsetPluggedInChanged");
         updateCurrentTtyMode();
-
-        if (newIsPluggedIn) {
-            showHeadSetPlugin();
-        } else {
-            cancelHeadSetPlugin();
-        }
     }
 
     private void updateCurrentTtyMode() {
@@ -123,33 +109,6 @@
         audioManager.setParameters("tty_mode=" + audioTtyMode);
     }
 
-    void showHeadSetPlugin() {
-        Log.v(TtyManager.this, "showHeadSetPlugin()...");
-
-        String titleText = mContext.getString(
-                R.string.headset_plugin_view_title);
-        String expandedText = mContext.getString(
-                R.string.headset_plugin_view_text);
-
-        Notification notification = new Notification();
-        notification.icon = android.R.drawable.stat_sys_headset;
-        notification.flags |= Notification.FLAG_NO_CLEAR;
-        notification.tickerText = titleText;
-
-        // create the target network operators settings intent
-        Intent intent = new Intent("android.intent.action.NO_ACTION");
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
-
-        notification.setLatestEventInfo(mContext, titleText, expandedText, pi);
-        mNotificationManager.notify(HEADSET_PLUGIN_NOTIFICATION, notification);
-    }
-
-    void cancelHeadSetPlugin() {
-        Log.v(TtyManager.this, "cancelHeadSetPlugin()...");
-        mNotificationManager.cancel(HEADSET_PLUGIN_NOTIFICATION);
-    }
-
     private final class TtyBroadcastReceiver extends BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {