Merge "Removes hearing aids settings page flag" into main
This commit is contained in:
@@ -32,7 +32,6 @@ import android.content.pm.ServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
@@ -112,9 +111,7 @@ public class AccessibilityDetailsSettingsFragment extends InstrumentedFragment {
|
||||
return new LaunchFragmentArguments(destination, /* arguments= */ null);
|
||||
}
|
||||
|
||||
if (ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.equals(componentName)
|
||||
&& FeatureFlagUtils.isEnabled(getContext(),
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE)) {
|
||||
if (ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.equals(componentName)) {
|
||||
final String destination = AccessibilityHearingAidsFragment.class.getName();
|
||||
return new LaunchFragmentArguments(destination, /* arguments= */ null);
|
||||
}
|
||||
|
@@ -25,9 +25,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -35,7 +33,6 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settingslib.bluetooth.BluetoothCallback;
|
||||
@@ -116,17 +113,7 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
||||
final CachedBluetoothDevice device = mHelper.getConnectedHearingAidDevice();
|
||||
if (FeatureFlagUtils.isEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE)) {
|
||||
launchHearingAidPage();
|
||||
return true;
|
||||
}
|
||||
if (device == null) {
|
||||
launchHearingAidInstructionDialog();
|
||||
} else {
|
||||
launchBluetoothDeviceDetailSetting(device);
|
||||
}
|
||||
launchHearingAidPage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -215,29 +202,6 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
|
||||
mHearingAidPreference = preference;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void launchBluetoothDeviceDetailSetting(final CachedBluetoothDevice device) {
|
||||
if (device == null) {
|
||||
return;
|
||||
}
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS,
|
||||
device.getDevice().getAddress());
|
||||
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(BluetoothDeviceDetailsFragment.class.getName())
|
||||
.setArguments(args)
|
||||
.setTitleRes(R.string.device_details_title)
|
||||
.setSourceMetricsCategory(getMetricsCategory())
|
||||
.launch();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void launchHearingAidInstructionDialog() {
|
||||
HearingAidDialogFragment fragment = HearingAidDialogFragment.newInstance();
|
||||
fragment.show(mFragmentManager, HearingAidDialogFragment.class.toString());
|
||||
}
|
||||
|
||||
private void launchHearingAidPage() {
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(AccessibilityHearingAidsFragment.class.getName())
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
@@ -51,8 +50,7 @@ public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDe
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return mCachedDevice.isHearingAidDevice() && FeatureFlagUtils.isEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE);
|
||||
return mCachedDevice.isHearingAidDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -32,7 +32,6 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
@@ -158,8 +157,6 @@ public class AccessibilityDetailsSettingsFragmentTest {
|
||||
|
||||
@Test
|
||||
public void onCreate_hearingAidsComponentName_launchAccessibilityHearingAidsFragment() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Intent.EXTRA_COMPONENT_NAME,
|
||||
ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.flattenToString());
|
||||
|
@@ -18,11 +18,7 @@ package com.android.settings.accessibility;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.robolectric.Shadows.shadowOf;
|
||||
|
||||
@@ -35,7 +31,6 @@ import android.bluetooth.BluetoothProfile;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
@@ -111,8 +106,6 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
|
||||
mShadowApplication = shadowOf((Application) ApplicationProvider.getApplicationContext());
|
||||
setupEnvironment();
|
||||
|
||||
@@ -251,37 +244,6 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
mContext.getText(R.string.accessibility_hearingaid_not_connected_summary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleHearingAidPreferenceClick_noHearingAid_launchHearingAidInstructionDialog() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, false);
|
||||
mPreferenceController = spy(new AccessibilityHearingAidPreferenceController(mContext,
|
||||
HEARING_AID_PREFERENCE));
|
||||
mPreferenceController.setPreference(mHearingAidPreference);
|
||||
doNothing().when(mPreferenceController).launchHearingAidInstructionDialog();
|
||||
|
||||
mPreferenceController.handlePreferenceTreeClick(mHearingAidPreference);
|
||||
|
||||
verify(mPreferenceController).launchHearingAidInstructionDialog();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleHearingAidPreferenceClick_withHearingAid_launchBluetoothDeviceDetailSetting
|
||||
() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, false);
|
||||
mPreferenceController = spy(new AccessibilityHearingAidPreferenceController(mContext,
|
||||
HEARING_AID_PREFERENCE));
|
||||
mPreferenceController.setPreference(mHearingAidPreference);
|
||||
when(mHearingAidProfile.getConnectedDevices()).thenReturn(generateHearingAidDeviceList());
|
||||
when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
|
||||
doNothing().when(mPreferenceController).launchBluetoothDeviceDetailSetting(any());
|
||||
|
||||
mPreferenceController.handlePreferenceTreeClick(mHearingAidPreference);
|
||||
|
||||
verify(mPreferenceController).launchBluetoothDeviceDetailSetting(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onServiceConnected_onHearingAidProfileConnected_updateSummary() {
|
||||
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
|
||||
|
@@ -23,7 +23,6 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@@ -63,8 +62,6 @@ public class BluetoothDetailsHearingDeviceControlsControllerTest extends
|
||||
|
||||
@Test
|
||||
public void isAvailable_isHearingAidDevice_available() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
|
||||
when(mCachedDevice.isHearingAidDevice()).thenReturn(true);
|
||||
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
@@ -72,8 +69,6 @@ public class BluetoothDetailsHearingDeviceControlsControllerTest extends
|
||||
|
||||
@Test
|
||||
public void isAvailable_isNotHearingAidDevice_notAvailable() {
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
|
||||
when(mCachedDevice.isHearingAidDevice()).thenReturn(false);
|
||||
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
|
Reference in New Issue
Block a user