aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-08-16 18:45:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-16 18:45:26 -0700
commite486175987bca15881d292a8005e813f1d61e89f (patch)
tree93f09d4060596bc04fd1de4f63489a96857b25af /java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java
parent5cb10f78ed5c0e17798ea5300d8291b613c5e2a9 (diff)
parent58e3f1065ef47e7116299b9d5087ba2a2b6065a2 (diff)
downloadlatinime-e486175987bca15881d292a8005e813f1d61e89f.tar.gz
latinime-e486175987bca15881d292a8005e813f1d61e89f.tar.xz
latinime-e486175987bca15881d292a8005e813f1d61e89f.zip
Merge "Fixed speaking keys when editing password fields"
Diffstat (limited to 'java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java')
-rw-r--r--java/src/com/android/inputmethod/compat/AudioManagerCompatWrapper.java54
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);
+ }
+}