Camera定制修改

mtk Android13 Camera2

需求:

Android13 MtkCamera右上角的前后摄切换点击范围小导致经常点击无反应,需增大view宽度

跟踪代码可找到对应资源文件:vendor\mediatek\proprietary\packages\apps\Camera2\feature\setting\cameraswitcher\res\

根据vendor\mediatek\proprietary\packages\apps\Camera2\feature\setting\cameraswitcher\src\com\mediatek\camera\feature\setting\CameraSwitcher.java代码中的:

复制代码
mAppUi.addToQuickSwitcher(mSwitcherView, 0);

追踪可知最后是调用:/vendor/mediatek/proprietary/packages/apps/Camera2/host/src/com/mediatek/camera/ui/QuickSwitcherManager.java中的updateQuickItems()

复制代码
private void updateQuickItems() {
        float density = mApp.getActivity().getResources().getDisplayMetrics().density;
        int marginInPix = (int) (MARGIN_IN_DP * density);
        if (mQuickSwitcherLayout != null && mQuickSwitcherLayout.getChildCount() != 0) {
            mQuickSwitcherLayout.removeAllViews();
        }
        if (mQuickSwitcherLayout != null) {
            Iterator iterator = mQuickItems.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry map = (Map.Entry) iterator.next();
                View view = (View) map.getValue();
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        100,
                        ViewGroup.LayoutParams.WRAP_CONTENT);
                params.setMargins(marginInPix, 0, 0, 0);
                view.setLayoutParams(params);
                mQuickSwitcherLayout.addView(view);
            }
            updateViewOrientation();
        }
    }

修改宽度为需要大小即可

需求:移除高温报警

