Snap for 12078078 from c5e168c830 to 24Q4-release
Change-Id: Ib4bb866fd2c7b29f3c1a9f1b37a832b8fa26e23c
This commit is contained in:
@@ -10,6 +10,16 @@ flag {
|
||||
bug: "332974327"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "audio_balance_state_description"
|
||||
namespace: "accessibility"
|
||||
description: "Provides a more valuable state description to the audio balance slider."
|
||||
bug: "319575109"
|
||||
metadata {
|
||||
purpose: PURPOSE_BUGFIX
|
||||
}
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "edit_shortcuts_in_full_screen"
|
||||
namespace: "accessibility"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
android:src="@drawable/counter_1_24dp" />
|
||||
<TextView
|
||||
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||
android:layout_toRightOf="@+id/lockIcon"
|
||||
android:layout_toEndOf="@+id/lockIcon"
|
||||
android:text="@string/private_space_separate_account_text"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
@@ -64,7 +64,7 @@
|
||||
android:src="@drawable/counter_2_24dp" />
|
||||
<TextView
|
||||
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||
android:layout_toRightOf="@+id/bellIcon"
|
||||
android:layout_toEndOf="@+id/bellIcon"
|
||||
android:text="@string/private_space_protected_lock_text"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
@@ -77,7 +77,7 @@
|
||||
android:src="@drawable/counter_3_24dp" />
|
||||
<TextView
|
||||
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||
android:layout_toRightOf="@+id/appsIcon"
|
||||
android:layout_toEndOf="@+id/appsIcon"
|
||||
android:text="@string/private_space_install_apps_text"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
@@ -94,7 +94,7 @@
|
||||
android:src="@drawable/ic_private_space_edu_icon" />
|
||||
<TextView
|
||||
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||
android:layout_toRightOf="@+id/eduIcon"
|
||||
android:layout_toEndOf="@+id/eduIcon"
|
||||
android:text="@string/private_space_apps_stopped_text"/>
|
||||
</RelativeLayout>
|
||||
<Space
|
||||
@@ -112,13 +112,13 @@
|
||||
android:id="@+id/info"
|
||||
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||
android:textSize = "14sp"
|
||||
android:layout_toRightOf="@+id/infoIcon"
|
||||
android:layout_toEndOf="@+id/infoIcon"
|
||||
android:text="@string/private_space_apps_permission_text"/>
|
||||
<TextView
|
||||
android:id="@+id/learn_more"
|
||||
style="@style/PrivateSpaceSetupSubHeaderStyle"
|
||||
android:layout_below="@id/info"
|
||||
android:layout_alignLeft="@+id/info"
|
||||
android:layout_alignStart="@+id/info"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/private_space_learn_more_text"/>
|
||||
|
||||
@@ -9339,8 +9339,6 @@
|
||||
<string name="zen_mode_apps_priority_apps">Selected apps</string>
|
||||
<!-- [CHAR LIMIT=60] Zen mode settings: no apps will be able to bypass dnd -->
|
||||
<string name="zen_mode_apps_none_apps">None</string>
|
||||
<!-- [CHAR LIMIT=60] Zen mode settings: all apps will be able to bypass dnd -->
|
||||
<string name="zen_mode_apps_all_apps">All</string>
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode settings: Lists apps that can bypass DND. For example, "Nest, Messages, and 2 more can interrupt". -->
|
||||
<string name="zen_mode_apps_subtext">
|
||||
{count, plural, offset:2
|
||||
@@ -13483,6 +13481,10 @@
|
||||
<string name="live_caption_disabled">Off</string>
|
||||
<!-- Summary of the Live Caption enabled state. -->
|
||||
<string name="live_caption_enabled">On</string>
|
||||
<!-- State description for the Audio Balance seek bar, with left reported before right. -->
|
||||
<string name="audio_seek_bar_state_left_first">Audio %1$d%% left, %2$d%% right</string>
|
||||
<!-- State description for the Audio Balance seek bar, with right reported before left. -->
|
||||
<string name="audio_seek_bar_state_right_first">Audio %1$d%% right, %2$d%% left</string>
|
||||
|
||||
<!-- Warning text about the visibility of device name. [CHAR LIMIT=NONE] -->
|
||||
<string name="about_phone_device_name_warning">Your device name is visible to apps you installed. It may also be seen by other people when you connect to Bluetooth devices, connect to a Wi-Fi network or set up a Wi-Fi hotspot.</string>
|
||||
|
||||
@@ -982,14 +982,15 @@
|
||||
</style>
|
||||
|
||||
<style name="PrivateSpaceBulletPointTextFontStyle" parent="@style/PrivateSpaceSetupTextFontStyle">
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textAlignment">viewStart</item>
|
||||
</style>
|
||||
|
||||
<style name="PrivateSpaceBulletPointIconStyle">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_alignParentLeft">true</item>
|
||||
<item name="android:layout_alignParentStart">true</item>
|
||||
<item name="android:layout_alignParentTop">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -34,11 +34,6 @@
|
||||
android:title="@string/zen_mode_apps_none_apps"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
android:key="zen_mode_apps_all"
|
||||
android:title="@string/zen_mode_apps_all_apps"
|
||||
settings:searchable="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -20,6 +20,7 @@ import static android.view.HapticFeedbackConstants.CLOCK_TICK;
|
||||
|
||||
import static com.android.settings.Utils.isNightMode;
|
||||
|
||||
import android.annotation.StringRes;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
@@ -86,6 +87,14 @@ public class BalanceSeekBar extends SeekBar {
|
||||
Settings.System.putFloatForUser(mContext.getContentResolver(),
|
||||
Settings.System.MASTER_BALANCE, balance, UserHandle.USER_CURRENT);
|
||||
}
|
||||
final int max = getMax();
|
||||
if (Flags.audioBalanceStateDescription() && max > 0) {
|
||||
seekBar.setStateDescription(createStateDescription(mContext,
|
||||
R.string.audio_seek_bar_state_left_first,
|
||||
R.string.audio_seek_bar_state_right_first,
|
||||
progress,
|
||||
max));
|
||||
}
|
||||
// If fromUser is false, the call is a set from the framework on creation or on
|
||||
// internal update. The progress may be zero, ignore (don't change system settings).
|
||||
|
||||
@@ -161,5 +170,19 @@ public class BalanceSeekBar extends SeekBar {
|
||||
canvas.restore();
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
private static CharSequence createStateDescription(Context context,
|
||||
@StringRes int resIdLeftFirst, @StringRes int resIdRightFirst,
|
||||
int progress, float max) {
|
||||
final boolean isLayoutRtl = context.getResources().getConfiguration().getLayoutDirection()
|
||||
== LAYOUT_DIRECTION_RTL;
|
||||
final int rightPercent = (int) (100 * (progress / max));
|
||||
final int leftPercent = 100 - rightPercent;
|
||||
if (rightPercent > leftPercent || (rightPercent == leftPercent && isLayoutRtl)) {
|
||||
return context.getString(resIdRightFirst, rightPercent, leftPercent);
|
||||
} else {
|
||||
return context.getString(resIdLeftFirst, leftPercent, rightPercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,23 +28,32 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.robolectric.Shadows.shadowOf;
|
||||
|
||||
import android.content.Context;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowSystemSettings;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = {
|
||||
ShadowSystemSettings.class,
|
||||
})
|
||||
public class BalanceSeekBarTest {
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
// Fix the maximum process value to 200 for testing the BalanceSeekBar.
|
||||
// It affects the SeekBar value of center(100) and snapThreshold(200 * SNAP_TO_PERCENTAGE).
|
||||
private static final int MAX_PROGRESS_VALUE = 200;
|
||||
@@ -143,6 +152,58 @@ public class BalanceSeekBarTest {
|
||||
assertThat(mSeekBar.getProgress()).isEqualTo(progressWithoutThreshold);
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_AUDIO_BALANCE_STATE_DESCRIPTION)
|
||||
public void onProgressChanged_getStateDescription_centered_leftFirst() {
|
||||
// Seek bar centered
|
||||
int progress = (int) (0.50f * MAX_PROGRESS_VALUE);
|
||||
mSeekBar.setMax(MAX_PROGRESS_VALUE);
|
||||
|
||||
mProxySeekBarListener.onProgressChanged(mSeekBar, progress, true);
|
||||
|
||||
assertThat(mSeekBar.getStateDescription()).isEqualTo(
|
||||
mContext.getString(R.string.audio_seek_bar_state_left_first, 50, 50));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_AUDIO_BALANCE_STATE_DESCRIPTION)
|
||||
public void onProgressChanged_getStateDescription_centered_rtl_rightFirst() {
|
||||
// RTL layout
|
||||
mContext.getResources().getConfiguration().setLayoutDirection(new Locale("iw", "IL"));
|
||||
// Seek bar centered
|
||||
int progress = (int) (0.50f * MAX_PROGRESS_VALUE);
|
||||
mSeekBar.setMax(MAX_PROGRESS_VALUE);
|
||||
|
||||
mProxySeekBarListener.onProgressChanged(mSeekBar, progress, true);
|
||||
|
||||
assertThat(mSeekBar.getStateDescription()).isEqualTo(
|
||||
mContext.getString(R.string.audio_seek_bar_state_right_first, 50, 50));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_AUDIO_BALANCE_STATE_DESCRIPTION)
|
||||
public void onProgressChanged_getStateDescription_25percent_leftFirst() {
|
||||
// Seek bar 3/4th toward the left
|
||||
int progress = (int) (0.25f * MAX_PROGRESS_VALUE);
|
||||
mSeekBar.setMax(MAX_PROGRESS_VALUE);
|
||||
mProxySeekBarListener.onProgressChanged(mSeekBar, progress, true);
|
||||
|
||||
assertThat(mSeekBar.getStateDescription()).isEqualTo(
|
||||
mContext.getString(R.string.audio_seek_bar_state_left_first, 75, 25));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_AUDIO_BALANCE_STATE_DESCRIPTION)
|
||||
public void onProgressChanged_getStateDescription_75percent_rightFirst() {
|
||||
// Seek bar 3/4th toward the right
|
||||
int progress = (int) (0.75f * MAX_PROGRESS_VALUE);
|
||||
mSeekBar.setMax(MAX_PROGRESS_VALUE);
|
||||
mProxySeekBarListener.onProgressChanged(mSeekBar, progress, true);
|
||||
|
||||
assertThat(mSeekBar.getStateDescription()).isEqualTo(
|
||||
mContext.getString(R.string.audio_seek_bar_state_right_first, 75, 25));
|
||||
}
|
||||
|
||||
// method to get the center from BalanceSeekBar for testing setMax().
|
||||
private int getBalanceSeekBarCenter(BalanceSeekBar seekBar) {
|
||||
return seekBar.getMax() / 2;
|
||||
|
||||
Reference in New Issue
Block a user