Merge changes from topic 'accessibilitybutton-target'
* changes: Update magnification strings Settings revisions for Accessibility button
This commit is contained in:
committed by
Android (Google) Code Review
commit
12e272ab8f
@@ -4093,6 +4093,8 @@
|
|||||||
<string name="accessibility_screen_magnification_gestures_title">Magnify with triple-tap</string>
|
<string name="accessibility_screen_magnification_gestures_title">Magnify with triple-tap</string>
|
||||||
<!-- Title for the accessibility preference screen to enable navigation bar screen magnification. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference screen to enable navigation bar screen magnification. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_screen_magnification_navbar_title">Magnify with button</string>
|
<string name="accessibility_screen_magnification_navbar_title">Magnify with button</string>
|
||||||
|
<!-- Summary for the accessibility magnification setting indicating both "Magnify with button" and "Magnify with triple-tap" are enabled [CHAR LIMIT=50] -->
|
||||||
|
<string name="accessibility_screen_magnification_state_navbar_gesture">Magnify with button & triple-tap</string>
|
||||||
<!-- Summary for the accessibility preference to enable screen magnification. [CHAR LIMIT=25] -->
|
<!-- Summary for the accessibility preference to enable screen magnification. [CHAR LIMIT=25] -->
|
||||||
<string name="accessibility_preference_magnification_summary">Zoom in on screen</string>
|
<string name="accessibility_preference_magnification_summary">Zoom in on screen</string>
|
||||||
<!-- Short summary for Magnification gesture. Tells the user that this feature allows the user to magnify the screen by tapping 3 times. Appears in accessibility portion of setup wizard -->
|
<!-- Short summary for Magnification gesture. Tells the user that this feature allows the user to magnify the screen by tapping 3 times. Appears in accessibility portion of setup wizard -->
|
||||||
@@ -4100,7 +4102,7 @@
|
|||||||
<!-- Short summary for nav bar Magnification. Tells the user that this feature allows the user to magnify the screen using a button in the nav bar -->
|
<!-- Short summary for nav bar Magnification. Tells the user that this feature allows the user to magnify the screen using a button in the nav bar -->
|
||||||
<string name="accessibility_screen_magnification_navbar_short_summary">Tap a button to zoom</string>
|
<string name="accessibility_screen_magnification_navbar_short_summary">Tap a button to zoom</string>
|
||||||
<!-- Summary for the accessibility preference screen to enable screen magnification gestures. [CHAR LIMIT=none] -->
|
<!-- Summary for the accessibility preference screen to enable screen magnification gestures. [CHAR LIMIT=none] -->
|
||||||
<string name="accessibility_screen_magnification_summary"><b>To zoom</b>, quickly tap the screen 3 times with one finger.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers together or apart to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, quickly tap the screen 3 times and hold down your finger on the third tap.\n<ul><li>Drag your finger to move around the screen</li>\n<li>Lift your finger to zoom out</li></ul>\n\nYou can\'t zoom in on the keyboard and navigation bar.</string>
|
<string name="accessibility_screen_magnification_summary"><b>To zoom</b>, quickly tap the screen 3 times.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, quickly tap the screen 3 times and hold down your finger on the third tap.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can\'t zoom in on the keyboard and navigation bar.</string>
|
||||||
<!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
|
<!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
|
||||||
<string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, use the Accessibility button at the bottom of the screen to quickly magnify.\n\n<b>To zoom</b>, tap the Accessibility button, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, tap the Accessibility button, then touch & hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
|
<string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, use the Accessibility button at the bottom of the screen to quickly magnify.\n\n<b>To zoom</b>, tap the Accessibility button, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, tap the Accessibility button, then touch & hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
|
||||||
<!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
|
<!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
|
||||||
|
|||||||
@@ -587,6 +587,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
|
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
|
||||||
mDisplayDaltonizerPreferenceScreen);
|
mDisplayDaltonizerPreferenceScreen);
|
||||||
|
|
||||||
|
updateMagnificationSummary(mDisplayMagnificationPreferenceScreen);
|
||||||
|
|
||||||
updateFontSizeSummary(mFontSizePreferenceScreen);
|
updateFontSizeSummary(mFontSizePreferenceScreen);
|
||||||
|
|
||||||
updateAutoclickSummary(mAutoclickPreferenceScreen);
|
updateAutoclickSummary(mAutoclickPreferenceScreen);
|
||||||
@@ -594,6 +596,25 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
updateAccessibilityShortcut(mAccessibilityShortcutPreferenceScreen);
|
updateAccessibilityShortcut(mAccessibilityShortcutPreferenceScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateMagnificationSummary(Preference pref) {
|
||||||
|
final boolean tripleTapEnabled = Settings.Secure.getInt(getContentResolver(),
|
||||||
|
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0) == 1;
|
||||||
|
final boolean buttonEnabled = Settings.Secure.getInt(getContentResolver(),
|
||||||
|
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, 0) == 1;
|
||||||
|
|
||||||
|
int summaryResId = 0;
|
||||||
|
if (!tripleTapEnabled && !buttonEnabled) {
|
||||||
|
summaryResId = R.string.accessibility_feature_state_off;
|
||||||
|
} else if (!tripleTapEnabled && buttonEnabled) {
|
||||||
|
summaryResId = R.string.accessibility_screen_magnification_navbar_title;
|
||||||
|
} else if (tripleTapEnabled && !buttonEnabled) {
|
||||||
|
summaryResId = R.string.accessibility_screen_magnification_gestures_title;
|
||||||
|
} else {
|
||||||
|
summaryResId = R.string.accessibility_screen_magnification_state_navbar_gesture;
|
||||||
|
}
|
||||||
|
pref.setSummary(summaryResId);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateFeatureSummary(String prefKey, Preference pref) {
|
private void updateFeatureSummary(String prefKey, Preference pref) {
|
||||||
final boolean enabled = Settings.Secure.getInt(getContentResolver(), prefKey, 0) == 1;
|
final boolean enabled = Settings.Secure.getInt(getContentResolver(), prefKey, 0) == 1;
|
||||||
pref.setSummary(enabled ? R.string.accessibility_feature_state_on
|
pref.setSummary(enabled ? R.string.accessibility_feature_state_on
|
||||||
|
|||||||
@@ -16,13 +16,16 @@
|
|||||||
|
|
||||||
package com.android.settings.accessibility;
|
package com.android.settings.accessibility;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -42,6 +45,10 @@ public final class MagnificationPreferenceFragment extends SettingsPreferenceFra
|
|||||||
private static final String MAGNIFICATION_NAVBAR_PREFERENCE_SCREEN_KEY =
|
private static final String MAGNIFICATION_NAVBAR_PREFERENCE_SCREEN_KEY =
|
||||||
"screen_magnification_navbar_preference_screen";
|
"screen_magnification_navbar_preference_screen";
|
||||||
|
|
||||||
|
// Pseudo ComponentName used to represent navbar magnification in Settings.Secure.
|
||||||
|
private static final String MAGNIFICATION_COMPONENT_ID =
|
||||||
|
"com.android.server.accessibility.MagnificationController";
|
||||||
|
|
||||||
private Preference mMagnificationGesturesPreference;
|
private Preference mMagnificationGesturesPreference;
|
||||||
private Preference mMagnificationNavbarPreference;
|
private Preference mMagnificationNavbarPreference;
|
||||||
|
|
||||||
@@ -147,17 +154,38 @@ public final class MagnificationPreferenceFragment extends SettingsPreferenceFra
|
|||||||
extras.putBoolean(AccessibilitySettings.EXTRA_LAUNCHED_FROM_SUW, mLaunchedFromSuw);
|
extras.putBoolean(AccessibilitySettings.EXTRA_LAUNCHED_FROM_SUW, mLaunchedFromSuw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getConfigurationWarningStringResourceForSecureSettingsKey(String key,
|
static CharSequence getConfigurationWarningStringForSecureSettingsKey(String key,
|
||||||
ContentResolver resolver) {
|
Context context) {
|
||||||
if (Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED.equals(key)) {
|
if (!Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED.equals(key)) {
|
||||||
if (Settings.Secure.getInt(resolver,
|
return null;
|
||||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, 0) == 1) {
|
}
|
||||||
// TODO(b/34720082): Only report a config warning when nav-bar is not mapped to mag
|
if (Settings.Secure.getInt(context.getContentResolver(),
|
||||||
return R.string.accessibility_screen_magnification_navbar_configuration_warning;
|
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, 0) == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final AccessibilityManager am = (AccessibilityManager) context.getSystemService(
|
||||||
|
Context.ACCESSIBILITY_SERVICE);
|
||||||
|
final String assignedId = Settings.Secure.getString(context.getContentResolver(),
|
||||||
|
Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT);
|
||||||
|
if (!TextUtils.isEmpty(assignedId) && !MAGNIFICATION_COMPONENT_ID.equals(assignedId)) {
|
||||||
|
final ComponentName assignedComponentName = ComponentName.unflattenFromString(
|
||||||
|
assignedId);
|
||||||
|
final List<AccessibilityServiceInfo> activeServices =
|
||||||
|
am.getEnabledAccessibilityServiceList(
|
||||||
|
AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
|
||||||
|
final int serviceCount = activeServices.size();
|
||||||
|
for (int i = 0; i < serviceCount; i++) {
|
||||||
|
final AccessibilityServiceInfo info = activeServices.get(i);
|
||||||
|
if (info.getComponentName().equals(assignedComponentName)) {
|
||||||
|
final CharSequence assignedServiceName = info.getResolveInfo().loadLabel(
|
||||||
|
context.getPackageManager());
|
||||||
|
return context.getString(
|
||||||
|
R.string.accessibility_screen_magnification_navbar_configuration_warning,
|
||||||
|
assignedServiceName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
|||||||
@@ -214,14 +214,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfigurationWarningIfNeeded() {
|
private void updateConfigurationWarningIfNeeded() {
|
||||||
final int warningRes =
|
final CharSequence warningMessage =
|
||||||
MagnificationPreferenceFragment
|
MagnificationPreferenceFragment.getConfigurationWarningStringForSecureSettingsKey(
|
||||||
.getConfigurationWarningStringResourceForSecureSettingsKey(
|
mPreferenceKey, getPrefContext());
|
||||||
mPreferenceKey, getContentResolver());
|
if (warningMessage != null) {
|
||||||
if (warningRes != -1) {
|
mConfigWarningPreference.setSummary(warningMessage);
|
||||||
mConfigWarningPreference.setSummary(warningRes);
|
|
||||||
}
|
}
|
||||||
mConfigWarningPreference.setVisible(warningRes != -1);
|
mConfigWarningPreference.setVisible(warningMessage != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getScreenWidth(Context context) {
|
private static int getScreenWidth(Context context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user