Snap for 9786938 from 40019f876b to udc-release

Change-Id: Ifca51b90f487c70cf3e6c5ab84867696bc65404a
This commit is contained in:
Android Build Coastguard Worker
2023-03-22 01:32:16 +00:00
20 changed files with 213 additions and 171 deletions

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="412"
android:viewportHeight="300"
android:width="412dp"
android:height="300dp">
<path
android:pathData="M28 0H384A28 28 0 0 1 412 28V272A28 28 0 0 1 384 300H28A28 28 0 0 1 0 272V28A28 28 0 0 1 28 0Z"
android:fillColor="#000000" />
<path
android:pathData="M257.719 40.9297H152.039C148.085 40.9297 144.879 44.1353 144.879 48.0897V264.77C144.879 268.724 148.085 271.93 152.039 271.93H257.719C261.673 271.93 264.879 268.724 264.879 264.77V48.0897C264.879 44.1353 261.673 40.9297 257.719 40.9297Z">
<aapt:attr
name="android:fillColor">
<gradient
android:startX="204.879"
android:startY="271.93"
android:endX="204.879"
android:endY="40.9297"
android:tileMode="clamp">
<item
android:color="#2E3192"
android:offset="0" />
<item
android:color="#000000"
android:offset="1" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M205.25 206.5C255.094 206.5 295.5 166.094 295.5 116.25C295.5 66.4063 255.094 26 205.25 26C155.406 26 115 66.4063 115 116.25C115 166.094 155.406 206.5 205.25 206.5Z"
android:fillColor="#FEEFC3"
android:fillAlpha="0.3" />
<path
android:pathData="M205.29 186.541C244.11 186.541 275.58 155.071 275.58 116.251C275.58 77.4308 244.11 45.9609 205.29 45.9609C166.47 45.9609 135 77.4308 135 116.251C135 155.071 166.47 186.541 205.29 186.541Z"
android:fillColor="#FEEFC3"
android:fillAlpha="0.8" />
<path
android:pathData="M257.78 40.9805H151.22C147.232 40.9805 144 44.2 144 48.1715V265.789C144 269.761 147.232 272.98 151.22 272.98H257.78C261.768 272.98 265 269.761 265 265.789V48.1715C265 44.2 261.768 40.9805 257.78 40.9805Z"
android:fillColor="#000000" />
<path
android:pathData="M269.34 107.531V98.6406C269.34 98.0518 269.106 97.4872 268.69 97.0709C268.274 96.6545 267.709 96.4206 267.12 96.4206V49.7506C267.118 46.8032 265.945 43.9773 263.86 41.8941C261.775 39.8108 258.948 38.6406 256 38.6406H153.77C150.824 38.6433 148 39.8146 145.917 41.8976C143.834 43.9805 142.663 46.8049 142.66 49.7506V263.111C142.663 266.056 143.834 268.881 145.917 270.964C148 273.047 150.824 274.218 153.77 274.221H256C258.946 274.218 261.77 273.047 263.853 270.964C265.936 268.881 267.107 266.056 267.11 263.111V154.211C267.403 154.211 267.692 154.153 267.962 154.041C268.232 153.928 268.477 153.764 268.683 153.557C268.89 153.35 269.053 153.104 269.164 152.833C269.275 152.563 269.331 152.273 269.33 151.981V129.761C269.331 129.469 269.275 129.179 269.164 128.91C269.053 128.64 268.889 128.394 268.683 128.188C268.476 127.981 268.231 127.818 267.961 127.707C267.691 127.596 267.402 127.539 267.11 127.541V109.761C267.403 109.762 267.694 109.705 267.965 109.594C268.236 109.482 268.483 109.318 268.69 109.11C268.897 108.903 269.061 108.657 269.173 108.386C269.285 108.114 269.341 107.824 269.34 107.531ZM264.9 263.111C264.892 265.466 263.951 267.722 262.283 269.384C260.615 271.047 258.355 271.981 256 271.981H153.77C151.413 271.978 149.154 271.04 147.487 269.374C145.82 267.707 144.883 265.448 144.88 263.091V49.7506C144.883 47.3937 145.82 45.134 147.487 43.4674C149.154 41.8007 151.413 40.8633 153.77 40.8606H256C258.357 40.8633 260.617 41.8007 262.283 43.4674C263.95 45.134 264.888 47.3937 264.89 49.7506L264.9 263.111Z"
android:fillColor="#80868B" />
<path
android:pathData="M206.5 88.9805H206.5A32.5 32.5 0 0 1 239 121.4805V121.4805A32.5 32.5 0 0 1 206.5 153.9805H206.5A32.5 32.5 0 0 1 174 121.4805V121.4805A32.5 32.5 0 0 1 206.5 88.9805Z"
android:fillColor="#D2E3FC" />
<path
android:pathData="M228 205.98H228A12 12 0 0 1 240 217.98V217.98A12 12 0 0 1 228 229.98H228A12 12 0 0 1 216 217.98V217.98A12 12 0 0 1 228 205.98Z"
android:fillColor="#5BB974" />
<path
android:pathData="M184 205.98H184A12 12 0 0 1 196 217.98V217.98A12 12 0 0 1 184 229.98H184A12 12 0 0 1 172 217.98V217.98A12 12 0 0 1 184 205.98Z"
android:fillColor="#EE675C" />
</vector>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="412"
android:viewportHeight="300"
android:width="412dp"
android:height="300dp">
<path
android:pathData="M28 0H384A28 28 0 0 1 412 28V272A28 28 0 0 1 384 300H28A28 28 0 0 1 0 272V28A28 28 0 0 1 28 0Z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M205.25 205.5C255.094 205.5 295.5 165.094 295.5 115.25C295.5 65.4063 255.094 25 205.25 25C155.406 25 115 65.4063 115 115.25C115 165.094 155.406 205.5 205.25 205.5Z"
android:fillColor="#FCC934"
android:fillAlpha="0.3" />
<path
android:pathData="M205.29 185.541C244.11 185.541 275.58 154.071 275.58 115.251C275.58 76.4308 244.11 44.9609 205.29 44.9609C166.47 44.9609 135 76.4308 135 115.251C135 154.071 166.47 185.541 205.29 185.541Z"
android:fillColor="#FCC934"
android:fillAlpha="0.8" />
<path
android:pathData="M257.78 39.9805H151.22C147.232 39.9805 144 43.2 144 47.1715V264.789C144 268.761 147.232 271.98 151.22 271.98H257.78C261.768 271.98 265 268.761 265 264.789V47.1715C265 43.2 261.768 39.9805 257.78 39.9805Z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M269.34 107.531V98.6406C269.34 98.0518 269.106 97.4872 268.69 97.0709C268.274 96.6545 267.709 96.4206 267.12 96.4206V49.7506C267.118 46.8032 265.945 43.9773 263.86 41.8941C261.775 39.8108 258.948 38.6406 256 38.6406H153.77C150.824 38.6433 148 39.8146 145.917 41.8976C143.834 43.9805 142.663 46.8049 142.66 49.7506V263.111C142.663 266.056 143.834 268.881 145.917 270.964C148 273.047 150.824 274.218 153.77 274.221H256C258.946 274.218 261.77 273.047 263.853 270.964C265.936 268.881 267.107 266.056 267.11 263.111V154.211C267.403 154.211 267.692 154.153 267.962 154.041C268.232 153.928 268.477 153.764 268.683 153.557C268.89 153.35 269.053 153.104 269.164 152.833C269.275 152.563 269.331 152.273 269.33 151.981V129.761C269.331 129.469 269.275 129.179 269.164 128.91C269.053 128.64 268.889 128.394 268.683 128.188C268.476 127.981 268.231 127.818 267.961 127.707C267.691 127.596 267.402 127.539 267.11 127.541V109.761C267.403 109.762 267.694 109.705 267.965 109.594C268.236 109.482 268.483 109.318 268.69 109.11C268.897 108.903 269.061 108.657 269.173 108.386C269.285 108.114 269.341 107.824 269.34 107.531ZM264.9 263.111C264.892 265.466 263.951 267.722 262.283 269.384C260.615 271.047 258.355 271.981 256 271.981H153.77C151.413 271.978 149.154 271.04 147.487 269.374C145.82 267.707 144.883 265.448 144.88 263.091V49.7506C144.883 47.3937 145.82 45.134 147.487 43.4674C149.154 41.8007 151.413 40.8633 153.77 40.8606H256C258.357 40.8633 260.617 41.8007 262.283 43.4674C263.95 45.134 264.888 47.3937 264.89 49.7506L264.9 263.111Z"
android:fillColor="#DADCE0" />
<path
android:pathData="M206.5 88.9805H206.5A32.5 32.5 0 0 1 239 121.4805V121.4805A32.5 32.5 0 0 1 206.5 153.9805H206.5A32.5 32.5 0 0 1 174 121.4805V121.4805A32.5 32.5 0 0 1 206.5 88.9805Z"
android:fillColor="#669DF6" />
<path
android:pathData="M228 205.98H228A12 12 0 0 1 240 217.98V217.98A12 12 0 0 1 228 229.98H228A12 12 0 0 1 216 217.98V217.98A12 12 0 0 1 228 205.98Z"
android:fillColor="#1E8E3E" />
<path
android:pathData="M184 205.98H184A12 12 0 0 1 196 217.98V217.98A12 12 0 0 1 184 229.98H184A12 12 0 0 1 172 217.98V217.98A12 12 0 0 1 184 205.98Z"
android:fillColor="#D93025" />
</vector>

