硬件平台:展讯8541e
软件平台:Andoir8.1
需求:智能硬件连接PC之后,走MTP模式,数据不同步,重新插拔USB线也无作用,只有重启才能同步数据,因此需要添加USB事件触发同步事件。
diff --git a/src/com/android/providers/media/MtpReceiver.java b/src/com/android/providers/media/MtpReceiver.java
index ae5b490..88ded32 100755
--- a/src/com/android/providers/media/MtpReceiver.java
+++ b/src/com/android/providers/media/MtpReceiver.java
@@ -27,6 +27,8 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.util.Log;
import android.mtp.MtpServer;
+import android.os.Environment;
+import android.os.EnvironmentEx;
public class MtpReceiver extends BroadcastReceiver {
private static final String TAG = MtpReceiver.class.getSimpleName();