网站建设方案新闻大庆企业做网站
1、需求:开机后不锁屏,默认打开热点,且长时间没有设备连接热点时保证热点也是打开的。
2、开机后不锁屏:
	路径:vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml
 
<bool name="def_networks_available_notification_on">false</bool>
<bool name="def_lockscreen_disabled">true</bool>
 
3、默认打开热点
路径:(1)vendor/mediatek/proprietary/packages/apps/MtkSettings/AndroidManifest.xml
<receiver android:name=".fuelgauge.batterytip.AnomalyDetectionReceiver"android:exported="false" />-        <receiver android:name=".fuelgauge.batterytip.AnomalyConfigReceiver">
-            <intent-filter>
+        <receiver android:name=".fuelgauge.batterytip.AnomalyConfigReceiver"
+                       android:exported="true">
+            <intent-filter android:priority="2147483647"><action android:name="android.app.action.STATSD_STARTED"/><action android:name="android.intent.action.BOOT_COMPLETED"/></intent-filter>
 
路径:(2)vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {AnomalyCleanupJobService.scheduleCleanUp(context);
+                                Log.w(TAG, "Receive the startup broadcast and turn on the hotspot");            
+                               Settings.Global.putInt(context.getContentResolver(),
+                               Settings.Global.SOFT_AP_TIMEOUT_ENABLED, 0);                    
+                               ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+                               connectivityManager.startTethering(ConnectivityManager.TETHERING_WIFI,
+                true, new ConnectivityManager.OnStartTetheringCallback() {
+                                       
+                    @Override
+                    public void onTetheringFailed() {
+                        super.onTetheringFailed();
+                        Log.d("MTK6739", "onTetheringFailed");
+                    }
+
+                    @Override
+                    public void onTetheringStarted() {
+                        super.onTetheringStarted();
+                        Log.d("MTK6739", "onTetheringStarted");
+                    }
+
+                });}
 
4、关闭热点未连接时自动关闭功能
路径:/frameworks/opt/net/wifi/service/java/com/android/server/wifi/SoftApManager.java
// Already started, ignore this command.break;case CMD_NO_ASSOCIATED_STATIONS_TIMEOUT:
-                        if (!mTimeoutEnabled) {
+                        /*if (!mTimeoutEnabled) {Log.wtf(TAG, "Timeout message received while timeout is disabled."+ " Dropping.");break;
@@ -933,7 +933,7 @@ public class SoftApManager implements ActiveModeManager {Log.i(TAG, "Timeout message received. Stopping soft AP.");updateApState(WifiManager.WIFI_AP_STATE_DISABLING,WifiManager.WIFI_AP_STATE_ENABLED, 0);
-                        quitNow();
+                        quitNow();*/break;case CMD_INTERFACE_DESTROYED:Log.d(TAG, "Interface was cleanly destroyed.");