File diff suppressed because one or more lines are too long

View File

@@ -126,10 +126,12 @@
<string name="bluetooth_pair_other_ear_dialog_right_ear_positive_button">Pair right ear</string>
<!-- Connected devices settings. Positive button of the dialog to help user to pair left ear of the hearing aid device. Dialog shows when only one of the hearing aid device set is connected. [CHAR LIMIT=20] -->
<string name="bluetooth_pair_other_ear_dialog_left_ear_positive_button">Pair left ear</string>
<!-- Connected devices settings. Title of the preference to show the entrance of the hearing device controls page. [CHAR LIMIT=35] -->
<string name="bluetooth_device_controls_title">Hearing device controls</string>
<!-- Connected devices settings. Summary of the preference to show the entrance of the hearing device controls page. [CHAR LIMIT=NONE] -->
<string name="bluetooth_device_controls_summary">Hearing device shortcut, hearing aid compatibility</string>
<!-- Title for all hearing devices related controls section. [CHAR LIMIT=60] -->
<string name="bluetooth_device_controls_general">For all available hearing devices</string>
<!-- Connected devices settings. Title of the preference to show the entrance of the hearing device controls related page. [CHAR LIMIT=65] -->
<string name="bluetooth_device_controls_title">Shortcuts &amp; hearing aid compatibility</string>
<!-- Title for this device specific controls section. [CHAR LIMIT=30] -->
<string name="bluetooth_device_controls_specific">For this device</string>
<!-- Connected devices settings. Title of the preference to show the entrance of the audio output page. It can change different types of audio are played on phone or other bluetooth devices. [CHAR LIMIT=35] -->
<string name="bluetooth_audio_routing_title">Audio output</string>
<!-- Title for bluetooth audio routing page footer. [CHAR LIMIT=30] -->

