summaryrefslogtreecommitdiffstats
path: root/gallerycommon
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2012-07-13 11:54:05 +0800
committerAngus Kong <shkong@google.com>2012-07-13 14:06:59 +0800
commit1b10bf568327fa6c6c1ddbfd98cb17524bebfd46 (patch)
tree82e0e579ec8e3e11a2f382bcb6c245659b9492a4 /gallerycommon
parent4bfc86a3d6ce4df7fa3751ef5e06cf622cae0de2 (diff)
downloadandroid_packages_apps_Gallery2-1b10bf568327fa6c6c1ddbfd98cb17524bebfd46.tar.gz
android_packages_apps_Gallery2-1b10bf568327fa6c6c1ddbfd98cb17524bebfd46.tar.bz2
android_packages_apps_Gallery2-1b10bf568327fa6c6c1ddbfd98cb17524bebfd46.zip
Add the method for hidden fields.
bug:6698375 Change-Id: I5feb3fdd680fec0d745bd3176f4676c16484d4ed
Diffstat (limited to 'gallerycommon')
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/ApiHelper.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
index fd2488faf..753cacdf7 100644
--- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java
@@ -25,6 +25,8 @@ import android.os.Build;
import android.provider.MediaStore.MediaColumns;
import android.view.View;
+import java.lang.reflect.Field;
+
public class ApiHelper {
public static interface VERSION_CODES {
// These value are copied from Build.VERSION_CODES
@@ -87,6 +89,19 @@ public class ApiHelper {
public static final boolean HAS_GET_CAMERA_DISABLED =
hasMethod(DevicePolicyManager.class, "getCameraDisabled", ComponentName.class);
+ public static final boolean HAS_MEDIA_ACTION_SOUND =
+ Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
+
+ public static int getIntFieldIfExists(Class<?> klass, String fieldName,
+ Class<?> obj, int defaultVal) {
+ try {
+ Field f = klass.getDeclaredField(fieldName);
+ return f.getInt(obj);
+ } catch (Exception e) {
+ return defaultVal;
+ }
+ }
+
private static boolean hasField(Class<?> klass, String fieldName) {
try {
klass.getDeclaredField(fieldName);