Loading android/app/Android.bp +9 −8 Original line number Diff line number Diff line Loading @@ -92,22 +92,23 @@ android_app { "services.net", ], static_libs: [ "com.android.vcard", "bluetooth.mapsapi", "sap-api-java-static", "services.net", "libprotobuf-java-lite", "bluetooth-protos-lite", "android.hardware.radio-V1.0-java", "androidx.core_core", "androidx.legacy_legacy-support-v4", "androidx.lifecycle_lifecycle-livedata", "modules-utils-statemachine", "androidx.room_room-runtime", "bluetooth.mapsapi", "bluetooth-protos-lite", "com.android.vcard", "guava", "android.hardware.radio-V1.0-java", "libprotobuf-java-lite", "mmslib", "modules-utils-backgroundthread", "modules-utils-bytesmatcher", "modules-utils-statemachine", "sap-api-java-static", "services.net", "PlatformProperties" ], plugins: [ Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +9 −2 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.provider.DeviceConfig; import android.provider.Settings; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Base64; import android.util.Log; Loading Loading @@ -757,8 +758,14 @@ public class AdapterService extends Service { mDefaultSnoopLogSettingAtEnable = Settings.Global.getString(getContentResolver(), Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE); SystemProperties.set(BLUETOOTH_BTSNOOP_DEFAULT_MODE_PROPERTY, mDefaultSnoopLogSettingAtEnable); BluetoothProperties.snoop_default_mode( BluetoothProperties.snoop_default_mode_values.DISABLED); for (BluetoothProperties.snoop_default_mode_values value : BluetoothProperties.snoop_default_mode_values.values()) { if (value.getPropValue().equals(mDefaultSnoopLogSettingAtEnable)) { BluetoothProperties.snoop_default_mode(value); } } } else if (newState == BluetoothAdapter.STATE_BLE_ON && prevState != BluetoothAdapter.STATE_OFF) { String snoopLogSetting = Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.permission.PermissionCheckerManager; import android.sysprop.BluetoothProperties; import android.test.mock.MockContentResolver; import android.util.Log; Loading Loading @@ -534,18 +535,19 @@ public class AdapterServiceTest { */ @Test public void testSnoopLoggingChange() { String snoopSetting = SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, ""); SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "false"); BluetoothProperties.snoop_log_mode_values snoopSetting = BluetoothProperties.snoop_log_mode() .orElse(BluetoothProperties.snoop_log_mode_values.EMPTY); BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.DISABLED); doEnable(0, false); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Assert.assertFalse( SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "true").equals("true")); "full").equals("full")); SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "true"); BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FULL); mAdapterService.disable(); Loading Loading @@ -575,7 +577,7 @@ public class AdapterServiceTest { Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); // Restore earlier setting SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, snoopSetting); BluetoothProperties.snoop_log_mode(snoopSetting); } Loading Loading
android/app/Android.bp +9 −8 Original line number Diff line number Diff line Loading @@ -92,22 +92,23 @@ android_app { "services.net", ], static_libs: [ "com.android.vcard", "bluetooth.mapsapi", "sap-api-java-static", "services.net", "libprotobuf-java-lite", "bluetooth-protos-lite", "android.hardware.radio-V1.0-java", "androidx.core_core", "androidx.legacy_legacy-support-v4", "androidx.lifecycle_lifecycle-livedata", "modules-utils-statemachine", "androidx.room_room-runtime", "bluetooth.mapsapi", "bluetooth-protos-lite", "com.android.vcard", "guava", "android.hardware.radio-V1.0-java", "libprotobuf-java-lite", "mmslib", "modules-utils-backgroundthread", "modules-utils-bytesmatcher", "modules-utils-statemachine", "sap-api-java-static", "services.net", "PlatformProperties" ], plugins: [ Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +9 −2 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.provider.DeviceConfig; import android.provider.Settings; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Base64; import android.util.Log; Loading Loading @@ -757,8 +758,14 @@ public class AdapterService extends Service { mDefaultSnoopLogSettingAtEnable = Settings.Global.getString(getContentResolver(), Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE); SystemProperties.set(BLUETOOTH_BTSNOOP_DEFAULT_MODE_PROPERTY, mDefaultSnoopLogSettingAtEnable); BluetoothProperties.snoop_default_mode( BluetoothProperties.snoop_default_mode_values.DISABLED); for (BluetoothProperties.snoop_default_mode_values value : BluetoothProperties.snoop_default_mode_values.values()) { if (value.getPropValue().equals(mDefaultSnoopLogSettingAtEnable)) { BluetoothProperties.snoop_default_mode(value); } } } else if (newState == BluetoothAdapter.STATE_BLE_ON && prevState != BluetoothAdapter.STATE_OFF) { String snoopLogSetting = Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.permission.PermissionCheckerManager; import android.sysprop.BluetoothProperties; import android.test.mock.MockContentResolver; import android.util.Log; Loading Loading @@ -534,18 +535,19 @@ public class AdapterServiceTest { */ @Test public void testSnoopLoggingChange() { String snoopSetting = SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, ""); SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "false"); BluetoothProperties.snoop_log_mode_values snoopSetting = BluetoothProperties.snoop_log_mode() .orElse(BluetoothProperties.snoop_log_mode_values.EMPTY); BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.DISABLED); doEnable(0, false); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Assert.assertFalse( SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "true").equals("true")); "full").equals("full")); SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "true"); BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FULL); mAdapterService.disable(); Loading Loading @@ -575,7 +577,7 @@ public class AdapterServiceTest { Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); // Restore earlier setting SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, snoopSetting); BluetoothProperties.snoop_log_mode(snoopSetting); } Loading