View File

@@ -24,6 +24,7 @@
android:entries="@array/long_press_timeout_selector_list_titles"
android:entryValues="@array/long_press_timeout_selector_values"
android:key="select_long_press_timeout_preference"
android:summary="%s"
android:persistent="false"
android:title="@string/accessibility_long_press_timeout_preference_title"
settings:controller="com.android.settings.accessibility.SelectLongPressTimeoutPreferenceController"/>

View File

@@ -71,7 +71,12 @@
android:key="device_companion_apps"/>
<PreferenceCategory
android:key="feature_controls_group"/>
android:key="device_controls_general"
android:title="@string/bluetooth_device_controls_general"/>
<PreferenceCategory
android:key="device_controls_specific"
android:title="@string/bluetooth_device_controls_specific"/>
<PreferenceCategory
android:key="spatial_audio_group"/>

View File

@@ -20,14 +20,13 @@
android:title="@string/flash_notifications_title">
<com.android.settingslib.widget.TopIntroPreference
android:key="flash_notifications_intro"
android:title="@string/flash_notifications_intro" />
<!-- TODO update when rawRes added
<com.android.settingslib.widget.IllustrationPreference
android:key="flash_notifications_guide_preference"
settings:lottie_rawRes="@raw/NOT ADDED"
settings:searchable="false" />
-->
android:key="flash_notifications_illustration"
settings:searchable="false"
settings:lottie_rawRes="@drawable/flash_notifications_illustration"/>
<SwitchPreference
android:key="camera_flash_notification_preference"

View File

@@ -19,21 +19,30 @@ package com.android.settings.accessibility;
import android.content.Context;
import android.provider.Settings;
import androidx.annotation.IntDef;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.google.common.primitives.Ints;
import java.util.Optional;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** Preference controller that controls the button or gesture in accessibility button page. */
public class AccessibilityButtonGesturePreferenceController extends BasePreferenceController
implements Preference.OnPreferenceChangeListener {
private Optional<Integer> mDefaultGesture = Optional.empty();
@Retention(RetentionPolicy.SOURCE)
@IntDef({
Mode.BUTTON,
Mode.GESTURE,
})
private @interface Mode {
int BUTTON = 1;
int GESTURE = 2;
}
public AccessibilityButtonGesturePreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
@@ -47,12 +56,9 @@ public class AccessibilityButtonGesturePreferenceController extends BasePreferen
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ListPreference listPreference = (ListPreference) preference;
final Integer value = Ints.tryParse((String) newValue);
if (value != null) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, value);
updateState(listPreference);
putCurrentAccessibilityButtonMode(value);
}
return true;
}
@@ -62,21 +68,17 @@ public class AccessibilityButtonGesturePreferenceController extends BasePreferen
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
listPreference.setValue(getCurrentAccessibilityButtonMode());
listPreference.setValue(String.valueOf(getCurrentAccessibilityButtonMode()));
}
private String getCurrentAccessibilityButtonMode() {
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, getDefaultGestureValue());
return String.valueOf(mode);
@Mode
private int getCurrentAccessibilityButtonMode() {
return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, Mode.BUTTON);
}
private int getDefaultGestureValue() {
if (!mDefaultGesture.isPresent()) {
final String[] valuesList = mContext.getResources().getStringArray(
R.array.accessibility_button_gesture_selector_values);
mDefaultGesture = Optional.of(Integer.parseInt(valuesList[0]));
}
return mDefaultGesture.get();
private void putCurrentAccessibilityButtonMode(@Mode int mode) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, mode);
}
}

View File

@@ -19,21 +19,30 @@ package com.android.settings.accessibility;
import android.content.Context;
import android.provider.Settings;
import androidx.annotation.IntDef;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.google.common.primitives.Ints;
import java.util.Optional;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** Preference controller that controls the preferred location in accessibility button page. */
public class AccessibilityButtonLocationPreferenceController extends BasePreferenceController
implements Preference.OnPreferenceChangeListener {
private Optional<Integer> mDefaultLocation = Optional.empty();
@Retention(RetentionPolicy.SOURCE)
@IntDef({
Location.FLOATING_MENU,
Location.NAVIGATION_BAR,
})
private @interface Location {
int FLOATING_MENU = 1;
int NAVIGATION_BAR = 0;
}
public AccessibilityButtonLocationPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
@@ -47,12 +56,9 @@ public class AccessibilityButtonLocationPreferenceController extends BasePrefere
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ListPreference listPreference = (ListPreference) preference;
final Integer value = Ints.tryParse((String) newValue);
if (value != null) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, value);
updateState(listPreference);
putCurrentAccessibilityButtonMode(value);
}
return true;
}
@@ -62,21 +68,17 @@ public class AccessibilityButtonLocationPreferenceController extends BasePrefere
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
listPreference.setValue(getCurrentAccessibilityButtonMode());
listPreference.setValue(String.valueOf(getCurrentAccessibilityButtonMode()));
}
private String getCurrentAccessibilityButtonMode() {
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, getDefaultLocationValue());
return String.valueOf(mode);
@Location
private int getCurrentAccessibilityButtonMode() {
return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, Location.FLOATING_MENU);
}
private int getDefaultLocationValue() {
if (!mDefaultLocation.isPresent()) {
final String[] valuesList = mContext.getResources().getStringArray(
R.array.accessibility_button_location_selector_values);
mDefaultLocation = Optional.of(Integer.parseInt(valuesList[0]));
}
return mDefaultLocation.get();
private void putCurrentAccessibilityButtonMode(@Location int location) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, location);
}
}

View File

