• android P 默认开启wlan热点


    vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java

    +///mh.add
    +import android.net.ConnectivityManager;
    +import android.provider.Settings;
    +///mh.end
    
         private static final String TAG = "AnomalyConfigReceiver";
    +    private Context mContext;//mh.add
    
    
         @Override
         public void onReceive(Context context, Intent intent) {
             if (StatsManager.ACTION_STATSD_STARTED.equals(intent.getAction())
                     || Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {                           
    +            mContext = context;//mh.add
                 final StatsManager statsManager = context.getSystemService(StatsManager.class);
     
                 // Check whether to update the config
    
                 if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
    +                wifiApControl();//mh.add
                     AnomalyCleanupJobService.scheduleCleanUp(context);
                 }
    
    +       //mh.add start
    +       private void wifiApControl() {
    +               Settings.Global.putInt(mContext.getContentResolver(),
    +                Settings.Global.SOFT_AP_TIMEOUT_ENABLED, 0);
    +               ConnectivityManager  connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    +               connectivityManager.startTethering(ConnectivityManager.TETHERING_WIFI,
    +                                               true, new ConnectivityManager.OnStartTetheringCallback() {
    +
    +            @Override
    +            public void onTetheringFailed() {
    +                super.onTetheringFailed();
    +                Log.d("menghua", "onTetheringFailed");
    +            }
    +
    +            @Override
    +            public void onTetheringStarted() {
    +                super.onTetheringStarted();
    +                Log.d("menghua", "onTetheringStarted");
    +            }
    +
    +        });
    +       }
    +       //mh.end
  • 相关阅读:
    Angular 学习笔记 (Material table sticky 原理)
    Asp.net core 学习笔记 ( ef core transaction scope & change level )
    sql server 学习笔记 (nested transaction 嵌套事务)
    html 图片文字并排显示
    Maven 的配置
    Eclipse的配置
    tomcat 的安装与配置
    java jdk的安装与配置
    javascript 拖拽
    html5 CSS input placeholder兼容性处理
  • 原文地址:https://www.cnblogs.com/copyworker/p/12509212.html
Copyright © 2020-2023  润新知