【高通平台】安卓平板,使用QQ 视频通话,视频旋转90度问题修改
16lz
2021-01-23
修改过来的方向
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);}