-
-
Save maartin0/6ae4cb3412c0fd1e7eeb28e9c343d080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --------- beginning of crash | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: FATAL EXCEPTION: Camera request Thread | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: Process: com.fp5.camera, PID: 24178 | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'com.tcl.camsdk.manager.CameraModeManager$CameraFacing com.tcl.camsdk.mode.base.ModeInfo.getFacing()' on a null object reference | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at com.android.camera.custom.InitCameraConfig.getPictureSize(InitCameraConfig.java:45) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at com.android.camera.custom.InitCameraConfig.initMasterCameraPictureSize(InitCameraConfig.java:196) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at com.android.camera.device.camera.CameraDeviceControl$1.run(CameraDeviceControl.java:84) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:959) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:100) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at android.os.Looper.loop(Looper.java:317) | |
| 05-17 19:12:21.124 24178 24197 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:85) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: FATAL EXCEPTION: Camera request Thread | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: Process: com.fp5.camera, PID: 24328 | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'com.tcl.camsdk.manager.CameraModeManager$CameraFacing com.tcl.camsdk.mode.base.ModeInfo.getFacing()' on a null object reference | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at com.android.camera.custom.InitCameraConfig.getPictureSize(InitCameraConfig.java:45) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at com.android.camera.custom.InitCameraConfig.initMasterCameraPictureSize(InitCameraConfig.java:196) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at com.android.camera.device.camera.CameraDeviceControl$1.run(CameraDeviceControl.java:84) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:959) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:100) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at android.os.Looper.loop(Looper.java:317) | |
| 05-17 19:12:22.236 24328 24347 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:85) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| == Service global info: == | |
| Number of camera devices: 6 | |
| Number of normal camera devices: 4 | |
| Number of public camera devices visible to API1: 4 | |
| Device 0 maps to "0" | |
| Device 1 maps to "1" | |
| Device 2 maps to "2" | |
| Device 3 maps to "5" | |
| Active Camera Clients: | |
| [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| == Service global info: == | |
| Number of camera devices: 5 | |
| Number of normal camera devices: 3 | |
| Number of public camera devices visible to API1: 3 | |
| Device 0 maps to "0" | |
| Device 1 maps to "1" | |
| Device 2 maps to "4" | |
| Active Camera Clients: | |
| [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.android.camera.custom; | |
| import android.content.SharedPreferences; | |
| import android.graphics.Point; | |
| import android.hardware.camera2.CameraCharacteristics; | |
| import android.hardware.camera2.params.StreamConfigurationMap; | |
| import android.util.Size; | |
| import android.view.SurfaceHolder; | |
| import com.android.camera.CameraApplication; | |
| import com.android.camera.settings.Keys; | |
| import com.android.camera.settings.SettingsManager; | |
| import com.android.camera.ui.picker.PickerType; | |
| import com.android.camera.utils.CameraUtil; | |
| import com.android.camera.utils.Logger; | |
| import com.tcl.camsdk.manager.CameraModeManager; | |
| import com.tcl.camsdk.manager.TctCameraCharacteristicsKey; | |
| import com.tcl.camsdk.mode.base.ModeInfo; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.LinkedList; | |
| import java.util.List; | |
| /* JADX INFO: loaded from: classes.dex */ | |
| public class InitCameraConfig { | |
| private static final String TAG = "InitCameraConfig"; | |
| private static InitCameraConfig mInitCameraConfig; | |
| public static InitCameraConfig getInstance() { | |
| if (mInitCameraConfig == null) { | |
| mInitCameraConfig = new InitCameraConfig(); | |
| } | |
| return mInitCameraConfig; | |
| } | |
| private String getPictureSize(ModeInfo modeInfo) { | |
| String str; | |
| String string; | |
| SettingsManager settingsManager = CameraApplication.getSettingsManager(); | |
| boolean z = modeInfo.getFacing() == CameraModeManager.CameraFacing.FACING_FRONT; | |
| ArrayList<Size> arrayListSizesToList = CameraUtil.SizesToList(modeInfo.getSupportedCaptureSize()); | |
| String str2 = TAG; | |
| if (arrayListSizesToList == null || arrayListSizesToList.size() < 1) { | |
| Logger.e(TAG, "support picture size is not yet config by hal!"); | |
| if (!TctCustomUtils.isUnConfigProject()) { | |
| return null; | |
| } | |
| arrayListSizesToList = new ArrayList<>(); | |
| arrayListSizesToList.addAll(Arrays.asList(((StreamConfigurationMap) modeInfo.getCameraCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)).getOutputSizes(SurfaceHolder.class))); | |
| } | |
| ArrayList arrayList = new ArrayList(); | |
| Logger.i(TAG, "getPictureSize isFacingFront:" + z + ", supportSize:" + arrayListSizesToList.toString()); | |
| int i = 0; | |
| while (true) { | |
| if (i >= arrayListSizesToList.size()) { | |
| str = str2; | |
| break; | |
| } | |
| Size size = arrayListSizesToList.get(i); | |
| double width = ((double) size.getWidth()) / ((double) size.getHeight()); | |
| boolean zNeedAddToSupportSize = needAddToSupportSize(width); | |
| int i2 = 0; | |
| while (true) { | |
| if (i2 >= arrayList.size()) { | |
| str = str2; | |
| break; | |
| } | |
| Size size2 = (Size) arrayList.get(i2); | |
| str = str2; | |
| if (Math.abs(width - (((double) size2.getWidth()) / ((double) size2.getHeight()))) < 0.02d) { | |
| zNeedAddToSupportSize = false; | |
| break; | |
| } | |
| i2++; | |
| str2 = str; | |
| } | |
| if (zNeedAddToSupportSize) { | |
| arrayList.add(arrayListSizesToList.get(i)); | |
| } | |
| if (arrayList.size() >= 4) { | |
| break; | |
| } | |
| i++; | |
| str2 = str; | |
| } | |
| if (arrayList.size() == 0) { | |
| arrayList.add(arrayListSizesToList.get(arrayListSizesToList.size() - 1)); | |
| if (arrayListSizesToList.size() > 1) { | |
| arrayList.add(arrayListSizesToList.get(arrayListSizesToList.size() - 2)); | |
| } | |
| } | |
| String strListToString = CameraUtil.listToString(arrayList); | |
| GeneralConfigUtils.setCameraSupportPictureSizes(modeInfo.getCameraType(), z, strListToString); | |
| String ratioString = PickerType.getRatioString(settingsManager.getPreviewRatio(z)); | |
| int i3 = 0; | |
| while (true) { | |
| if (i3 >= arrayList.size()) { | |
| string = null; | |
| break; | |
| } | |
| Size size3 = (Size) arrayList.get(i3); | |
| if (ratioString.equals(CameraUtil.getPreviewRatioString(((double) size3.getWidth()) / ((double) size3.getHeight())))) { | |
| string = size3.toString(); | |
| break; | |
| } | |
| i3++; | |
| } | |
| if (string == null) { | |
| string = ((Size) arrayList.get(0)).toString(); | |
| } | |
| Logger.i(str, "getPictureSize:" + strListToString + "; currentSize:" + string); | |
| return string; | |
| } | |
| private Size getTctCustomMaxSize(ModeInfo modeInfo) { | |
| Size[] supportedCaptureSize = modeInfo.getSupportedCaptureSize(); | |
| if (supportedCaptureSize == null || supportedCaptureSize.length < 1) { | |
| return null; | |
| } | |
| return supportedCaptureSize[0]; | |
| } | |
| private String initPreviewSize(ModeInfo modeInfo) { | |
| Size[] supportedPreviewSize; | |
| LinkedList linkedList; | |
| try { | |
| supportedPreviewSize = modeInfo.getSupportedPreviewSize(); | |
| } catch (Exception unused) { | |
| supportedPreviewSize = null; | |
| } | |
| if (supportedPreviewSize != null) { | |
| linkedList = new LinkedList(Arrays.asList(supportedPreviewSize)); | |
| } else { | |
| linkedList = new LinkedList(); | |
| } | |
| if (!linkedList.isEmpty()) { | |
| Logger.i(TAG, "preview size from meatadate = " + CameraUtil.listToString(linkedList)); | |
| GeneralConfigUtils.setSupportPreviewSizes(linkedList); | |
| return CameraUtil.listToString(linkedList); | |
| } | |
| Logger.e(TAG, "preview size is not yet config by hal!"); | |
| if (!TctCustomUtils.isUnConfigProject()) { | |
| return null; | |
| } | |
| ArrayList<Size> arrayList = new ArrayList<>(); | |
| arrayList.addAll(Arrays.asList(((StreamConfigurationMap) modeInfo.getCameraCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)).getOutputSizes(SurfaceHolder.class))); | |
| ArrayList arrayList2 = new ArrayList(); | |
| List<Size> listStringToList = CameraUtil.stringToList(GeneralConfigUtils.getCameraSupportPictureSizes(CameraModeManager.Master, false)); | |
| for (int i = 0; i < listStringToList.size(); i++) { | |
| Size size = listStringToList.get(i); | |
| Size optimalPreviewSize = getOptimalPreviewSize(((double) size.getWidth()) / ((double) size.getHeight()), arrayList); | |
| if (optimalPreviewSize != null) { | |
| Logger.w(TAG, "initPreviewSize previewSize=" + optimalPreviewSize.toString()); | |
| arrayList2.add(optimalPreviewSize); | |
| } | |
| } | |
| if (arrayList2.size() <= 1) { | |
| return null; | |
| } | |
| GeneralConfigUtils.setSupportPreviewSizes(arrayList2); | |
| return CameraUtil.listToString(arrayList2); | |
| } | |
| private void initHighPixelSize(ModeInfo modeInfo) { | |
| int[] iArr = (int[]) modeInfo.getCameraCharacteristics().get(TctCameraCharacteristicsKey.TCT_DEVICE_HIGH_RESOLUTION_SIZE); | |
| if (iArr != null && iArr.length >= 2) { | |
| GeneralConfigUtils.setHighPixelSize(modeInfo.getCameraType(), modeInfo.getFacing() == CameraModeManager.CameraFacing.FACING_FRONT, new Size(iArr[0], iArr[1])); | |
| } else { | |
| Logger.w(TAG, "HighPictureSize is null or empty!"); | |
| } | |
| } | |
| public void initMasterCameraPictureSize() { | |
| if (GeneralConfigUtils.needCheckPictureSize(false)) { | |
| Logger.i(TAG, "initMasterCameraPictureSize E!"); | |
| SharedPreferences defaultPreferences = CameraApplication.getSettingsManager().getDefaultPreferences(); | |
| ModeInfo modeInfo = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_BACK, CameraModeManager.AUTO, CameraModeManager.Master); | |
| String pictureSize = getPictureSize(modeInfo); | |
| String strInitPreviewSize = initPreviewSize(modeInfo); | |
| initHighPixelSize(modeInfo); | |
| ModeInfo modeInfo2 = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_FRONT, CameraModeManager.AUTO, CameraModeManager.Master); | |
| String pictureSize2 = getPictureSize(modeInfo2); | |
| initHighPixelSize(modeInfo2); | |
| initMacroTypeSize(); | |
| initWideTypeSize(); | |
| initPortraitPictureSize(); | |
| initPortraitPreviewSize(); | |
| SharedPreferences.Editor editorEdit = defaultPreferences.edit(); | |
| editorEdit.putString(Keys.KEY_PICTURE_SIZE_BACK, pictureSize); | |
| editorEdit.putString(Keys.KEY_PICTURE_SIZE_FRONT, pictureSize2); | |
| if (strInitPreviewSize != null) { | |
| editorEdit.putString(Keys.PREVIEW_SIZES_KEY, strInitPreviewSize); | |
| } | |
| editorEdit.commit(); | |
| Logger.d(TAG, "initMasterCameraPictureSize X :" + pictureSize + CameraUtil.DELIMITER + pictureSize2 + CameraUtil.DELIMITER + strInitPreviewSize); | |
| } | |
| } | |
| private void initMacroTypeSize() { | |
| ModeInfo modeInfo = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_BACK, CameraModeManager.AUTO, CameraModeManager.Macro); | |
| if (modeInfo == null) { | |
| return; | |
| } | |
| Size tctCustomMaxSize = getTctCustomMaxSize(modeInfo); | |
| if (tctCustomMaxSize != null) { | |
| GeneralConfigUtils.setCameraPictureSize(modeInfo.getCameraType(), tctCustomMaxSize); | |
| } | |
| initHighPixelSize(modeInfo); | |
| } | |
| private void initWideTypeSize() { | |
| ModeInfo modeInfo = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_BACK, CameraModeManager.AUTO, CameraModeManager.Wide); | |
| if (modeInfo == null) { | |
| return; | |
| } | |
| Size tctCustomMaxSize = getTctCustomMaxSize(modeInfo); | |
| if (tctCustomMaxSize != null) { | |
| GeneralConfigUtils.setCameraPictureSize(modeInfo.getCameraType(), tctCustomMaxSize); | |
| } | |
| initHighPixelSize(modeInfo); | |
| } | |
| private void initPortraitPictureSize() { | |
| ModeInfo modeInfo = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_BACK, CameraModeManager.PORTRAIT, CameraModeManager.Bokeh); | |
| if (modeInfo == null) { | |
| Logger.i(TAG, "Portrait mode info = null"); | |
| return; | |
| } | |
| Size tctCustomMaxSize = getTctCustomMaxSize(modeInfo); | |
| if (tctCustomMaxSize != null) { | |
| GeneralConfigUtils.setCameraPictureSize(modeInfo.getCameraType(), tctCustomMaxSize); | |
| } else { | |
| Logger.e(TAG, "Portrait size == null"); | |
| } | |
| } | |
| private void initPortraitPreviewSize() { | |
| ModeInfo modeInfo = CameraModeManager.getModeInfo(CameraModeManager.CameraFacing.FACING_BACK, CameraModeManager.PORTRAIT, CameraModeManager.Bokeh); | |
| if (modeInfo == null) { | |
| Logger.i(TAG, "Portrait mode info = null"); | |
| return; | |
| } | |
| Size[] supportedPreviewSize = modeInfo.getSupportedPreviewSize(); | |
| if (supportedPreviewSize != null && supportedPreviewSize.length > 0) { | |
| GeneralConfigUtils.setPortraitPreviewSize(modeInfo.getCameraType(), supportedPreviewSize[0]); | |
| } else { | |
| Logger.e(TAG, "Portrait preview size = null"); | |
| } | |
| } | |
| private boolean needAddToSupportSize(double d) { | |
| if (Math.abs(1.0d - d) < 0.02d || Math.abs(1.333299994468689d - d) < 0.02d || Math.abs(1.7776999473571777d - d) < 0.02d) { | |
| return true; | |
| } | |
| double fixedFullScreenRatio = TctCustomUtils.getFixedFullScreenRatio(); | |
| Logger.w(TAG, "needAddToSupportSize screenRatio=" + fixedFullScreenRatio + ", ratio=" + d); | |
| return Math.abs(fixedFullScreenRatio - d) < 0.05d; | |
| } | |
| public Size getOptimalPreviewSize(double d, ArrayList<Size> arrayList) { | |
| Point screenSize = TctCustomUtils.getScreenSize(); | |
| int iMin = screenSize != null ? Math.min(screenSize.x, screenSize.y) : 720; | |
| Size size = null; | |
| double dAbs = Double.MAX_VALUE; | |
| double d2 = Double.MAX_VALUE; | |
| for (Size size2 : arrayList) { | |
| if (size2.getHeight() <= 1200 && Math.abs((((double) size2.getWidth()) / ((double) size2.getHeight())) - d) <= 0.01d) { | |
| double dAbs2 = Math.abs(size2.getHeight() - iMin); | |
| if (dAbs2 < d2 || (dAbs2 == d2 && size2.getHeight() < iMin)) { | |
| size = size2; | |
| d2 = dAbs2; | |
| } | |
| } | |
| } | |
| if (size == null) { | |
| Logger.w(TAG, "No preview size match the aspect ratio"); | |
| for (Size size3 : arrayList) { | |
| if (Math.abs(size3.getHeight() - iMin) < dAbs) { | |
| dAbs = Math.abs(size3.getHeight() - iMin); | |
| size = size3; | |
| } | |
| } | |
| } | |
| return size; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment