diff options
author | Santhosh Kumar H E <skhara@codeaurora.org> | 2013-12-05 16:36:52 +0530 |
---|---|---|
committer | Santhosh Kumar H E <skhara@codeaurora.org> | 2013-12-06 18:58:24 +0530 |
commit | dbdb7620da136374eea95170261032f910015db0 (patch) | |
tree | 007242cdb44941ecb855751c85da69aa97cc6a43 /src/com/android/camera/util/CameraUtil.java | |
parent | 1c7734057201ffd1b6d165d9e24793ef3d213043 (diff) | |
parent | df2b0819907c440a660e228414a18184732816d1 (diff) | |
download | android_packages_apps_Snap-dbdb7620da136374eea95170261032f910015db0.tar.gz android_packages_apps_Snap-dbdb7620da136374eea95170261032f910015db0.tar.bz2 android_packages_apps_Snap-dbdb7620da136374eea95170261032f910015db0.zip |
Merge remote-tracking branch into merge_branch
Delay onResume tasks to speed up lockscreen onResume->onPause->onResume launch sequence.
Import translations. DO NOT MERGE
gcam: Clean up placeholders, and add deletion robustness.
Fix issue of focus indicator staying on without being hidden
Ensure view size gets updated after phone decors change.
Show the 100% state of the progress at least one frame.
Add parameters and deduplicate parameter changes
Revert parallel opening camera in photo mode.
Differentiate the InProgressData from the normal PhotoData.
Close mode menus if another control is touched
Start gcam module directly when handling capture intent.
Import translations. DO NOT MERGE
Add a null check to fix NPE
Add logging to various actions
Ensure mOpenCameraThread has been setup before dereferencing.
Add logging to various actions
Ensure mOpenCameraThread has been setup before dereferencing.
Add GCam progress indicator.
hide preview cover on arrival of new preview data if hidden
Fix photo mode is getting stuck in a single CameraState.
...
Conflicts:
res/layout/photo_module.xml
res/values/arrays.xml
src/com/android/camera/CameraActivity.java
src/com/android/camera/PhotoUI.java
src/com/android/camera/Storage.java
src/com/android/camera/WideAnglePanoramaModule.java
src/com/android/camera/ui/FilmStripView.java
Change-Id: Ic41b4e7e07b2b0ed7936b78a6c5f05270d05985f
Diffstat (limited to 'src/com/android/camera/util/CameraUtil.java')
-rw-r--r-- | src/com/android/camera/util/CameraUtil.java | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index dbd078d14..68211d648 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -679,6 +679,16 @@ public class CameraUtil { rect.bottom = Math.round(rectF.bottom); } + public static Rect rectFToRect(RectF rectF) { + Rect rect = new Rect(); + rectFToRect(rectF, rect); + return rect; + } + + public static RectF rectToRectF(Rect r) { + return new RectF(r.left, r.top, r.right, r.bottom); + } + public static void prepareMatrix(Matrix matrix, boolean mirror, int displayOrientation, int viewWidth, int viewHeight) { // Need mirror for front camera. @@ -691,6 +701,21 @@ public class CameraUtil { matrix.postTranslate(viewWidth / 2f, viewHeight / 2f); } + public static void prepareMatrix(Matrix matrix, boolean mirror, int displayOrientation, + Rect previewRect) { + // Need mirror for front camera. + matrix.setScale(mirror ? -1 : 1, 1); + // This is the value for android.hardware.Camera.setDisplayOrientation. + matrix.postRotate(displayOrientation); + + // Camera driver coordinates range from (-1000, -1000) to (1000, 1000). + // We need to map camera driver coordinates to preview rect coordinates + Matrix mapping = new Matrix(); + mapping.setRectToRect(new RectF(-1000, -1000, 1000, 1000), rectToRectF(previewRect), + Matrix.ScaleToFit.FILL); + matrix.setConcat(mapping, matrix); + } + public static String createJpegName(long dateTaken) { synchronized (sImageFileNamer) { return sImageFileNamer.generateName(dateTaken); @@ -820,7 +845,10 @@ public class CameraUtil { * the right range. */ public static int[] getPhotoPreviewFpsRange(Parameters params) { - List<int[]> frameRates = params.getSupportedPreviewFpsRange(); + return getPhotoPreviewFpsRange(params.getSupportedPreviewFpsRange()); + } + + public static int[] getPhotoPreviewFpsRange(List<int[]> frameRates) { if (frameRates.size() == 0) { Log.e(TAG, "No suppoted frame rates returned!"); return null; @@ -902,6 +930,8 @@ public class CameraUtil { public static void playVideo(Activity activity, Uri uri, String title) { try { boolean isSecureCamera = ((CameraActivity)activity).isSecureCamera(); + UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA, + UsageStatistics.ACTION_PLAY_VIDEO, null); if (!isSecureCamera) { Intent intent = IntentHelper.getVideoPlayerIntent(activity, uri) .putExtra(Intent.EXTRA_TITLE, title) @@ -966,20 +996,4 @@ public class CameraUtil { } return ret; } - - /** - * Launches apps supporting action {@link Intent.ACTION_MAIN} of category - * {@link Intent.CATEGORY_APP_GALLERY}. Note that - * {@link Intent.CATEGORY_APP_GALLERY} is only available on API level 15+. - * - * @param ctx The {@link android.content.Context} to launch the app. - * @return {@code true} on success. - */ - public static boolean launchGallery(Context ctx) { - if (ApiHelper.HAS_APP_GALLERY) { - ctx.startActivity(IntentHelper.getGalleryIntent(ctx)); - return true; - } - return false; - } } |