Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60c20f23 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add API for checking if call captioning is enabled on the device"

parents 6508b4ec c751b74f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
  }
+0 −1
Original line number Diff line number Diff line
@@ -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 {
+12 −0
Original line number Diff line number Diff line
@@ -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) {
+0 −2
Original line number Diff line number Diff line
@@ -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>
+2 −0
Original line number Diff line number Diff line
@@ -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" />