Merge "Add API for checking if call captioning is enabled on the device"
This commit is contained in:
committed by
Android (Google) Code Review
commit
60c20f23cb
@@ -52368,6 +52368,7 @@ package android.view.accessibility {
|
||||
method public final float getFontScale();
|
||||
method @Nullable public final java.util.Locale getLocale();
|
||||
method @NonNull public android.view.accessibility.CaptioningManager.CaptionStyle getUserStyle();
|
||||
method public boolean isCallCaptioningEnabled();
|
||||
method public final boolean isEnabled();
|
||||
method public void removeCaptioningChangeListener(@NonNull android.view.accessibility.CaptioningManager.CaptioningChangeListener);
|
||||
}
|
||||
|
||||
@@ -367,7 +367,6 @@ package android {
|
||||
field public static final int config_showDefaultAssistant = 17891329; // 0x1110001
|
||||
field public static final int config_showDefaultEmergency = 17891330; // 0x1110002
|
||||
field public static final int config_showDefaultHome = 17891331; // 0x1110003
|
||||
field public static final int config_systemCaptionsServiceCallsEnabled;
|
||||
}
|
||||
|
||||
public static final class R.color {
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.annotation.SystemService;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
@@ -30,6 +31,8 @@ import android.os.Handler;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -51,6 +54,7 @@ public class CaptioningManager {
|
||||
private final ArrayList<CaptioningChangeListener> mListeners = new ArrayList<>();
|
||||
private final ContentResolver mContentResolver;
|
||||
private final ContentObserver mContentObserver;
|
||||
private final Resources mResources;
|
||||
|
||||
/**
|
||||
* Creates a new captioning manager for the specified context.
|
||||
@@ -62,6 +66,7 @@ public class CaptioningManager {
|
||||
|
||||
final Handler handler = new Handler(context.getMainLooper());
|
||||
mContentObserver = new MyContentObserver(handler);
|
||||
mResources = context.getResources();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,6 +186,13 @@ public class CaptioningManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if system wide call captioning is enabled for this device.
|
||||
*/
|
||||
public boolean isCallCaptioningEnabled() {
|
||||
return mResources.getBoolean(R.bool.config_systemCaptionsServiceCallsEnabled);
|
||||
}
|
||||
|
||||
private void notifyEnabledChanged() {
|
||||
final boolean enabled = isEnabled();
|
||||
synchronized (mListeners) {
|
||||
|
||||
@@ -3317,8 +3317,6 @@
|
||||
</staging-public-group>
|
||||
|
||||
<staging-public-group type="bool" first-id="0x01cf0000">
|
||||
<!-- @hide @SystemApi -->
|
||||
<public name="config_systemCaptionsServiceCallsEnabled" />
|
||||
<!-- @hide @TestApi -->
|
||||
<public name="config_preventImeStartupUnlessTextEditor" />
|
||||
</staging-public-group>
|
||||
|
||||
@@ -3654,6 +3654,8 @@
|
||||
<java-symbol type="string" name="config_retailDemoPackage" />
|
||||
<java-symbol type="string" name="config_retailDemoPackageSignature" />
|
||||
|
||||
<java-symbol type="bool" name="config_systemCaptionsServiceCallsEnabled" />
|
||||
|
||||
<java-symbol type="string" name="notification_channel_foreground_service" />
|
||||
<java-symbol type="string" name="foreground_service_app_in_background" />
|
||||
<java-symbol type="string" name="foreground_service_apps_in_background" />
|
||||
|
||||
Reference in New Issue
Block a user