Add A11y Slices

Add AccessibilityPreferenceController, which wraps all a11y settings
since they are share common infrastructure for enabling, current value,
and availability.

We add an overlay for OEMs to declare their bundled a11y services.
This is the only list of services that will be possible to enabled via
Settings slices.

Accessibility Slices are built by getting a list of valid services,
and indexing the service names as a key in the Slices DB. When they are
built at runtime, they use the generic A11yPrefController to get the status
and enable/disable the service.

Bug: 67997836
Bug: 67997672
Test: robotests
Change-Id: I66f905bf1c55eecb937945c4675c12bcbc96d698
This commit is contained in:
Matthew Fritze
2018-03-01 19:02:07 -08:00
parent d743f20618
commit a711ed8330
14 changed files with 467 additions and 49 deletions

View File

@@ -113,13 +113,13 @@ public class SliceBuilderUtils {
* - key
* <p>
* Examples of valid paths are:
* - intent/wifi
* - intent/bluetooth
* - action/wifi
* - action/accessibility/servicename
* - /intent/wifi
* - /intent/bluetooth
* - /action/wifi
* - /action/accessibility/servicename
*
* @param uri of the Slice. Follows pattern outlined in {@link SettingsSliceProvider}.
* @return Pair whose first element {@code true} if the path is prepended with "action", and
* @return Pair whose first element {@code true} if the path is prepended with "intent", and
* second is a key.
*/
public static Pair<Boolean, String> getPathData(Uri uri) {
@@ -133,10 +133,10 @@ public class SliceBuilderUtils {
throw new IllegalArgumentException("Uri (" + uri + ") has incomplete path: " + path);
}
final boolean isInline = TextUtils.equals(SettingsSlicesContract.PATH_SETTING_ACTION,
final boolean isIntent = TextUtils.equals(SettingsSlicesContract.PATH_SETTING_INTENT,
split[1]);
return new Pair<>(isInline, split[2]);
return new Pair<>(isIntent, split[2]);
}
/**
@@ -215,8 +215,8 @@ public class SliceBuilderUtils {
static Intent getContentIntent(Context context, SliceData sliceData) {
final Uri contentUri = new Uri.Builder().appendPath(sliceData.getKey()).build();
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(context,
sliceData.getFragmentClassName(), sliceData.getKey(), sliceData.getScreenTitle(),
0 /* TODO */);
sliceData.getFragmentClassName(), sliceData.getKey(),
sliceData.getScreenTitle().toString(), 0 /* TODO */);
intent.setClassName(context.getPackageName(), SubSettings.class.getName());
intent.setData(contentUri);
return intent;