Fix Bluetooth tethering toggle status

The mBluetoothPan is updated async, toggle status is set before data
loaded.

Refresh the status after load to fix this issue.

Fix: 272525310
Test: Manually when Bluetooth tethering is on
Change-Id: Ia306f3648ba8d32a63a8ec6c72260f7f43b830bc
This commit is contained in:
Chaohui Wang
2023-05-12 16:25:27 +08:00
parent 0af8c60342
commit 3988d11ddd

View File

@@ -171,6 +171,8 @@ public class TetherSettings extends RestrictedSettingsFragment
return;
}
setupTetherPreference();
final Activity activity = getActivity();
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null) {
@@ -184,7 +186,6 @@ public class TetherSettings extends RestrictedSettingsFragment
new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
}
setupTetherPreference();
setTopIntroPreferenceTitle();
mDataSaverBackend.addListener(this);
@@ -605,6 +606,7 @@ public class TetherSettings extends RestrictedSettingsFragment
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (mBluetoothPan.get() == null) {
mBluetoothPan.set((BluetoothPan) proxy);
updateBluetoothState();
}
}