Snap for 8479861 from cf601f574b to tm-qpr1-release

Change-Id: Iec35cc407823953f9506749ca2350cea897c30f7
This commit is contained in:
Android Build Coastguard Worker
2022-04-21 03:09:16 +00:00
13 changed files with 103 additions and 12 deletions

View File

@@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
android:imeOptions="actionNext|flagForceAscii"
android:imeOptions="actionNext|flagForceAscii|flagNoExtractUi"
android:gravity="center"
style="@style/TextAppearance.PasswordEntry"/>

View File

@@ -52,7 +52,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
android:imeOptions="actionNext|flagForceAscii"
android:imeOptions="actionNext|flagForceAscii|flagNoExtractUi"
android:gravity="center"
style="@style/TextAppearance.PasswordEntry"/>
@@ -85,4 +85,4 @@
android:text="@string/cancel" />
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
</com.google.android.setupdesign.GlifLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -30,9 +30,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginEnd="?attr/sudMarginEnd">
android:orientation="vertical">
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/error_text"

View File

@@ -30,9 +30,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginEnd="?attr/sudMarginEnd">
android:orientation="vertical">
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/error_text"

View File

@@ -2931,6 +2931,8 @@
<string name="auto_rotate_screen_summary">Automatically adjust the screen orientation when you move your phone between portrait and landscape</string>
<!-- Accessibility description for auto rotate learn more link [CHAR LIMIT=NONE] -->
<string name="auto_rotate_link_a11y">Learn more about auto-rotate</string>
<!-- Accessibility summary text for auto rotate [CHAR LIMIT=60] -->
<string name="auto_rotate_summary_a11y">When you move your phone between portrait and landscape</string>
<!-- Display settings screen, screen resolution settings title [CHAR LIMIT=30] -->
<string name="screen_resolution_title">Screen resolution</string>
@@ -5300,6 +5302,8 @@
<string name="accessibility_text_reading_preview_mail_content">Good morning!\n\nI just wanted to check how the designs are coming. Will they be ready before we start building the new balloons?</string>
<!-- Title for the reset button of the accessibility text reading page to reset all preferences state. [CHAR LIMIT=25] -->
<string name="accessibility_text_reading_reset_button_title">Reset settings</string>
<!-- Message for the toast after clicking the reset button of the dialog of the accessibility text reading page. [CHAR LIMIT=NONE] -->
<string name="accessibility_text_reading_reset_message">Display size and text settings have been reset</string>
<!-- Title for the confirm dialog of reset settings. [CHAR LIMIT=NONE] -->
<string name="accessibility_text_reading_confirm_dialog_title">Reset display size and text?</string>
<!-- Message for the confirm dialog of reset settings. [CHAR LIMIT=NONE] -->

View File

@@ -229,8 +229,6 @@
<item name="android:clipToPadding">true</item>
<item name="android:clipChildren">true</item>
<item name="android:textAppearanceListItem">@style/TextAppearance.PreferenceTitle.SettingsLib</item>
<item name="android:listPreferredItemPaddingStart">@dimen/settingslib_listPreferredItemPaddingStart</item>
<item name="android:listPreferredItemPaddingEnd">16dp</item>
<item name="preferenceTheme">@style/PreferenceTheme.SettingsLib</item>
<item name="android:switchStyle">@style/Switch.SettingsLib</item>
<item name="preferenceFragmentCompatStyle">@style/SetupWizardPreferenceFragmentStyle</item>

View File

@@ -23,6 +23,7 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
@@ -178,6 +179,9 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
} else {
mResetStateListeners.forEach(ResetStateListener::resetState);
}
Toast.makeText(getPrefContext(), R.string.accessibility_text_reading_reset_message,
Toast.LENGTH_SHORT).show();
}
private List<ResetStateListener> getResetStateListeners() {

View File

@@ -51,6 +51,11 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
final boolean isEnabled = Settings.Secure.getInt(getContentResolver(), ENABLED, OFF) == ON;
if (enabled == isEnabled) {
return;
}
if (enabled) {
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
}

View File

@@ -166,6 +166,11 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
final boolean isEnabled = Settings.Secure.getInt(getContentResolver(), ENABLED, OFF) == ON;
if (enabled == isEnabled) {
return;
}
if (enabled) {
showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
}

View File

@@ -479,7 +479,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
@Override
protected void refresh() {
for (LocalBluetoothProfile profile : getProfiles()) {
if (!profile.isProfileReady()) {
if (profile != null && !profile.isProfileReady()) {
continue;
}
SwitchPreference pref = mProfilesContainer.findPreference(

View File

@@ -22,6 +22,7 @@ import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.text.TextUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -65,6 +66,10 @@ public class ManageStoragePreferenceController extends BasePreferenceController
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!TextUtils.equals(getPreferenceKey(), preference.getKey())) {
return super.handlePreferenceTreeClick(preference);
}
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.STORAGE_FREE_UP_SPACE_NOW);

View File

@@ -47,6 +47,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.shadows.ShadowToast;
import java.util.ArrayList;
import java.util.Arrays;
@@ -104,4 +105,18 @@ public class TextReadingPreferenceFragmentTest {
verify(listener1).resetState();
verify(listener2).resetState();
}
@Test
public void onDialogPositiveButtonClicked_boldTextEnabled_showToast() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.FONT_WEIGHT_ADJUSTMENT, BOLD_TEXT_ADJUSTMENT);
final AlertDialog dialog = (AlertDialog) mFragment.onCreateDialog(
DialogEnums.DIALOG_RESET_SETTINGS);
dialog.show();
dialog.getButton(DialogInterface.BUTTON_POSITIVE).callOnClick();
assertThat(ShadowToast.getTextOfLatestToast())
.isEqualTo(mContext.getString(R.string.accessibility_text_reading_reset_message));
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.deviceinfo.storage;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.widget.CardPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class ManageStoragePreferenceControllerTest {
private ManageStoragePreferenceController mController;
private CardPreference mPreference;
@Before
public void setUp() {
Context context = ApplicationProvider.getApplicationContext();
mPreference = new CardPreference(context);
mController = new ManageStoragePreferenceController(context, "free_up_space");
}
@Test
public void handPreferenceTreeClick_keyMatched_consumeClickEvent() {
mPreference.setKey(mController.getPreferenceKey());
assertTrue(mController.handlePreferenceTreeClick(mPreference));
}
@Test
public void handPreferenceTreeClick_keyNotMatched_notConsumeClickEvent() {
mPreference.setKey("not_matched_key");
assertFalse(mController.handlePreferenceTreeClick(mPreference));
}
}