Merge "Create Public API in AccessibilityManager to expose Audio description enabled status."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ba3d33a9e
@@ -50835,6 +50835,7 @@ package android.view.accessibility {
|
||||
method public int getRecommendedTimeoutMillis(int, int);
|
||||
method public void interrupt();
|
||||
method public static boolean isAccessibilityButtonSupported();
|
||||
method public boolean isAudioDescriptionEnabled();
|
||||
method public boolean isEnabled();
|
||||
method public boolean isTouchExplorationEnabled();
|
||||
method public void removeAccessibilityRequestPreparer(android.view.accessibility.AccessibilityRequestPreparer);
|
||||
|
||||
@@ -7234,6 +7234,14 @@ public final class Settings {
|
||||
public static final String ENABLED_ACCESSIBILITY_SERVICES =
|
||||
"enabled_accessibility_services";
|
||||
|
||||
/**
|
||||
* Whether select sound track with audio description by default.
|
||||
* @hide
|
||||
*/
|
||||
@Readable
|
||||
public static final String ENABLE_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT =
|
||||
"enable_accessibility_audio_description_by_default";
|
||||
|
||||
/**
|
||||
* List of the notified non-accessibility category accessibility services.
|
||||
*
|
||||
@@ -10390,14 +10398,6 @@ public final class Settings {
|
||||
public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
|
||||
"enable_accessibility_global_gesture_enabled";
|
||||
|
||||
/**
|
||||
* Whether select sound track with audio description by default.
|
||||
* @hide
|
||||
*/
|
||||
@Readable
|
||||
public static final String ENABLE_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT =
|
||||
"enable_accessibility_audio_description_by_default";
|
||||
|
||||
/**
|
||||
* Whether Airplane Mode is on.
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.annotation.UserIdInt;
|
||||
import android.app.RemoteAction;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
@@ -54,6 +55,7 @@ import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -271,6 +273,8 @@ public final class AccessibilityManager {
|
||||
*/
|
||||
private SparseArray<List<AccessibilityRequestPreparer>> mRequestPreparerLists;
|
||||
|
||||
private ContentResolver mContentResolver;
|
||||
|
||||
/**
|
||||
* Listener for the system accessibility state. To listen for changes to the
|
||||
* accessibility state on the device, implement this interface and register
|
||||
@@ -483,6 +487,7 @@ public final class AccessibilityManager {
|
||||
mCallback = new MyCallback();
|
||||
mHandler = new Handler(context.getMainLooper(), mCallback);
|
||||
mUserId = userId;
|
||||
mContentResolver = context.getContentResolver();
|
||||
synchronized (mLock) {
|
||||
initialFocusAppearanceLocked(context.getResources());
|
||||
tryConnectToServiceLocked(service);
|
||||
@@ -507,6 +512,7 @@ public final class AccessibilityManager {
|
||||
mCallback = new MyCallback();
|
||||
mHandler = handler;
|
||||
mUserId = userId;
|
||||
mContentResolver = context.getContentResolver();
|
||||
synchronized (mLock) {
|
||||
initialFocusAppearanceLocked(context.getResources());
|
||||
if (serviceConnect) {
|
||||
@@ -1820,6 +1826,25 @@ public final class AccessibilityManager {
|
||||
return res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if users want to select sound track with audio description by default.
|
||||
*
|
||||
* Audio description, also referred to as a video description, described video, or
|
||||
* more precisely called a visual description, is a form of narration used to provide
|
||||
* information surrounding key visual elements in a media work for the benefit of
|
||||
* blind and visually impaired consumers.
|
||||
*
|
||||
* The method provides the preference value to content provider apps to select the
|
||||
* default sound track during playing a video or movie.
|
||||
*
|
||||
* @return {@code true} if the audio description is enabled, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAudioDescriptionEnabled() {
|
||||
return Settings.Secure.getInt(
|
||||
mContentResolver,
|
||||
Settings.Secure.ENABLE_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT, 0) == 1;
|
||||
}
|
||||
|
||||
private final class MyCallback implements Handler.Callback {
|
||||
public static final int MSG_SET_STATE = 1;
|
||||
|
||||
|
||||
@@ -272,7 +272,6 @@ public class SettingsBackupTest {
|
||||
Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
|
||||
Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
|
||||
Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
|
||||
Settings.Global.ENABLE_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
|
||||
Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
|
||||
Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
|
||||
Settings.Global.ENHANCED_4G_MODE_ENABLED,
|
||||
@@ -722,6 +721,7 @@ public class SettingsBackupTest {
|
||||
Settings.Secure.DOCKED_CLOCK_FACE,
|
||||
Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
|
||||
Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
|
||||
Settings.Secure.ENABLE_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
|
||||
Settings.Secure.ENABLED_INPUT_METHODS, // Intentionally removed in P
|
||||
Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT,
|
||||
Settings.Secure.ENABLED_NOTIFICATION_LISTENERS,
|
||||
|
||||
Reference in New Issue
Block a user