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();
相关推荐
阿华-vitor1 小时前
自定义控件之动画篇(六)——联合动画的代码及xml实现
android·xml·gitee
baozongwi3 小时前
ctfshow web sql注入 web242--web249
android·数据库·经验分享·sql·mysql·web安全
Dnelic-4 小时前
Android 15 应用适配默认全屏的行为变更(Android V的新特性)
android·ui·view·应用开发·android 15·android应用开发
svygh1236 小时前
安卓h5打包系统设计
android·html5·打包
人民的石头6 小时前
Android studio 打包低版本的Android项目报错
android·ide·android studio
xiangxiongfly9158 小时前
Android 换肤之主题换肤
android·换肤·主题换肤
Freeze-hu12 小时前
qt for android 工程添加AndroidManifest.xml 文件
android·xml
H10016 小时前
手机系统设置选项
android
coder_pig16 小时前
跟🤡杰哥一起学Flutter (十九、Flutter混编杂谈[Android]😫)
android·flutter·harmonyos
工程师老罗16 小时前
Android线性布局的概念与属性
android