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();
相关推荐
MiyamuraMiyako1 小时前
从 0 到发布:Gradle 插件双平台(MavenCentral + Plugin Portal)发布记录与避坑
android
NRatel1 小时前
Unity 游戏提升 Android TargetVersion 相关记录
android·游戏·unity·提升版本
叽哥4 小时前
Kotlin学习第 1 课:Kotlin 入门准备:搭建学习环境与认知基础
android·java·kotlin
风往哪边走4 小时前
创建自定义语音录制View
android·前端
用户2018792831674 小时前
事件分发之“官僚主义”?或“绕圈”的艺术
android
用户2018792831674 小时前
Android事件分发为何喜欢“兜圈子”?不做个“敞亮人”!
android
Kapaseker6 小时前
你一定会喜欢的 Compose 形变动画
android
QuZhengRong6 小时前
【数据库】Navicat 导入 Excel 数据乱码问题的解决方法
android·数据库·excel
zhangphil7 小时前
Android Coil3视频封面抽取封面帧存Disk缓存,Kotlin(2)
android·kotlin
程序员码歌14 小时前
【零代码AI编程实战】AI灯塔导航-总结篇
android·前端·后端