Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bc14456 authored by Michael Bestas's avatar Michael Bestas
Browse files

Revert "Phone: Add headset notification when wired headset plugin"

* This is useless and was -2ed on cm-11.0

This reverts commit e76b5478.

Change-Id: I603b4044473f8b20c4ff661194608ec973c2a276
parent 1910df58
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -41,6 +41,4 @@
    <string name="no_vm_number" msgid="4164780423805688336">"缺少语音信箱号码"</string>
    <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM卡上未存储语音信箱号码。"</string>
    <string name="add_vm_number_str" msgid="4676479471644687453">"添加号码"</string>
    <string name="headset_plugin_view_text">耳机已插入到手机。</string>
    <string name="headset_plugin_view_title">耳机插入</string>
</resources>
+0 −2
Original line number Diff line number Diff line
@@ -41,6 +41,4 @@
    <string name="no_vm_number" msgid="4164780423805688336">"未填留言信箱號碼"</string>
    <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM 卡中沒有儲存任何留言信箱號碼。"</string>
    <string name="add_vm_number_str" msgid="4676479471644687453">"新增電話號碼"</string>
    <string name="headset_plugin_view_text">耳機已插入到手機</string>
    <string name="headset_plugin_view_title">耳機插入</string>
</resources>
+0 −2
Original line number Diff line number Diff line
@@ -41,6 +41,4 @@
    <string name="no_vm_number" msgid="4164780423805688336">"遺失語音信箱號碼"</string>
    <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM 卡中未儲存語音信箱號碼。"</string>
    <string name="add_vm_number_str" msgid="4676479471644687453">"新增號碼"</string>
    <string name="headset_plugin_view_text">耳機已插入到手機</string>
    <string name="headset_plugin_view_title">耳機插入</string>
</resources>
+0 −2
Original line number Diff line number Diff line
@@ -112,7 +112,5 @@
    <!-- DO NOT TRANSLATE. Hardcoded number used for restricted incoming phone numbers. -->
    <string name="handle_restricted">RESTRICTED</string>

    <string name="headset_plugin_view_text">Headset is plugged in.</string>
    <string name="headset_plugin_view_title">Headset</string>
    <string name="select_account_dialog_title">Select Account</string>
</resources>
+0 −41
Original line number Diff line number Diff line
@@ -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;
@@ -36,17 +33,12 @@ final class TtyManager implements WiredHeadsetManager.Listener {
    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,
@@ -73,12 +65,6 @@ final class TtyManager implements WiredHeadsetManager.Listener {
    public void onWiredHeadsetPluggedInChanged(boolean oldIsPluggedIn, boolean newIsPluggedIn) {
        Log.v(this, "onWiredHeadsetPluggedInChanged");
        updateCurrentTtyMode();

        if (newIsPluggedIn) {
            showHeadSetPlugin();
        } else {
            cancelHeadSetPlugin();
        }
    }

    private void updateCurrentTtyMode() {
@@ -121,33 +107,6 @@ final class TtyManager implements WiredHeadsetManager.Listener {
        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) {