diff --git a/res/drawable/accessibility_color_inversion_banner.gif b/res/drawable/accessibility_color_inversion_banner.gif
new file mode 100644
index 00000000000..dc7c8acc136
Binary files /dev/null and b/res/drawable/accessibility_color_inversion_banner.gif differ
diff --git a/res/drawable/accessibility_color_inversion_banner.png b/res/drawable/accessibility_color_inversion_banner.png
deleted file mode 100644
index 2d068e34a3b..00000000000
Binary files a/res/drawable/accessibility_color_inversion_banner.png and /dev/null differ
diff --git a/res/drawable/accessibility_magnification_banner.gif b/res/drawable/accessibility_magnification_banner.gif
new file mode 100644
index 00000000000..f9b7e368ac5
Binary files /dev/null and b/res/drawable/accessibility_magnification_banner.gif differ
diff --git a/res/drawable/accessibility_screen_magnification_background.xml b/res/drawable/accessibility_screen_magnification_background.xml
deleted file mode 100644
index e22cfece1df..00000000000
--- a/res/drawable/accessibility_screen_magnification_background.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
diff --git a/res/layout/magnification_video_preference.xml b/res/layout/magnification_video_preference.xml
deleted file mode 100644
index ff7089c8389..00000000000
--- a/res/layout/magnification_video_preference.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/preference_bluetooth_profile_category.xml b/res/layout/preference_bluetooth_profile_category.xml
new file mode 100644
index 00000000000..8c09bad01bc
--- /dev/null
+++ b/res/layout/preference_bluetooth_profile_category.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index c6b2dc2cf11..a9ce5c3f945 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -280,13 +280,6 @@
16dp
18dp
-
- 750dp
- 383dp
- 170dp
- 311dp
- 40dp
-
16dp
diff --git a/res/xml/all_tether_prefs.xml b/res/xml/all_tether_prefs.xml
index 84d5d2ac173..0aee621b7f7 100644
--- a/res/xml/all_tether_prefs.xml
+++ b/res/xml/all_tether_prefs.xml
@@ -41,16 +41,16 @@
android:title="@string/wifi_hotspot_auto_off_title"
android:summary="@string/wifi_hotspot_auto_off_summary"/>
+
+
-
-
+
+
-
-
diff --git a/src/com/android/settings/AllInOneTetherSettings.java b/src/com/android/settings/AllInOneTetherSettings.java
index 1cf68a0a227..ed3b5b071c6 100644
--- a/src/com/android/settings/AllInOneTetherSettings.java
+++ b/src/com/android/settings/AllInOneTetherSettings.java
@@ -98,9 +98,9 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
public static final String ETHERNET_TETHER_KEY = "enable_ethernet_tethering" + DEDUP_POSTFIX;
@VisibleForTesting
- static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
+ static final int EXPANDED_CHILD_COUNT_DEFAULT = 4;
@VisibleForTesting
- static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
+ static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 3;
@VisibleForTesting
static final int EXPANDED_CHILD_COUNT_MAX = Integer.MAX_VALUE;
private static final String TAG = "AllInOneTetherSettings";
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 23869110c68..d0b83b6b8e1 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -28,6 +28,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
+import android.icu.text.CaseMap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -61,6 +62,7 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
@@ -581,7 +583,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
}
if ((shortcutTypes & UserShortcutType.HARDWARE) == UserShortcutType.HARDWARE) {
final CharSequence hardwareTitle = context.getText(
- R.string.accessibility_shortcut_edit_dialog_title_hardware);
+ R.string.accessibility_shortcut_hardware_keyword);
list.add(hardwareTitle);
}
@@ -590,7 +592,9 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
list.add(softwareTitle);
}
final String joinStrings = TextUtils.join(/* delimiter= */", ", list);
- return AccessibilityUtil.capitalize(joinStrings);
+
+ return CaseMap.toTitle().wholeString().noLowercase().apply(Locale.getDefault(), /* iter= */
+ null, joinStrings);
}
protected int getUserShortcutTypes(Context context, @UserShortcutType int defaultValue) {
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 52f8f71d57c..0b221e561da 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -25,10 +25,7 @@ import android.app.settings.SettingsEnums;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.res.Resources;
-import android.media.AudioManager;
-import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnPreparedListener;
+import android.icu.text.CaseMap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
@@ -36,18 +33,11 @@ import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
import android.widget.CheckBox;
-import android.widget.ImageView;
-import android.widget.RelativeLayout.LayoutParams;
-import android.widget.VideoView;
import androidx.appcompat.app.AlertDialog;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.PreferenceViewHolder;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
@@ -56,6 +46,7 @@ import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
@@ -81,83 +72,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
private static final char COMPONENT_NAME_SEPARATOR = ':';
private static final TextUtils.SimpleStringSplitter sStringColonSplitter =
new TextUtils.SimpleStringSplitter(COMPONENT_NAME_SEPARATOR);
- protected VideoPreference mVideoPreference;
-
- protected class VideoPreference extends Preference {
- private ImageView mVideoBackgroundView;
- private OnGlobalLayoutListener mLayoutListener;
-
- public VideoPreference(Context context) {
- super(context);
- }
-
- @Override
- public void onBindViewHolder(PreferenceViewHolder view) {
- super.onBindViewHolder(view);
- Resources res = getPrefContext().getResources();
- final int backgroundAssetWidth = res.getDimensionPixelSize(
- R.dimen.screen_magnification_video_background_width);
- final int videoAssetWidth = res
- .getDimensionPixelSize(R.dimen.screen_magnification_video_width);
- final int videoAssetHeight = res
- .getDimensionPixelSize(R.dimen.screen_magnification_video_height);
- final int videoAssetMarginTop = res.getDimensionPixelSize(
- R.dimen.screen_magnification_video_margin_top);
- view.setDividerAllowedAbove(false);
- view.setDividerAllowedBelow(false);
- mVideoBackgroundView = (ImageView) view.findViewById(R.id.video_background);
- final VideoView videoView = (VideoView) view.findViewById(R.id.video);
-
- // Loop the video.
- videoView.setOnPreparedListener(new OnPreparedListener() {
- @Override
- public void onPrepared(MediaPlayer mediaPlayer) {
- mediaPlayer.setLooping(true);
- }
- });
-
- // Make sure the VideoView does not request audio focus.
- videoView.setAudioFocusRequest(AudioManager.AUDIOFOCUS_NONE);
-
- // Resolve and set the video content
- Bundle args = getArguments();
- if ((args != null) && args.containsKey(
- AccessibilitySettings.EXTRA_VIDEO_RAW_RESOURCE_ID)) {
- videoView.setVideoURI(Uri.parse(String.format("%s://%s/%s",
- ContentResolver.SCHEME_ANDROID_RESOURCE,
- getPrefContext().getPackageName(),
- args.getInt(AccessibilitySettings.EXTRA_VIDEO_RAW_RESOURCE_ID))));
- }
-
- // Make sure video controls (e.g. for pausing) are not displayed.
- videoView.setMediaController(null);
-
- // LayoutListener for adjusting the position of the VideoView on the background image.
- mLayoutListener = new OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- final int backgroundViewWidth = mVideoBackgroundView.getWidth();
-
- LayoutParams videoLp = (LayoutParams) videoView.getLayoutParams();
- videoLp.width = videoAssetWidth * backgroundViewWidth / backgroundAssetWidth;
- videoLp.height = videoAssetHeight * backgroundViewWidth / backgroundAssetWidth;
- videoLp.setMargins(0,
- videoAssetMarginTop * backgroundViewWidth / backgroundAssetWidth, 0, 0);
- videoView.setLayoutParams(videoLp);
- videoView.invalidate();
- videoView.start();
- }
- };
-
- mVideoBackgroundView.getViewTreeObserver().addOnGlobalLayoutListener(mLayoutListener);
- }
-
- @Override
- protected void onPrepareForRemoval() {
- mVideoBackgroundView.getViewTreeObserver()
- .removeOnGlobalLayoutListener(mLayoutListener);
- }
- }
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -169,6 +83,10 @@ public class ToggleScreenMagnificationPreferenceFragment extends
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mPackageName = getString(R.string.accessibility_screen_magnification_title);
+ mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
+ .authority(getPrefContext().getPackageName())
+ .appendPath(String.valueOf(R.drawable.accessibility_magnification_banner))
+ .build();
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
removeDialog(DialogEnums.EDIT_SHORTCUT);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
@@ -178,13 +96,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
- final PreferenceScreen preferenceScreen = getPreferenceScreen();
- mVideoPreference = new VideoPreference(getPrefContext());
- mVideoPreference.setSelectable(false);
- mVideoPreference.setPersistent(false);
- mVideoPreference.setLayoutResource(R.layout.magnification_video_preference);
- preferenceScreen.addPreference(mVideoPreference);
-
initShortcutPreference();
super.onViewCreated(view, savedInstanceState);
@@ -204,11 +115,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
AccessibilityManager.class);
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
- VideoView videoView = (VideoView) getView().findViewById(R.id.video);
- if (videoView != null) {
- videoView.start();
- }
-
updateShortcutPreferenceData();
updateShortcutPreference();
}
@@ -348,13 +254,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
if ((shortcutType & UserShortcutType.HARDWARE) == UserShortcutType.HARDWARE) {
final CharSequence hardwareTitle = context.getText(
- R.string.accessibility_shortcut_edit_dialog_title_hardware);
+ R.string.accessibility_shortcut_hardware_keyword);
list.add(hardwareTitle);
}
if ((shortcutType & UserShortcutType.TRIPLETAP) == UserShortcutType.TRIPLETAP) {
final CharSequence tripleTapTitle = context.getText(
- R.string.accessibility_shortcut_edit_dialog_title_triple_tap);
+ R.string.accessibility_shortcut_triple_tap_keyword);
list.add(tripleTapTitle);
}
@@ -363,7 +269,9 @@ public class ToggleScreenMagnificationPreferenceFragment extends
list.add(softwareTitle);
}
final String joinStrings = TextUtils.join(/* delimiter= */", ", list);
- return AccessibilityUtil.capitalize(joinStrings);
+
+ return CaseMap.toTitle().wholeString().noLowercase().apply(Locale.getDefault(), /* iter= */
+ null, joinStrings);
}
@Override
@@ -432,20 +340,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
mToggleServiceDividerSwitchPreference.setVisible(false);
}
- @Override
- protected void onProcessArguments(Bundle arguments) {
- super.onProcessArguments(arguments);
- if (arguments == null) {
- return;
- }
-
- if (arguments.containsKey(AccessibilitySettings.EXTRA_VIDEO_RAW_RESOURCE_ID)) {
- mVideoPreference.setVisible(true);
- } else {
- mVideoPreference.setVisible(false);
- }
- }
-
@Override
public void onToggleClicked(ShortcutPreference preference) {
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
index aa1240921a5..dcaeffe07d8 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
@@ -28,6 +28,7 @@ import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
+import com.android.settings.R;
import com.android.settingslib.bluetooth.A2dpProfile;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
@@ -48,6 +49,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
implements Preference.OnPreferenceClickListener,
LocalBluetoothProfileManager.ServiceListener {
private static final String KEY_PROFILES_GROUP = "bluetooth_profiles";
+ private static final String KEY_BOTTOM_PREFERENCE = "bottom_preference";
+ private static final int ORDINAL = 99;
@VisibleForTesting
static final String HIGH_QUALITY_AUDIO_PREF_TAG = "A2dpProfileHighQualityAudio";
@@ -55,7 +58,9 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
private LocalBluetoothManager mManager;
private LocalBluetoothProfileManager mProfileManager;
private CachedBluetoothDevice mCachedDevice;
- private PreferenceCategory mProfilesContainer;
+
+ @VisibleForTesting
+ PreferenceCategory mProfilesContainer;
public BluetoothDetailsProfilesController(Context context, PreferenceFragmentCompat fragment,
LocalBluetoothManager manager, CachedBluetoothDevice device, Lifecycle lifecycle) {
@@ -69,6 +74,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
@Override
protected void init(PreferenceScreen screen) {
mProfilesContainer = (PreferenceCategory)screen.findPreference(getPreferenceKey());
+ mProfilesContainer.setLayoutResource(R.layout.preference_bluetooth_profile_category);
// Call refresh here even though it will get called later in onResume, to avoid the
// list of switches appearing to "pop" into the page.
refresh();
@@ -283,6 +289,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
mProfilesContainer.removePreference(pref);
}
}
+
+ Preference preference = mProfilesContainer.findPreference(KEY_BOTTOM_PREFERENCE);
+ if (preference == null) {
+ preference = new Preference(mContext);
+ preference.setLayoutResource(R.layout.preference_bluetooth_profile_category);
+ preference.setEnabled(false);
+ preference.setKey(KEY_BOTTOM_PREFERENCE);
+ preference.setOrder(ORDINAL);
+ mProfilesContainer.addPreference(preference);
+ }
}
@Override
diff --git a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
index 792bba5ca5c..95f4daa4c67 100644
--- a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
+++ b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
@@ -18,6 +18,8 @@ package com.android.settings.gestures;
import android.app.settings.SettingsEnums;
import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.os.Bundle;
import android.provider.Settings;
import android.view.WindowManager;
@@ -45,8 +47,7 @@ public class GestureNavigationSettingsFragment extends DashboardFragment {
private WindowManager mWindowManager;
private BackGestureIndicatorView mIndicatorView;
- private static final float[] BACK_GESTURE_INSET_SCALES = {0.75f, 1.0f, 1.33f, 1.66f};
-
+ private float[] mBackGestureInsetScales;
private float mDefaultBackGestureInset;
public GestureNavigationSettingsFragment() {
@@ -59,15 +60,18 @@ public class GestureNavigationSettingsFragment extends DashboardFragment {
mIndicatorView = new BackGestureIndicatorView(getActivity());
mWindowManager = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
-
- mDefaultBackGestureInset = getActivity().getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.config_backGestureInset);
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
+ final Resources res = getActivity().getResources();
+ mDefaultBackGestureInset = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.config_backGestureInset);
+ mBackGestureInsetScales = getFloatArray(res.obtainTypedArray(
+ com.android.internal.R.array.config_backGestureInsetScales));
+
initSeekBarPreference(LEFT_EDGE_SEEKBAR_KEY);
initSeekBarPreference(RIGHT_EDGE_SEEKBAR_KEY);
}
@@ -121,8 +125,8 @@ public class GestureNavigationSettingsFragment extends DashboardFragment {
// Find the closest value to initScale
float minDistance = Float.MAX_VALUE;
int minDistanceIndex = -1;
- for (int i = 0; i < BACK_GESTURE_INSET_SCALES.length; i++) {
- float d = Math.abs(BACK_GESTURE_INSET_SCALES[i] - initScale);
+ for (int i = 0; i < mBackGestureInsetScales.length; i++) {
+ float d = Math.abs(mBackGestureInsetScales[i] - initScale);
if (d < minDistance) {
minDistance = d;
minDistanceIndex = i;
@@ -131,19 +135,29 @@ public class GestureNavigationSettingsFragment extends DashboardFragment {
pref.setProgress(minDistanceIndex);
pref.setOnPreferenceChangeListener((p, v) -> {
- final int width = (int) (mDefaultBackGestureInset * BACK_GESTURE_INSET_SCALES[(int) v]);
+ final int width = (int) (mDefaultBackGestureInset * mBackGestureInsetScales[(int) v]);
mIndicatorView.setIndicatorWidth(width, key == LEFT_EDGE_SEEKBAR_KEY);
return true;
});
pref.setOnPreferenceChangeStopListener((p, v) -> {
mIndicatorView.setIndicatorWidth(0, key == LEFT_EDGE_SEEKBAR_KEY);
- final float scale = BACK_GESTURE_INSET_SCALES[(int) v];
+ final float scale = mBackGestureInsetScales[(int) v];
Settings.Secure.putFloat(getContext().getContentResolver(), settingsKey, scale);
return true;
});
}
+ private static float[] getFloatArray(TypedArray array) {
+ int length = array.length();
+ float[] floatArray = new float[length];
+ for (int i = 0; i < length; i++) {
+ floatArray[i] = array.getFloat(i, 1.0f);
+ }
+ array.recycle();
+ return floatArray;
+ }
+
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.gesture_navigation_settings) {
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index 316060996a1..9e682021a00 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -54,8 +54,8 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
private static final String TAG = "WifiTetherSettings";
private static final IntentFilter TETHER_STATE_CHANGE_FILTER;
private static final String KEY_WIFI_TETHER_SCREEN = "wifi_tether_settings_screen";
- private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
- private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
+ private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 3;
+ private static final int EXPANDED_CHILD_COUNT_DEFAULT = 4;
@VisibleForTesting
static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java
index 5fc45a63773..c5b0a6a0630 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java
@@ -29,6 +29,7 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
+import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.SwitchPreference;
@@ -84,6 +85,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
mController = new BluetoothDetailsProfilesController(mContext, mFragment, mLocalManager,
mCachedDevice, mLifecycle);
mProfiles.setKey(mController.getPreferenceKey());
+ mController.mProfilesContainer = mProfiles;
mScreen.addPreference(mProfiles);
}
@@ -193,11 +195,14 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
private List getProfileSwitches(boolean expectOnlyMConnectable) {
if (expectOnlyMConnectable) {
assertThat(mConnectableProfiles).isNotEmpty();
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(mConnectableProfiles.size());
+ assertThat(mProfiles.getPreferenceCount() - 1).isEqualTo(mConnectableProfiles.size());
}
List result = new ArrayList<>();
for (int i = 0; i < mProfiles.getPreferenceCount(); i++) {
- result.add((SwitchPreference)mProfiles.getPreference(i));
+ final Preference preference = mProfiles.getPreference(i);
+ if (preference instanceof SwitchPreference) {
+ result.add((SwitchPreference) preference);
+ }
}
return result;
}
@@ -236,7 +241,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
mController.onDeviceAttributesChanged();
// There should have been no new switches added.
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(3);
// Make sure both switches got disabled.
assertThat(switches.get(0).isEnabled()).isFalse();
@@ -258,7 +263,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
assertThat(mConnectableProfiles.get(0).isEnabled(mDevice)).isFalse();
// Make sure no new preferences were added.
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(3);
// Clicking the pref again should make the profile once again preferred.
pref.performClick();
@@ -266,7 +271,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
assertThat(mConnectableProfiles.get(0).isEnabled(mDevice)).isTrue();
// Make sure we still haven't gotten any new preferences added.
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(3);
}
@Test
@@ -295,7 +300,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
assertThat(pref.isChecked()).isTrue();
pref.performClick();
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(1);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
assertThat(mDevice.getPhonebookAccessPermission())
.isEqualTo(BluetoothDevice.ACCESS_REJECTED);
}
@@ -318,7 +323,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
assertThat(pref.isChecked()).isFalse();
pref.performClick();
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(1);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
assertThat(mDevice.getPhonebookAccessPermission())
.isEqualTo(BluetoothDevice.ACCESS_ALLOWED);
}
@@ -340,7 +345,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
assertThat(pref.isChecked()).isFalse();
pref.performClick();
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(1);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
assertThat(mDevice.getMessageAccessPermission()).isEqualTo(BluetoothDevice.ACCESS_ALLOWED);
}
@@ -386,7 +391,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
setupDevice(makeDefaultDeviceConfig());
addMockA2dpProfile(true, false, false);
showScreen(mController);
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(1);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
SwitchPreference pref = (SwitchPreference) mProfiles.getPreference(0);
assertThat(pref.getKey())
.isNotEqualTo(BluetoothDetailsProfilesController.HIGH_QUALITY_AUDIO_PREF_TAG);
@@ -408,7 +413,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
setupDevice(makeDefaultDeviceConfig());
A2dpProfile audioProfile = addMockA2dpProfile(true, true, true);
showScreen(mController);
- assertThat(mProfiles.getPreferenceCount()).isEqualTo(2);
+ assertThat(mProfiles.getPreferenceCount()).isEqualTo(3);
// Disabling media audio should cause the high quality audio switch to disappear, but not
// the regular audio one.