diff options
author | 2011-08-08 11:05:04 -0700 | |
---|---|---|
committer | 2011-08-08 11:05:04 -0700 | |
commit | 58e3f1065ef47e7116299b9d5087ba2a2b6065a2 (patch) | |
tree | 722d51e2c08f6f4d9f5ebf9fb5d6ae97f8e1f7ae /java/src/com/android/inputmethod/compat | |
parent | 0a5345c7b6e9282ea401a4017c2c2f9835e623b1 (diff) | |
download | latinime-58e3f1065ef47e7116299b9d5087ba2a2b6065a2.tar.gz latinime-58e3f1065ef47e7116299b9d5087ba2a2b6065a2.tar.xz latinime-58e3f1065ef47e7116299b9d5087ba2a2b6065a2.zip |
Fixed speaking keys when editing password fields
Bug: 5042681
Change-Id: Ic4523ec38b0faa2b6a91d476ea7af7e69404861c
Diffstat (limited to 'java/src/com/android/inputmethod/compat')
-rw-r--r-- | java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java new file mode 100644 index 000000000..b6c3e2a88 --- /dev/null +++ b/java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011 The Android Open Source 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. + */ + +package com.android.inputmethod.compat; + +import android.media.AudioManager; + +import java.lang.reflect.Method; + +public class AudioManagerCompatWrapper { + private static final Method METHOD_isWiredHeadsetOn = CompatUtils.getMethod( + AudioManager.class, "isWiredHeadsetOn"); + private static final Method METHOD_isBluetoothA2dpOn = CompatUtils.getMethod( + AudioManager.class, "isBluetoothA2dpOn"); + + private final AudioManager mManager; + + public AudioManagerCompatWrapper(AudioManager manager) { + mManager = manager; + } + + /** + * Checks whether audio routing to the wired headset is on or off. + * + * @return true if audio is being routed to/from wired headset; + * false if otherwise + */ + public boolean isWiredHeadsetOn() { + return (Boolean) CompatUtils.invoke(mManager, false, METHOD_isWiredHeadsetOn); + } + + /** + * Checks whether A2DP audio routing to the Bluetooth headset is on or off. + * + * @return true if A2DP audio is being routed to/from Bluetooth headset; + * false if otherwise + */ + public boolean isBluetoothA2dpOn() { + return (Boolean) CompatUtils.invoke(mManager, false, METHOD_isBluetoothA2dpOn); + } +} |