diff options
25 files changed, 543 insertions, 807 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 92e8b7f35..1b8a88d2d 100644..100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -53,8 +53,7 @@ android:screenOrientation="portrait" android:taskAffinity="com.android.camera.CameraActivity" android:theme="@style/Theme.Camera" - android:windowSoftInputMode="stateAlwaysHidden|adjustPan" - android:visibleToInstantApps="true"> + android:windowSoftInputMode="stateAlwaysHidden|adjustPan" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> @@ -70,32 +69,10 @@ android:label="@string/app_name" android:launchMode="singleTop" android:configChanges="orientation|screenSize|keyboardHidden" - android:parentActivityName="com.android.camera.CameraActivity" - android:visibleToInstantApps="true"> - - <intent-filter> - <action android:name="android.media.action.VIDEO_CAMERA" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - - <intent-filter> - <action android:name="android.media.action.VIDEO_CAPTURE" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - - <intent-filter> - <action android:name="android.media.action.IMAGE_CAPTURE" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - - <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - - <meta-data - android:name="android.support.PARENT_ACTIVITY" - android:value="com.android.camera.CameraActivity" /> + android:parentActivityName="com.android.camera.CameraActivity" > + <meta-data + android:name="android.support.PARENT_ACTIVITY" + android:value="com.android.camera.CameraActivity" /> </activity> <activity @@ -133,6 +110,43 @@ </intent-filter> </activity-alias> + <activity-alias + android:name="com.android.camera.PhotoCamera" + android:icon="@mipmap/ic_launcher_camera" + android:label="@string/snapcam_app_name" + android:launchMode="singleTop" + android:targetActivity="com.android.camera.PermissionsActivity"> + <intent-filter> + <action android:name="android.media.action.IMAGE_CAPTURE" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + <intent-filter> + <action android:name="android.media.action.STILL_IMAGE_CAMERA" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity-alias> + + <!-- Video camera and capture use the Camcorder label and icon. --> + <activity-alias + android:name="com.android.camera.VideoCamera" + android:icon="@mipmap/ic_launcher_video_camera" + android:label="@string/video_camera_label" + android:launchMode="singleTop" + android:targetActivity="com.android.camera.PermissionsActivity"> + <intent-filter> + <action android:name="android.media.action.VIDEO_CAMERA" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + <intent-filter> + <action android:name="android.media.action.VIDEO_CAPTURE" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity-alias> + <activity android:name="com.android.camera.SecureCameraActivity" android:clearTaskOnLaunch="true" diff --git a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp index 2a7a1c2a0..4725463f2 100644 --- a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp +++ b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp @@ -16,9 +16,7 @@ #include "SurfaceTextureRenderer.h" -#include <string.h> #include <GLES2/gl2ext.h> - const GLfloat g_vVertices[] = { -1.f, -1.f, 0.0f, 1.0f, // Position 0 0.0f, 0.0f, // TexCoord 0 diff --git a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.h b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.h index ea2b81ade..9dbe9eb48 100644 --- a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.h +++ b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.h @@ -8,6 +8,7 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> class SurfaceTextureRenderer: public Renderer { public: diff --git a/proguard.flags b/proguard.flags index 522c66444..9d477262a 100644 --- a/proguard.flags +++ b/proguard.flags @@ -3,7 +3,6 @@ #Avoid the library class dependency error -dontwarn android.view.inputmethod.InputMethodManager -dontwarn android.content.res.Resources --dontwarn com.android.internal.widget.ViewInfoStore$InfoRecord # ctors of subclasses of CameraPreference are called with Java reflection. -keep class * extends com.android.camera.CameraPreference { @@ -58,4 +57,3 @@ } -keep class android.renderscript.** { *; } - diff --git a/res/layout/one_ui_layout.xml b/res/layout/one_ui_layout.xml index 59e31b95d..5904b5b96 100644..100755 --- a/res/layout/one_ui_layout.xml +++ b/res/layout/one_ui_layout.xml @@ -133,48 +133,15 @@ style="@style/OneUIMenuButton" /> <LinearLayout - android:id="@+id/remaining_photos" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="@android:color/transparent" - android:orientation="horizontal" - android:visibility="gone"> - - <TextView - android:id="@+id/remaining_photos_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="@android:color/transparent" - android:textColor="@android:color/white" - android:visibility="gone" /> - - <ImageView - android:id="@+id/remaining_photos_image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/remaining_sheets" - android:visibility="gone" /> - </LinearLayout> - - <include layout="@layout/pro_mode_layout" /> - - <ImageView - android:id="@+id/promode_close_button" - android:layout_height="20dp" - android:layout_width="20dp" - android:src="@drawable/icon_x" /> - - <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/makeup_seekbar_layout" android:visibility="gone"> <ImageView - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_marginLeft="20dp" - android:layout_marginRight="10dp" - android:src="@drawable/seekbar_hide" + android:layout_width="12dp" + android:layout_height="20dp" + android:layout_marginLeft="23dp" + android:layout_marginRight="23dp" android:id="@+id/seekbar_toggle"> </ImageView> <RelativeLayout @@ -182,8 +149,8 @@ android:layout_height="wrap_content" android:id="@+id/seekbar_body"> <com.android.camera.ui.RotateLayout - android:layout_width="30dp" - android:layout_height="40dp" + android:layout_width="24dp" + android:layout_height="24dp" android:layout_alignParentLeft="true" android:id="@+id/makeup_low_text"> <TextView @@ -196,18 +163,18 @@ </TextView> </com.android.camera.ui.RotateLayout> <SeekBar - android:layout_width="220dp" - android:layout_height="40dp" - android:maxHeight="3dip" - android:minHeight="1dip" - android:layout_marginLeft="10dp" - android:layout_toRightOf="@+id/makeup_low_text" - android:progressDrawable="@drawable/beautify_progressbar_style" - android:thumb="@drawable/ic_beautify_oval" - android:id="@+id/makeup_seekbar"/> + android:layout_width="220dp" + android:layout_height="wrap_content" + android:maxHeight="3dip" + android:minHeight="1dip" + android:layout_marginLeft="10dp" + android:layout_toRightOf="@+id/makeup_low_text" + android:progressDrawable="@drawable/beautify_progressbar_style" + android:thumb="@drawable/ic_beautify_oval" + android:id="@+id/makeup_seekbar"/> <com.android.camera.ui.RotateLayout - android:layout_width="30dp" - android:layout_height="40dp" + android:layout_width="24dp" + android:layout_height="24dp" android:layout_toRightOf="@+id/makeup_seekbar" android:layout_marginLeft="10dp" android:id="@+id/makeup_high_text"> @@ -222,4 +189,36 @@ </com.android.camera.ui.RotateLayout> </RelativeLayout> </LinearLayout> + + <LinearLayout + android:id="@+id/remaining_photos" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@android:color/transparent" + android:orientation="horizontal" + android:visibility="gone"> + + <TextView + android:id="@+id/remaining_photos_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@android:color/transparent" + android:textColor="@android:color/white" + android:visibility="gone" /> + + <ImageView + android:id="@+id/remaining_photos_image" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/remaining_sheets" + android:visibility="gone" /> + </LinearLayout> + + <include layout="@layout/pro_mode_layout" /> + + <ImageView + android:id="@+id/promode_close_button" + android:layout_height="20dp" + android:layout_width="20dp" + android:src="@drawable/icon_x" /> </com.android.camera.ui.OneUICameraControls> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 9b8290f13..607e3b5ec 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -85,8 +85,8 @@ <string name="unknown" msgid="564184550182858146">"未知"</string> <string name="try_to_set_local_album_available_offline" msgid="3363125545009254117">"该内容已存储到本地,可以离线查看。"</string> <string name="please_wait" msgid="1416313324505140068">"请稍候"</string> - <string name="rendering_photo_sphere">"正在渲染全景照片"</string> - <string name="camera_error_title">"相机故障"</string> + <string name="rendering_photo_sphere" msgid="3032858512989313215">"正在渲染 Photo Sphere 全景照片"</string> + <string name="camera_error_title" msgid="6200558085072670067">"相机发生错误"</string> <string name="cannot_connect_camera" msgid="4311259792784598381">"无法连接到相机。"</string> <string name="camera_disabled" msgid="6963443549010040595">"由于安全政策的限制,相机已被禁用。"</string> <string name="wait" msgid="765601745709933047">"请稍候…"</string> @@ -98,7 +98,7 @@ <string name="pref_camera_id_title" msgid="4680648115225411185">"选择摄像头"</string> <string name="pref_camera_id_entry_back" msgid="6386943973628160510">"后置"</string> <string name="pref_camera_id_entry_front" msgid="6233067010315787044">"前置"</string> - <string name="pref_camera_recordlocation_title">"存储位置信息"</string> + <string name="pref_camera_recordlocation_title" msgid="3354956161456185749">"保存地理位置"</string> <string name="pref_camera_location_label" msgid="8695441802378057719">"位置信息"</string> <string name="pref_camera_timer_title" msgid="4728838281741571323">"倒计时器"</string> <plurals name="pref_camera_timer_entry"> @@ -108,7 +108,6 @@ <!-- no translation found for pref_camera_timer_sound_default (6225207881203007747) --> <skip /> <string name="pref_camera_timer_sound_title" msgid="9036987234878551217">"倒计时过程中发出提示音"</string> - <string name="pref_camera_savepath_default">0</string> <string name="setting_off" msgid="6782191065550276632">"关"</string> <string name="setting_on" msgid="9086728135773197891">"开"</string> <string name="pref_video_quality_title" msgid="5887153490982738588">"视频画质"</string> @@ -118,15 +117,10 @@ <string name="pref_camera_settings_category" msgid="4274141528139077830">"相机设置"</string> <string name="pref_camcorder_settings_category" msgid="3553148484755353397">"摄像机设置"</string> <string name="pref_camera_picturesize_title" msgid="686045304547541815">"照片尺寸"</string> - <string name="pref_camera_picturesize_entry_24mp">"24M 像素"</string> - <string name="pref_camera_picturesize_entry_21mp">"2100 万像素"</string> - <string name="pref_camera_picturesize_entry_16mp">"1600 万像素"</string> - <string name="pref_camera_picturesize_entry_16mp_wide">"1600 万像素 (16:9)"</string> - <string name="pref_camera_picturesize_entry_13mp">"1300万像素"</string> - <string name="pref_camera_picturesize_entry_12mp">"1200 万像素"</string> - <string name="pref_camera_picturesize_entry_8mp">"800万像素"</string> - <string name="pref_camera_picturesize_entry_square">"方形 (1:1)"</string> - <string name="pref_camera_picturesize_entry_5mp">"500万像素"</string> + <string name="pref_camera_picturesize_entry_square">方形 (1:1)</string> + <string name="pref_camera_picturesize_entry_13mp" msgid="6728485576074234195">"1300万像素"</string> + <string name="pref_camera_picturesize_entry_8mp" msgid="7088352012301633667">"800万像素"</string> + <string name="pref_camera_picturesize_entry_5mp" msgid="1501745661448065284">"500万像素"</string> <string name="pref_camera_picturesize_entry_4mp_wide" msgid="3338812763544573634">"400万像素 (16:9)"</string> <string name="pref_camera_picturesize_entry_3mp" msgid="140799231761236311">"300万像素"</string> <string name="pref_camera_picturesize_entry_2mp" msgid="450006451326859328">"200万像素"</string> @@ -154,14 +148,14 @@ <string name="pref_camera_whitebalance_title" msgid="7962809566612868179">"白平衡"</string> <string name="pref_camera_whitebalance_label" msgid="7370366644738746700">"白平衡"</string> <string name="pref_camera_whitebalance_entry_auto" msgid="1390631794449502796">"自动"</string> - <string name="pref_camera_whitebalance_entry_incandescent">"白炽光"</string> - <string name="pref_camera_whitebalance_entry_daylight">"日光"</string> - <string name="pref_camera_whitebalance_entry_fluorescent">"荧光"</string> + <string name="pref_camera_whitebalance_entry_incandescent" msgid="1140391575294372706">"白炽灯"</string> + <string name="pref_camera_whitebalance_entry_daylight" msgid="757833578153467254">"晴天"</string> + <string name="pref_camera_whitebalance_entry_fluorescent" msgid="5157027611220790970">"日光灯"</string> <string name="pref_camera_whitebalance_entry_cloudy" msgid="3569589102226796875">"阴天"</string> <string name="pref_camera_whitebalance_label_auto" msgid="4305837287360485369">"自动"</string> - <string name="pref_camera_whitebalance_label_incandescent">"白炽光"</string> - <string name="pref_camera_whitebalance_label_daylight">"日光"</string> - <string name="pref_camera_whitebalance_label_fluorescent">"荧光"</string> + <string name="pref_camera_whitebalance_label_incandescent" msgid="2860805668879945185">"白炽灯"</string> + <string name="pref_camera_whitebalance_label_daylight" msgid="4562002095198912409">"晴天"</string> + <string name="pref_camera_whitebalance_label_fluorescent" msgid="10552295745391742">"日光灯"</string> <string name="pref_camera_whitebalance_label_cloudy" msgid="4880793739075193336">"阴天"</string> <string name="pref_camera_scenemode_title" msgid="5709932164781367066">"取景模式"</string> <string name="pref_camera_scenemode_entry_auto" msgid="9205644316260850379">"自动"</string> @@ -171,14 +165,12 @@ <string name="pref_camera_scenemode_entry_turn_hdr_plus_off" msgid="2668770361856397834">"关闭 HDR+"</string> <string name="pref_camera_scenemode_entry_turn_hdr_on" msgid="5232394324298489502">"开启 HDR"</string> <string name="pref_camera_scenemode_entry_turn_hdr_off" msgid="7694606461440250206">"关闭 HDR"</string> - <string name="pref_camera_scenemode_entry_action">"运动"</string> - <string name="pref_camera_scenemode_entry_night">"夜景"</string> + <string name="pref_camera_scenemode_entry_action" msgid="5753183620959062015">"动作"</string> + <string name="pref_camera_scenemode_entry_night" msgid="3468037364159759991">"夜间"</string> <string name="pref_camera_scenemode_entry_sunset" msgid="5884302914893488509">"日落"</string> <string name="pref_camera_scenemode_entry_party" msgid="401232668169066415">"派对"</string> - <string name="pref_camera_scenemode_entry_refocus">"UbiFocus"</string> - <string name="pref_camera_scenemode_entry_optizoom">"光学变焦"</string> <string name="pref_camera_scenemode_label_auto" msgid="2874586883608401615">"无"</string> - <string name="pref_camera_scenemode_label_action">"运动"</string> + <string name="pref_camera_scenemode_label_action" msgid="1822814017595414923">"动作"</string> <string name="pref_camera_scenemode_label_night" msgid="7764371228088101131">"夜景"</string> <string name="pref_camera_scenemode_label_sunset" msgid="3443610538453611123">"日落"</string> <string name="pref_camera_scenemode_label_party" msgid="917499272505930322">"派对"</string> @@ -188,13 +180,6 @@ <string name="pref_camera_countdown_label_ten" msgid="4372650985906500604">"10秒"</string> <string name="pref_camera_countdown_label_fifteen" msgid="8469955900530268867">"15秒"</string> <string name="not_selectable_in_scene_mode" msgid="3260801086980522611">"无法在取景模式下选择。"</string> - <string name="advanced_capture_disable_continuous_shot">"启用高级拍摄将禁用连拍功能。"</string> - <string name="video_quality_4k_disable_SeeMore">"在 4K 视频期间无法启用查看详情。"</string> - <string name="disable_CDS_during_HighQualityNoiseReduction">"高品质降噪将禁用 CDS。"</string> - <string name="disable_TNR_during_HighQualityNoiseReduction">"高品质降噪将禁用 TNR。"</string> - <string name="disable_CDS_during_SeeMore">"查看详情将禁用 CDS。"</string> - <string name="disable_TNR_during_SeeMore">"查看详情将禁用 TNR。"</string> - <string name="disable_NR_during_SeeMore">"查看详情将禁用降噪。"</string> <string name="pref_exposure_title" msgid="7525751789152582800">"曝光"</string> <string name="pref_exposure_label" msgid="2604738602400261218">"曝光"</string> <!-- no translation found for pref_camera_hdr_default (5054955236904902318) --> @@ -205,7 +190,7 @@ <string name="pref_camera_id_label_back" msgid="1645608049757733858">"前置摄像头"</string> <string name="pref_camera_id_label_front" msgid="349308803062874842">"后置摄像头"</string> <string name="dialog_ok" msgid="774141340500181131">"确定"</string> - <string name="spaceIsLow_content" product="default">"SD 卡空间不足。请更改画质设置,或者删除部分图片或其他文件。"</string> + <string name="spaceIsLow_content" product="default" msgid="4522771065344332702">"SD 卡空间不足。请更改画质设置,或删除部分图片或其他文件。"</string> <string name="video_reach_size_limit" msgid="9196836111505731836">"已达文件大小上限。"</string> <string name="pano_too_fast_prompt" msgid="2503148095578052177">"速度太快"</string> <string name="pano_dialog_prepare_preview" msgid="4445235163599534263">"正在生成全景图"</string> @@ -215,16 +200,16 @@ <string name="pano_dialog_waiting_previous" msgid="2646847402743245320">"正在等待上一幅全景图处理完毕"</string> <string name="pano_review_saving_indication_str" msgid="4691771283450663293">"正在保存…"</string> <string name="pano_review_rendering" msgid="2743087719999377155">"正在渲染全景图"</string> - <string name="tap_to_focus">"触摸对焦。"</string> + <string name="tap_to_focus" msgid="3519718196270593468">"触摸即可对焦。"</string> <string name="pref_video_effect_title" msgid="594570613431209010">"效果"</string> <string name="effect_none" msgid="3102797925086872636">"无"</string> - <string name="effect_goofy_face_squeeze">"面部哈哈镜"</string> + <string name="effect_goofy_face_squeeze" msgid="1362021544829311452">"哈哈镜"</string> <string name="effect_goofy_face_big_eyes" msgid="9220121522816762649">"大眼睛"</string> <string name="effect_goofy_face_big_mouth" msgid="2064008284599552683">"大嘴巴"</string> <string name="effect_goofy_face_small_mouth" msgid="3105849596912069261">"小嘴巴"</string> <string name="effect_goofy_face_big_nose" msgid="6936976307035428164">"大鼻子"</string> <string name="effect_goofy_face_small_eyes" msgid="558042211252573238">"小眼睛"</string> - <string name="effect_backdropper_space">"太空背景"</string> + <string name="effect_backdropper_space" msgid="9133825395915767627">"太空"</string> <string name="effect_backdropper_sunset" msgid="7354053769863638757">"日落"</string> <string name="effect_backdropper_gallery" msgid="2333888391153564920">"您的视频"</string> <string name="video_snapshot_hint" msgid="2707403607250082339">"在录制视频过程中,触摸一下即可拍一张照片。"</string> @@ -240,7 +225,7 @@ <string name="accessibility_switch_to_camera" msgid="4518394037216725274">"切换到拍照模式"</string> <string name="accessibility_switch_to_video" msgid="8174781871592793967">"切换到视频模式"</string> <string name="accessibility_switch_to_panorama" msgid="8322228859117808037">"切换到全景模式"</string> - <string name="accessibility_switch_to_photo_sphere">"切换到全景照片"</string> + <string name="accessibility_switch_to_photo_sphere" msgid="5803217570370854725">"切换到 Photo Sphere 模式"</string> <string name="accessibility_switch_to_gcam" msgid="7562625440767034695">"切换到高画质模式"</string> <string name="accessibility_review_cancel" msgid="5462850829869569629">"取消"</string> <string name="accessibility_review_ok" msgid="3486465319880320270">"完成"</string> @@ -316,11 +301,11 @@ <string name="pref_camera_focusmode_entry_continuous">连续对焦</string> <string name="pref_camera_scenemode_entry_portrait">"肖像"</string> <string name="pref_camera_scenemode_entry_landscape">"风景"</string> - <string name="pref_camera_scenemode_entry_night_portrait">"夜间人像"</string> + <string name="pref_camera_scenemode_entry_night_portrait">"夜景肖像"</string> <string name="pref_camera_scenemode_entry_theatre">"剧院"</string> <string name="pref_camera_scenemode_entry_beach">"海滩"</string> <string name="pref_camera_scenemode_entry_snow">"雪景"</string> - <string name="pref_camera_scenemode_entry_steadyphoto">"防抖"</string> + <string name="pref_camera_scenemode_entry_steadyphoto">"稳定"</string> <string name="pref_camera_scenemode_entry_fireworks">"焰火"</string> <string name="pref_camera_scenemode_entry_sports">"运动"</string> <string name="pref_camera_scenemode_entry_candlelight">"烛光"</string> @@ -424,15 +409,11 @@ <!-- Settings screen, Anti Banding title --> <string name="pref_camera_antibanding_title">"反带效应"</string> <!-- Settings screen, Anti Banding entries --> - <string name="pref_camera_antibanding_entry_0">"关闭"</string> - <string name="pref_camera_antibanding_entry_1">"50 Hz"</string> - <string name="pref_camera_antibanding_entry_2">"60 Hz"</string> - <string name="pref_camera_antibanding_entry_3">"自动"</string> - <string name="pref_camera_filter_mode_entry_on">"开启"</string> - <string name="pref_camera_filter_mode_entry_off">"关闭"</string> + <string name="pref_camera_antibanding_entry_0">"关"</string> + <string name="pref_camera_antibanding_entry_3">"自动"</string> <!-- Settings screen, Select Iso title --> - <string name="pref_camera_iso_title">"ISO"</string> + <string name="pref_camera_iso_title">"选择 ISO"</string> <!-- Settings screen, ISO dialog radio button choices --> <string name="pref_camera_iso_entry_auto">"自动"</string> <string name="pref_camera_iso_entry_isodeblur">"ISO 自动(HJR)"</string> @@ -502,13 +483,13 @@ <!-- error message --> <string name="error_app_unsupported_hfr">"当前分辨率下不支持高帧率视频,如需高帧率请更改视频画质"</string> <string name="error_app_unsupported_hfr_codec">"高帧率下仅支持H264视频编码格式,如需高帧率请更改视频编码"</string> - <string name="error_app_unsupported">"当前分辨率不支持录像"</string> + <string name="error_app_unsupported">"此编码格式不支持当前的分辨率设置,请切换至H264"</string> <string name="error_app_unsupported_raw">"RAW图片格式下不支持零秒快拍,已为您切换至JPEG格式"</string> <string name="error_app_unsupported_hsr">当前格式下不支持HSR</string> <!-- The message is shown in toast when the app encounters an unsupported selection for HFR/HSR mode --> <string name="error_app_unsupported_hfr_selection">HFR/HSR不支持DIS/延时拍摄/HDR模式</string> <!-- The message is shown in toast when the app encounters an unsupported resolution for DIS mode --> - <string name="error_app_unsupported_dis">"图像防抖不支持的视频分辨率"</string> + <string name="error_app_unsupported_dis">DIS不支持当前的分辨率设置</string> <string name="pref_camera_longshot_title">连拍</string> <string name="msg_cancel_longshot_for_limited_memory">内存不足, 取消连拍</string> @@ -521,7 +502,7 @@ <string name="HDR_disable_continuous_shot">"开启HDR将禁用连拍功能"</string> <!-- Toast showing non-supported functionality for flash in AE bracket --> - <string name="flash_aebracket_message">自动曝光模式下不支持闪光灯</string> + <string name="flash_aebracket_message">闪光灯不支持自动包围曝光模式</string> <string name="pref_camera_ae_bracket_hdr_title">自动包围曝光</string> @@ -564,8 +545,8 @@ <string name="text_tsmakeup_alert_continue">继续</string> <string name="text_tsmakeup_alert_quit">退出</string> - <string name="all_in_focus">"全景对焦"</string> - <string name="refocus_toast">"要对上一张照片重新对焦,点按此处"</string> + <string name="all_in_focus">全焦</string> + <string name="refocus_toast">点击此处可重新对焦照片</string> <string name="refocus_prompt_title">UbiFocus</string> <string name="refocus_prompt_message">开启UbiFocus模式后,相机会连续拍摄5张照片并将其合成一张全焦照片。您还可以事后重新对焦。</string> @@ -650,146 +631,12 @@ <string name="pref_camera_tnr_entry_enable">启用</string> <!-- Settings screen, Picture quality dialog radio button choices --> - <string name="pref_camera_jpegquality_entry_0">"低画质"</string> - <string name="pref_camera_jpegquality_entry_1">"中画质"</string> - <string name="pref_camera_jpegquality_entry_2">"高画质"</string> + <string name="pref_camera_jpegquality_entry_0">低</string> + <string name="pref_camera_jpegquality_entry_1">标准</string> + <string name="pref_camera_jpegquality_entry_2">高</string> + <!-- Setting screen, shutter sound choices --> <string name="pref_camera_shuttersound_title">快门声音</string> <string name="pref_camera_shuttersound_entry_enable">开</string> <string name="pref_camera_shuttersound_entry_disable">关</string> - - <!-- Settings screen, Power Mode title --> - <string name="pref_camera_powermode_title">"电源模式"</string> - - <!-- Settings screen, Video encoder dialog title --> - <string name="pref_camera_videoencoder_dialogtitle">"视频编码器"</string> - - <!-- Settings screen, Skin Tone Enhancement radio button choices --> - <string name="pref_camera_skinToneEnhancement_entry_enable">"启用"</string> - <string name="pref_camera_skinToneEnhancement_entry_disable">"停用"</string> - - <!-- Settings screen, Selectable Zone Af dialog radio button choices --> - <string name="pref_camera_advanced_feature_entry_ubifocus">"Ubi 对焦"</string> - <string name="pref_camera_advanced_feature_entry_refocus">"重新聚焦"</string> - <string name="pref_camera_advanced_feature_entry_chromaflash">"Chroma Flash"</string> - <string name="pref_camera_advanced_feature_entry_optizoom">"光学变焦"</string> - <string name="pref_camera_advanced_feature_entry_FSSR">"FSSR"</string> - <string name="pref_camera_advanced_feature_entry_trueportrait">"真实肖像"</string> - <string name="pref_camera_advanced_feature_entry_multi_touch_focus">"多点触控对焦"</string> - <string name="pref_camera_advanced_feature_entry_stillmore">"还有更多"</string> - - <!-- Instant Capture entry --> - <string name="pref_camera_instant_capture_title" translatable="true">"即时捕获"</string> - <string name="pref_camera_instant_capture_entry_enable" translatable="true">"启用"</string> - <string name="pref_camera_instant_capture_entry_disable" translatable="true">"停用"</string> - - <!-- Settings screen, Selfie Flash Detection --> - <string name="pref_selfie_flash_title">"自拍闪光灯"</string> - <!-- Settings menu, Selfie Flash choices --> - <string name="pref_selfie_flash_entry_off">"关闭"</string> - <string name="pref_selfie_flash_entry_on">"开启"</string> - - <!-- The message is shown in dialog when the app encounters an unsupported video profile--> - <string name="error_app_unsupported_profile">"不支持的视频配置文件"</string> - - <string name="err_app_unsupport_ae_bracket_code">"当前应用程序不支持自动曝光"</string> - <!-- The messsage shown if user selects a snapshot resolution lower than the current video size. --> - <string name="snapshot_lower_than_video">"视频快照大小小于视频大小。最大为视频大小。请选择高于或等于当前视频大小的分辨率。 "</string> - <!-- The messsage shown if user selects a snapshot resolution in low power mode. --> - <string name="snapshotsize_low_powermode">"我们不支持低电耗模式下的照片分辨率。将拍摄视频大小快照。请针对照片大小选择高电耗模式。 "</string> - <!-- The messsage shown if user tries to take snapshot during D1/QCIF resolution. --> - <string name="snapshot_qcif_and_d1">"此分辨率仅支持视频大小快照。 "</string> - - <!-- Settings screen, Select See More title --> - <string name="pref_camera_noise_reduction_title">"降噪"</string> - <!-- Settings screen, see more radio button choices --> - <string name="pref_camera_noise_reduction_entry_off">"关闭"</string> - <string name="pref_camera_noise_reduction_entry_fast">"快"</string> - <string name="pref_camera_noise_reduction_entry_high_quality">"高品质"</string> - - <string name="pref_camera_filter_mode_title">"色效应模式"</string> - <!-- Settings screen, Color effect dialog radio button choices --> - - <!-- Select IS title --> - <string name="pref_camera_dis_title">"图像防抖"</string> - - <!-- Select Face Recognition title --> - <string name="pref_camera_facerc_title">"人脸识别"</string> - - <!-- Face Recognition choices --> - <string name="pref_camera_facerc_entry_off">"关闭"</string> - <string name="pref_camera_facerc_entry_on">"开启"</string> - - <!-- Settings screen, picture format dialog radio button choices --> - <string name="pref_camera_picture_format_entry_jpeg">Jpeg</string> - <string name="pref_camera_picture_format_entry_raw">"原始"</string> - - <!-- Settings screen, Select Auto Scene Detection --> - <string name="pref_camera_scenedetect_title">"自动取景检测"</string> - <!-- Settings menu, auto scene detection choices --> - <string name="pref_camera_scenedetect_entry_off">"关闭"</string> - <!-- Scene detection set to on - supports backlight and snow cloudy detection. --> - <string name="pref_camera_scenedetect_entry_on">"开启"</string> - <!-- Toast showing error if invalid size selected for time lapse [CHAR LIMIT=65] --> - <string name="time_lapse_error">"延时录制的视频大小无效。"</string> - - <!-- Settings screen, Selectable HDR mode title --> - <string name="pref_camera_hdr_mode_title">"HDR 模式"</string> - <!-- Settings screen, Selectable HDR mode radio button choices --> - <string name="pref_camera_hdr_mode_entry_sensor">"传感器 HDR"</string> - <string name="pref_camera_hdr_mode_entry_multi_frame">"多帧 HDR"</string> - - <!-- Settings screen, Selectable HDR need 1x frame default value --> - <string name="pref_camera_hdr_need_1x_default">@string/pref_hdr_need_1x_value_true</string> - - <!-- Settings screen, Selectable HDR need 1x frame radio button choices --> - <string name="pref_camera_hdr_need_1x_entry_false">@string/setting_off</string> - <string name="pref_camera_hdr_need_1x_entry_true">@string/setting_on</string> - - <!--Menu, video rotation label--> - <string name="pref_camera_video_rotation_label">"视频旋转"</string> - - <!-- Continous shot enable message --> - <string name="longshot_enable_message">"连拍模式下不支持高级功能"</string> - <!-- Advance features enable message --> - <string name="advance_feature_enable_msg">"启用高级功能时不支持连拍"</string> - - <string name="text_tsmakeup_beautify_toast" translatable="true">"美化"</string> - - <string name="mute_button_desc">"静音按钮"</string> - <!-- Help menu strings --> - <string name="help_menu_ok" translatable="true">"确定"</string> - <string name="help_menu_scene_mode_1" translatable="true">"选择"</string> - <string name="help_menu_scene_mode_2" translatable="true">"取景模式"</string> - <string name="help_menu_scene_mode_3" translatable="true">"以提升图片质量"</string> - <string name="help_menu_color_filter_1" translatable="true">"应用彩色"</string> - <string name="help_menu_color_filter_2" translatable="true">"滤镜"</string> - <string name="help_menu_color_filter_3" translatable="true">"以"</string> - <string name="help_menu_color_filter_4" translatable="true">"增强图片效果"</string> - <string name="help_menu_beautify_1" translatable="true">"增强肖像"</string> - <string name="help_menu_beautify_2" translatable="true">"(通过"</string> - <string name="help_menu_beautify_3" translatable="true">"美化功能)"</string> - <string name="help_menu_switcher_1" translatable="true">"切换"</string> - <string name="help_menu_switcher_2" translatable="true">"相机模式、视频模式"</string> - <string name="help_menu_switcher_3" translatable="true">"和全景模式"</string> - - <string-array name="pref_camera2_timer_entries"> - <item>"关闭"</item> - <item>"2秒"</item> - <item>"5秒"</item> - <item>"10秒"</item> - </string-array> - <string name="settings_title">"设置"</string> - <string name="perf_camera2_version_info" translatable="true">"版本信息"</string> - <string name="perf_camera2_preferences_category_general" translatable="true">"通用"</string> - <string name="perf_camera2_preferences_category_photo" translatable="true">"拍照"</string> - <string name="perf_camera2_preferences_category_video" translatable="true">"录像"</string> - <string name="perf_camera2_preferences_category_system" translatable="true">System</string> - <string name="pref_camera2_category_system">其他</string> - <string name="pref_camera2_restore_default">"恢复"</string> - <string name="pref_camera2_restore_default_hint">"相机将恢复到出厂设置"</string> - - <string name="makeup_ui_ok_button" translatable="true">确定</string> - <string name="makeup_seekbar_low" translatable="true">低</string> - <string name="makeup_seekbar_high" translatable="true">高</string> </resources> diff --git a/res/values/camera2arrays.xml b/res/values/camera2arrays.xml index 7f4b0da26..b6cf25f2e 100644..100755 --- a/res/values/camera2arrays.xml +++ b/res/values/camera2arrays.xml @@ -431,7 +431,7 @@ <item>@string/pref_camera_picturesize_entry_16mp_wide</item> <item>@string/pref_camera_picturesize_entry_13mp</item> <item>@string/pref_camera_picturesize_entry_12mp</item> - <item>@string/pref_camera_picturesize_entry_8mp_wide</item> + <item>@string/pref_camera_picturesize_entry_8mp</item> <item>@string/pref_camera_picturesize_entry_8mp</item> <item>@string/pref_camera_picturesize_entry_square</item> <item>@string/pref_camera_picturesize_entry_5mp</item> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index d24129977..8c77a062b 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -533,12 +533,12 @@ <!-- Select IS title --> <string name="pref_camera_dis_title">Image Stabilization</string> + <string name="pref_camera_dis_default">disable</string> <!-- DIS choices --> <string name="pref_camera_dis_entry_off">Off</string> <string name="pref_camera_dis_entry_on">On</string> - <string name="pref_camera_dis_default">disable</string> <string name="pref_camera_dis_value_disable">disable</string> <string name="pref_camera_dis_value_enable">enable</string> @@ -1006,9 +1006,9 @@ <string name="pref_camera2_noise_reduction_default" translatable="false">off</string> <string name="pref_camera2_noise_reduction_title" translatable="true">Noise Reduction</string> - <string name="pref_camera2_noise_reduction_entry_off" translatable="true">@string/pref_camera_noise_reduction_entry_off</string> - <string name="pref_camera2_noise_reduction_entry_fast" translatable="true">@string/pref_camera_noise_reduction_entry_fast</string> - <string name="pref_camera2_noise_reduction_entry_high_quality" translatable="true">@string/pref_camera_noise_reduction_entry_high_quality</string> + <string name="pref_camera2_noise_reduction_entry_off" translatable="true">Off</string> + <string name="pref_camera2_noise_reduction_entry_fast" translatable="true">Fast</string> + <string name="pref_camera2_noise_reduction_entry_high_quality" translatable="true">High Quality</string> <string name="pref_camera2_noise_reduction_value_off" translatable="false">off</string> <string name="pref_camera2_noise_reduction_value_fast" translatable="false">fast</string> @@ -1037,9 +1037,9 @@ <string name="pref_camera2_shutter_sound_value_on" translatable="true">on</string> <string name="pref_camera2_shutter_sound_value_off" translatable="true">off</string> - <string name="pref_camera2_shutter_sound_entry_on" translatable="true">@string/pref_camera_shuttersound_entry_enable</string> - <string name="pref_camera2_shutter_sound_entry_off" translatable="true">@string/pref_camera_shuttersound_entry_disable</string> - <string name="pref_camera2_shutter_sound_title" translatable="true">@string/pref_camera_shuttersound_title</string> + <string name="pref_camera2_shutter_sound_entry_on" translatable="true">On</string> + <string name="pref_camera2_shutter_sound_entry_off" translatable="true">Off</string> + <string name="pref_camera2_shutter_sound_title" translatable="true">Shutter Sound</string> <string name="pref_camera2_timer_entry_off" translatable="true">Off</string> <string name="pref_camera2_timer_entry_2sec" translatable="true">2 seconds</string> @@ -1169,6 +1169,10 @@ <string name="pref_camera2_bsgc_entry_value_enable" translatable="false">enable</string> <string name="pref_camera2_bsgc_entry_value_disable" translatable="false">disable</string> + + <string name="pref_camera2_picturesize_default" translatable="false">3840x2160</string> + <string name="pref_camera2_video_quality_default" translatable="false">1920x1080</string> + <string name="pref_camera2_zsl_title" translatable="true">ZSL</string> <string name="pref_camera2_zsl_default" translatable="false">@string/pref_camera2_zsl_entryvalue_disable</string> <string name="pref_camera2_zsl_entry_disable" translatable="true">Off</string> @@ -1178,7 +1182,5 @@ <string name="pref_camera2_zsl_entryvalue_app_zsl" translatable="false">app-zsl</string> <string name="pref_camera2_zsl_entryvalue_hal_zsl" translatable="false">hal-zsl</string> - <string name="pref_camera2_picturesize_default" translatable="false">3840x2160</string> - <string name="pref_camera2_video_quality_default" translatable="false">1920x1080</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 42ad07272..0b2310439 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -296,7 +296,6 @@ <string name="pref_camera_picturesize_entry_12mp">12M pixels</string> <!-- Settings screen, dialog choice for 8 megapixels picture size [CHAR LIMIT=20] --> <string name="pref_camera_picturesize_entry_8mp">8M pixels</string> - <string name="pref_camera_picturesize_entry_8mp_wide">8M pixels (16:9)</string> <!-- Settings screen, dialog choice for square picture size [CHAR LIMIT=20] --> <string name="pref_camera_picturesize_entry_square">Square (1:1)</string> <!-- Settings screen, dialog choice for 5 megapixels picture size [CHAR LIMIT=20] --> diff --git a/res/xml/setting_menu_preferences.xml b/res/xml/setting_menu_preferences.xml index cb7b3897a..48b6f99d3 100644..100755 --- a/res/xml/setting_menu_preferences.xml +++ b/res/xml/setting_menu_preferences.xml @@ -273,7 +273,7 @@ android:key="version_info" android:layout="@layout/preference" android:summary="Version" - android:title="@string/perf_camera2_version_info" /> + android:title="Version Info" /> </PreferenceCategory> <PreferenceCategory diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index f679e26c3..ea4bc03ba 100644..100755 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -639,8 +639,14 @@ public class CameraActivity extends Activity View decorView = getWindow().getDecorView(); int currentSystemUIVisibility = decorView.getSystemUiVisibility(); + boolean hidePreview = SystemProperties.getBoolean("camera.ui.no_navigation_bar", false); int systemUIVisibility = DEFAULT_SYSTEM_UI_VISIBILITY; int systemUINotVisible = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN; + if (hidePreview) { + systemUIVisibility |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + systemUINotVisible |= (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + } int newSystemUIVisibility = systemUIVisibility | (visible ? View.SYSTEM_UI_FLAG_VISIBLE : systemUINotVisible); @@ -1645,8 +1651,7 @@ public class CameraActivity extends Activity SETTING_LIST_WIDTH_1 = lower / 2 + offset; SETTING_LIST_WIDTH_2 = lower / 2 - offset; registerSDcardMountedReceiver(); - - mAutoTestEnabled = PersistUtil.isAutoTestEnabled(); + mAutoTestEnabled = SystemProperties.getBoolean("camera.ui.auto_test", false); if (mAutoTestEnabled) { registerAutoTestReceiver(); diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 541c65704..e0141ed11 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -38,7 +38,6 @@ import android.util.Log; import com.android.camera.util.ApiHelper; import com.android.camera.util.CameraUtil; import com.android.camera.util.GcamHelper; -import com.android.camera.util.PersistUtil; import org.codeaurora.snapcam.R; import org.codeaurora.snapcam.wrapper.CamcorderProfileWrapper; import org.codeaurora.snapcam.wrapper.ParametersWrapper; @@ -339,10 +338,6 @@ public class CameraSettings { VIDEO_ENCODER_BITRATE.put("1280x720:240", 72000000); VIDEO_ENCODER_BITRATE.put("720:480:120", 5200000); - //resolution, fps and encoder type - VIDEO_ENCODER_BITRATE.put("3840x2160:60:" + MediaRecorder.VideoEncoder.H264, 67200000); - VIDEO_ENCODER_BITRATE.put("3840x2160:60:" + MediaRecorder.VideoEncoder.HEVC, 50400000); - } // Following maps help find a corresponding time-lapse or high-speed quality @@ -982,8 +977,6 @@ public class CameraSettings { supportedAdvancedFeatures)) { removePreference(group, chromaFlash.getKey()); } - //remove chromaFlash - removePreference(group, chromaFlash.getKey()); } if (sceneMode != null) { @@ -1044,7 +1037,7 @@ public class CameraSettings { removePreference(group, cameraHdrPlus.getKey()); } - if (PersistUtil.isSaveInSdEnabled()) { + if (SystemProperties.getBoolean("persist.env.camera.saveinsd", false)) { final String CAMERA_SAVEPATH_SDCARD = "1"; final int CAMERA_SAVEPATH_SDCARD_IDX = 1; final int CAMERA_SAVEPATH_PHONE_IDX = 0; diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 5b029df86..46a822e67 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -89,6 +89,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.util.AttributeSet; import android.graphics.Bitmap; +import android.graphics.YuvImage; import com.android.camera.exif.ExifInterface; import com.android.camera.imageprocessor.filter.BlurbusterFilter; @@ -1027,6 +1028,7 @@ public class CaptureModule implements CameraModule, PhotoController, if(id == getMainCameraId()) { mCurrentSession = cameraCaptureSession; } + initializePreviewConfiguration(id); setDisplayOrientation(); updateFaceDetection(); @@ -1045,18 +1047,17 @@ public class CaptureModule implements CameraModule, PhotoController, mCaptureSession[id].setRepeatingRequest(mPreviewRequestBuilder[id] .build(), mCaptureCallback, mCameraHandler); } - if (isClearSightOn()) { ClearSightImageProcessor.getInstance().onCaptureSessionConfigured(id == BAYER_ID, cameraCaptureSession); } else if (mChosenImageFormat == ImageFormat.PRIVATE && id == getMainCameraId()) { mPostProcessor.onSessionConfigured(mCameraDevice[id], mCaptureSession[id]); } - } catch (CameraAccessException e) { e.printStackTrace(); } catch(IllegalStateException e) { e.printStackTrace(); } + } @Override @@ -1270,11 +1271,12 @@ public class CaptureModule implements CameraModule, PhotoController, mJpegImageData = data; } - public void showCapturedReview(final byte[] jpegData, final int orientation) { + public void showCapturedReview(final byte[] jpegData, final int orientation, + final boolean mirror) { mActivity.runOnUiThread(new Runnable() { @Override public void run() { - mUI.showCapturedImageForReview(jpegData, orientation); + mUI.showCapturedImageForReview(jpegData, orientation, mirror); } }); } @@ -1307,7 +1309,11 @@ public class CaptureModule implements CameraModule, PhotoController, if (takeZSLPicture(BAYER_ID)) { return; } - lockFocus(BAYER_ID); +/* take picture directly for now*/ + captureStillPicture(BAYER_ID); + mState[BAYER_ID] = STATE_PICTURE_TAKEN; + +//todo lockFocus(BAYER_ID); break; case MONO_MODE: lockFocus(MONO_ID); @@ -1317,7 +1323,11 @@ public class CaptureModule implements CameraModule, PhotoController, if (takeZSLPicture(FRONT_ID)) { return; } - lockFocus(FRONT_ID); +/* take picture directly for now*/ + captureStillPicture(FRONT_ID); + mState[FRONT_ID] = STATE_PICTURE_TAKEN; + +//todo lockFocus(FRONT_ID); } } } @@ -1470,175 +1480,173 @@ public class CaptureModule implements CameraModule, PhotoController, Log.d(TAG, "captureStillPicture " + id); mJpegImageData = null; mIsRefocus = false; + CameraCaptureSession.CaptureCallback captureCallback = new CameraCaptureSession.CaptureCallback() { + + @Override + public void onCaptureCompleted(CameraCaptureSession session, + CaptureRequest request, + TotalCaptureResult result) { + Log.d(TAG, "captureStillPicture onCaptureCompleted: " + id); + } + + @Override + public void onCaptureFailed(CameraCaptureSession session, + CaptureRequest request, + CaptureFailure result) { + Log.d(TAG, "captureStillPicture onCaptureFailed: " + id); + } + + @Override + public void onCaptureSequenceCompleted(CameraCaptureSession session, int + sequenceId, long frameNumber) { + Log.d(TAG, "captureStillPicture onCaptureSequenceCompleted: " + id); + unlockFocus(id); + } + }; try { if (null == mActivity || null == mCameraDevice[id]) { warningToast("Camera is not ready yet to take a picture."); return; } - CaptureRequest.Builder captureBuilder = - mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); + final boolean csEnabled = isClearSightOn(); + CaptureRequest.Builder captureBuilder; + if(csEnabled) { + captureBuilder = ClearSightImageProcessor.getInstance().createCaptureRequest(mCameraDevice[id]); + } else { + captureBuilder = mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); + } if(mSettingsManager.isZSLInHALEnabled()) { + Log.d(TAG, "CONTROL_ENABLE_ZSL is enabled."); captureBuilder.set(CaptureRequest.CONTROL_ENABLE_ZSL, true); - }else{ + } else { + Log.d(TAG, "CONTROL_ENABLE_ZSL is disabled."); captureBuilder.set(CaptureRequest.CONTROL_ENABLE_ZSL, false); } +/*todo Location location = mLocationManager.getCurrentLocation(); + if(location != null) { + // make copy so that we don't alter the saved location since we may re-use it + location = new Location(location); + // workaround for Google bug. Need to convert timestamp from ms -> sec + location.setTime(location.getTime()/1000); + captureBuilder.set(CaptureRequest.JPEG_GPS_LOCATION, location); + Log.d(TAG, "captureStillPicture gps: " + location.toString()); + } else { + Log.d(TAG, "captureStillPicture no location - getRecordLocation: " + getRecordLocation()); + } + captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(id, mOrientation)); + captureBuilder.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, mPictureThumbSize); + captureBuilder.set(CaptureRequest.JPEG_THUMBNAIL_QUALITY, (byte)80); +*/ + captureBuilder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO); - applySettingsForJpegInformation(captureBuilder, id); addPreviewSurface(captureBuilder, null, id); - VendorTagUtil.setCdsMode(captureBuilder, 2);// CDS 0-OFF, 1-ON, 2-AUTO + captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, mControlAFMode); + captureBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); + VendorTagUtil.setCdsMode(captureBuilder, 2); // CDS 0-OFF, 1-ON, 2-AUTO applySettingsForCapture(captureBuilder, id); - if(isClearSightOn()) { - captureStillPictureForClearSight(id); + if(csEnabled) { + applySettingsForLockExposure(captureBuilder, id); + checkAndPlayShutterSound(id); + ClearSightImageProcessor.getInstance().capture( + id==BAYER_ID, mCaptureSession[id], captureBuilder, mCaptureCallbackHandler); } else if(id == getMainCameraId() && mPostProcessor.isFilterOn()) { // Case of post filtering - captureStillPictureForFilter(captureBuilder, id); - } else { + applySettingsForLockExposure(captureBuilder, id); + checkAndPlayShutterSound(id); + mCaptureSession[id].stopRepeating(); captureBuilder.addTarget(mImageReader[id].getSurface()); if (mSaveRaw) { captureBuilder.addTarget(mRawImageReader[id].getSurface()); } - mCaptureSession[id].stopRepeating(); - if (mLongshotActive) { - captureStillPictureForLongshot(captureBuilder, id); + mPostProcessor.onStartCapturing(); + if(mPostProcessor.isManualMode()) { + mPostProcessor.manualCapture(captureBuilder, mCaptureSession[id], mCaptureCallbackHandler); } else { - captureStillPictureForCommon(captureBuilder, id); + List<CaptureRequest> captureList = mPostProcessor.setRequiredImages(captureBuilder); + mCaptureSession[id].captureBurst(captureList, mPostProcessor.getCaptureCallback(), mCaptureCallbackHandler); } - } - } catch (CameraAccessException e) { - Log.d(TAG, "Capture still picture has failed"); - e.printStackTrace(); - } - } - - private void captureStillPictureForClearSight(int id) throws CameraAccessException{ - CaptureRequest.Builder captureBuilder = - ClearSightImageProcessor.getInstance().createCaptureRequest(mCameraDevice[id]); + } else { + captureBuilder.addTarget(mImageReader[id].getSurface()); + if (mSaveRaw) { + captureBuilder.addTarget(mRawImageReader[id].getSurface()); + } + mCaptureSession[id].stopRepeating(); - if(mSettingsManager.isZSLInHALEnabled()) { - captureBuilder.set(CaptureRequest.CONTROL_ENABLE_ZSL, true); - }else{ - captureBuilder.set(CaptureRequest.CONTROL_ENABLE_ZSL, false); - } - - applySettingsForJpegInformation(captureBuilder, id); - addPreviewSurface(captureBuilder, null, id); - VendorTagUtil.setCdsMode(captureBuilder, 2); // CDS 0-OFF, 1-ON, 2-AUTO - applySettingsForCapture(captureBuilder, id); - applySettingsForLockExposure(captureBuilder, id); - checkAndPlayShutterSound(id); - ClearSightImageProcessor.getInstance().capture( - id==BAYER_ID, mCaptureSession[id], captureBuilder, mCaptureCallbackHandler); - } - - private void captureStillPictureForFilter(CaptureRequest.Builder captureBuilder, int id) throws CameraAccessException{ - applySettingsForLockExposure(captureBuilder, id); - checkAndPlayShutterSound(id); - mCaptureSession[id].stopRepeating(); - captureBuilder.addTarget(mImageReader[id].getSurface()); - if (mSaveRaw) { - captureBuilder.addTarget(mRawImageReader[id].getSurface()); - } - mPostProcessor.onStartCapturing(); - if(mPostProcessor.isManualMode()) { - mPostProcessor.manualCapture(captureBuilder, mCaptureSession[id], mCaptureCallbackHandler); - } else { - List<CaptureRequest> captureList = mPostProcessor.setRequiredImages(captureBuilder); - mCaptureSession[id].captureBurst(captureList, mPostProcessor.getCaptureCallback(), mCaptureCallbackHandler); - } - } + if (mLongshotActive) { + Log.d(TAG, "captureStillPicture capture longshot " + id); + List<CaptureRequest> burstList = new ArrayList<>(); + for (int i = 0; i < PersistUtil.getLongshotShotLimit(); i++) { + burstList.add(captureBuilder.build()); + } + mCaptureSession[id].captureBurst(burstList, new + CameraCaptureSession.CaptureCallback() { - private void captureStillPictureForLongshot(CaptureRequest.Builder captureBuilder, int id) throws CameraAccessException{ - Log.d(TAG, "captureStillPictureForLongshot " + id); - List<CaptureRequest> burstList = new ArrayList<>(); - for (int i = 0; i < PersistUtil.getLongshotShotLimit(); i++) { - burstList.add(captureBuilder.build()); - } - mCaptureSession[id].captureBurst(burstList, new - CameraCaptureSession.CaptureCallback() { + @Override + public void onCaptureCompleted(CameraCaptureSession session, + CaptureRequest request, + TotalCaptureResult result) { + Log.d(TAG, "captureStillPicture Longshot onCaptureCompleted: " + id); + if (mLongshotActive) { + checkAndPlayShutterSound(id); + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + mUI.doShutterAnimation(); + } + }); + } + } - @Override - public void onCaptureCompleted(CameraCaptureSession session, - CaptureRequest request, - TotalCaptureResult result) { - Log.d(TAG, "captureStillPictureForLongshot onCaptureCompleted: " + id); - if (mLongshotActive) { - checkAndPlayShutterSound(id); - mActivity.runOnUiThread(new Runnable() { @Override - public void run() { - mUI.doShutterAnimation(); + public void onCaptureFailed(CameraCaptureSession session, + CaptureRequest request, + CaptureFailure result) { + Log.d(TAG, "captureStillPicture Longshot onCaptureFailed: " + id); + if (mLongshotActive) { + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + mUI.doShutterAnimation(); + } + }); + } } - }); - } - } - @Override - public void onCaptureFailed(CameraCaptureSession session, - CaptureRequest request, - CaptureFailure result) { - Log.d(TAG, "captureStillPictureForLongshot onCaptureFailed: " + id); - if (mLongshotActive) { - mActivity.runOnUiThread(new Runnable() { @Override - public void run() { - mUI.doShutterAnimation(); + public void onCaptureSequenceCompleted(CameraCaptureSession session, int + sequenceId, long frameNumber) { + Log.d(TAG, "captureStillPicture Longshot onCaptureSequenceCompleted: " + id); + mLongshotActive = false; + unlockFocus(id); } - }); + }, mCaptureCallbackHandler); + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + mUI.enableVideo(false); } - } + }); - @Override - public void onCaptureSequenceCompleted(CameraCaptureSession session, int - sequenceId, long frameNumber) { - Log.d(TAG, "captureStillPictureForLongshot onCaptureSequenceCompleted: " + id); - mLongshotActive = false; - unlockFocus(id); + } else { + checkAndPlayShutterSound(id); + if(isMpoOn()) { + mCaptureStartTime = System.currentTimeMillis(); + mMpoSaveHandler.obtainMessage(MpoSaveHandler.MSG_CONFIGURE, + Long.valueOf(mCaptureStartTime)).sendToTarget(); + } +/*todo if(mChosenImageFormat == ImageFormat.YUV_420_888 || mChosenImageFormat == ImageFormat.PRIVATE) { // Case of ZSL, FrameFilter, SelfieMirror + mPostProcessor.onStartCapturing(); + mCaptureSession[id].capture(captureBuilder.build(), mPostProcessor.getCaptureCallback(), mCaptureCallbackHandler); + } else*/ { + mCaptureSession[id].capture(captureBuilder.build(), captureCallback, mCaptureCallbackHandler); } - }, mCaptureCallbackHandler); - mActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - mUI.enableVideo(false); - } - }); - } - - private void captureStillPictureForCommon(CaptureRequest.Builder captureBuilder, int id) throws CameraAccessException{ - checkAndPlayShutterSound(id); - if(isMpoOn()) { - mCaptureStartTime = System.currentTimeMillis(); - mMpoSaveHandler.obtainMessage(MpoSaveHandler.MSG_CONFIGURE, - Long.valueOf(mCaptureStartTime)).sendToTarget(); - } - if(mChosenImageFormat == ImageFormat.YUV_420_888 || mChosenImageFormat == ImageFormat.PRIVATE) { // Case of ZSL, FrameFilter, SelfieMirror - mPostProcessor.onStartCapturing(); - mCaptureSession[id].capture(captureBuilder.build(), mPostProcessor.getCaptureCallback(), mCaptureCallbackHandler); - } else { - mCaptureSession[id].capture(captureBuilder.build(), new CameraCaptureSession.CaptureCallback() { - - @Override - public void onCaptureCompleted(CameraCaptureSession session, - CaptureRequest request, - TotalCaptureResult result) { - Log.d(TAG, "captureStillPictureForCommon onCaptureCompleted: " + id); - } - - @Override - public void onCaptureFailed(CameraCaptureSession session, - CaptureRequest request, - CaptureFailure result) { - Log.d(TAG, "captureStillPictureForCommon onCaptureFailed: " + id); - } - - @Override - public void onCaptureSequenceCompleted(CameraCaptureSession session, int - sequenceId, long frameNumber) { - Log.d(TAG, "captureStillPictureForCommon onCaptureSequenceCompleted: " + id); - unlockFocus(id); } - }, mCaptureCallbackHandler); + } + } catch (CameraAccessException e) { + Log.d(TAG, "Capture still picture has failed"); + e.printStackTrace(); } } @@ -1653,12 +1661,12 @@ public class CaptureModule implements CameraModule, PhotoController, CaptureRequest.Builder captureBuilder = mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_VIDEO_SNAPSHOT); - captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(id, mOrientation)); + /* todo captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(id, mOrientation)); captureBuilder.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, mVideoSnapshotThumbSize); captureBuilder.set(CaptureRequest.JPEG_THUMBNAIL_QUALITY, (byte)80); applyVideoSnapshot(captureBuilder, id); applyZoom(captureBuilder, id); - + */ captureBuilder.addTarget(mVideoSnapshotImageReader.getSurface()); mCurrentSession.capture(captureBuilder.build(), @@ -1756,7 +1764,8 @@ public class CaptureModule implements CameraModule, PhotoController, ClearSightImageProcessor.getInstance().setCallback(this); } } else { - if ((imageFormat == ImageFormat.YUV_420_888 || imageFormat == ImageFormat.PRIVATE) +//todo if ((imageFormat == ImageFormat.YUV_420_888 || imageFormat == ImageFormat.PRIVATE) + if ((imageFormat == ImageFormat.PRIVATE) && i == getMainCameraId()) { if(mPostProcessor.isZSLEnabled()) { mImageReader[i] = ImageReader.newInstance(mSupportedMaxPictureSize.getWidth(), @@ -1792,19 +1801,38 @@ public class CaptureModule implements CameraModule, PhotoController, String title = (name == null) ? null : name.title; long date = (name == null) ? -1 : name.date; - byte[] bytes = getJpegData(image); - if (image.getFormat() == ImageFormat.RAW10) { + byte[] bytes = getJpegData(image); mActivity.getMediaSaveService().addRawImage(bytes, title, "raw"); + } else if (image.getFormat() == ImageFormat.YUV_420_888) { + Log.d(TAG, "Bring up picture of YUV is taken and ready to process"); + int width = image.getWidth(); + int height = image.getHeight(); + int stride = image.getPlanes()[0].getRowStride(); + ByteBuffer yuvBuf = ByteBuffer.allocateDirect(stride * height*3/2); + + ByteBuffer yBuf = image.getPlanes()[0].getBuffer(); + ByteBuffer vuBuf = image.getPlanes()[2].getBuffer(); + yBuf.get(yuvBuf.array(), 0, yBuf.remaining()); + vuBuf.get(yuvBuf.array(), stride*height, vuBuf.remaining()); + byte[] bytes = nv21ToJpeg(yuvBuf, width, height, stride); + mActivity.getMediaSaveService().addImage(bytes, title, date, + null, width, height, 90, null, + mOnMediaSavedListener, mContentResolver, "jpeg"); + mActivity.updateThumbnail(bytes); + image.close(); } else { + byte[] bytes = getJpegData(image); + ExifInterface exif = Exif.getExif(bytes); int orientation = Exif.getOrientation(exif); if (mIntentMode != CaptureModule.INTENT_MODE_NORMAL) { mJpegImageData = bytes; if (!mQuickCapture) { - showCapturedReview(bytes, orientation); + showCapturedReview(bytes, orientation, + mPostProcessor.isSelfieMirrorOn()); } else { onCaptureDone(); } @@ -1842,16 +1870,30 @@ public class CaptureModule implements CameraModule, PhotoController, } } + private byte[] nv21ToJpeg(ByteBuffer byteBuffer, int width, int height, int stride) { + PostProcessor.BitmapOutputStream bos = new PostProcessor.BitmapOutputStream(1024); + YuvImage im = new YuvImage(byteBuffer.array(), ImageFormat.NV21, + width, height, new int[]{stride, stride}); + im.compressToJpeg(new Rect(0,0, width, height), 50, bos); + byte[] bytes = bos.getArray(); + return bytes; + } + private void createVideoSnapshotImageReader() { if (mVideoSnapshotImageReader != null) { mVideoSnapshotImageReader.close(); } - mVideoSnapshotImageReader = ImageReader.newInstance(mVideoSnapshotSize.getWidth(), - mVideoSnapshotSize.getHeight(), ImageFormat.JPEG, 2); +/*Todo mVideoSnapshotImageReader = ImageReader.newInstance(mVideoSnapshotSize.getWidth(), + mVideoSnapshotSize.getHeight(), ImageFormat.JPEG, 2);*/ + + mVideoSnapshotImageReader = ImageReader.newInstance(3840, 2160, mChosenImageFormat, 2); + Log.e(TAG, "Image="+mChosenImageFormat); mVideoSnapshotImageReader.setOnImageAvailableListener( new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { + Log.d(TAG, "Video Snapshot Image Available."); + Image image = reader.acquireNextImage(); mCaptureStartTime = System.currentTimeMillis(); mNamedImages.nameNewImage(mCaptureStartTime); @@ -1859,19 +1901,39 @@ public class CaptureModule implements CameraModule, PhotoController, String title = (name == null) ? null : name.title; long date = (name == null) ? -1 : name.date; - ByteBuffer buffer = image.getPlanes()[0].getBuffer(); - byte[] bytes = new byte[buffer.remaining()]; - buffer.get(bytes); + if (image.getFormat() == ImageFormat.YUV_420_888) { + Log.d(TAG, "Bring up picture of YUV is taken and ready to process"); + int width = image.getWidth(); + int height = image.getHeight(); + int stride = image.getPlanes()[0].getRowStride(); + ByteBuffer yuvBuf = ByteBuffer.allocateDirect(stride * height*3/2); + + ByteBuffer yBuf = image.getPlanes()[0].getBuffer(); + ByteBuffer vuBuf = image.getPlanes()[2].getBuffer(); + yBuf.get(yuvBuf.array(), 0, yBuf.remaining()); + vuBuf.get(yuvBuf.array(), stride*height, vuBuf.remaining()); + byte[] bytes = nv21ToJpeg(yuvBuf, width, height, stride); + mActivity.getMediaSaveService().addImage(bytes, title, date, + null, width, height, 90, null, + mOnMediaSavedListener, mContentResolver, "jpeg"); + mActivity.updateThumbnail(bytes); + image.close(); + } else { + + ByteBuffer buffer = image.getPlanes()[0].getBuffer(); + byte[] bytes = new byte[buffer.remaining()]; + buffer.get(bytes); - ExifInterface exif = Exif.getExif(bytes); - int orientation = Exif.getOrientation(exif); + ExifInterface exif = Exif.getExif(bytes); + int orientation = Exif.getOrientation(exif); - mActivity.getMediaSaveService().addImage(bytes, title, date, + mActivity.getMediaSaveService().addImage(bytes, title, date, null, image.getWidth(), image.getHeight(), orientation, null, mOnMediaSavedListener, mContentResolver, "jpeg"); - mActivity.updateThumbnail(bytes); - image.close(); + mActivity.updateThumbnail(bytes); + image.close(); + } } }, mImageAvailableHandler); } @@ -2089,23 +2151,6 @@ public class CaptureModule implements CameraModule, PhotoController, applyCommonSettings(builder, id); } - private void applySettingsForJpegInformation(CaptureRequest.Builder builder, int id) { - Location location = mLocationManager.getCurrentLocation(); - if(location != null) { - // make copy so that we don't alter the saved location since we may re-use it - location = new Location(location); - // workaround for Google bug. Need to convert timestamp from ms -> sec - location.setTime(location.getTime()/1000); - builder.set(CaptureRequest.JPEG_GPS_LOCATION, location); - Log.d(TAG, "gps: " + location.toString()); - } else { - Log.d(TAG, "no location - getRecordLocation: " + getRecordLocation()); - } - builder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(id, mOrientation)); - builder.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, mPictureThumbSize); - builder.set(CaptureRequest.JPEG_THUMBNAIL_QUALITY, (byte)80); - } - private void applyVideoSnapshot(CaptureRequest.Builder builder, int id) { builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO); applyColorEffect(builder); @@ -2342,6 +2387,42 @@ public class CaptureModule implements CameraModule, PhotoController, updateMaxVideoDuration(); } + private Size checkOverridePreviewSize(int cur_width, int cur_height) { + int preview_resolution = PersistUtil.getCameraPreviewSize(); + + switch (preview_resolution) { + case 1: { + cur_width = 640; + cur_height = 480; + Log.v(TAG, "Preview resolution hardcoded to 640x480"); + break; + } + case 2: { + cur_width = 720; + cur_height = 480; + Log.v(TAG, "Preview resolution hardcoded to 720x480"); + break; + } + case 3: { + cur_width = 1280; + cur_height = 720; + Log.v(TAG, "Preview resolution hardcoded to 1280x720"); + break; + } + case 4: { + cur_width = 1920; + cur_height = 1080; + Log.v(TAG, "Preview resolution hardcoded to 1920x1080"); + break; + } + default: { + Log.v(TAG, "Preview resolution as per Snapshot aspect ratio"); + break; + } + } + return new Size(cur_width, cur_height); + } + private void updatePreviewSize() { int width = mPreviewSize.getWidth(); int height = mPreviewSize.getHeight(); @@ -2352,16 +2433,7 @@ public class CaptureModule implements CameraModule, PhotoController, width = mVideoSize.getWidth(); height = mVideoSize.getHeight(); } - - Point previewSize = PersistUtil.getCameraPreviewSize(); - if (previewSize != null) { - width = previewSize.x; - height = previewSize.y; - } - - Log.d(TAG, "updatePreviewSize final preview size = " + width + ", " + height); - - mPreviewSize = new Size(width, height); + mPreviewSize = checkOverridePreviewSize(width, height); mUI.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); } @@ -2402,7 +2474,7 @@ public class CaptureModule implements CameraModule, PhotoController, } else if(mPostProcessor.isFilterOn() || getFrameFilters().size() != 0 || mPostProcessor.isSelfieMirrorOn()) { mChosenImageFormat = ImageFormat.YUV_420_888; } else { - mChosenImageFormat = ImageFormat.JPEG; + mChosenImageFormat = ImageFormat.YUV_420_888; //todo ImageFormat.JPEG; } setUpCameraOutputs(mChosenImageFormat); @@ -3042,9 +3114,11 @@ public class CaptureModule implements CameraModule, PhotoController, Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), SurfaceHolder.class); mSupportedMaxPictureSize = prevSizes[0]; - Size[] rawSize = mSettingsManager.getSupportedOutputSize(getMainCameraId(), + if (mSaveRaw == true) { + Size[] rawSize = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.RAW10); - mSupportedRawPictureSize = rawSize[0]; + mSupportedRawPictureSize = rawSize[0]; + } mPreviewSize = getOptimalPreviewSize(mPictureSize, prevSizes); Size[] thumbSizes = mSettingsManager.getSupportedThumbnailSizes(getMainCameraId()); mPictureThumbSize = getOptimalPreviewSize(mPictureSize, thumbSizes); // get largest thumb size @@ -3076,19 +3150,17 @@ public class CaptureModule implements CameraModule, PhotoController, Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), MediaRecorder.class); mVideoPreviewSize = getOptimalPreviewSize(mVideoSize, prevSizes); - - Point previewSize = PersistUtil.getCameraPreviewSize(); - if (previewSize != null) { - mVideoPreviewSize = new Size(previewSize.x, previewSize.y); - } - Log.d(TAG, "updatePreviewSize final preview size = " + mVideoPreviewSize.getWidth() - + ", " + mVideoPreviewSize.getHeight()); + mVideoPreviewSize = checkOverridePreviewSize(mVideoPreviewSize.getWidth(), + mVideoPreviewSize.getHeight()); } private void updateVideoSnapshotSize() { - mVideoSnapshotSize = mVideoSize; - if (is4kSize(mVideoSize) && is4kSize(mVideoSnapshotSize)) { - mVideoSnapshotSize = getMaxPictureSizeLessThan4k(); + updateHFRSetting(); + mVideoSnapshotSize = mPictureSize; + mVideoSnapshotSize = getMaxPictureSizeForLiveShot(); + // if video High FrameRate > 60fps, the mVideoSnapshotSize = mVideoSize + if (mHighSpeedCapture && ((int)mHighSpeedFPSRange.getUpper() > NORMAL_SESSION_MAX_FPS)) { + mVideoSnapshotSize = mVideoSize; } Size[] thumbSizes = mSettingsManager.getSupportedThumbnailSizes(getMainCameraId()); mVideoSnapshotThumbSize = getOptimalPreviewSize(mVideoSnapshotSize, thumbSizes); // get largest thumb size @@ -3128,6 +3200,7 @@ public class CaptureModule implements CameraModule, PhotoController, mStartRecPending = true; mIsRecordingVideo = true; mMediaRecorderPausing = false; + mUI.hideUIwhileRecording(); mActivity.updateStorageSpaceAndHint(); if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) { @@ -3139,17 +3212,6 @@ public class CaptureModule implements CameraModule, PhotoController, try { setUpMediaRecorder(cameraId); - try { - mMediaRecorder.start(); // Recording is now started - } catch (RuntimeException e) { - Toast.makeText(mActivity,"Could not start media recorder.\n " + - "Can't start video recording.", Toast.LENGTH_LONG).show(); - releaseMediaRecorder(); - releaseAudioFocus(); - mStartRecPending = false; - mIsRecordingVideo = false; - return false; - } if (mUnsupportedResolution == true ) { Log.v(TAG, "Unsupported Resolution according to target"); mStartRecPending = false; @@ -3165,7 +3227,6 @@ public class CaptureModule implements CameraModule, PhotoController, requestAudioFocus(); mUI.clearFocus(); - mUI.hideUIwhileRecording(); mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS, mCameraId[cameraId]); mState[cameraId] = STATE_PREVIEW; mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE; @@ -3233,6 +3294,17 @@ public class CaptureModule implements CameraModule, PhotoController, + e.getMessage()); e.printStackTrace(); } + try { + mMediaRecorder.start(); // Recording is now started + } catch (RuntimeException e) { + Toast.makeText(mActivity,"Could not start media recorder.\n " + + "Can't start video recording.", Toast.LENGTH_LONG).show(); + releaseMediaRecorder(); + releaseAudioFocus(); + mStartRecPending = false; + mIsRecordingVideo = false; + return; + } mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; @@ -3267,6 +3339,17 @@ public class CaptureModule implements CameraModule, PhotoController, } catch (IllegalStateException e) { e.printStackTrace(); } + try { + mMediaRecorder.start(); // Recording is now started + } catch (RuntimeException e) { + Toast.makeText(mActivity,"Could not start media recorder.\n " + + "Can't start video recording.", Toast.LENGTH_LONG).show(); + releaseMediaRecorder(); + releaseAudioFocus(); + mStartRecPending = false; + mIsRecordingVideo = false; + return; + } mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; @@ -3312,6 +3395,9 @@ public class CaptureModule implements CameraModule, PhotoController, mHighSpeedRecordingMode = mode.equals("hsr"); mHighSpeedCaptureRate = Integer.parseInt(value.substring(3)); } + if (mHighSpeedCapture) { + mHighSpeedFPSRange = new Range(mHighSpeedCaptureRate, mHighSpeedCaptureRate); + } } private void setUpVideoCaptureRequestBuilder(CaptureRequest.Builder builder,int cameraId) { @@ -3973,14 +4059,14 @@ public class CaptureModule implements CameraModule, PhotoController, if (value == null || value.equals("0")) return; int intValue = Integer.parseInt(value); - request.set(CaptureModule.INSTANT_AEC_MODE, intValue); + //todo request.set(CaptureModule.INSTANT_AEC_MODE, intValue); } private void applySaturationLevel(CaptureRequest.Builder request) { String value = mSettingsManager.getValue(SettingsManager.KEY_SATURATION_LEVEL); if (value != null) { int intValue = Integer.parseInt(value); - request.set(CaptureModule.SATURATION, intValue); + //todo request.set(CaptureModule.SATURATION, intValue); } } @@ -4285,7 +4371,7 @@ public class CaptureModule implements CameraModule, PhotoController, } } - public Surface getPreviewSurfaceForSession(int id) { + private Surface getPreviewSurfaceForSession(int id) { if (isBackCamera()) { if (getCameraMode() == DUAL_MODE && id == MONO_ID) { return mUI.getMonoDummySurface(); @@ -4583,6 +4669,57 @@ public class CaptureModule implements CameraModule, PhotoController, return (optimalPickIndex == -1) ? null : prevSizes[optimalPickIndex]; } + private Size getMaxPictureSizeForLiveShot() { + Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG); + float ratio = (float) mVideoSize.getWidth() / mVideoSize.getHeight(); + Size optimalSize = null; + double minDiff = Double.MAX_VALUE; + for (Size size : sizes) { + // if video quality set 1080p, the mVideoSnapshotSize is biggest is 16M(16:9 and 4:3) + if (mVideoSize.getHeight() == 1080 && mVideoSize.getWidth() == 1920) { + if (size.getHeight() > 3456 || size.getWidth() > 5312) continue; + // if video quality set 4K dci or UHD, the mVideoSnapshotSize is biggest is 12M + } else if ((mVideoSize.getHeight() == 2160 && mVideoSize.getWidth() == 4096) || + (mVideoSize.getHeight() == 2160 && mVideoSize.getWidth() == 3840)){ + if (size.getHeight() > 3000 || size.getWidth() > 4000) continue; + } + + float pictureRatio = (float) size.getWidth() / size.getHeight(); + if (Math.abs(pictureRatio - ratio) > 0.01) continue; + + double heightDiff = Math.abs(size.getHeight() - mPictureSize.getHeight()); + if (heightDiff < minDiff) { + optimalSize = size; + minDiff = Math.abs(size.getHeight() - mPictureSize.getHeight()); + } else if (heightDiff == minDiff) { + // Prefer resolutions smaller-than-display when an equally close + // larger-than-display resolution is available + if (size.getHeight() < mPictureSize.getHeight()) { + optimalSize = size; + minDiff = heightDiff; + } + } + } + + // Cannot find one that matches the aspect ratio. This should not happen. + // Ignore the requirement. + if (optimalSize == null) { + Log.w(TAG, "No picture size match the aspect ratio"); + for (Size size : sizes) { + if (mVideoSize.getHeight() == 1080 && mVideoSize.getWidth() == 1920) { + if (size.getHeight() >= 3456 || size.getWidth() >= 4608) continue; + } else if ((mVideoSize.getHeight() == 2160 && mVideoSize.getWidth() == 4096) || + (mVideoSize.getHeight() == 2160 && mVideoSize.getWidth() == 3840)) { + if (size.getHeight() >= 3000 || size.getWidth() >= 4000) continue; + } + if (optimalSize == null || size.getWidth() > optimalSize.getWidth()) { + optimalSize = size; + } + } + } + return optimalSize; + } + private Size getMaxPictureSizeLessThan4k() { Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG); float ratio = (float) mVideoSize.getWidth() / mVideoSize.getHeight(); diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index d0b129ad9..6ec09effd 100644..100755 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -306,10 +306,8 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, mMakeupSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) { - if ( progresValue != 0 ) { - int value = 10 + 9 * progresValue / 10; - mSettingsManager.setValue(SettingsManager.KEY_MAKEUP, value + ""); - } + int value = progresValue/10*10; + mSettingsManager.setValue(SettingsManager.KEY_MAKEUP, value+""); } @Override public void onStartTrackingTouch(SeekBar seekBar) { @@ -486,8 +484,8 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, showFirstTimeHelp(); } - protected void showCapturedImageForReview(byte[] jpegData, int orientation) { - mDecodeTaskForReview = new CaptureUI.DecodeImageForReview(jpegData, orientation); + protected void showCapturedImageForReview(byte[] jpegData, int orientation, boolean mirror) { + mDecodeTaskForReview = new CaptureUI.DecodeImageForReview(jpegData, orientation, mirror); mDecodeTaskForReview.execute(); if (getCurrentIntentMode() != CaptureModule.INTENT_MODE_NORMAL) { if (mFilterMenuStatus == FILTER_MENU_ON) { @@ -1739,18 +1737,24 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, private class DecodeTask extends AsyncTask<Void, Void, Bitmap> { private final byte [] mData; private int mOrientation; + private boolean mMirror; - public DecodeTask(byte[] data, int orientation) { + public DecodeTask(byte[] data, int orientation, boolean mirror) { mData = data; mOrientation = orientation; + mMirror = mirror; } @Override protected Bitmap doInBackground(Void... params) { Bitmap bitmap = CameraUtil.downSample(mData, mDownSampleFactor); // Decode image in background. - if ((mOrientation != 0) && (bitmap != null)) { + if ((mOrientation != 0 || mMirror) && (bitmap != null)) { Matrix m = new Matrix(); + if (mMirror) { + // Flip horizontally + m.setScale(-1f, 1f); + } m.preRotate(mOrientation); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, false); @@ -1764,8 +1768,8 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, } private class DecodeImageForReview extends CaptureUI.DecodeTask { - public DecodeImageForReview(byte[] data, int orientation) { - super(data, orientation); + public DecodeImageForReview(byte[] data, int orientation, boolean mirror) { + super(data, orientation, mirror); } @Override diff --git a/src/com/android/camera/MediaSaveService.java b/src/com/android/camera/MediaSaveService.java index 217f44f27..6ca37b9e2 100644 --- a/src/com/android/camera/MediaSaveService.java +++ b/src/com/android/camera/MediaSaveService.java @@ -41,7 +41,6 @@ import com.android.camera.exif.ExifInterface; import com.android.camera.mpo.MpoData; import com.android.camera.mpo.MpoImageData; import com.android.camera.mpo.MpoInterface; -import com.android.camera.util.PersistUtil; import com.android.camera.util.XmpUtil; import org.codeaurora.snapcam.filter.GDepth; @@ -59,8 +58,7 @@ public class MediaSaveService extends Service { // The memory limit for unsaved image is 50MB. private static final int SAVE_TASK_MEMORY_LIMIT_IN_MB = - PersistUtil.getSaveTaskMemoryLimitInMb(); - + android.os.SystemProperties.getInt("persist.camera.perf.memlimit", 60); private static final int SAVE_TASK_MEMORY_LIMIT = SAVE_TASK_MEMORY_LIMIT_IN_MB * 1024 * 1024; private static final String TAG = "CAM_" + MediaSaveService.class.getSimpleName(); diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index af796c6a7..4cccf8e94 100644..100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -1181,10 +1181,7 @@ public class SettingsManager implements ListMenu.SettingsListener { public int getHighSpeedVideoEncoderBitRate(CamcorderProfile profile, int targetRate) { int bitRate; String key = profile.videoFrameWidth+"x"+profile.videoFrameHeight+":"+targetRate; - String resolutionFpsEncoder = key + ":" + profile.videoCodec; - if (CameraSettings.VIDEO_ENCODER_BITRATE.containsKey(resolutionFpsEncoder)) { - bitRate = CameraSettings.VIDEO_ENCODER_BITRATE.get(resolutionFpsEncoder); - } else if (CameraSettings.VIDEO_ENCODER_BITRATE.containsKey(key) ) { + if (CameraSettings.VIDEO_ENCODER_BITRATE.containsKey(key)) { bitRate = CameraSettings.VIDEO_ENCODER_BITRATE.get(key); } else { Log.i(TAG, "No pre-defined bitrate for "+key); @@ -1397,9 +1394,7 @@ public class SettingsManager implements ListMenu.SettingsListener { modes.add("" + i); } } catch(NullPointerException e) { - Log.w(TAG, "Supported instant aec modes is null."); } catch(IllegalArgumentException e) { - Log.w(TAG, "Supported instant aec modes is null."); } return modes; diff --git a/src/com/android/camera/imageprocessor/FrameProcessor.java b/src/com/android/camera/imageprocessor/FrameProcessor.java index 6b0c97732..b1b415acd 100644 --- a/src/com/android/camera/imageprocessor/FrameProcessor.java +++ b/src/com/android/camera/imageprocessor/FrameProcessor.java @@ -401,11 +401,7 @@ public class FrameProcessor { } } else { filter.init(mSize.getWidth(), mSize.getHeight(), stride, stride); - if (filter instanceof BeautificationFilter) { - filter.addImage(bY, bVU, 0, new Boolean(false)); - } else { - filter.addImage(bY, bVU, 0, new Boolean(true)); - } + filter.addImage(bY, bVU, 0, new Boolean(true)); needToFeedSurface = true; } bY.rewind(); @@ -489,11 +485,7 @@ public class FrameProcessor { mBY.rewind(); mBVU.rewind(); mFilter.init(mWidth, mHeight, mStride, mStride); - if (mFilter instanceof BeautificationFilter) { - mFilter.addImage(mBY, mBVU, 0, new Boolean(false)); - } else { - mFilter.addImage(mBY, mBVU, 0, new Boolean(true)); - } + mFilter.addImage(mBY, mBVU, 0, new Boolean(true)); mMutureLock.release(); } catch (InterruptedException e) { } diff --git a/src/com/android/camera/imageprocessor/PostProcessor.java b/src/com/android/camera/imageprocessor/PostProcessor.java index d70743be9..6e34de96d 100644 --- a/src/com/android/camera/imageprocessor/PostProcessor.java +++ b/src/com/android/camera/imageprocessor/PostProcessor.java @@ -391,7 +391,6 @@ public class PostProcessor{ public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { - Log.d(TAG, "onCaptureCompleted"); if(mTotalCaptureResultList.size() <= PostProcessor.MAX_REQUIRED_IMAGE_NUM) { mTotalCaptureResultList.add(result); } @@ -406,13 +405,11 @@ public class PostProcessor{ public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request, CaptureFailure result) { - Log.d(TAG, "onCaptureFailed"); } @Override public void onCaptureSequenceCompleted(CameraCaptureSession session, int sequenceId, long frameNumber) { - Log.d(TAG, "onCaptureSequenceCompleted"); if(!isFilterOn()) { mController.unlockFocus(mController.getMainCameraId()); } @@ -564,20 +561,17 @@ public class PostProcessor{ public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { - Log.d(TAG, "reprocessImage onCaptureCompleted"); } @Override public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request, CaptureFailure result) { - Log.d(TAG, "reprocessImage onCaptureFailed"); } @Override public void onCaptureSequenceCompleted(CameraCaptureSession session, int sequenceId, long frameNumber) { - Log.d(TAG, "reprocessImage onCaptureSequenceCompleted"); } }, mHandler); } catch (CameraAccessException e) { @@ -678,7 +672,6 @@ public class PostProcessor{ mImageHandlerTask = new ImageHandlerTask(); mSaveRaw = isSaveRaw; if(setFilter(postFilterId) || isFlashModeOn || isTrackingFocusOn || isMakeupOn || isSelfieMirrorOn - || PersistUtil.getCameraZSLDisabled() || !SettingsManager.getInstance().isZSLInAppEnabled() || "enable".equals( SettingsManager.getInstance().getValue(SettingsManager.KEY_AUTO_HDR)) @@ -1098,7 +1091,8 @@ public class PostProcessor{ if (mController.isQuickCapture()) { mController.onCaptureDone(); } else { - mController.showCapturedReview(bytes, mOrientation); + mController.showCapturedReview( + bytes, mOrientation, isSelfieMirrorOn()); } } mActivity.getMediaSaveService().addImage( @@ -1172,7 +1166,8 @@ public class PostProcessor{ if (mController.isQuickCapture()) { mController.onCaptureDone(); } else { - mController.showCapturedReview(bytes, orientation); + mController.showCapturedReview(bytes, + orientation, isSelfieMirrorOn()); } } else { mActivity.getMediaSaveService().addImage( @@ -1209,7 +1204,7 @@ public class PostProcessor{ return quality; } - private class BitmapOutputStream extends ByteArrayOutputStream { + public static class BitmapOutputStream extends ByteArrayOutputStream { public BitmapOutputStream(int size) { super(size); } diff --git a/src/com/android/camera/imageprocessor/ZSLQueue.java b/src/com/android/camera/imageprocessor/ZSLQueue.java index 0509b8fb5..c9ecb79a2 100644 --- a/src/com/android/camera/imageprocessor/ZSLQueue.java +++ b/src/com/android/camera/imageprocessor/ZSLQueue.java @@ -42,7 +42,9 @@ import java.util.LinkedList; import java.util.NoSuchElementException; public class ZSLQueue { - private int mCircularBufferSize; + private static final String CIRCULAR_BUFFER_SIZE_PERSIST = "persist.camera.zsl.buffer.size"; + private static final int CIRCULAR_BUFFER_SIZE_DEFAULT = 5; + private int mCircularBufferSize = CIRCULAR_BUFFER_SIZE_DEFAULT; private ImageItem[] mBuffer; private int mImageHead; private int mMetaHead; @@ -54,7 +56,7 @@ public class ZSLQueue { private static final String TAG = "ZSLQueue"; public ZSLQueue(CaptureModule module) { - mCircularBufferSize = PersistUtil.getCircularBufferSize(); + mCircularBufferSize = SystemProperties.getInt(CIRCULAR_BUFFER_SIZE_PERSIST, CIRCULAR_BUFFER_SIZE_DEFAULT); synchronized (mLock) { mBuffer = new ImageItem[mCircularBufferSize]; mImageHead = 0; diff --git a/src/com/android/camera/imageprocessor/filter/ChromaflashFilter.java b/src/com/android/camera/imageprocessor/filter/ChromaflashFilter.java index 4682e3947..607908ebf 100644 --- a/src/com/android/camera/imageprocessor/filter/ChromaflashFilter.java +++ b/src/com/android/camera/imageprocessor/filter/ChromaflashFilter.java @@ -32,10 +32,8 @@ import android.graphics.Rect; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraCaptureSession; import android.hardware.camera2.CameraCharacteristics; -import android.hardware.camera2.CameraDevice; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.CaptureResult; -import android.hardware.camera2.TotalCaptureResult; import android.os.Handler; import android.util.Log; @@ -157,33 +155,20 @@ public class ChromaflashFilter implements ImageFilter{ for (int i = 0; i < NUM_REQUIRED_IMAGE; i++) { if (i == 0) { captureSession.capture(builder.build(), callback, handler); - waitForImage(i); } else if (i == 1) { //To change the setting builder.set(CaptureRequest.CONTROL_AE_LOCK, Boolean.FALSE); - builder.set(CaptureRequest.FLASH_MODE, - CaptureRequest.FLASH_MODE_SINGLE); captureSession.capture(builder.build(), callback, handler); waitForImage(i); } else if (i == 2) { //To change the setting - builder.set(CaptureRequest.CONTROL_AE_MODE, - CaptureRequest.CONTROL_AE_MODE_ON); - CaptureRequest.Builder AeTunningBuilder = captureSession.getDevice(). - createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); - CaptureRequest request = builder.build(); - for (CaptureRequest.Key key : request.getKeys()) { - AeTunningBuilder.set(key, request.get(key)); - } - AeTunningBuilder.addTarget(mModule.getPreviewSurfaceForSession( - mModule.getMainCameraId())); - - waitForAeBlock(AeTunningBuilder,builder,callback, - captureSession,handler,5); - } else if (i == 3) { + builder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON); + builder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_SINGLE); + builder.set(CaptureRequest.CONTROL_AE_LOCK, Boolean.TRUE); captureSession.capture(builder.build(), callback, handler); waitForImage(i); + } else if (i == 3) { + captureSession.capture(builder.build(), callback, handler); } else if (i == 4) { //To change the setting builder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF); - builder.set(CaptureRequest.CONTROL_AE_LOCK, Boolean.FALSE); captureSession.capture(builder.build(), callback, handler); waitForImage(i); } else if (i == 5) { @@ -205,41 +190,6 @@ public class ChromaflashFilter implements ImageFilter{ } } - private void waitForAeBlock(final CaptureRequest.Builder tuningBuilder, - final CaptureRequest.Builder captureBuilder, - final CameraCaptureSession.CaptureCallback callback, - final CameraCaptureSession captureSession, - final Handler handler, final int AeTunningTime) { - try{ - captureSession.capture(tuningBuilder.build(), - new CameraCaptureSession.CaptureCallback() { - private boolean mAeStateConverged = false; - - @Override - public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, - TotalCaptureResult result) { - Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); - Log.d(TAG,"AE tunning onCaptureCompleted aeState = " + aeState); - if (aeState != null && aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) { - mAeStateConverged = true; - } - Log.d(TAG,"AE tunning completed mAeStateConverged = " + mAeStateConverged); - if(!mAeStateConverged && AeTunningTime >= 2) { - int resetTime = AeTunningTime - 1; - waitForAeBlock(tuningBuilder,captureBuilder,callback, - captureSession,handler,resetTime); - } else { - try{ - captureSession.capture(captureBuilder.build(),callback,handler); - } catch (CameraAccessException e){} - } - } - }, handler); - }catch (CameraAccessException e){ - - } - } - public static boolean isSupportedStatic() { return mIsSupported; } diff --git a/src/com/android/camera/ui/Camera2FaceView.java b/src/com/android/camera/ui/Camera2FaceView.java index 81be61f81..3b6d10541 100644..100755 --- a/src/com/android/camera/ui/Camera2FaceView.java +++ b/src/com/android/camera/ui/Camera2FaceView.java @@ -151,9 +151,7 @@ public class Camera2FaceView extends FaceView { faceBound.offset(-mCameraBound.left, -mCameraBound.top); mRect.set(faceBound); translateMatrix.mapRect(mRect); - if (LOGV) CameraUtil.dumpRect(mRect, "Original rect"); mMatrix.mapRect(mRect); - if (LOGV) CameraUtil.dumpRect(mRect, "Transformed rect"); mPaint.setColor(mColor); mRect.offset(dx, dy); diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java index 04b3664eb..b617891e5 100644..100755 --- a/src/com/android/camera/ui/FaceView.java +++ b/src/com/android/camera/ui/FaceView.java @@ -33,17 +33,14 @@ import android.view.View; import com.android.camera.PhotoUI; import com.android.camera.util.CameraUtil; -import com.android.camera.util.PersistUtil; import org.codeaurora.snapcam.R; import org.codeaurora.snapcam.wrapper.ExtendedFaceWrapper; public class FaceView extends View implements FocusIndicator, Rotatable, PhotoUI.SurfaceTextureSizeChangedListener { - protected static final String TAG = "CAM_FaceView"; - protected final boolean LOGV = - (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) || - (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_ALL); + protected static final String TAG = "CAM FaceView"; + protected final boolean LOGV = false; // The value for android.hardware.Camera.setDisplayOrientation. protected int mDisplayOrientation; // The orientation compensation for the face indicator to make it look diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index d6c1956d9..3b0d5e6ac 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -526,8 +526,8 @@ public class CameraUtil { //For < 720p, there is no need to do any capping. //By capping the panel size, we are indirectly controlling the preview size being //chosen in getOptimalPreviewSize(). - String uMax = PersistUtil.getDisplayUMax(); - String lMax = PersistUtil.getDisplayLMax(); + String uMax = SystemProperties.get("camera.display.umax", ""); + String lMax = SystemProperties.get("camera.display.lmax", ""); if ((uMax.length() > 0) && (lMax.length() > 0)) { Log.v(TAG,"display uMax "+ uMax + " lMax " + lMax); String uMaxArr[] = uMax.split("x", 2); diff --git a/src/com/android/camera/util/PersistUtil.java b/src/com/android/camera/util/PersistUtil.java index 976389ea2..8c1b57e98 100644 --- a/src/com/android/camera/util/PersistUtil.java +++ b/src/com/android/camera/util/PersistUtil.java @@ -28,32 +28,20 @@ */ package com.android.camera.util; -import android.graphics.Point; import android.os.SystemProperties; -import android.text.TextUtils; -import android.util.Log; public class PersistUtil { - public static final int CAMERA2_DEBUG_DUMP_IMAGE = 1; - public static final int CAMERA2_DEBUG_DUMP_LOG = 2; - public static final int CAMERA2_DEBUG_DUMP_ALL = 100; - - private static final int CAMERA_SENSOR_HORIZONTAL_ALIGNED = 0; - private static final int CAMERA_SENSOR_VERTICAL_ALIGNED = 1; - private static final int PERSIST_MEMORY_LIMIT = SystemProperties.getInt("persist.vendor.camera.perf.memlimit", 60); private static final boolean PERSIST_SKIP_MEMORY_CHECK = SystemProperties.getBoolean("persist.vendor.camera.perf.skip_memck", false); private static final int PERSIST_LONGSHOT_SHOT_LIMIT = SystemProperties.getInt("persist.vendor.camera.longshot.shotnum", 50); - private static final String PERSIST_CAMERA_PREVIEW_SIZE = - SystemProperties.get("persist.vendor.camera.preview.size", ""); + private static final int PERSIST_CAMERA_PREVIEW_SIZE = + SystemProperties.getInt("persist.vendor.camera.preview.size", 0); private static final boolean PERSIST_CAMERA_CAMERA2 = SystemProperties.getBoolean("persist.vendor.camera.camera2", true); - private static final boolean PERSIST_CAMERA_ZSL = - SystemProperties.getBoolean("persist.vendor.camera.zsl.disabled", false); private static final int PERSIST_CAMERA2_DEBUG = SystemProperties.getInt("persist.vendor.camera2.debug", 0); private static final int PERSIST_CAMERA_CANCEL_TOUCHFOCUS_DELAY = @@ -68,59 +56,10 @@ public class PersistUtil { SystemProperties.get("persist.vendor.camera.stm_smooth", "0"); private static final int PERSIST_CAMERA_STILLMORE_NUM_REQUIRED_IMAGE = SystemProperties.getInt("persist.vendor.camera.stm_img_nums", 5); - private static final String PERSIST_CAMERA_CS_BRINTENSITY_KEY = - SystemProperties.get("persist.vendor.camera.sensor.brinten", "0.0"); - private static final String PERSIST_CAMERA_CS_SMOOTH_KEY = - SystemProperties.get("persist.vendor.camera.sensor.smooth", "0.5"); - private static final int PERSIST_CAMERA_SENSOR_ALIGN_KEY = - SystemProperties.getInt("persist.vendor.camera.sensor.align", - CAMERA_SENSOR_HORIZONTAL_ALIGNED); - private static final int CIRCULAR_BUFFER_SIZE_PERSIST = - SystemProperties.getInt("persist.vendor.camera.zsl.buffer.size", 5); - private static final int SAVE_TASK_MEMORY_LIMIT_IN_MB = - SystemProperties.getInt("persist.vendor.camera.perf.memlimit", 60); - private static final boolean PERSIST_CAMERA_UI_AUTO_TEST_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.ui.auto_test", false); - private static final boolean PERSIST_CAMERA_SAVE_IN_SD_ENABLED = - SystemProperties.getBoolean("persist.vendor.env.camera.saveinsd", false); - private static final boolean PERSIST_LONG_SAVE_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.longshot.save", false); - private static final boolean PERSIST_CAMERA_PREVIEW_RESTART_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.feature.restart", false); - private static final boolean PERSIST_CAPTURE_ANIMATION_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.capture.animate", true); - private static final boolean PERSIST_SKIP_MEM_CHECK_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.perf.skip_memck", false); - private static final boolean PERSIST_ZZHDR_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.zzhdr.enable", false); - private static final int PERSIST_PREVIEW_SIZE = - SystemProperties.getInt("persist.vendor.camera.preview.size", 0); - private static final long PERSIST_TIMESTAMP_LIMIT = - SystemProperties.getLong("persist.vendor.camera.cs.threshold", 10); - private static final int PERSIST_BURST_COUNT = - SystemProperties.getInt("persist.vendor.camera.cs.burstcount", 4); - private static final boolean PERSIST_DUMP_FRAMES_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.cs.dumpframes", false); - private static final boolean PERSIST_DUMP_YUV_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.cs.dumpyuv", false); - private static final int PERSIST_CS_TIMEOUT = - SystemProperties.getInt("persist.vendor.camera.cs.timeout", 300); - private static final boolean PERSIST_DUMP_DEPTH_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.cs.dumpdepth", false); - private static final boolean PERSIST_DISABLE_QCOM_MISC_SETTING = - SystemProperties.getBoolean("persist.vendor.camera.qcom.misc.disable", false); - private static final int PREVIEW_FLIP_VALUE = - SystemProperties.getInt("persist.vendor.debug.camera.preview.flip", 0); - private static final int PERSIST_VIDEO_FLIP_VALUE = - SystemProperties.getInt("persist.vendor.debug.camera.video.flip", 0); - private static final int PERSIST_PICTURE_FLIP_VALUE = - SystemProperties.getInt("persist.vendor.debug.camera.picture.flip", 0); - private static final boolean PERSIST_YV_12_FORMAT_ENABLED = - SystemProperties.getBoolean("persist.vendor.camera.debug.camera.yv12", false); - private static final String PERSIST_DISPLAY_UMAX = - SystemProperties.get("persist.vendor.camera.display.umax", ""); - private static final String PERSIST_DISPLAY_LMAX = - SystemProperties.get("persist.vendor.camera.display.lmax", ""); + + public static final int CAMERA2_DEBUG_DUMP_IMAGE = 1; + public static final int CAMERA2_DEBUG_DUMP_LOG = 2; + public static final int CAMERA2_DEBUG_DUMP_ALL = 100; public static int getMemoryLimit() { return PERSIST_MEMORY_LIMIT; @@ -133,31 +72,15 @@ public class PersistUtil { public static int getLongshotShotLimit() { return PERSIST_LONGSHOT_SHOT_LIMIT; } - public static int getLongshotShotLimit(int defaultValue) { - return SystemProperties.getInt("persist.vendor.camera.longshot.shotnum", defaultValue); - } - public static Point getCameraPreviewSize() { - Point result = null; - if (PERSIST_CAMERA_PREVIEW_SIZE != null) { - String[] sourceStrArray = PERSIST_CAMERA_PREVIEW_SIZE.split("x"); - if (sourceStrArray != null && sourceStrArray.length >= 2) { - result = new Point(); - result.x = Integer.parseInt(sourceStrArray[0]); - result.y = Integer.parseInt(sourceStrArray[1]); - } - } - return result; + public static int getCameraPreviewSize() { + return PERSIST_CAMERA_PREVIEW_SIZE; } public static boolean getCamera2Mode() { return PERSIST_CAMERA_CAMERA2; } - public static boolean getCameraZSLDisabled() { - return PERSIST_CAMERA_ZSL; - } - public static int getCamera2Debug() { return PERSIST_CAMERA_DEBUG; } @@ -187,115 +110,4 @@ public class PersistUtil { public static int getCancelTouchFocusDelay() { return PERSIST_CAMERA_CANCEL_TOUCHFOCUS_DELAY; } - - public static float getDualCameraBrIntensity() { - return Float.parseFloat(PERSIST_CAMERA_CS_BRINTENSITY_KEY); - } - - public static float getDualCameraSmoothingIntensity() { - return Float.parseFloat(PERSIST_CAMERA_CS_SMOOTH_KEY); - } - - public static boolean getDualCameraSensorAlign() { - return PERSIST_CAMERA_SENSOR_ALIGN_KEY == CAMERA_SENSOR_VERTICAL_ALIGNED; - } - - public static int getCircularBufferSize(){ - return CIRCULAR_BUFFER_SIZE_PERSIST; - } - - public static int getSaveTaskMemoryLimitInMb(){ - return SAVE_TASK_MEMORY_LIMIT_IN_MB; - } - - public static boolean isAutoTestEnabled(){ - return PERSIST_CAMERA_UI_AUTO_TEST_ENABLED; - } - - public static boolean isSaveInSdEnabled(){ - return PERSIST_CAMERA_SAVE_IN_SD_ENABLED; - } - - public static boolean isLongSaveEnabled(){ - return PERSIST_LONG_SAVE_ENABLED; - } - - public static boolean isPreviewRestartEnabled(){ - return PERSIST_CAMERA_PREVIEW_RESTART_ENABLED; - } - - public static boolean isCaptureAnimationEnabled(){ - return PERSIST_CAPTURE_ANIMATION_ENABLED; - } - - public static boolean isSkipMemoryCheckEnabled(){ - return PERSIST_SKIP_MEM_CHECK_ENABLED; - } - - public static boolean isZzhdrEnabled(){ - return PERSIST_ZZHDR_ENABLED; - } - - public static int getPreviewSize(){ - //Read Preview Resolution from adb command - //value: 0(default) - Default value as per snapshot aspect ratio - //value: 1 - 640x480 - //value: 2 - 720x480 - //value: 3 - 1280x720 - //value: 4 - 1920x1080 - return PERSIST_PREVIEW_SIZE; - } - - public static long getTimestampLimit(){ - return PERSIST_TIMESTAMP_LIMIT; - } - - public static int getImageToBurst(){ - return PERSIST_BURST_COUNT; - } - - public static boolean isDumpFramesEnabled(){ - return PERSIST_DUMP_FRAMES_ENABLED; - } - - public static boolean isDumpYUVEnabled(){ - return PERSIST_DUMP_YUV_ENABLED; - } - - public static int getClearSightTimeout(){ - return PERSIST_CS_TIMEOUT; - } - - public static boolean isDumpDepthEnabled() { - return PERSIST_DUMP_DEPTH_ENABLED; - } - - public static boolean isDisableQcomMiscSetting(){ - return PERSIST_DISABLE_QCOM_MISC_SETTING; - } - - public static int getPreviewFlip() { - return PREVIEW_FLIP_VALUE; - } - - public static int getVideoFlip() { - return PERSIST_VIDEO_FLIP_VALUE; - } - - public static int getPictureFlip() { - return PERSIST_PICTURE_FLIP_VALUE; - } - - public static boolean isYv12FormatEnable() { - return PERSIST_YV_12_FORMAT_ENABLED; - } - - public static String getDisplayUMax() { - return PERSIST_DISPLAY_UMAX; - } - - public static String getDisplayLMax() { - return PERSIST_DISPLAY_LMAX; - } - } diff --git a/version.mk b/version.mk index b9926f8b1..869c764ad 100644 --- a/version.mk +++ b/version.mk @@ -85,10 +85,10 @@ version_code_package := $(base_version_major)$(base_version_minor)$(base_version # On eng builds, the BUILD_NUMBER has the user and timestamp inline ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h) - date_string := $$(date +%m%d%y_%H%M%S) + date_string := $(shell date +%m%d%y_%H%M%S) version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density)) else - version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density)) + version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER)-$(base_version_arch)$(base_version_density)) endif # Cleanup the locals |