Fix audio routing can not work after the phone get rebooted

Root Cause: setPreferredDeviceForStrategy() need to be called when hearing device get connected.

Solution:
 * Call setPreferredDeviceForStrategy() when HearingAidDeviceManager#onProfileConnectionStateChangedIfProcessed()
 * Extract the common functions into SettingsLib

Bug: 269122580
Test: make RunSettingsRoboTests
ROBOTEST_FILTER="(CachedBluetoothDeviceManagerTest|HearingAidAudioRoutingHelperTest|HearingAidDeviceManagerTest)"

Change-Id: I622040384f56f61c65f0daac45735789d637b703
8 files changed