本文主要通过SystemProperties系统属性和Settings.System存储数据库的状态进行判断,从而实现控制相机
/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml
<!--camera-->
<string name="manager_camera_switch">摄像头功能管理</string>
<string name="use_camera_switch">摄像头功能开关</string>
<string name="use_camera_summary">打开:禁用\n关闭:可用</string>
overlay/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/strings.xml
<add-resource type="string" name="manager_camera_switch"/>
<add-resource type="string" name="use_camera_switch"/>
<add-resource type="string" name="use_camera_summary"/>
<!--camera-->
<string name="manager_camera_switch">Manage camera functionality</string>
<string name="use_camera_switch">Close Camera Switch</string>
<string name="use_camera_summary">ON:Disable\nOFF:Available</string>
vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/fradvanced_features_settings.xml 【这里可以是其他一级二级菜单管理下添加】
<Preference
android:key="camera_switch"
android:icon="@drawable/ic_settings_splitscreen"
android:title="@string/manager_camera_switch"
>
<intent android:action="com.freeme.intent.action.cameraswitch"/>
</Preference>
===================================【通知跳转Java类加载进入子菜单】
/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/freeme_camera_switch.xml
<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/manager_camera_switch"
>
<SwitchPreference
android:key="switch_preference"
android:title="@string/use_camera_switch"
android:summary="@string/use_camera_summary"/>
</PreferenceScreen>
/vendor/mediatek/proprietary/packages/apps/MtkSettings/AndroidManifest.xml
<!--tyd.lxd,add camera switch-->
<activity
android:name="com.android.settings.CameraSwitchSetting"
android:configChanges="orientation|keyboardHidden|screenSize|mnc|mcc"
android:excludeFromRecents="true"
android:clearTaskOnLaunch="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent