• 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
  • 相关阅读:
    SQLServer 备份和还原
    Ling To DataTable
    asp.net安全防范
    SQLServer 定时备份(一)
    asp.net网站安全常见问题与防范
    SQLServer 定时备份(二)
    flex大法:一网打尽所有常见布局
    BetterScroll源码阅读顺便学习TypeScript
    快速搭建一个代码在线编辑预览工具
    一个简单标注库的插件化开发实践
  • 原文地址:https://www.cnblogs.com/gleaner/p/12509212.html
Copyright © 2020-2023  润新知