mt8788 Android9.0 开机默认host模式

项目中是用两个GPIO口来控制host与devices之间切换,所以要控制两个GPIO口都拉高电压

+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java
@@ -22,6 +22,8 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.util.Log;
+import java.io.FileWriter;
+import java.io.IOException;

 import com.android.internal.annotations.VisibleForTesting;

@@ -31,7 +33,7 @@ import com.android.internal.annotations.VisibleForTesting;
  */
 public class AnomalyConfigReceiver extends BroadcastReceiver {
     private static final String TAG = "AnomalyConfigReceiver";
-
+       private FileWriter fw1;
     @Override
     public void onReceive(Context context, Intent intent) {
         if (StatsManager.ACTION_STATSD_STARTED.equals(intent.getAction())
@@ -51,5 +53,26 @@ public class AnomalyConfigReceiver extends BroadcastReceiver {
                 AnomalyCleanupJobService.scheduleCleanUp(context);
             }
         }
+
+
+               if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+
+                       try {
+                               fw1 = new FileWriter("/sys/devices/platform/1000b000.pinctrl/mt_gpio");
+                               fw1.write("out 73 1");
+                               fw1.close();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+                       try {
+                               fw1 = new FileWriter("/sys/devices/platform/1000b000.pinctrl/mt_gpio");
+                               fw1.write("out 86 1");
+                               fw1.close();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+                       
+               }
     }
 }
上一篇:JAVA之IO技术-字符流对象Writer的子类对象FileWriter的使用


下一篇:java 清空文件内容的两种方式