summaryrefslogtreecommitdiffstats
path: root/gallerycommon/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'gallerycommon/src/com/android')
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index 434771b6e..2802d075c 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -352,4 +352,29 @@ public class ApiHelper {
return obj == null ? null : new Metadata(obj);
}
}
+
+ public static class AudioSystem {
+ public static final int FORCE_NONE = 0;
+ public static final int FORCE_SPEAKER = 1;
+
+ public static final int FOR_MEDIA = 1;
+
+ private static final Method setForceUseMethod;
+ private static final Method getForceUseMethod;
+
+ static {
+ Class<?> klass = getClassForName("android.media.AudioSystem");
+ setForceUseMethod = getMethod(klass, "setForceUse", int.class, int.class);
+ getForceUseMethod = getMethod(klass, "getForceUse", int.class);
+ }
+
+ public static void setForceUse(int usage, int config) {
+ invoke(setForceUseMethod, null, usage, config);
+ }
+
+ public static int getForceUse(int usage) {
+ Object obj = invoke(getForceUseMethod, null, usage);
+ return obj == null ? FORCE_NONE : (Integer) obj;
+ }
+ }
}