Snap for 8909196 from cb930bc0ff to tm-qpr1-release

Change-Id: Iad8489298add4d5fc18d622d7cbf1d3c344234ff
This commit is contained in:
Android Build Coastguard Worker
2022-08-05 03:25:12 +00:00
28 changed files with 119 additions and 11 deletions

View File

@@ -34,5 +34,6 @@
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceListItem"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
style="@style/MainSwitchText.Settingslib" />
</LinearLayout>

View File

@@ -60,6 +60,7 @@
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:ellipsize="marquee" />
<TextView
@@ -71,6 +72,7 @@
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="10" />
</RelativeLayout>

View File

@@ -52,6 +52,7 @@
android:textColor="?android:attr/textColorSecondary"
android:focusable="false"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="2" />
</RelativeLayout>

View File

@@ -57,6 +57,7 @@
android:ellipsize="marquee"
android:duplicateParentState="true"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
/>
<TextView
android:id="@android:id/summary"
@@ -69,6 +70,7 @@
android:visibility="gone"
android:duplicateParentState="true"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
/>
</LinearLayout>
<TextView

View File

@@ -29,6 +29,7 @@
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceMedium"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textColor="?android:attr/textColorSecondary" />
<com.android.settings.fuelgauge.BatteryActiveView

View File

@@ -54,6 +54,15 @@
<include
android:id="@+id/bluetooth_audio_codec_ldac"
layout="@layout/preference_widget_dialog_radiobutton"/>
<include
android:id="@+id/bluetooth_audio_codec_lc3"
layout="@layout/preference_widget_dialog_radiobutton"/>
<include
android:id="@+id/bluetooth_audio_codec_opus"
layout="@layout/preference_widget_dialog_radiobutton"/>
</RadioGroup>
<include

View File

@@ -59,7 +59,8 @@
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/customize_button_title"
android:hyphenationFrequency="full"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
app:layout_constraintTop_toTopOf="@+id/preview"
app:layout_constraintBottom_toBottomOf="@+id/preview"
app:layout_constraintStart_toStartOf="@+id/preview"

View File

@@ -63,6 +63,7 @@
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:ellipsize="marquee"/>
<TextView
@@ -77,6 +78,7 @@
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
style="@style/PreferenceSummaryTextStyle"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -31,6 +31,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:layout_weight="1" />
<TextView
@@ -41,6 +42,7 @@
android:layout_width="wrap_content"
android:layout_weight="1"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:gravity="end|bottom" />
</LinearLayout>

View File

@@ -39,6 +39,7 @@
android:singleLine="true"
android:textAlignment="viewStart"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
@@ -52,6 +53,7 @@
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorSecondary"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View

View File

@@ -62,6 +62,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:fadingEdge="horizontal"/>
<TextView
android:id="@android:id/summary"
@@ -76,6 +77,7 @@
android:textColor="?android:attr/textColorSecondary"
android:focusable="false"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="4" />
</RelativeLayout>
</LinearLayout>

View File

@@ -46,6 +46,7 @@
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:fadingEdge="horizontal"/>
<LinearLayout
android:id="@android:id/widget_frame"

View File

@@ -58,6 +58,7 @@
android:layout_alignStart="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="2" />
</RelativeLayout>

View File

@@ -36,6 +36,7 @@
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textColor="?android:attr/textColorPrimary" />
<TextView
@@ -46,6 +47,7 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textColor="?android:attr/textColorSecondary" />
<include

View File

@@ -39,6 +39,7 @@
android:textAlignment="center"
android:ellipsize="marquee"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:fadingEdge="horizontal" />
<TextView
@@ -52,6 +53,7 @@
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorSecondary"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="10" />
</RelativeLayout>

View File

@@ -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"/>
<ProgressBar

View File

@@ -76,6 +76,7 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
<LinearLayout

View File

@@ -77,6 +77,7 @@
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="10" />
</RelativeLayout>

View File

@@ -74,6 +74,7 @@
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="10" />
</RelativeLayout>

View File

@@ -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" />
</com.android.settings.CheckableLinearLayout>

View File

@@ -56,6 +56,7 @@
android:fadingEdge="horizontal"
android:maxLines="2"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textAppearance="?android:attr/textAppearanceListItem"/>
<TextView
@@ -65,6 +66,7 @@
android:textDirection="locale"
android:textAppearance="?android:attr/textAppearanceSmall"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>

View File

@@ -33,7 +33,8 @@
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1"
android:hyphenationFrequency="normalFast"
/>
android:lineBreakWordStyle="phrase"
/>
<TextView android:id="@android:id/summary"
android:layout_width="match_parent"
@@ -42,6 +43,7 @@
android:textColor="?android:attr/textColorSecondary"
android:paddingBottom="5dp"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:maxLines="10" />
<ProgressBar

View File

@@ -17,5 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hyphenationFrequency="normal"
android:hyphenationFrequency="normalFast"
android:lineBreakWordStyle="phrase"
android:textAppearance="?android:attr/textAppearanceSmall" />

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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++) {

View File

@@ -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;

View File

@@ -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<BluetoothCodecConfig> 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<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC);
List<BluetoothCodecConfig> 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<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigAAC, mCodecConfigSBC);
List<BluetoothCodecConfig> mCodecConfigs = Arrays.asList(mCodecConfigOPUS,
mCodecConfigAAC, mCodecConfigSBC);
mCodecStatus = new BluetoothCodecStatus.Builder()
.setCodecConfig(mCodecConfigAAC)
.setCodecsSelectableCapabilities(mCodecConfigs)