Merge "Fix issue: 2413494: Add TTY support." into eclair
This commit is contained in:
@@ -218,8 +218,4 @@
|
|||||||
<!-- Component name of the default wallpaper. This will be ImageWallpaper if not
|
<!-- Component name of the default wallpaper. This will be ImageWallpaper if not
|
||||||
specified -->
|
specified -->
|
||||||
<string name="default_wallpaper_component">@null</string>
|
<string name="default_wallpaper_component">@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>
|
</resources>
|
||||||
|
|||||||
@@ -53,19 +53,6 @@ class HeadsetObserver extends UEventObserver {
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final WakeLock mWakeLock; // held while there is a pending route change
|
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) {
|
public HeadsetObserver(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
||||||
@@ -74,11 +61,6 @@ class HeadsetObserver extends UEventObserver {
|
|||||||
|
|
||||||
startObserving(HEADSET_UEVENT_MATCH);
|
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
|
init(); // set initial status
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,39 +100,6 @@ class HeadsetObserver extends UEventObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized final void update(String newName, int newState) {
|
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
|
// Retain only relevant bits
|
||||||
int headsetState = newState & SUPPORTED_HEADSETS;
|
int headsetState = newState & SUPPORTED_HEADSETS;
|
||||||
int newOrOld = headsetState | mHeadsetState;
|
int newOrOld = headsetState | mHeadsetState;
|
||||||
|
|||||||
@@ -43,4 +43,25 @@ public class TtyIntent {
|
|||||||
*/
|
*/
|
||||||
public static final String TTY_ENABLED = "ttyEnabled";
|
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";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user