复制代码
--- a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottle.java
+++ b/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottle.java
@@ -109,16 +109,16 @@ public class ThermalThrottle implements IThermalThrottle{
     @Override
     public void resume() {
         LogHelper.d(TAG, "[resume]...");
-        int contentLaunch = mRes.getIdentifier("pref_thermal_dialog_content_launch", "string",
-                mActivity.getPackageName());
-        if (getTemperStatus() == THERMAL_URGENT_VALUE
-                || mThermalStatus == THERMAL_BUFFER_VALUE) {
-            mIsShowing = true;
-            if (!mActivity.isFinishing()) {
-                Toast.makeText(mActivity, contentLaunch, Toast.LENGTH_LONG).show();
-                mActivity.finish();
-            }
-        }
+        // int contentLaunch = mRes.getIdentifier("pref_thermal_dialog_content_launch", "string",
+        //         mActivity.getPackageName());
+        // if (getTemperStatus() == THERMAL_URGENT_VALUE
+        //         || mThermalStatus == THERMAL_BUFFER_VALUE) {
+        //     mIsShowing = true;
+        //     if (!mActivity.isFinishing()) {
+        //         Toast.makeText(mActivity, contentLaunch, Toast.LENGTH_LONG).show();
+        //         mActivity.finish();
+        //     }
+        // }
         mIsResumed = true;
         mWaitingTime = WAITING_TIME;
         if (mWorkerHandler != null) {
diff --git a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottleFromService.java b/alps-mp-t0/vendor/mediatek/proprietary/
packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottleFromService.java
index c2282fe1d73..9865798ae8e 100644
--- a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottleFromService.java
+++ b/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/thermal/ThermalThrottleFromService.java
@@ -201,12 +201,12 @@ public class ThermalThrottleFromService implements IThermalThrottle {
             }
         }
         LogHelper.d(TAG, "[resume] mThermalStatus = " + mThermalStatus + " " + THERMAL_URGENT_VALUE);
-        if (mThermalStatus >= THERMAL_URGENT_VALUE && (!mActivity.isFinishing())) {
-            int contentLaunch = mRes.getIdentifier("pref_thermal_dialog_content_launch", "string",
-                    mActivity.getPackageName());
-            Toast.makeText(mActivity, contentLaunch, Toast.LENGTH_LONG).show();
-            mActivity.finish();
-        }
+        // if (mThermalStatus >= THERMAL_URGENT_VALUE && (!mActivity.isFinishing())) {^M
+        //     int contentLaunch = mRes.getIdentifier("pref_thermal_dialog_content_launch", "string",^M
+        //             mActivity.getPackageName());^M
+        //     Toast.makeText(mActivity, contentLaunch, Toast.LENGTH_LONG).show();^M
+        //     mActivity.finish();^M
+        // }^M
         try {
             mThermalService.registerThermalEventListenerWithType(
                     mSkinThermalEventListener, Temperature.TYPE_SKIN);

需求:移除相机录音快门声音

复制代码
--- a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/VideoMode.java
+++ b/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/VideoMode.java
@@ -262,7 +262,7 @@ public class VideoMode extends CameraModeBase {
             case STATE_PREVIEW:
                 if(getModeState() == ModeState.STATE_RESUMED) {
                     mAppUi.applyAllUIEnabled(false);
-                    mICameraContext.getSoundPlayback().play(R.raw.video_shutter,100);
+                    //mICameraContext.getSoundPlayback().play(R.raw.video_shutter,100);
                     LogHelper.i(TAG, "onShutterButtonClick mDelayTime = " + DELAY_TIME*100);
                     SystemClock.sleep(DELAY_TIME * 100);
                     startRecording();
diff --git a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/device/v2/VideoDevice2Controller.java b/alps-mp-t0/vendor/mediatek/pro
prietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/device/v2/VideoDevice2Controller.java
index 5ef93b3e6f7..a712a82024c 100755
--- a/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/device/v2/VideoDevice2Controller.java
+++ b/alps-mp-t0/vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/mode/video/device/v2/VideoDevice2Controller.java
@@ -452,7 +452,7 @@ public class VideoDevice2Controller extends Device2Controller
     @Override
     public void stopRecording() {
         LogHelper.i(TAG, "[stopRecording] +");
-        mICameraContext.getSoundPlayback().play(R.raw.video_shutter,100);
+        //mICameraContext.getSoundPlayback().play(R.raw.video_shutter,100);
         setStopRecordingToCamera();
         mIsRecording = false;

mtk Android9 Camera

需求:移除相机录音快门声音

代码路径:frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp

复制代码
     // start recording mode
     enableMsgType(CAMERA_MSG_VIDEO_FRAME);
-    sCameraService->playSound(CameraService::SOUND_RECORDING_START);
+    //sCameraService->playSound(CameraService::SOUND_RECORDING_START);
     result = mHardware->startRecording();
     if (result != NO_ERROR) {
         ALOGE("mHardware->startRecording() failed with status %d", result);
@@ -497,7 +497,7 @@ void CameraClient::stopRecording() {
 
         disableMsgType(CAMERA_MSG_VIDEO_FRAME);
         mHardware->stopRecording();
-        sCameraService->playSound(CameraService::SOUND_RECORDING_STOP);
+        //sCameraService->playSound(CameraService::SOUND_RECORDING_STOP);
 
         mPreviewBuffer.clear();
相关推荐
每次的天空1 小时前
Android学习总结之应用启动流程(从点击图标到界面显示)
android·学习
一清三白3 小时前
Android Studio 连接雷电模拟器教程
android
姜行运3 小时前
数据结构【栈和队列附顺序表应用算法】
android·c语言·数据结构·算法
wang_peng4 小时前
android studio 基础
android·ide·android studio
〆、风神6 小时前
EasyExcel 数据字典转换器实战:注解驱动设计
android·java·注解
stevenzqzq6 小时前
Android studio xml布局预览中 Automotive和Autotive Distant Display的区别
android·xml·android studio
QING6187 小时前
Kotlin commonPrefixWith用法及代码示例
android·kotlin·源码阅读
QING6187 小时前
Kotlin groupByTo用法及代码示例
android·kotlin·源码阅读
兰琛12 小时前
Compose组件转换XML布局
android·xml·kotlin
水w14 小时前
【Android Studio】解决报错问题Algorithm HmacPBESHA256 not available
android·开发语言·android studio