@@ -16,14 +16,12 @@
package com.android.settings.accessibility;
import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
import android.view.accessibility.CaptioningManager;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
@@ -46,22 +44,20 @@ public class CaptioningFontSizeController extends BasePreferenceController
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final ListPreference listPreference = screen.findPreference(getPreferenceKey());
public void updateState(Preference preference) {
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
final float fontSize = mCaptioningManager.getFontScale();
listPreference.setValue(Float.toString(fontSize));
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ListPreference listPreference = (ListPreference) preference;
final ContentResolver cr = mContext.getContentResolver();
Settings.Secure.putFloat(
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
Float.parseFloat((String) newValue));
listPreference.setValue((String) newValue);
mCaptionHelper.setEnabled(true);
return false;
return true;
}
}

View File

@@ -16,14 +16,12 @@
package com.android.settings.accessibility;
import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
import android.view.accessibility.CaptioningManager.CaptionStyle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
@@ -44,23 +42,21 @@ public class CaptioningTypefaceController extends BasePreferenceController
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final ListPreference listPreference = screen.findPreference(getPreferenceKey());
final ContentResolver cr = mContext.getContentResolver();
final CaptionStyle attrs = CaptionStyle.getCustomStyle(cr);
public void updateState(Preference preference) {
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
final CaptionStyle attrs = CaptionStyle.getCustomStyle(mContext.getContentResolver());
final String rawTypeface = attrs.mRawTypeface;
listPreference.setValue(rawTypeface == null ? "" : rawTypeface);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ListPreference listPreference = (ListPreference) preference;
final ContentResolver cr = mContext.getContentResolver();
Settings.Secure.putString(
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE, (String) newValue);
listPreference.setValue((String) newValue);
mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE,
(String) newValue);
mCaptionHelper.setEnabled(true);
return false;
return true;
}
}

View File

