diff --git a/res/layout/accessibility_launch_activity_preference.xml b/res/layout/accessibility_launch_activity_preference.xml index 0e3e2251d44..26a1c334212 100644 --- a/res/layout/accessibility_launch_activity_preference.xml +++ b/res/layout/accessibility_launch_activity_preference.xml @@ -34,5 +34,6 @@ android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceListItem" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" style="@style/MainSwitchText.Settingslib" /> diff --git a/res/layout/accessibility_shortcut_secondary_action.xml b/res/layout/accessibility_shortcut_secondary_action.xml index ddbadb5b911..b3b81fe5593 100644 --- a/res/layout/accessibility_shortcut_secondary_action.xml +++ b/res/layout/accessibility_shortcut_secondary_action.xml @@ -60,6 +60,7 @@ android:singleLine="true" android:textAppearance="?android:attr/textAppearanceListItem" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:ellipsize="marquee" /> diff --git a/res/layout/apn_preference_layout.xml b/res/layout/apn_preference_layout.xml index 2c453aa591e..241be74fe29 100644 --- a/res/layout/apn_preference_layout.xml +++ b/res/layout/apn_preference_layout.xml @@ -52,6 +52,7 @@ android:textColor="?android:attr/textColorSecondary" android:focusable="false" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:maxLines="2" /> diff --git a/res/layout/app_preference_item.xml b/res/layout/app_preference_item.xml index c6857604c79..7e7ff392bd6 100755 --- a/res/layout/app_preference_item.xml +++ b/res/layout/app_preference_item.xml @@ -57,6 +57,7 @@ android:ellipsize="marquee" android:duplicateParentState="true" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" /> + + + + + diff --git a/res/layout/horizontal_preference.xml b/res/layout/horizontal_preference.xml index d87963cc446..922143b4df2 100644 --- a/res/layout/horizontal_preference.xml +++ b/res/layout/horizontal_preference.xml @@ -31,6 +31,7 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:layout_weight="1" /> diff --git a/res/layout/notification_app.xml b/res/layout/notification_app.xml index 2d17c8d9b15..15e83f1837b 100644 --- a/res/layout/notification_app.xml +++ b/res/layout/notification_app.xml @@ -39,6 +39,7 @@ android:singleLine="true" android:textAlignment="viewStart" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/res/layout/preference_balance_slider.xml b/res/layout/preference_balance_slider.xml index 3f1c4edfb9d..278cf793d43 100644 --- a/res/layout/preference_balance_slider.xml +++ b/res/layout/preference_balance_slider.xml @@ -46,6 +46,7 @@ android:textColor="?android:attr/textColorPrimary" android:ellipsize="marquee" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:fadingEdge="horizontal"/> diff --git a/res/layout/preference_labeled_slider.xml b/res/layout/preference_labeled_slider.xml index 610b79f1e13..a11d574b319 100644 --- a/res/layout/preference_labeled_slider.xml +++ b/res/layout/preference_labeled_slider.xml @@ -36,6 +36,7 @@ android:singleLine="true" android:textAppearance="?android:attr/textAppearanceListItem" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:textColor="?android:attr/textColorPrimary" /> diff --git a/res/layout/preference_progress_category.xml b/res/layout/preference_progress_category.xml index 9e33c5d4476..b04f5bee659 100644 --- a/res/layout/preference_progress_category.xml +++ b/res/layout/preference_progress_category.xml @@ -48,6 +48,7 @@ android:layout_gravity="start|center" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:textColor="?android:attr/colorAccent"/> diff --git a/res/layout/preference_two_target_radio.xml b/res/layout/preference_two_target_radio.xml index e5e6d4a3a00..ece07464f52 100644 --- a/res/layout/preference_two_target_radio.xml +++ b/res/layout/preference_two_target_radio.xml @@ -74,6 +74,7 @@ android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textColor="?android:attr/textColorSecondary" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:maxLines="10" /> diff --git a/res/layout/radio_with_summary.xml b/res/layout/radio_with_summary.xml index 2f39e6746c9..ac65a0e81e4 100644 --- a/res/layout/radio_with_summary.xml +++ b/res/layout/radio_with_summary.xml @@ -34,6 +34,7 @@ android:paddingStart="20dp" android:drawableStart="?android:attr/listChoiceIndicatorSingle" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:ellipsize="marquee" /> @@ -45,6 +46,7 @@ android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textColor="?android:attr/textColorSecondary" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:maxLines="10" /> diff --git a/res/layout/running_services_app_item.xml b/res/layout/running_services_app_item.xml index f2585303aea..65328bab338 100644 --- a/res/layout/running_services_app_item.xml +++ b/res/layout/running_services_app_item.xml @@ -56,6 +56,7 @@ android:fadingEdge="horizontal" android:maxLines="2" android:hyphenationFrequency="normalFast" + android:lineBreakWordStyle="phrase" android:textAppearance="?android:attr/textAppearanceListItem"/> diff --git a/res/layout/settings_summary_preference.xml b/res/layout/settings_summary_preference.xml index 2f899e170f9..894a5e54661 100644 --- a/res/layout/settings_summary_preference.xml +++ b/res/layout/settings_summary_preference.xml @@ -33,7 +33,8 @@ android:textColor="?android:attr/textColorPrimary" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1" android:hyphenationFrequency="normalFast" - /> + android:lineBreakWordStyle="phrase" + /> diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java index 9c24a238051..5f15093259f 100644 --- a/src/com/android/settings/core/SettingsBaseActivity.java +++ b/src/com/android/settings/core/SettingsBaseActivity.java @@ -23,6 +23,7 @@ import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.TypedArray; +import android.graphics.text.LineBreakConfig; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -109,6 +110,12 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa if (mCollapsingToolbarLayout != null) { mCollapsingToolbarLayout.setLineSpacingMultiplier(TOOLBAR_LINE_SPACING_MULTIPLIER); mCollapsingToolbarLayout.setHyphenationFrequency(HYPHENATION_FREQUENCY_NORMAL_FAST); + mCollapsingToolbarLayout.setStaticLayoutBuilderConfigurer(builder -> + builder.setLineBreakConfig( + new LineBreakConfig.Builder() + .setLineBreakWordStyle( + LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE) + .build())); } disableCollapsingToolbarLayoutScrollingBehavior(); } else { diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java index 62bcffbfc28..c9cc2b79beb 100644 --- a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java +++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java @@ -40,7 +40,11 @@ public abstract class AbstractBluetoothDialogPreferenceController extends private static final String TAG = "AbstractBtDlgCtr"; - protected static final int[] CODEC_TYPES = {BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC, + private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO(b/240635097): remove in U + + protected static final int[] CODEC_TYPES = {SOURCE_CODEC_TYPE_OPUS, + BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3, + BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC, BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD, BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX, BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java index 6a733f3fbab..929a6d02f10 100644 --- a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java +++ b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreference.java @@ -61,6 +61,8 @@ public class BluetoothCodecDialogPreference extends BaseBluetoothDialogPreferenc mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx); mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx_hd); mRadioButtonIds.add(R.id.bluetooth_audio_codec_ldac); + mRadioButtonIds.add(R.id.bluetooth_audio_codec_lc3); + mRadioButtonIds.add(R.id.bluetooth_audio_codec_opus); String[] stringArray = context.getResources().getStringArray( R.array.bluetooth_a2dp_codec_titles); for (int i = 0; i < stringArray.length; i++) { diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java index a65a1ba8cd4..87d5ff09fc5 100644 --- a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java +++ b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java @@ -40,6 +40,8 @@ public class BluetoothCodecDialogPreferenceController extends private static final String KEY = "bluetooth_audio_codec_settings"; private static final String TAG = "BtCodecCtr"; + private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U + private final Callback mCallback; public BluetoothCodecDialogPreferenceController(Context context, Lifecycle lifecycle, @@ -118,6 +120,14 @@ public class BluetoothCodecDialogPreferenceController extends codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC; codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST; break; + case 6: + codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3; + codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST; + break; + case 7: + codecTypeValue = SOURCE_CODEC_TYPE_OPUS; // TODO update in U + codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST; + break; default: break; } @@ -180,6 +190,9 @@ public class BluetoothCodecDialogPreferenceController extends case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC: index = 5; break; + case SOURCE_CODEC_TYPE_OPUS: // TODO update in U + index = 7; + break; default: Log.e(TAG, "Unsupported config:" + config); break; diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java index f04a80d1988..8da44cc0d87 100644 --- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java @@ -52,6 +52,8 @@ import java.util.List; @RunWith(RobolectricTestRunner.class) public class BluetoothCodecDialogPreferenceControllerTest { + private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO(b/240635097): remove in U + private static final String DEVICE_ADDRESS = "00:11:22:33:44:55"; @Mock @@ -72,6 +74,7 @@ public class BluetoothCodecDialogPreferenceControllerTest { private BluetoothCodecConfig mCodecConfigAPTX; private BluetoothCodecConfig mCodecConfigAPTXHD; private BluetoothCodecConfig mCodecConfigLDAC; + private BluetoothCodecConfig mCodecConfigOPUS; private BluetoothDevice mActiveDevice; private Context mContext; private LifecycleOwner mLifecycleOwner; @@ -119,13 +122,17 @@ public class BluetoothCodecDialogPreferenceControllerTest { mCodecConfigLDAC = new BluetoothCodecConfig.Builder() .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC) .build(); + mCodecConfigOPUS = new BluetoothCodecConfig.Builder() + .setCodecType(SOURCE_CODEC_TYPE_OPUS) + .build(); when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.A2DP))) .thenReturn(Arrays.asList(mActiveDevice)); } @Test public void writeConfigurationValues_selectDefault_setHighest() { - BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC}; + BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC, + mCodecConfigSBC}; mCodecStatus = new BluetoothCodecStatus.Builder() .setCodecConfig(mCodecConfigSBC) .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs)) @@ -136,13 +143,14 @@ public class BluetoothCodecDialogPreferenceControllerTest { mController.onBluetoothServiceConnected(mBluetoothA2dp); mController.writeConfigurationValues(0); - verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC); + // TODO(b/240635097): update in U + verify(mBluetoothA2dpConfigStore).setCodecType(SOURCE_CODEC_TYPE_OPUS); } @Test public void writeConfigurationValues_checkCodec() { - BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX, - mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC}; + BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigOPUS, mCodecConfigAAC, + mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC}; mCodecStatus = new BluetoothCodecStatus.Builder() .setCodecConfig(mCodecConfigSBC) .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs)) @@ -167,12 +175,15 @@ public class BluetoothCodecDialogPreferenceControllerTest { mController.writeConfigurationValues(5); verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC); + mController.writeConfigurationValues(7); + // TODO(b/240635097): update in U + verify(mBluetoothA2dpConfigStore).setCodecType(SOURCE_CODEC_TYPE_OPUS); } @Test public void writeConfigurationValues_resetHighestConfig() { BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX, - mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC}; + mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigOPUS}; mCodecStatus = new BluetoothCodecStatus.Builder() .setCodecConfig(mCodecConfigAAC) .setCodecsSelectableCapabilities(Arrays.asList(mCodecConfigs)) @@ -197,6 +208,14 @@ public class BluetoothCodecDialogPreferenceControllerTest { mController.convertCfgToBtnIndex(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC)); } + @Test + public void getCurrentIndexByConfig_verifyOpusIndex() { + assertThat(mController.getCurrentIndexByConfig(mCodecConfigOPUS)).isEqualTo( + mController.convertCfgToBtnIndex(SOURCE_CODEC_TYPE_OPUS)); + // TODO(b/240635097): update in U + } + + @Test public void onIndexUpdated_notifyPreference() { mController.onIndexUpdated(0); @@ -204,9 +223,29 @@ public class BluetoothCodecDialogPreferenceControllerTest { verify(mCallback).onBluetoothCodecChanged(); } + @Test + public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsOpus() { + List mCodecConfigs = Arrays.asList(mCodecConfigOPUS, + mCodecConfigAAC, mCodecConfigSBC); + mCodecStatus = new BluetoothCodecStatus.Builder() + .setCodecConfig(mCodecConfigOPUS) + .setCodecsSelectableCapabilities(mCodecConfigs) + .build(); + when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus); + when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn( + BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED); + mController.onBluetoothServiceConnected(mBluetoothA2dp); + + mController.onHDAudioEnabled(/* enabled= */ true); + + verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType( + eq(SOURCE_CODEC_TYPE_OPUS)); // TODO(b/240635097): update in U + } + @Test public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsAAC() { - List mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC); + List mCodecConfigs = Arrays.asList(mCodecConfigOPUS, + mCodecConfigAAC, mCodecConfigSBC); mCodecStatus = new BluetoothCodecStatus.Builder() .setCodecConfig(mCodecConfigAAC) .setCodecsSelectableCapabilities(mCodecConfigs) @@ -223,7 +262,8 @@ public class BluetoothCodecDialogPreferenceControllerTest { } @Test public void onHDAudioEnabled_optionalCodecDisabled_setsCodecTypeAsSBC() { - List mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC); + List mCodecConfigs = Arrays.asList(mCodecConfigOPUS, + mCodecConfigAAC, mCodecConfigSBC); mCodecStatus = new BluetoothCodecStatus.Builder() .setCodecConfig(mCodecConfigAAC) .setCodecsSelectableCapabilities(mCodecConfigs)