修改过来的方向

Z:\smd450_8953pro\frameworks\base\core\java\android\hardware\Camera.java

//270 行public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) {......//Log.e(TAG, "sssssssssss Audio sssssssssssssssss22 302,cameraInfo.orientation =" +cameraInfo.orientation );if(!(ActivityThread.currentOpPackageName().equalsIgnoreCase("org.codeaurora.snapcam") )   && !(ActivityThread.currentOpPackageName().equalsIgnoreCase("org.codeaurora.gallery") )){if(cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK  ) {cameraInfo.orientation =0;}else if(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT){cameraInfo.orientation =180;}//Log.e(TAG, "sssssssssss Audio sssssssssssssssss33 309,cameraInfo.orientation =" +cameraInfo.orientation );}

Z:\smd450_8953pro\frameworks\base\core\java\android\view\OrientationEventListener.java

修改本地的方向

 class SensorEventListenerImpl implements SensorEventListener {        private static final int _DATA_X = 0;        private static final int _DATA_Y = 1;        private static final int _DATA_Z = 2;                public void onSensorChanged(SensorEvent event) {            float[] values = event.values;            int orientation = ORIENTATION_UNKNOWN;            float X = -values[_DATA_X];            float Y = -values[_DATA_Y];            float Z = -values[_DATA_Z];                    float magnitude = X*X + Y*Y;            // Don't trust the angle if the magnitude is small compared to the y value            if (magnitude * 4 >= Z*Z) {                float OneEightyOverPi = 57.29577957855f;                float angle = (float)Math.atan2(-Y, X) * OneEightyOverPi;                orientation = 90 - (int)Math.round(angle);                // normalize to 0 - 359 range                while (orientation >= 360) {                    orientation -= 360;                }                 while (orientation < 0) {                    orientation += 360;                }            }            if (mOldListener != null) {                mOldListener.onSensorChanged(Sensor.TYPE_ACCELEROMETER, event.values);            }            if (orientation != mOrientation) {                mOrientation = orientation;// oudelin addif(ActivityThread.currentOpPackageName().equalsIgnoreCase("com.tencent.mobileqq")) {orientation=orientation+90;//Log.w(TAG, "ssssss22  1256 orientation ="+orientation);}

 

 

更多相关文章

  1. android 固定屏幕显示方向
  2. Android之屏幕方向|显示方式|Activity重建问题|横竖屏切换不同的
  3. 开发Android主攻四大方向
  4. android根据应用方向自动旋转的自定义view

随机推荐

  1. Android(安卓)Design版微信首度亮相:微信
  2. android Menu菜单操作(偏门--监听 more 操
  3. Android(安卓)开发的前景如何?
  4. opencv for android:如何在Android(安卓)
  5. 现阶段 Android(安卓)行业真的凉了吗?到底
  6. 最近,又有人在谈论Android的前景了...
  7. Android(安卓)客户端性能优化(魅族资深工
  8. android-EditText输入框被键盘遮挡问题解
  9. Android中读取短信信息
  10. Android(安卓)ListView SimpleAdapter Ar