@@ -22,7 +22,6 @@ import android.database.ContentObserver;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.ArrayMap;
import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;
@@ -30,7 +29,6 @@ import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -52,9 +50,6 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
@VisibleForTesting
ListPreference mPreference;
private final ArrayMap<String, String> mValueTitleMap = new ArrayMap<>();
private int mDefaultSize;
@Retention(RetentionPolicy.SOURCE)
@IntDef({
Size.SMALL,
@@ -75,8 +70,6 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
updateAvailabilityStatus();
}
};
initValueTitleMap();
}
@Override
@@ -94,11 +87,9 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ListPreference listPreference = (ListPreference) preference;
final Integer value = Ints.tryParse((String) newValue);
if (value != null) {
putAccessibilityFloatingMenuSize(value);
updateState(listPreference);
}
return true;
}
@@ -108,7 +99,7 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
listPreference.setValue(String.valueOf(getAccessibilityFloatingMenuSize(mDefaultSize)));
listPreference.setValue(String.valueOf(getAccessibilityFloatingMenuSize()));
}
@Override
@@ -129,25 +120,10 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
mPreference.setEnabled(AccessibilityUtil.isFloatingMenuEnabled(mContext));
}
private void initValueTitleMap() {
if (mValueTitleMap.size() == 0) {
final String[] values = mContext.getResources().getStringArray(
R.array.accessibility_button_size_selector_values);
final String[] titles = mContext.getResources().getStringArray(
R.array.accessibility_button_size_selector_titles);
final int mapSize = values.length;
mDefaultSize = Integer.parseInt(values[0]);
for (int i = 0; i < mapSize; i++) {
mValueTitleMap.put(values[i], titles[i]);
}
}
}
@Size
private int getAccessibilityFloatingMenuSize(@Size int defaultValue) {
private int getAccessibilityFloatingMenuSize() {
return Settings.Secure.getInt(mContentResolver,
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, defaultValue);
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, Size.SMALL);
}
private void putAccessibilityFloatingMenuSize(@Size int value) {

View File

@@ -50,11 +50,9 @@ public class SelectLongPressTimeoutPreferenceController extends BasePreferenceCo
if (!(preference instanceof ListPreference)) {
return false;
}
final ListPreference listPreference = (ListPreference) preference;
final int newValue = Integer.parseInt((String) object);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LONG_PRESS_TIMEOUT, newValue);
updateState(listPreference);
return true;
}
@@ -62,16 +60,9 @@ public class SelectLongPressTimeoutPreferenceController extends BasePreferenceCo
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (!(preference instanceof ListPreference)) {
return;
}
final ListPreference listPreference = (ListPreference) preference;
listPreference.setValue(getLongPressTimeoutValue());
}
@Override
public CharSequence getSummary() {
return mLongPressTimeoutValueToTitleMap.get(getLongPressTimeoutValue());
listPreference.setValue(getLongPressTimeoutValue());
}
private String getLongPressTimeoutValue() {

View File

@@ -16,7 +16,6 @@
package com.android.settings.bluetooth;
import static com.android.settings.bluetooth.BluetoothDeviceDetailsFragment.FEATURE_AUDIO_ROUTING_ORDER;
import static com.android.settings.bluetooth.BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS;
import android.content.Context;
@@ -38,7 +37,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
*/
public class BluetoothDetailsAudioRoutingController extends BluetoothDetailsController {
private static final String KEY_FEATURE_CONTROLS_GROUP = "feature_controls_group";
private static final String KEY_DEVICE_CONTROLS_SPECIFIC_GROUP = "device_controls_specific";
@VisibleForTesting
static final String KEY_AUDIO_ROUTING = "audio_routing";
@@ -61,7 +60,6 @@ public class BluetoothDetailsAudioRoutingController extends BluetoothDetailsCont
final PreferenceCategory prefCategory = screen.findPreference(getPreferenceKey());
final Preference pref = createAudioRoutingPreference(prefCategory.getContext());
pref.setOrder(FEATURE_AUDIO_ROUTING_ORDER);
prefCategory.addPreference(pref);
}
@@ -70,7 +68,7 @@ public class BluetoothDetailsAudioRoutingController extends BluetoothDetailsCont
@Override
public String getPreferenceKey() {
return KEY_FEATURE_CONTROLS_GROUP;
return KEY_DEVICE_CONTROLS_SPECIFIC_GROUP;
}
private Preference createAudioRoutingPreference(Context context) {

View File

@@ -16,8 +16,6 @@
package com.android.settings.bluetooth;
import static com.android.settings.bluetooth.BluetoothDeviceDetailsFragment.FEATURE_HEARING_DEVICE_CONTROLS_ORDER;
import android.content.Context;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
@@ -41,7 +39,7 @@ import com.google.common.annotations.VisibleForTesting;
public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDetailsController
implements Preference.OnPreferenceClickListener {
private static final String KEY_FEATURE_CONTROLS_GROUP = "feature_controls_group";
private static final String KEY_DEVICE_CONTROLS_GENERAL_GROUP = "device_controls_general";
@VisibleForTesting
static final String KEY_HEARING_DEVICE_CONTROLS = "hearing_device_controls";
@@ -65,7 +63,6 @@ public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDe
final PreferenceCategory prefCategory = screen.findPreference(getPreferenceKey());
final Preference pref = createHearingDeviceControlsPreference(prefCategory.getContext());
pref.setOrder(FEATURE_HEARING_DEVICE_CONTROLS_ORDER);
prefCategory.addPreference(pref);
}
@@ -74,7 +71,7 @@ public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDe
@Override
public String getPreferenceKey() {
return KEY_FEATURE_CONTROLS_GROUP;
return KEY_DEVICE_CONTROLS_GENERAL_GROUP;
}
@Override
@@ -90,7 +87,6 @@ public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDe
final Preference preference = new Preference(context);
preference.setKey(KEY_HEARING_DEVICE_CONTROLS);
preference.setTitle(context.getString(R.string.bluetooth_device_controls_title));
preference.setSummary(context.getString(R.string.bluetooth_device_controls_summary));
preference.setOnPreferenceClickListener(this);
return preference;

View File

@@ -63,9 +63,6 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
public static final String KEY_DEVICE_ADDRESS = "device_address";
private static final String TAG = "BTDeviceDetailsFrg";
static final int FEATURE_HEARING_DEVICE_CONTROLS_ORDER = 1;
static final int FEATURE_AUDIO_ROUTING_ORDER = 2;
@VisibleForTesting
static int EDIT_DEVICE_NAME_ITEM_ID = Menu.FIRST;

View File

@@ -16,7 +16,6 @@
package com.android.settings.accessibility;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
@@ -93,13 +92,4 @@ public class AccessibilityButtonGesturePreferenceControllerTest {
final String gestureValue = String.valueOf(ACCESSIBILITY_BUTTON_MODE_GESTURE);
assertThat(mListPreference.getValue()).isEqualTo(gestureValue);
}
@Test
public void onPreferenceChange_a11yBtnModeFloatingMenu_floatingMenuValue() {
final String floatingMenuValue = String.valueOf(ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU);
mController.onPreferenceChange(mListPreference, floatingMenuValue);
assertThat(mListPreference.getValue()).isEqualTo(floatingMenuValue);
}
}

View File

@@ -16,7 +16,6 @@
package com.android.settings.accessibility;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
@@ -94,13 +93,4 @@ public class AccessibilityButtonLocationPreferenceControllerTest {
final String navigationBarValue = String.valueOf(ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR);
assertThat(mListPreference.getValue()).isEqualTo(navigationBarValue);
}
@Test
public void onPreferenceChange_a11yBtnModeFloatingMenu_floatingMenuValue() {
final String floatingMenuValue = String.valueOf(ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU);
mController.onPreferenceChange(mListPreference, floatingMenuValue);
assertThat(mListPreference.getValue()).isEqualTo(floatingMenuValue);
}
}

