android 9.0 P 版本修改相机全屏显示,移植老项目相机模糊问题
diff --git a/packages/apps/SnapdragonCamera/AndroidManifest.xml b/packages/apps/SnapdragonCamera/AndroidManifest.xml
index 4307577..f4c98af 100755
--- a/packages/apps/SnapdragonCamera/AndroidManifest.xml
+++ b/packages/apps/SnapdragonCamera/AndroidManifest.xml
@@ -50,7 +50,7 @@android:label="@string/snapcam_app_name"android:launchMode="singleTask"android:logo="@mipmap/ic_launcher_gallery"
- android:screenOrientation="portrait"
+ android:screenOrientation="landscape"android:taskAffinity="com.android.camera.CameraActivity"android:theme="@style/Theme.Camera"android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
@@ -146,7 +146,7 @@android:label="@string/snapcam_app_name"android:launchMode="singleInstance"android:logo="@mipmap/ic_launcher_gallery"
- android:screenOrientation="portrait"
+ android:screenOrientation="landscape"android:taskAffinity="com.android.camera.SecureCameraActivity"android:theme="@style/Theme.Camera"android:windowSoftInputMode="stateAlwaysHidden|adjustPan" >
diff --git a/packages/apps/SnapdragonCamera/res/values-zh-rCN/strings.xml b/packages/apps/SnapdragonCamera/res/values-zh-rCN/strings.xml
old mode 100644
new mode 100755
index 9b8290f..f514d9c
--- a/packages/apps/SnapdragonCamera/res/values-zh-rCN/strings.xml
+++ b/packages/apps/SnapdragonCamera/res/values-zh-rCN/strings.xml
@@ -464,9 +464,9 @@<string name="pref_camera_contrast_entry_level10">"等级 10"</string><!-- Settings screen, Multiple levels entries -->
- <string name="pref_camera_sharpness_entry_level0">等级 0</string>
+ <string name="pref_camera_sharpness_entry_level0">等级 0(默认)</string><string name="pref_camera_sharpness_entry_level1">等级 1</string>
- <string name="pref_camera_sharpness_entry_level2">等级 2(默认)</string>
+ <string name="pref_camera_sharpness_entry_level2">等级 2</string><string name="pref_camera_sharpness_entry_level3">等级 3</string><string name="pref_camera_sharpness_entry_level4">等级 4</string><string name="pref_camera_sharpness_entry_level5">等级 5</string>
diff --git a/packages/apps/SnapdragonCamera/res/values/qcomstrings.xml b/packages/apps/SnapdragonCamera/res/values/qcomstrings.xml
index ce27909..8e29e1f 100755
--- a/packages/apps/SnapdragonCamera/res/values/qcomstrings.xml
+++ b/packages/apps/SnapdragonCamera/res/values/qcomstrings.xml
@@ -278,7 +278,7 @@<string name="pref_camera_video_cds_title">Video CDS mode</string><!-- Default cds mode setting-->
- <string name="pref_camera_cds_default" translatable="false">off</string>
+ <string name="pref_camera_cds_default" translatable="false">on</string><!-- Default video cds mode setting--><string name="pref_camera_video_cds_default" translatable="false">off</string>
@@ -488,7 +488,7 @@<string name="pref_camera_antibanding_title">Anti Banding</string><!-- Default Anti Banding setting. -->
- <string name="pref_camera_antibanding_default">off</string>
+ <string name="pref_camera_antibanding_default">50hz</string><!-- Settings screen, Anti Banding entries --><string name="pref_camera_antibanding_entry_0">Off</string>
@@ -554,9 +554,9 @@<string name="pref_camera_facerc_entry_on">On</string><!-- Settings screen, Multiple levels entries -->
- <string name="pref_camera_sharpness_entry_level0">Level 0</string>
+ <string name="pref_camera_sharpness_entry_level0">Level 0(Default)</string><string name="pref_camera_sharpness_entry_level1">Level 1</string>
- <string name="pref_camera_sharpness_entry_level2">Level 2(Default)</string>
+ <string name="pref_camera_sharpness_entry_level2">Level 2</string><string name="pref_camera_sharpness_entry_level3">Level 3</string><string name="pref_camera_sharpness_entry_level4">Level 4</string><string name="pref_camera_sharpness_entry_level5">Level 5</string>
@@ -589,7 +589,7 @@<string name="pref_camera_saturation_entry_level10">Level 10</string><!-- Default sharpness setting. Do not translate. -->
- <string name="pref_camera_sharpness_default">2</string>
+ <string name="pref_camera_sharpness_default">0</string><!-- Settings screen, Select sharpness title --><string name="pref_camera_sharpness_title">Sharpness</string>
diff --git a/packages/apps/SnapdragonCamera/src/com/android/camera/PhotoModule.java b/packages/apps/SnapdragonCamera/src/com/android/camera/PhotoModule.java
index b814569..b75d4e6 100755
--- a/packages/apps/SnapdragonCamera/src/com/android/camera/PhotoModule.java
+++ b/packages/apps/SnapdragonCamera/src/com/android/camera/PhotoModule.java
@@ -4108,13 +4108,21 @@ public class PhotoModuleSize optimalSize = CameraUtil.getOptimalPreviewSize(mActivity, sizes,(double) size.width / size.height);+ for(int i = 0;i < sizes.size(); i ++){
+ // System.out.println(sizes.get(i));
+ Log.d(TAG, "updateCameraParametersPreference 4113 preview size = "
+ + optimalSize.width + ", " + optimalSize.height);
+ }
+ optimalSize.width = 1920;
+ optimalSize.height = 1080;
+Point previewSize = PersistUtil.getCameraPreviewSize();if (previewSize != null) {optimalSize.width = previewSize.x;optimalSize.height = previewSize.y;}- Log.d(TAG, "updateCameraParametersPreference final preview size = "
+ Log.d(TAG, "updateCameraParametersPreference 112 final 00000 preview size = "+ optimalSize.width + ", " + optimalSize.height);Size original = mParameters.getPreviewSize();
diff --git a/packages/apps/SnapdragonCamera/src/com/android/camera/VideoModule.java b/packages/apps/SnapdragonCamera/src/com/android/camera/VideoModule.java
index 299eac8..57f2f9a 100755
--- a/packages/apps/SnapdragonCamera/src/com/android/camera/VideoModule.java
+++ b/packages/apps/SnapdragonCamera/src/com/android/camera/VideoModule.java
@@ -111,6 +111,7 @@ public class VideoModule implements CameraModule,private static final long SDCARD_SIZE_LIMIT = 4000 * 1024 * 1024;private static final long SHUTTER_BUTTON_TIMEOUT = 0L; // 0ms
+ private static final int MAX_SHARPNESS_LEVEL = 6;/*** An unpublished intent flag requesting to start recording straight away
@@ -1246,6 +1247,27 @@ public class VideoModule implements CameraModule,if (mPreviewing == true) {stopPreview();}
+ //add by delin
+ Parameters parameters = mCameraDevice.getParameters();
+ String sharpnessStr = mPreferences.getString(
+ CameraSettings.KEY_SHARPNESS,
+ mActivity.getString(R.string.pref_camera_sharpness_default));
+ int sharpness = Integer.parseInt(sharpnessStr) *
+ (parameters.getMaxSharpness()/MAX_SHARPNESS_LEVEL);
+ Log.v(TAG, "Sharpness value =" + sharpness);
+ if((0 <= sharpness) && (sharpness <= parameters.getMaxSharpness())){
+ Log.v(TAG, "parameters.setSharpness");
+ parameters.setSharpness(sharpness);
+ }
+ // Set anti banding parameter.
+ String antiBanding = mPreferences.getString(
+ CameraSettings.KEY_ANTIBANDING,
+ mActivity.getString(R.string.pref_camera_antibanding_default));
+ Log.v(TAG, "antiBanding value =" + antiBanding);
+ if (CameraUtil.isSupported(antiBanding, parameters.getSupportedAntibanding())) {
+ Log.v(TAG, "setAntibanding antiBanding value =" + antiBanding);
+ parameters.setAntibanding(antiBanding);
+ }setDisplayOrientation();mCameraDevice.setDisplayOrientation(mCameraDisplayOrientation);
@@ -2392,9 +2414,9 @@ public class VideoModule implements CameraModule,mParameters.setAntibanding(Parameters.ANTIBANDING_AUTO);}} else {
- if (isSupported(mDefaultAntibanding, mParameters.getSupportedAntibanding())) {
+ /*if (isSupported(mDefaultAntibanding, mParameters.getSupportedAntibanding())) {mParameters.setAntibanding(mDefaultAntibanding);
- }
+ }*/}Log.d(TAG, "antiBanding value = " + mParameters.getAntibanding());diff --git a/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaModule.java b/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaModule.java
old mode 100644
new mode 100755
index 0aab8f8..1cfb694
--- a/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaModule.java
@@ -70,7 +70,7 @@ public class WideAnglePanoramaModulepublic static final int DEFAULT_SWEEP_ANGLE = 160;public static final int DEFAULT_BLEND_MODE = Mosaic.BLENDTYPE_HORIZONTAL;
- public static final int DEFAULT_CAPTURE_PIXELS = 960 * 720;
+ public static final int DEFAULT_CAPTURE_PIXELS =1280 * 960;private static final int MSG_LOW_RES_FINAL_MOSAIC_READY = 1;private static final int MSG_GENERATE_FINAL_MOSAIC_ERROR = 2;
@@ -86,7 +86,7 @@ public class WideAnglePanoramaModuleprivate static final int PREVIEW_ACTIVE = 1;public static final int CAPTURE_STATE_VIEWFINDER = 0;public static final int CAPTURE_STATE_MOSAIC = 1;
-
+ private static final int MAX_SHARPNESS_LEVEL = 6;// The unit of speed is degrees per frame.private static final float PANNING_SPEED_THRESHOLD = 2.5f;private static final boolean DEBUG = false;
@@ -439,6 +439,7 @@ public class WideAnglePanoramaModulemCameraPreviewHeight = h;pixelsDiff = d;hasFound = true;
+ break;}}return hasFound;
@@ -474,7 +475,27 @@ public class WideAnglePanoramaModule}parameters.set(CameraUtil.RECORDING_HINT, CameraUtil.FALSE);
+//add by delin
+ String sharpnessStr = mPreferences.getString(
+ CameraSettings.KEY_SHARPNESS,
+ mActivity.getString(R.string.pref_camera_sharpness_default));
+ int sharpness = Integer.parseInt(sharpnessStr) *
+ (parameters.getMaxSharpness()/MAX_SHARPNESS_LEVEL);
+ Log.v(TAG, "Sharpness value =" + sharpness);
+ if((0 <= sharpness) && (sharpness <= parameters.getMaxSharpness())){
+ Log.v(TAG, "parameters.setSharpness");
+ parameters.setSharpness(sharpness);
+ }+ // Set anti banding parameter.
+ String antiBanding = mPreferences.getString(
+ CameraSettings.KEY_ANTIBANDING,
+ mActivity.getString(R.string.pref_camera_antibanding_default));
+ Log.v(TAG, "antiBanding value =" + antiBanding);
+ if (CameraUtil.isSupported(antiBanding, parameters.getSupportedAntibanding())) {
+ Log.v(TAG, "setAntibanding antiBanding value =" + antiBanding);
+ parameters.setAntibanding(antiBanding);
+ }mHorizontalViewAngle = parameters.getHorizontalViewAngle();mVerticalViewAngle = parameters.getVerticalViewAngle();}
@@ -1133,7 +1154,7 @@ public class WideAnglePanoramaModule// as Panoroma will add 90 degree rotation compensation during// postprocessing, we need to consider both camera mount angle and// this compensation angle
- mCameraDevice.setDisplayOrientation(0);
+ mCameraDevice.setDisplayOrientation(270);if (mCameraTexture != null)mCameraTexture.setOnFrameAvailableListener(this);
diff --git a/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaUI.java b/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaUI.java
index 74ba2c3..c360378 100755
--- a/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaUI.java
+++ b/packages/apps/SnapdragonCamera/src/com/android/camera/WideAnglePanoramaUI.java
@@ -384,7 +384,8 @@ public class WideAnglePanoramaUI implementsint w = width;int h = height;- h = w * 4 / 3;
+ // h = w * 4 / 3;
+ w = h * 4 / 3;yOffset = (height - h) / 2;FrameLayout.LayoutParams param = new FrameLayout.LayoutParams(w, h);