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();
相关推荐
你过来啊你几秒前
Android性能优化之启动优化
android
apihz37 分钟前
域名WHOIS信息查询免费API使用指南
android·开发语言·数据库·网络协议·tcp/ip
问道飞鱼1 小时前
【移动端知识】移动端多 WebView 互访方案:Android、iOS 与鸿蒙实现
android·ios·harmonyos·多webview互访
aningxiaoxixi2 小时前
Android 之 audiotrack
android
枷锁—sha2 小时前
【DVWA系列】——CSRF——Medium详细教程
android·服务器·前端·web安全·网络安全·csrf
Cao_Shixin攻城狮5 小时前
Flutter运行Android项目时显示java版本不兼容(Unsupported class file major version 65)的处理
android·java·flutter
呼啦啦呼啦啦啦啦啦啦8 小时前
利用pdfjs实现的pdf预览简单demo(包含翻页功能)
android·javascript·pdf
idjl10 小时前
Mysql测试题
android·adb
游戏开发爱好者812 小时前
iOS App 电池消耗管理与优化 提升用户体验的完整指南
android·ios·小程序·https·uni-app·iphone·webview
人生游戏牛马NPC1号13 小时前
学习 Flutter (四):玩安卓项目实战 - 中
android·学习·flutter