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();
相关推荐
帅得不敢出门10 小时前
安卓设备adb执行AT指令控制电话卡
android·adb·sim卡·at指令·电话卡
我又来搬代码了11 小时前
【Android】使用productFlavors构建多个变体
android
德育处主任13 小时前
Mac和安卓手机互传文件(ADB)
android·macos
芦半山13 小时前
Android“引用们”的底层原理
android·java
迃-幵14 小时前
力扣:225 用队列实现栈
android·javascript·leetcode
大风起兮云飞扬丶14 小时前
Android——从相机/相册获取图片
android
Rverdoser14 小时前
Android Studio 多工程公用module引用
android·ide·android studio
aaajj14 小时前
[Android]从FLAG_SECURE禁止截屏看surface
android
@OuYang15 小时前
android10 蓝牙(二)配对源码解析
android
Liknana15 小时前
Android 网易游戏面经
android·面试