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

Commit 777db0c0 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "resolved conflicts for merge of 61bb25f2 to master"

parents 6dee18c5 d7b92a0f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -237,8 +237,4 @@

    <!-- Component name of the service providing geocoder API support. -->
    <string name="config_geocodeProvider">@null</string>

    <!-- Flag indicating whether headset events are used by kernel to indicate
    TTY mode changes. -->
    <bool name="tty_mode_uses_headset_events">false</bool>
</resources>
+0 −51
Original line number Diff line number Diff line
@@ -53,19 +53,6 @@ class HeadsetObserver extends UEventObserver {
    private final Context mContext;
    private final WakeLock mWakeLock;  // held while there is a pending route change

    private boolean mHandleTTY;
    private int mTTYState;
    private AudioManager mAudioManager = null;

    // special use of bits in headset state received from kernel made by some
    // platforms to indicate changes in TTY mode.
    private static final int BIT_TTY_OFF = 0;
    private static final int BIT_TTY_FULL = (1 << 2);
    private static final int BIT_TTY_VCO = (1 << 5);
    private static final int BIT_TTY_HCO = (1 << 6);
    private static final int TTY_BITS_MASK = (BIT_TTY_FULL | BIT_TTY_VCO | BIT_TTY_HCO);


    public HeadsetObserver(Context context) {
        mContext = context;
        PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
@@ -74,11 +61,6 @@ class HeadsetObserver extends UEventObserver {

        startObserving(HEADSET_UEVENT_MATCH);

        // read settings for TTY mode indication method
        mHandleTTY = context.getResources().getBoolean(
                com.android.internal.R.bool.tty_mode_uses_headset_events);
        mTTYState = BIT_TTY_OFF;

        init();  // set initial status
    }

@@ -118,39 +100,6 @@ class HeadsetObserver extends UEventObserver {
    }

    private synchronized final void update(String newName, int newState) {
        // handle TTY state change first
        if (mHandleTTY) {
            int ttyState = newState  & TTY_BITS_MASK;
            if (ttyState != mTTYState) {
                String ttyMode;

                switch (ttyState) {
                case BIT_TTY_FULL:
                    ttyMode = "tty_full";
                    break;
                case BIT_TTY_VCO:
                    ttyMode = "tty_vco";
                    break;
                case BIT_TTY_HCO:
                    ttyMode = "tty_hco";
                    break;
                case BIT_TTY_OFF:
                    ttyMode = "tty_off";
                    break;
                default:
                    ttyMode = "tty_invalid";
                    break;

                }
                if (ttyMode != "tty_invalid") {
                    mTTYState = ttyState;
                    if (mAudioManager == null) {
                        mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
                    }
                    mAudioManager.setParameters("tty_mode="+ttyMode);
                }
            }
        }
        // Retain only relevant bits
        int headsetState = newState & SUPPORTED_HEADSETS;
        int newOrOld = headsetState | mHeadsetState;
+21 −0
Original line number Diff line number Diff line
@@ -43,4 +43,25 @@ public class TtyIntent {
     */
    public static final String TTY_ENABLED = "ttyEnabled";

    /**
     * Broadcast intent action indicating that the TTY preferred operating mode
     * has changed. An intent extra provides the new mode as an int.
     * @see #TTY_PREFFERED_MODE
     *
     * {@hide}
     */
    public static final String TTY_PREFERRED_MODE_CHANGE_ACTION =
        "com.android.internal.telephony.cdma.intent.action.TTY_PREFERRED_MODE_CHANGE";

    /**
     * The lookup key for an int that indicates preferred TTY mode.
     * Valid modes are:
     * - {@link Phone.TTY_MODE_OFF}
     * - {@link Phone.TTY_MODE_FULL}
     * - {@link Phone.TTY_MODE_HCO}
     * - {@link Phone.TTY_MODE_VCO}
     *
     * {@hide}
     */
    public static final String TTY_PREFFERED_MODE = "ttyPreferredMode";
}