Android 9.0 屏蔽设备的WLAN功能
最近接到需求反馈,想要屏蔽设备的WLAN功能,具体修改参照如下:
/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/bools.xml
- <!-- Whether Wi-Fi settings should be shown or not.
- This also controls whether Wi-fi related sub-settings (e.g. Wi-Fi preferences) will
- surface in search results or not.-->
- - <bool name="config_show_wifi_settings">true</bool>
- + <bool name="config_show_wifi_settings">false</bool>
另外一级菜单“网络和互联网”的 summary 也要调整,将WLAN字样去除,具体修改参照如下:
/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/network/NetworkDashboardFragment.java
- public void setListening(boolean listening) {
- if (listening) {
- /*/
- String summary = BidiFormatter.getInstance()
- .unicodeWrap(mContext.getString(R.string.wifi_settings_title));
- if (mMobileNetworkPreferenceController.isAvailable()) {
- final String mobileSettingSummary = mContext.getString(
- R.string.network_dashboard_summary_mobile);
- //*/
- String summary = BidiFormatter.getInstance()
- .unicodeWrap(mContext.getString(R.string.network_dashboard_summary_mobile));
- //}
- //*/
下拉状态栏中对应WLAN功能的quick setting图标也需要屏蔽掉:
/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
- <string name="quick_settings_tiles_default" translatable="false">
- - wifi,bt,dnd,flashlight,rotation,cell,airplane,cast,location,screenrecord
- + bt,dnd,flashlight,rotation,cell,airplane,cast,location,screenrecord
- </string>
-
- <string name="quick_settings_tiles_stock" translatable="false">
- - wifi,cell,dnd,flashlight,rotation,bt,airplane,location,screenrecord,hotspot,inversion,saver,work,cast,night
- + cell,dnd,flashlight,rotation,bt,airplane,location,screenrecord,hotspot,inversion,saver,work,cast,night
- </string>
重新编译验证,修改生效,设备WLAN功能已屏蔽