Add debug menu to enable btsnoop
bug: 8059358 Change-Id: Ib695aa5c9fff96d1676f718a2e3fb0bbf91eca04
This commit is contained in:
@@ -3074,6 +3074,10 @@
|
|||||||
<string name="keep_screen_on">Stay awake</string>
|
<string name="keep_screen_on">Stay awake</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 -->
|
||||||
|
<string name="bt_hci_snoop_log">Enable Bluetooth HCI snoop log</string>
|
||||||
|
<!-- setting Checkbox summary whether to capture all bluetooth HCI packets in a file -->
|
||||||
|
<string name="bt_hci_snoop_log_summary">Capture all bluetooth HCI packets in a file</string>
|
||||||
|
|
||||||
<!-- Runtime selection title, used for debug purposes only. [CHAR LIMIT=25] -->
|
<!-- Runtime selection title, used for debug purposes only. [CHAR LIMIT=25] -->
|
||||||
<string name="select_runtime_title">Select runtime </string>
|
<string name="select_runtime_title">Select runtime </string>
|
||||||
|
@@ -56,6 +56,11 @@
|
|||||||
android:title="@string/enforce_read_external_title"
|
android:title="@string/enforce_read_external_title"
|
||||||
android:summary="@string/enforce_read_external_summary" />
|
android:summary="@string/enforce_read_external_summary" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="bt_hci_snoop_log"
|
||||||
|
android:title="@string/bt_hci_snoop_log"
|
||||||
|
android:summary="@string/bt_hci_snoop_log_summary"/>
|
||||||
|
|
||||||
<PreferenceCategory android:key="debug_debugging_category"
|
<PreferenceCategory android:key="debug_debugging_category"
|
||||||
android:title="@string/debug_debugging_category">
|
android:title="@string/debug_debugging_category">
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ import android.app.Dialog;
|
|||||||
import android.app.DialogFragment;
|
import android.app.DialogFragment;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.app.backup.IBackupManager;
|
import android.app.backup.IBackupManager;
|
||||||
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -97,6 +98,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
|
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
|
||||||
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 BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
|
||||||
private static final String SELECT_RUNTIME_KEY = "select_runtime";
|
private static final String SELECT_RUNTIME_KEY = "select_runtime";
|
||||||
private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib";
|
private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib";
|
||||||
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
|
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
|
||||||
@@ -167,6 +169,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
private Preference mBugreport;
|
private Preference mBugreport;
|
||||||
private CheckBoxPreference mBugreportInPower;
|
private CheckBoxPreference mBugreportInPower;
|
||||||
private CheckBoxPreference mKeepScreenOn;
|
private CheckBoxPreference mKeepScreenOn;
|
||||||
|
private CheckBoxPreference mBtHciSnoopLog;
|
||||||
private CheckBoxPreference mEnforceReadExternal;
|
private CheckBoxPreference mEnforceReadExternal;
|
||||||
private CheckBoxPreference mAllowMockLocation;
|
private CheckBoxPreference mAllowMockLocation;
|
||||||
private PreferenceScreen mPassword;
|
private PreferenceScreen mPassword;
|
||||||
@@ -252,6 +255,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
mBugreport = findPreference(BUGREPORT);
|
mBugreport = findPreference(BUGREPORT);
|
||||||
mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
|
mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
|
||||||
mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
|
mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
|
||||||
|
mBtHciSnoopLog = findAndInitCheckboxPref(BT_HCI_SNOOP_LOG);
|
||||||
mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL);
|
mEnforceReadExternal = findAndInitCheckboxPref(ENFORCE_READ_EXTERNAL);
|
||||||
mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
|
mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
|
||||||
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
|
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
|
||||||
@@ -477,6 +481,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
||||||
updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
|
updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
|
||||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
|
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
|
||||||
|
updateCheckBox(mBtHciSnoopLog, Settings.Secure.getInt(cr,
|
||||||
|
Settings.Secure.BLUETOOTH_HCI_LOG, 0) != 0);
|
||||||
updateCheckBox(mEnforceReadExternal, isPermissionEnforced(READ_EXTERNAL_STORAGE));
|
updateCheckBox(mEnforceReadExternal, isPermissionEnforced(READ_EXTERNAL_STORAGE));
|
||||||
updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
|
updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
|
||||||
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
|
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
|
||||||
@@ -607,6 +613,14 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void writeBtHciSnoopLogOptions() {
|
||||||
|
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
adapter.configHciSnoopLog(mBtHciSnoopLog.isChecked());
|
||||||
|
Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||||
|
Settings.Secure.BLUETOOTH_HCI_LOG,
|
||||||
|
mBtHciSnoopLog.isChecked() ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void writeDebuggerOptions() {
|
private void writeDebuggerOptions() {
|
||||||
try {
|
try {
|
||||||
ActivityManagerNative.getDefault().setDebugApp(
|
ActivityManagerNative.getDefault().setDebugApp(
|
||||||
@@ -1193,6 +1207,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
|
Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
|
||||||
mKeepScreenOn.isChecked() ?
|
mKeepScreenOn.isChecked() ?
|
||||||
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
|
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
|
||||||
|
} else if (preference == mBtHciSnoopLog) {
|
||||||
|
writeBtHciSnoopLogOptions();
|
||||||
} else if (preference == mEnforceReadExternal) {
|
} else if (preference == mEnforceReadExternal) {
|
||||||
if (mEnforceReadExternal.isChecked()) {
|
if (mEnforceReadExternal.isChecked()) {
|
||||||
ConfirmEnforceFragment.show(this);
|
ConfirmEnforceFragment.show(this);
|
||||||
|
Reference in New Issue
Block a user