Loading system/bta/dm/bta_dm_act.cc +9 −1 Original line number Diff line number Diff line Loading @@ -321,7 +321,15 @@ void bta_dm_disable() { log::warn("Unable to disable classic BR/EDR connectability"); } /* if sniff is offload, no need to handle it in the stack */ if (com::android::bluetooth::flags::enable_sniff_offload() && osi_property_get_bool(kPropertySniffOffloadEnabled, false)) { log::info("Sniff offloading. Skip bta_dm_disable_pm."); } else { /* Disable bluetooth low power manager */ bta_dm_disable_pm(); } if (com::android::bluetooth::flags::separate_service_and_device_discovery()) { bta_dm_disc_disable_search(); bta_dm_disc_disable_disc(); Loading system/bta/dm/bta_dm_pm.cc +3 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,9 @@ void bta_dm_disable_pm(void) { /* Need to stop all active timers. */ for (int i = 0; i < BTA_DM_NUM_PM_TIMER; i++) { for (int j = 0; j < BTA_DM_PM_MODE_TIMER_MAX; j++) { if (bta_dm_cb.pm_timer[i].in_use) { bta_dm_pm_stop_timer_by_index(&bta_dm_cb.pm_timer[i], j); } bta_dm_cb.pm_timer[i].pm_action[j] = BTA_DM_PM_NO_ACTION; } } Loading system/bta/test/bta_dm_test.cc +6 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,12 @@ TEST_F_WITH_FLAGS(BtaDmCustomAlarmTest, sniff_offload_feature__enable_flag, is_property_enabled = false; bluetooth::legacy::testing::BTA_dm_on_hw_on(); ASSERT_EQ((uint8_t)BTA_ID_MAX, bta_dm_cb.pm_timer[0].srvc_id[0]); // Shouldn't crash even there's no active timer when calling // bta_dm_disable_pm. bta_dm_cb.pm_timer[0].in_use = false; bta_dm_cb.pm_timer[0].srvc_id[0] = kUnusedTimer; bta_dm_disable_pm(); } TEST_F_WITH_FLAGS(BtaDmCustomAlarmTest, sniff_offload_feature__disable_flag, Loading Loading
system/bta/dm/bta_dm_act.cc +9 −1 Original line number Diff line number Diff line Loading @@ -321,7 +321,15 @@ void bta_dm_disable() { log::warn("Unable to disable classic BR/EDR connectability"); } /* if sniff is offload, no need to handle it in the stack */ if (com::android::bluetooth::flags::enable_sniff_offload() && osi_property_get_bool(kPropertySniffOffloadEnabled, false)) { log::info("Sniff offloading. Skip bta_dm_disable_pm."); } else { /* Disable bluetooth low power manager */ bta_dm_disable_pm(); } if (com::android::bluetooth::flags::separate_service_and_device_discovery()) { bta_dm_disc_disable_search(); bta_dm_disc_disable_disc(); Loading
system/bta/dm/bta_dm_pm.cc +3 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,9 @@ void bta_dm_disable_pm(void) { /* Need to stop all active timers. */ for (int i = 0; i < BTA_DM_NUM_PM_TIMER; i++) { for (int j = 0; j < BTA_DM_PM_MODE_TIMER_MAX; j++) { if (bta_dm_cb.pm_timer[i].in_use) { bta_dm_pm_stop_timer_by_index(&bta_dm_cb.pm_timer[i], j); } bta_dm_cb.pm_timer[i].pm_action[j] = BTA_DM_PM_NO_ACTION; } } Loading
system/bta/test/bta_dm_test.cc +6 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,12 @@ TEST_F_WITH_FLAGS(BtaDmCustomAlarmTest, sniff_offload_feature__enable_flag, is_property_enabled = false; bluetooth::legacy::testing::BTA_dm_on_hw_on(); ASSERT_EQ((uint8_t)BTA_ID_MAX, bta_dm_cb.pm_timer[0].srvc_id[0]); // Shouldn't crash even there's no active timer when calling // bta_dm_disable_pm. bta_dm_cb.pm_timer[0].in_use = false; bta_dm_cb.pm_timer[0].srvc_id[0] = kUnusedTimer; bta_dm_disable_pm(); } TEST_F_WITH_FLAGS(BtaDmCustomAlarmTest, sniff_offload_feature__disable_flag, Loading