summaryrefslogtreecommitdiffstats
path: root/gallerycommon/src
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
commit6911cdad988bc9abdf32a34a5b3c60374dd4a9e4 (patch)
treeeb5b6af4b7682fb02c3207ebf03e7deb34ff9e7b /gallerycommon/src
parent0c03082cc886cbaf76bec8b725d72dd42a01f645 (diff)
downloadandroid_packages_apps_Snap-6911cdad988bc9abdf32a34a5b3c60374dd4a9e4.tar.gz
android_packages_apps_Snap-6911cdad988bc9abdf32a34a5b3c60374dd4a9e4.tar.bz2
android_packages_apps_Snap-6911cdad988bc9abdf32a34a5b3c60374dd4a9e4.zip
Add the method for hidden fields.
bug:6698375 Change-Id: I5feb3fdd680fec0d745bd3176f4676c16484d4ed
Diffstat (limited to 'gallerycommon/src')
-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);