diff options
author | Likai Ding <likaid@codeaurora.org> | 2016-05-18 15:43:12 +0800 |
---|---|---|
committer | Likai Ding <likaid@codeaurora.org> | 2016-06-03 15:36:58 +0800 |
commit | fdb52c1657054bc3ae54c6006a8fd2807a6d7137 (patch) | |
tree | b92cd7d4c336895e1ece8e43aa4bcff9cbd43b6b /gallerycommon | |
parent | c4528995435f4b82ec104329002c1c25308a6425 (diff) | |
download | android_packages_apps_Gallery2-fdb52c1657054bc3ae54c6006a8fd2807a6d7137.tar.gz android_packages_apps_Gallery2-fdb52c1657054bc3ae54c6006a8fd2807a6d7137.tar.bz2 android_packages_apps_Gallery2-fdb52c1657054bc3ae54c6006a8fd2807a6d7137.zip |
Gallery: AudioSystem wrapper
CRs-Fixed: 986672
Change-Id: I6cb69643162a089b3565666523291563860e6170
Diffstat (limited to 'gallerycommon')
-rw-r--r-- | gallerycommon/src/com/android/gallery3d/common/ApiHelper.java | 25 |
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; + } + } } |