Remove allowlist reboot behavior

As we switch to use allowlist or bypass it, it would only impact the
default connection after the paring. So based on it, we don't need to
force device reboot to apply the setting

Bug: 300012501
Test: m SettingsGoogle
Change-Id: I0b63a68e1263692e922968c122b96b5635b9861f
This commit is contained in:
Alice Kuo
2023-10-05 05:28:36 +08:00
parent c41abccb0f
commit f8767cdd31
3 changed files with 0 additions and 77 deletions

View File

@@ -49,9 +49,6 @@ public class BluetoothLeAudioAllowListPreferenceController
private final DevelopmentSettingsDashboardFragment mFragment;
@VisibleForTesting
boolean mChanged = false;
public BluetoothLeAudioAllowListPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
super(context);
@@ -66,8 +63,6 @@ public class BluetoothLeAudioAllowListPreferenceController
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
BluetoothRebootDialog.show(mFragment);
mChanged = true;
return false;
}
@@ -92,25 +87,4 @@ public class BluetoothLeAudioAllowListPreferenceController
((SwitchPreference) mPreference).setChecked(false);
}
}
/**
* Called when the RebootDialog confirm is clicked.
*/
public void onRebootDialogConfirmed() {
if (!mChanged) {
return;
}
final boolean leAudioAllowListEnabled =
SystemProperties.getBoolean(LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, false);
SystemProperties.set(LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY,
Boolean.toString(leAudioAllowListEnabled));
}
/**
* Called when the RebootDialog cancel is clicked.
*/
public void onRebootDialogCanceled() {
mChanged = false;
}
}

View File

@@ -442,11 +442,6 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
getDevelopmentOptionsController(
BluetoothLeAudioPreferenceController.class);
leAudioFeatureController.onRebootDialogConfirmed();
final BluetoothLeAudioAllowListPreferenceController leAudioAllowListController =
getDevelopmentOptionsController(
BluetoothLeAudioAllowListPreferenceController.class);
leAudioAllowListController.onRebootDialogConfirmed();
}
@Override
@@ -464,11 +459,6 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
getDevelopmentOptionsController(
BluetoothLeAudioPreferenceController.class);
leAudioFeatureController.onRebootDialogCanceled();
final BluetoothLeAudioAllowListPreferenceController leAudioAllowListController =
getDevelopmentOptionsController(
BluetoothLeAudioAllowListPreferenceController.class);
leAudioAllowListController.onRebootDialogCanceled();
}
@Override

View File

@@ -18,23 +18,16 @@ package com.android.settings.development;
import static android.bluetooth.BluetoothStatusCodes.FEATURE_SUPPORTED;
import static com.android.settings.development.BluetoothLeAudioAllowListPreferenceController
.LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.os.SystemProperties;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -69,38 +62,4 @@ public class BluetoothLeAudioAllowListPreferenceControllerTest {
when(mBluetoothAdapter.isLeAudioSupported())
.thenReturn(FEATURE_SUPPORTED);
}
@Test
public void onRebootDialogConfirmedAsLeAudioAllowListDisabled_shouldSwitchStatus() {
SystemProperties.set(LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, Boolean.toString(false));
mController.mChanged = true;
mController.onRebootDialogConfirmed();
final boolean mode = SystemProperties.getBoolean(
LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, false);
assertThat(mode).isFalse();
}
@Test
public void onRebootDialogConfirmedAsLeAudioAllowListEnabled_shouldSwitchStatus() {
SystemProperties.set(LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, Boolean.toString(true));
mController.mChanged = true;
mController.onRebootDialogConfirmed();
final boolean status = SystemProperties.getBoolean(
LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, false);
assertThat(status).isTrue();
}
@Test
public void onRebootDialogCanceled_shouldNotSwitchStatus() {
SystemProperties.set(LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, Boolean.toString(false));
mController.mChanged = true;
mController.onRebootDialogCanceled();
final boolean status = SystemProperties.getBoolean(
LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY, false);
assertThat(status).isFalse();
}
}