Android->net_adb:add support net adb button in Developer option

This commit is contained in:
zjy
2017-12-20 16:35:24 +08:00
committed by cjp
parent d3c6389512
commit 1b25357b13
8 changed files with 64 additions and 1 deletions

View File

@ -422,6 +422,16 @@ on boot
class_start core class_start core
on property:netadb.status=true
setprop service.adb.tcp.port 5555
stop adbd
start adbd
on property:netadb.status=false
setprop service.adb.tcp.port 0
stop adbd
start adbd
on nonencrypted on nonencrypted
class_start main class_start main
class_start late_start class_start late_start

View File

@ -2261,6 +2261,14 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</receiver>
<receiver android:name=".NetAdbBootStatus"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver> </receiver>
<receiver android:name="ScheduleOnOffReceiver" android:process=":remote"> <receiver android:name="ScheduleOnOffReceiver" android:process=":remote">
<intent-filter> <intent-filter>

View File

@ -1442,6 +1442,7 @@
<string name="bugreport_in_power_summary" msgid="1778455732762984579">"在电源菜单中显示用于提交错误报告的按钮"</string> <string name="bugreport_in_power_summary" msgid="1778455732762984579">"在电源菜单中显示用于提交错误报告的按钮"</string>
<string name="keep_screen_on" msgid="1146389631208760344">"不锁定屏幕"</string> <string name="keep_screen_on" msgid="1146389631208760344">"不锁定屏幕"</string>
<string name="enable_log_save">启用日志保存</string> <string name="enable_log_save">启用日志保存</string>
<string name="enable_net_adb">启用网络ADB</string>
<string name="keep_screen_on_summary" msgid="2173114350754293009">"充电时屏幕不会休眠"</string> <string name="keep_screen_on_summary" msgid="2173114350754293009">"充电时屏幕不会休眠"</string>
<string name="bt_hci_snoop_log" msgid="3340699311158865670">"启用蓝牙 HCI 信息收集日志"</string> <string name="bt_hci_snoop_log" msgid="3340699311158865670">"启用蓝牙 HCI 信息收集日志"</string>
<string name="bt_hci_snoop_log_summary" msgid="730247028210113851">"捕获单个文件中的所有蓝牙 HCI 包"</string> <string name="bt_hci_snoop_log_summary" msgid="730247028210113851">"捕获单个文件中的所有蓝牙 HCI 包"</string>

View File

@ -3409,6 +3409,7 @@
<!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source --> <!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
<string name="keep_screen_on">Stay awake</string> <string name="keep_screen_on">Stay awake</string>
<string name="enable_log_save">Enable logging to save</string> <string name="enable_log_save">Enable logging to save</string>
<string name="enable_net_adb">Enable Net ADB</string>
<!-- setting Checkbox summary whether to keep the screen on when plugged in --> <!-- setting Checkbox summary whether to keep the screen on when plugged in -->
<string name="keep_screen_on_summary">Screen will never sleep while charging</string> <string name="keep_screen_on_summary">Screen will never sleep while charging</string>
<!-- Setting Checkbox title whether to enable bluetooth HCI snoop log --> <!-- Setting Checkbox title whether to enable bluetooth HCI snoop log -->

View File

@ -36,6 +36,11 @@
android:title="@string/enable_log_save" android:title="@string/enable_log_save"
/> />
<SwitchPreference
android:key="enable_net_adb"
android:title="@string/enable_net_adb"
/>
<SwitchPreference <SwitchPreference
android:key="keep_screen_on" android:key="keep_screen_on"
android:title="@string/keep_screen_on" android:title="@string/keep_screen_on"

View File

@ -95,6 +95,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String ENABLE_TERMINAL = "enable_terminal"; private static final String ENABLE_TERMINAL = "enable_terminal";
private static final String KEEP_SCREEN_ON = "keep_screen_on"; private static final String KEEP_SCREEN_ON = "keep_screen_on";
private static final String ENABLE_LOG_SAVE = "enable_log_save"; private static final String ENABLE_LOG_SAVE = "enable_log_save";
private static final String ENABLE_NET_ADB = "enable_net_adb";
private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log"; private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable"; private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location"; private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
@ -191,6 +192,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private SwitchPreference mBugreportInPower; private SwitchPreference mBugreportInPower;
private SwitchPreference mKeepScreenOn; private SwitchPreference mKeepScreenOn;
private SwitchPreference mEnableLogSave; private SwitchPreference mEnableLogSave;
private SwitchPreference mEnableNetAdb;
private SwitchPreference mBtHciSnoopLog; private SwitchPreference mBtHciSnoopLog;
private SwitchPreference mEnableOemUnlock; private SwitchPreference mEnableOemUnlock;
private SwitchPreference mAllowMockLocation; private SwitchPreference mAllowMockLocation;
@ -308,6 +310,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY); mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
mKeepScreenOn = findAndInitSwitchPref(KEEP_SCREEN_ON); mKeepScreenOn = findAndInitSwitchPref(KEEP_SCREEN_ON);
mEnableLogSave = findAndInitSwitchPref(ENABLE_LOG_SAVE); mEnableLogSave = findAndInitSwitchPref(ENABLE_LOG_SAVE);
mEnableNetAdb = findAndInitSwitchPref(ENABLE_NET_ADB);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG); mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK); mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference()) { if (!showEnableOemUnlockPreference()) {
@ -1432,7 +1435,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
}else{ }else{
SystemProperties.set("app.logsave.start","0"); SystemProperties.set("app.logsave.start","0");
} }
} else if (preference == mBtHciSnoopLog) { } else if(preference == mEnableNetAdb)
{
if(mEnableNetAdb.isChecked())
{
SystemProperties.set("netadb.status","true");
}else{
SystemProperties.set("netadb.status","false");
}
}else if (preference == mBtHciSnoopLog) {
writeBtHciSnoopLogOptions(); writeBtHciSnoopLogOptions();
} else if (preference == mEnableOemUnlock) { } else if (preference == mEnableOemUnlock) {
if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) { if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) {

View File

@ -0,0 +1,27 @@
package com.android.settings;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.util.Log;
import android.os.SystemProperties;
public class NetAdbBootStatus extends BroadcastReceiver{
@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
String action = arg1.getAction();
if(action.equals(Intent.ACTION_BOOT_COMPLETED))
{
SharedPreferences shared = arg0.getSharedPreferences("com.android.settings_preferences", Context.MODE_PRIVATE);
boolean enable_net_adb = shared.getBoolean("enable_net_adb", false);
if(enable_net_adb)
SystemProperties.set("app.logsave.start", "true");
}
}
}