android:id="@+id/preview_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?android:attr/colorBackgroundFloating" />
+ android:background="?android:attr/colorBackgroundFloating"
+ android:importantForAccessibility="noHideDescendants"/>
<View
android:layout_width="match_parent"
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
+<!-- Copyright (C) 2016 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.
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.settings.display.AppGridView
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scrollbars="none"
- android:background="?android:attr/colorBackgroundFloating">
-
-</ScrollView>
+ android:layout_height="match_parent" />
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-
-<com.android.settings.display.AppGridView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scrollbars="none"
+ android:background="?android:attr/colorBackgroundFloating">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <!-- Wifi Setting -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingStart="8dp"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/wifi_signal_dark"
+ android:tint="?android:attr/colorAccent"
+ android:scaleType="center" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:paddingStart="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_settings"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_display_status_not_available"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <!-- Data usage Setting -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingStart="8dp"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/ic_settings_data_usage"
+ android:tint="?android:attr/colorAccent"
+ android:scaleType="center" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:paddingStart="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/data_usage_summary_title"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/no_data_usage"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <!-- Display Setting -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingStart="8dp"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/ic_settings_display"
+ android:tint="?android:attr/colorAccent"
+ android:scaleType="center" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:paddingStart="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/display_settings_title"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/display_summary_on"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <!-- Sound & Notification Setting -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingStart="8dp"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/ic_settings_sound"
+ android:tint="?android:attr/colorAccent"
+ android:scaleType="center" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:paddingStart="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/sound_settings"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/sound_settings_example_summary"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <!-- Apps Setting -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingStart="8dp"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/ic_settings_applications"
+ android:tint="?android:attr/colorAccent"
+ android:scaleType="center" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical"
+ android:paddingStart="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/applications_settings"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/apps_summary_example"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</ScrollView>
<!-- Sound: Dashboard summary. [CHAR LIMIT=100] -->
<string name="sound_settings_summary">Ringer volume at <xliff:g id="percentage" example="2">%1$s</xliff:g></string>
+ <!-- Sound: Dashboard summary example used in Setup Wizard preview screen. [CHAR LIMIT=100] -->
+ <string name="sound_settings_example_summary">Ringer volume at 80%</string>
+
<!-- Sound: Title for the option managing media volume. [CHAR LIMIT=30] -->
<string name="media_volume_option_title">Media volume</string>
<!-- Summary of apps [CHAR LIMIT=NONE] -->
<string name="apps_summary"><xliff:g id="count" example="24">%1$d</xliff:g> apps installed</string>
+ <!-- Example summary of apps used in Setup Wizard preview screen [CHAR LIMIT=NONE] -->
+ <string name="apps_summary_example">24 apps installed</string>
<!-- Summary of storage usage [CHAR LIMIT=NONE] -->
<string name="storage_summary"><xliff:g id="size1" example="8GB">%1$s</xliff:g> of <xliff:g id="size2" example="32GB">%2$s</xliff:g> used</string>
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
-import com.android.settings.accessibility.AccessibilitySettingsForSetupWizardActivity;
import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.FloatingActionButton;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- if (!TextUtils.isEmpty(mHelpUri)
- && !(getActivity() instanceof AccessibilitySettingsForSetupWizardActivity)) {
+ if (!TextUtils.isEmpty(mHelpUri)) {
setHasOptionsMenu(true);
}
}
package com.android.settings.accessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.os.Bundle;
+import android.os.Handler;
import android.provider.Settings;
import android.support.v7.preference.Preference;
+import android.util.Log;
import android.view.accessibility.AccessibilityManager;
import com.android.internal.logging.MetricsProto;
public class AccessibilitySettingsForSetupWizard extends SettingsPreferenceFragment
implements DialogCreatable, Preference.OnPreferenceChangeListener {
+ private static final String TAG = AccessibilitySettingsForSetupWizard.class.getSimpleName();
+
// Preferences.
private static final String DISPLAY_MAGNIFICATION_PREFERENCE =
"screen_magnification_preference";
- private static final String TALKBACK_PREFERENCE = "talkback_preference";
+ private static final String SCREEN_READER_PREFERENCE = "talkback_preference";
private static final String FONT_SIZE_PREFERENCE = "font_size_preference";
+ // Time needed to let Talkback initialize its self before launching the tutorial.
+ private static final long SCREEN_READER_INITIALIZATION_DELAY_MS = 3000;
+
+ private String mTalkbackPackage;
+
// Preference controls.
private Preference mDisplayMagnificationPreference;
private Preference mTalkbackPreference;
+ private Runnable mStartTalkbackRunnable = new Runnable() {
+ @Override
+ public void run() {
+ launchTalkbackTutorial();
+ }
+ };
+
@Override
protected int getMetricsCategory() {
return MetricsProto.MetricsEvent.ACCESSIBILITY;
addPreferencesFromResource(R.xml.accessibility_settings_for_setup_wizard);
mDisplayMagnificationPreference = findPreference(DISPLAY_MAGNIFICATION_PREFERENCE);
- mTalkbackPreference = findPreference(TALKBACK_PREFERENCE);
+ mTalkbackPreference = findPreference(SCREEN_READER_PREFERENCE);
}
@Override
return false;
}
- /**
- * Returns a semicolon-delimited string containing a list of all the
- * installed {@link AccessibilityService}s that provide at least one
- * required feedback type.
- *
- * @param context The {@link android.app.Activity} context.
- * @param requiredFeedbackTypes An integer mask containing the required
- * feedback types.
- * @return A semicolon-delimited string containing a list of accessibility services.
- */
- private String getAccessibilityServicesFiltered(
- Context context, int requiredFeedbackTypes) {
- final AccessibilityManager manager = context.getSystemService(AccessibilityManager.class);
- final List<AccessibilityServiceInfo> accessibilityServices = manager
- .getInstalledAccessibilityServiceList();
- final StringBuilder servicesToEnable = new StringBuilder();
-
- for (AccessibilityServiceInfo accessibilityService : accessibilityServices) {
- if ((accessibilityService.feedbackType & requiredFeedbackTypes) == 0) {
- continue;
- }
-
- final ServiceInfo serviceInfo = accessibilityService.getResolveInfo().serviceInfo;
- final ComponentName componentName = new ComponentName(serviceInfo.packageName,
- serviceInfo.name);
-
- servicesToEnable.append(componentName.flattenToString());
- servicesToEnable.append(':');
- }
-
- if (servicesToEnable.length() > 0) {
- servicesToEnable.deleteCharAt(servicesToEnable.length() - 1);
+ private void launchTalkbackTutorial() {
+ try {
+ Intent intent = new Intent(Settings.ACTION_SCREEN_READER_TUTORIAL);
+ intent.setPackage(mTalkbackPackage);
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ // This can happen if either the build is misconfigued or an OEM removes the intent
+ // filter for the Talkback tutorial from their implementation of Talkback.
+ Log.e(TAG, "Can't find Talkback Tutorial: " + Settings.ACTION_SCREEN_READER_TUTORIAL);
}
-
- return servicesToEnable.toString();
}
@Override
final int accessibilityEnabled =
Settings.Secure.getInt(resolver, Settings.Secure.ACCESSIBILITY_ENABLED, 0);
if (accessibilityEnabled == 0) {
- final String servicesToEnable = getAccessibilityServicesFiltered(
- getActivity(), AccessibilityServiceInfo.FEEDBACK_SPOKEN);
+ // Find the first installed screen reader.
+ String serviceToEnable = null;
+ final AccessibilityManager manager =
+ getActivity().getSystemService(AccessibilityManager.class);
+ final List<AccessibilityServiceInfo> accessibilityServices =
+ manager.getInstalledAccessibilityServiceList();
+ for (AccessibilityServiceInfo accessibilityService : accessibilityServices) {
+ if ((accessibilityService.feedbackType
+ & AccessibilityServiceInfo.FEEDBACK_SPOKEN) != 0) {
+ final ServiceInfo serviceInfo =
+ accessibilityService.getResolveInfo().serviceInfo;
+ mTalkbackPackage = serviceInfo.packageName;
+ final ComponentName componentName =
+ new ComponentName(serviceInfo.packageName, serviceInfo.name);
+
+ serviceToEnable = componentName.flattenToString();
+ break;
+ }
+ }
// Enable all accessibility services with spoken feedback type.
Settings.Secure.putString(resolver, Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
- servicesToEnable);
+ serviceToEnable);
// Allow the services we just enabled to toggle touch exploration.
Settings.Secure.putString(resolver,
Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
- servicesToEnable);
+ serviceToEnable);
// Enable touch exploration.
Settings.Secure.putInt(resolver, Settings.Secure.TOUCH_EXPLORATION_ENABLED, 1);
// Turn on accessibility mode last, since enabling accessibility with no
// services has no effect.
Settings.Secure.putInt(resolver, Settings.Secure.ACCESSIBILITY_ENABLED, 1);
+
+ // Since Talkback will display an error message if it's not active when the Tutorial
+ // is launched, launch Talkbck Tutorial with a delay.
+ new Handler().postDelayed(mStartTalkbackRunnable,
+ SCREEN_READER_INITIALIZATION_DELAY_MS);
+ } else {
+ launchTalkbackTutorial();
}
}
// This should be replaced once the final preview sample screen is in place.
mPreviewSampleResIds = new int[]{R.layout.screen_zoom_preview_1,
R.layout.screen_zoom_preview_2,
- R.layout.screen_zoom_preview_3};
+ R.layout.screen_zoom_preview_settings};
final DisplayDensityUtils density = new DisplayDensityUtils(getContext());