Limit btsnoop file size (8/8)

Limit btsnoop file size by rotating between snoop files. The rotation occurrs
when a fixed number of packets have been logged and will start overwriting
the older file.

Bug: 35998031
Test: Enable snoop logs from developer options and let logs get large
Merged-In: I04c16c69a74597c75ebdbf39b521d8e40b6bb6f7
Change-Id: I04c16c69a74597c75ebdbf39b521d8e40b6bb6f7
diff --git a/Settings/src/com/android/tv/settings/system/development/DevelopmentFragment.java b/Settings/src/com/android/tv/settings/system/development/DevelopmentFragment.java
index a2fd26a..81772a2 100644
--- a/Settings/src/com/android/tv/settings/system/development/DevelopmentFragment.java
+++ b/Settings/src/com/android/tv/settings/system/development/DevelopmentFragment.java
@@ -84,6 +84,7 @@
     private static final String ENABLE_TERMINAL = "enable_terminal";
     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 BTSNOOP_ENABLE_PROPERTY = "persist.bluetooth.btsnoopenable";
     private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
     private static final String HDCP_CHECKING_KEY = "hdcp_checking";
     private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
@@ -575,8 +576,8 @@
                 Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0);
         updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
                 Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
-        updateSwitchPreference(mBtHciSnoopLog, Settings.Secure.getInt(cr,
-                Settings.Secure.BLUETOOTH_HCI_LOG, 0) != 0);
+        updateSwitchPreference(mBtHciSnoopLog,
+                SystemProperties.getBoolean(BTSNOOP_ENABLE_PROPERTY, false));
         if (mEnableOemUnlock != null) {
             updateSwitchPreference(mEnableOemUnlock, isOemUnlockEnabled(getActivity()));
             mEnableOemUnlock.setEnabled(isOemUnlockAllowed());
@@ -679,9 +680,8 @@
 
     private void writeBtHciSnoopLogOptions() {
         BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-        adapter.configHciSnoopLog(mBtHciSnoopLog.isChecked());
-        Settings.Secure.putInt(mContentResolver, Settings.Secure.BLUETOOTH_HCI_LOG,
-                mBtHciSnoopLog.isChecked() ? 1 : 0);
+        SystemProperties.set(BTSNOOP_ENABLE_PROPERTY,
+                Boolean.toString(mBtHciSnoopLog.isChecked()));
     }
 
     private void writeDebuggerOptions() {