summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjeev Garg <sangarg@codeaurora.org>2016-05-31 15:46:29 +0530
committerSanjeev Garg <sangarg@codeaurora.org>2016-06-06 13:53:42 +0530
commit26d3e7fe41256349c50cdfd021cb385a573fbb18 (patch)
treef680521bd01d63c2888afbe7a7dbf58a32111fa7
parenta04dd5f1e56bfe54a95134a30ec7ec14eccb9730 (diff)
downloadandroid_packages_apps_Snap-26d3e7fe41256349c50cdfd021cb385a573fbb18.tar.gz
android_packages_apps_Snap-26d3e7fe41256349c50cdfd021cb385a573fbb18.tar.bz2
android_packages_apps_Snap-26d3e7fe41256349c50cdfd021cb385a573fbb18.zip
SnapdragonCamera: Using reflection to remove compilation error
Issue: Currently the camera app is being used across multiple PLs, which are on different android versions (Android M, N). There are different variables being used for h256 across different android framework - M and N. Hence using one variable name is causing compilation error in other android version Fix: Using java reflection to access variables to avoid any compilation dependency on different android versions CRs-Fixed: 1015477 Change-Id: I68519223dbe9825e8b1a7f5d1a8e509713a743c6
-rw-r--r--src/com/android/camera/CameraSettings.java8
-rw-r--r--src/com/android/camera/VideoModule.java8
2 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index a12ce5de0..562e52af6 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -282,7 +282,13 @@ public class CameraSettings {
//video encoders
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H263, "h263");
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H264, "h264");
- // VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H265, "h265");
+ int h265 = ApiHelper.getIntFieldIfExists(MediaRecorder.VideoEncoder.class,
+ "HEVC", null, MediaRecorder.VideoEncoder.DEFAULT);
+ if (h265 == MediaRecorder.VideoEncoder.DEFAULT) {
+ h265 = ApiHelper.getIntFieldIfExists(MediaRecorder.VideoEncoder.class,
+ "H265", null, MediaRecorder.VideoEncoder.DEFAULT);
+ }
+ VIDEO_ENCODER_TABLE.put(h265, "h265");
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.MPEG_4_SP, "m4v");
//video qualities
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index f8d79ed00..ac1916b6d 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -315,7 +315,13 @@ public class VideoModule implements CameraModule,
VIDEO_ENCODER_TABLE.put("h263", MediaRecorder.VideoEncoder.H263);
VIDEO_ENCODER_TABLE.put("h264", MediaRecorder.VideoEncoder.H264);
- // VIDEO_ENCODER_TABLE.put("h265", MediaRecorder.VideoEncoder.H265);
+ int h265 = ApiHelper.getIntFieldIfExists(MediaRecorder.VideoEncoder.class,
+ "HEVC", null, MediaRecorder.VideoEncoder.DEFAULT);
+ if (h265 == MediaRecorder.VideoEncoder.DEFAULT) {
+ h265 = ApiHelper.getIntFieldIfExists(MediaRecorder.VideoEncoder.class,
+ "H265", null, MediaRecorder.VideoEncoder.DEFAULT);
+ }
+ VIDEO_ENCODER_TABLE.put("h265", h265);
VIDEO_ENCODER_TABLE.put("m4v", MediaRecorder.VideoEncoder.MPEG_4_SP);
VIDEO_ENCODER_TABLE.putDefault(MediaRecorder.VideoEncoder.DEFAULT);