blob: 7e5d53726fe607195d0e8440938798b37929af6b [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.accessibility;
enum SettingsManagerStatus {
OK = 0;
ERROR = 1;
};
/// Specifies color correction mode.
enum ColorCorrection {
/// No color correction enabled.
DISABLED = 0;
/// Color correction enabled for protanomaly (red-green -- reduced sensitivity to red light).
CORRECT_PROTANOMALY = 1;
/// Color correction enabled for deuteranomaly (red-green -- reduced sensitivity to green light).
CORRECT_DEUTERANOMALY = 2;
/// Color correction enabled for tritanomaly (blue-yellow -- reduced sensitivity to blue light).
CORRECT_TRITANOMALY = 3;
};
/// Settings is used to represent all the Accessibility Settings along with Matrix
/// needed to apply Color Correction and Color Inversion.
/// This table will be used to transfer Settings information between different services to
/// either modify or get notified about Accessibility Settings.
table Settings {
/// When magnification_enabled == true, user can specify an area of the screen to be magnified.
/// Note that actually magnifying the region requires an addition input (gesture, button, etc.).
1: bool magnification_enabled;
/// Degree of magnification for magnified area.
2: float32 magnification_zoom_factor;
/// When screen_reader_enabled == true, user can specify elements of the UI to be described
/// audibly.
/// Note that reading a particular element requires an additional input.
3: bool screen_reader_enabled;
/// When color_inversion_enabled == true, certain colors are inverted across the entire screen.
/// No additional user input is required for the inversion to take place once enabled.
/// Colors will continue to be inverted until color_inversion_enabled is set to false.
4: bool color_inversion_enabled;
/// When color_correction is set to DISABLED, colors are displayed normally.
/// When color_correction has different value, colors are modified to correct for the specified
/// type of color-blindness.
/// No additional user input is required for corrections to take place once enabled.
/// Correction will continue to occur until color_correction is set to DISABLED.
5: ColorCorrection color_correction;
/// 3x3 Matrix in row-major form which will be used by the SettingsManager
/// client for applying Color Correction and Color Inversion. Display
/// adapter expects a 3x3 row major matrix and A11y manager stores the
/// matrix in the same format.
/// Color Adjustment matrix is used to modify onscreen colors for either
/// of Deuteranomaly, Protanomaly and Tritanomaly or it can be used for
/// performing Color Inversion.
6: array<float32>:9 color_adjustment_matrix;
};
/// SettingsManager will be implemented by Accessibility Manager.
/// The accessibility settings manager is an interface that allows other services to:
/// 1. register as a settings provider. In return, SettingsManager will provide an interface
/// to modify individual settings.
/// 2. register themselves to get notified whenever there is a change in Settings.
/// Ideally there should be just 1 Settings Provider and there can be multiple watchers.
/// "Settings Service" will be settings Provider for Accessibility. There could be multiple
/// settings watchers like Root Presenter, Flutter, Chrome, etc.
[Discoverable]
protocol SettingsManager {
/// Register Accessibility settings provider to make modification to accessibility settings.
RegisterSettingProvider(request<SettingsProvider> settings_provider_request);
/// Registers a watcher to observe changes in accessibility settings.
/// When a watcher is registered by calling Watch(), SettingsManager will send all the
/// Settings as part of registration.
Watch(SettingsWatcher watcher);
};
/// Interface to update Accessibility Settings. Various Accessibility Settings can be
/// modified individually.
protocol SettingsProvider {
/// Enables or disables magnification depending on `magnification_enabled`.
/// When `magnification_enabled` is different from the existing setting,
/// the zoom factor is reset to 1.0.
SetMagnificationEnabled(bool magnification_enabled)
-> (SettingsManagerStatus status);
/// Sets value of zoom factor, provided that magnification is enabled.
/// Zoom factor must be > 1.0.
/// Returns ERROR if zoom is disabled or if magnification_zoom_factor < 1.0.
SetMagnificationZoomFactor(float32 magnification_zoom_factor)
-> (SettingsManagerStatus status);
/// Sets value of screen_reader_enabled, and returns OK.
SetScreenReaderEnabled(bool screen_reader_enabled)
-> (SettingsManagerStatus status);
/// Sets value of color_inversion_enabled, and returns OK.
SetColorInversionEnabled(bool color_inversion_enabled)
-> (SettingsManagerStatus status);
/// Sets value of color_correction, and returns OK.
SetColorCorrection(ColorCorrection color_correction)
-> (SettingsManagerStatus status);
};
/// SettingsWatcher is the client side interface that Settings Manager can
/// use to notify clients whenever Accessibility Settings change.
protocol SettingsWatcher {
/// Called when accessibility settings elections change.
OnSettingsChange(Settings accessibility_settings);
};