其他分享
首页 > 其他分享> > mt8788 Android9.0 开机默认host模式

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();
+                       }
+                       
+               }
     }
 }

标签:AnomalyConfigReceiver,mt8788,host,IOException,Android9.0,FileWriter,import,andro
来源: https://blog.csdn.net/woaiminghui/article/details/117069870