From a575c653126a54850ed220b8255f035df4cdfe05 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Sat, 2 Jan 2016 20:14:18 +0100 Subject: SnapdragonCamera: Fix compilation 1. Address compilation due to compiler upgrade. 2. Comment out video dependencies to enable camera. 3. Fix compilation issue due to IMountService interface change. 4. Comment out ExtendedFace. 5. Remove non-standard video resolutions. Change-Id: I167ab5ff399c4f1d306a1a7ddf94896565c9625a --- src/com/android/camera/CameraActivity.java | 9 ++++++++- src/com/android/camera/CameraSettings.java | 17 ++--------------- src/com/android/camera/SDCard.java | 8 ++++++-- src/com/android/camera/VideoModule.java | 13 +++++++++---- src/com/android/camera/crop/CropActivity.java | 14 -------------- src/com/android/camera/ui/FaceView.java | 4 +++- 6 files changed, 28 insertions(+), 37 deletions(-) (limited to 'src/com/android/camera') diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 71894b82a..0553979d1 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -1407,11 +1407,13 @@ public class CameraActivity extends Activity } GcamHelper.init(getContentResolver()); +/* mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mOriginalMasterVol = mAudioManager.getMasterVolume(); mShutterVol = SystemProperties.getInt("persist.camera.snapshot.volume", -1); if (mShutterVol >= 0 && mShutterVol <= 100 ) mAudioManager.setMasterVolume(mShutterVol,0); +*/ getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.camera_filmstrip); @@ -1593,8 +1595,10 @@ public class CameraActivity extends Activity @Override public void onPause() { +/* if (mShutterVol >= 0 && mShutterVol <= 100) mAudioManager.setMasterVolume(mOriginalMasterVol,0); +*/ // Delete photos that are pending deletion performDeletion(); mOrientationListener.disable(); @@ -1618,9 +1622,10 @@ public class CameraActivity extends Activity @Override public void onResume() { +/* if (mShutterVol >= 0 && mShutterVol <= 100) mAudioManager.setMasterVolume(mShutterVol,0); - +*/ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA, UsageStatistics.ACTION_FOREGROUNDED, this.getClass().getSimpleName()); @@ -1681,8 +1686,10 @@ public class CameraActivity extends Activity mWakeLock.release(); Log.d(TAG, "wake lock release"); } +/* if (mShutterVol >= 0 && mShutterVol <= 100) mAudioManager.setMasterVolume(mOriginalMasterVol,0); +*/ if (mSecureCamera) { unregisterReceiver(mScreenOffReceiver); } diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 465c69049..e8d1a9945 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -1175,11 +1175,13 @@ public class CameraSettings { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private static void getFineResolutionQuality(ArrayList supported, int cameraId,Parameters parameters) { +/* if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_4kDCI)) { if (checkSupportedVideoQuality(parameters,4096,2160)) { supported.add(Integer.toString(CamcorderProfile.QUALITY_4kDCI)); } } +*/ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_2160P)) { if (checkSupportedVideoQuality(parameters,3840,2160)) { supported.add(Integer.toString(CamcorderProfile.QUALITY_2160P)); @@ -1200,26 +1202,11 @@ public class CameraSettings { supported.add(Integer.toString(CamcorderProfile.QUALITY_480P)); } } - if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_FWVGA)) { - if (checkSupportedVideoQuality(parameters,864,480)){ - supported.add(Integer.toString(CamcorderProfile.QUALITY_FWVGA)); - } - } - if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_WVGA)) { - if (checkSupportedVideoQuality(parameters,800,480)){ - supported.add(Integer.toString(CamcorderProfile.QUALITY_WVGA)); - } - } if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_VGA)) { if (checkSupportedVideoQuality(parameters,640,480)){ supported.add(Integer.toString(CamcorderProfile.QUALITY_VGA)); } } - if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_HVGA)) { - if (checkSupportedVideoQuality(parameters,480,360)){ - supported.add(Integer.toString(CamcorderProfile.QUALITY_HVGA)); - } - } if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_CIF)) { if (checkSupportedVideoQuality(parameters,352,288)){ supported.add(Integer.toString(CamcorderProfile.QUALITY_CIF)); diff --git a/src/com/android/camera/SDCard.java b/src/com/android/camera/SDCard.java index dad354007..e4f37f4e2 100644 --- a/src/com/android/camera/SDCard.java +++ b/src/com/android/camera/SDCard.java @@ -28,7 +28,8 @@ package com.android.camera; -import android.content.Context; +import android.app.ActivityThread; +import android.os.UserHandle; import android.os.StatFs; import android.os.Environment; import android.os.storage.StorageVolume; @@ -95,7 +96,10 @@ public class SDCard { try { mMountService = IMountService.Stub.asInterface(ServiceManager .getService("mount")); - final StorageVolume[] volumes = mMountService.getVolumeList(); + + String packageName = ActivityThread.currentOpPackageName(); + + final StorageVolume[] volumes = mMountService.getVolumeList(UserHandle.myUserId(), packageName, 0); if (volumes.length > VOLUME_SDCARD_INDEX) { mVolume = volumes[VOLUME_SDCARD_INDEX]; } diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index cfca4d671..28c62f360 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -306,7 +306,8 @@ 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); +//TODO: Add dependency +// VIDEO_ENCODER_TABLE.put("h265", MediaRecorder.VideoEncoder.H265); VIDEO_ENCODER_TABLE.put("m4v", MediaRecorder.VideoEncoder.MPEG_4_SP); VIDEO_ENCODER_TABLE.putDefault(MediaRecorder.VideoEncoder.DEFAULT); @@ -900,8 +901,8 @@ public class VideoModule implements CameraModule, } private boolean is4KEnabled() { - if (mProfile.quality == CamcorderProfile.QUALITY_2160P || - mProfile.quality == CamcorderProfile.QUALITY_4kDCI) { + if (mProfile.quality == CamcorderProfile.QUALITY_2160P /*|| + mProfile.quality == CamcorderProfile.QUALITY_4kDCI*/) { return true; } else { return false; @@ -963,7 +964,8 @@ public class VideoModule implements CameraModule, boolean supported = false; List videoEncoders = EncoderCapabilities.getVideoEncoders(); for (VideoEncoderCap videoEncoder: videoEncoders) { - if (videoEncoder.mCodec == mVideoEncoder) { +//TODO: How to handle HFRFrameWidth and HFRFrameHeight +/* if (videoEncoder.mCodec == mVideoEncoder) { int maxBitrate = (videoEncoder.mMaxHFRFrameWidth * videoEncoder.mMaxHFRFrameHeight * videoEncoder.mMaxHFRMode); @@ -972,6 +974,7 @@ public class VideoModule implements CameraModule, } break; } +*/ } return supported; @@ -2313,6 +2316,7 @@ public class VideoModule implements CameraModule, List videoEncoders = EncoderCapabilities.getVideoEncoders(); for (VideoEncoderCap videoEncoder: videoEncoders) { if (videoEncoder.mCodec == mVideoEncoder){ +/* TODO: int maxBitrate = (videoEncoder.mMaxHFRFrameWidth * videoEncoder.mMaxHFRFrameHeight * videoEncoder.mMaxHFRMode); @@ -2331,6 +2335,7 @@ public class VideoModule implements CameraModule, } } break; +*/ } } if ("hfr".equals(HighFrameRate.substring(0,3))) { diff --git a/src/com/android/camera/crop/CropActivity.java b/src/com/android/camera/crop/CropActivity.java index 9c9295dc4..9c09b9a87 100644 --- a/src/com/android/camera/crop/CropActivity.java +++ b/src/com/android/camera/crop/CropActivity.java @@ -118,8 +118,6 @@ public class CropActivity extends Activity { if (intent.getData() != null) { mSourceUri = intent.getData(); startLoadBitmap(mSourceUri); - } else { - pickImage(); } } @@ -143,18 +141,6 @@ public class CropActivity extends Activity { mCropView.configChanged(); } - /** - * Opens a selector in Gallery to chose an image for use when none was given - * in the CROP intent. - */ - private void pickImage() { - Intent intent = new Intent(); - intent.setType("image/*"); - intent.setAction(Intent.ACTION_GET_CONTENT); - startActivityForResult(Intent.createChooser(intent, getString(R.string.select_image)), - SELECT_PICTURE); - } - /** * Callback for pickImage(). */ diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java index 4ab74e4cf..773196f7b 100644 --- a/src/com/android/camera/ui/FaceView.java +++ b/src/com/android/camera/ui/FaceView.java @@ -34,7 +34,7 @@ import android.view.View; import com.android.camera.PhotoUI; import com.android.camera.util.CameraUtil; import org.codeaurora.snapcam.R; -import org.codeaurora.camera.ExtendedFace; +//import org.codeaurora.camera.ExtendedFace; public class FaceView extends View implements FocusIndicator, Rotatable, @@ -232,6 +232,7 @@ public class FaceView extends View mPaint.setColor(mColor); mRect.offset(dx, dy); canvas.drawOval(mRect, mPaint); +/* if (mFaces[i] instanceof ExtendedFace) { ExtendedFace face = (ExtendedFace)mFaces[i]; float[] point = new float[4]; @@ -390,6 +391,7 @@ public class FaceView extends View } } } +*/ } canvas.restore(); } -- cgit v1.2.3