现象:Android P 版本使用OTG时,直接入OTG线未接入设备,下拉栏会显示
“Android系统.正在通过USB为连接的设备充电”
原因:Android P 新增的USB特性导致,控制的宏开关为CONFIG_DUAL_ROLE_USB_INTF,用于控制两用OTG USB。
解决:若只做OTG功能,关闭该宏开关,但是会造成正常PC接入设备USB选择栏为灰色不可选,只能到开发者选项中修改USB默认模式。否则只能上层修改显示信息。
上层修改如下,规避不显示:
frameworksbaseservicesusbjavacomandroidserverusbUsbDeviceManager.java
protected void updateUsbNotification(boolean force) {
if (mNotificationManager == null || !mUseUsbNotification
|| ("0".equals(getSystemProperty("ify", "")))) {
return;
}
...
int id = 0;
int titleRes = 0;
Resources r = Resources();
CharSequence message = r.getText(
com.android.internal.R.string.usb_notification_message);
if (mAudioAccessoryConnected && !mAudioAccessorySupported) {
...
} else if (mConnected) {
...
// } else if (mSourcePower) {
//修改为如下
} else if (SourcePower && !"project_name".("ro.product.device_group",""))) {
Slog.d(TAG, "[ malata debug : ] ************** NOTE_USB_SUPPLYING");
titleRes = com.android.internal.R.string.usb_supplying_notification_title;
id = SystemMessage.NOTE_USB_SUPPLYING;
} else if (mHostConnected && mSinkPower && mUsbCharging) {
...
}
project_name为该项目名称。ro.product.device_group的赋值在
devicemalata{project_name}system.prop文件中ro.product.device_group=project_name一致
本文发布于:2024-02-04 06:24:12,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170700978253076.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |