Merge TQ1A.230205.002

Bug: 263898609
Merged-In: I13562d227e06627fac33239a9d21fd405a18d012
Change-Id: I1457d9362378bd893f557e1c998308cf8ee8904a
This commit is contained in:
Xin Li
2023-02-06 21:05:31 -08:00
4 changed files with 125 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ public class BluetoothSwitchPreferenceController
private SwitchWidgetController mSwitch;
private Context mContext;
private FooterPreference mFooterPreference;
private boolean mIsAlwaysDiscoverable;
@VisibleForTesting
AlwaysDiscoverable mAlwaysDiscoverable;
@@ -78,7 +79,9 @@ public class BluetoothSwitchPreferenceController
@Override
public void onStart() {
mBluetoothEnabler.resume(mContext);
mAlwaysDiscoverable.start();
if (mIsAlwaysDiscoverable) {
mAlwaysDiscoverable.start();
}
if (mSwitch != null) {
updateText(mSwitch.isChecked());
}
@@ -87,7 +90,19 @@ public class BluetoothSwitchPreferenceController
@Override
public void onStop() {
mBluetoothEnabler.pause();
mAlwaysDiscoverable.stop();
if (mIsAlwaysDiscoverable) {
mAlwaysDiscoverable.stop();
}
}
/**
* Set whether the device can be discovered. By default the value will be {@code false}.
*
* @param isAlwaysDiscoverable {@code true} if the device can be discovered,
* otherwise {@code false}
*/
public void setAlwaysDiscoverable(boolean isAlwaysDiscoverable) {
mIsAlwaysDiscoverable = isAlwaysDiscoverable;
}
@Override