View File

@@ -64,6 +64,7 @@ public class CaptioningFontSizeControllerTest {
mPreference = new ListPreference(mContext);
mPreference.setEntries(R.array.captioning_font_size_selector_titles);
mPreference.setEntryValues(R.array.captioning_font_size_selector_values);
mPreference.setSummary("%s");
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
CaptioningManager captioningManager = mContext.getSystemService(CaptioningManager.class);
mShadowCaptioningManager = Shadow.extract(captioningManager);
@@ -76,28 +77,19 @@ public class CaptioningFontSizeControllerTest {
}
@Test
public void displayPreference_byDefault_shouldReturnDefault() {
mController.displayPreference(mScreen);
public void updateState_byDefault_shouldReturnDefault() {
mController.updateState(mPreference);
assertThat(mPreference.getEntry().toString()).isEqualTo("Medium");
assertThat(mPreference.getSummary().toString()).isEqualTo("Medium");
}
@Test
public void displayPreference_bySmallValue_shouldReturnSmall() {
public void updateState_bySmallValue_shouldReturnSmall() {
mShadowCaptioningManager.setFontScale(0.5f);
mController.displayPreference(mScreen);
mController.updateState(mPreference);
assertThat(mPreference.getEntry().toString()).isEqualTo("Small");
}
@Test
public void onPreferenceChange_shouldReturnSmall() {
mController.displayPreference(mScreen);
mController.onPreferenceChange(mPreference, "0.5");
assertThat(mPreference.getEntry().toString()).isEqualTo("Small");
assertThat(mPreference.getSummary().toString()).isEqualTo("Small");
}
@Test

View File

@@ -64,6 +64,7 @@ public class CaptioningTypefaceControllerTest {
mPreference = new ListPreference(mContext);
mPreference.setEntries(R.array.captioning_typeface_selector_titles);
mPreference.setEntryValues(R.array.captioning_typeface_selector_values);
mPreference.setSummary("%s");
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
CaptioningManager captioningManager = mContext.getSystemService(CaptioningManager.class);
mShadowCaptioningManager = Shadow.extract(captioningManager);
@@ -76,29 +77,20 @@ public class CaptioningTypefaceControllerTest {
}
@Test
public void displayPreference_byDefault_shouldReturnDefault() {
mController.displayPreference(mScreen);
public void updateState_byDefault_shouldReturnDefault() {
mController.updateState(mPreference);
assertThat(mPreference.getEntry().toString()).isEqualTo("Default");
assertThat(mPreference.getSummary().toString()).isEqualTo("Default");
}
@Test
public void displayPreference_bySerif_shouldReturnSerif() {
public void updateState_bySerif_shouldReturnSerif() {
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE, "serif");
mController.displayPreference(mScreen);
mController.updateState(mPreference);
assertThat(mPreference.getEntry().toString()).isEqualTo("Serif");
}
@Test
public void onPreferenceChange_bySerif_shouldReturnSerif() {
mController.displayPreference(mScreen);
mController.onPreferenceChange(mPreference, "serif");
assertThat(mPreference.getEntry().toString()).isEqualTo("Serif");
assertThat(mPreference.getSummary().toString()).isEqualTo("Serif");
}
@Test