Clean up captions service checks
This CL finish the migration to the new CaptioningManager API. As part of the cleanup the captions service config is also removed, and the PackageManager implementation is updated to take the captions package name from the remaining config value which is stil in use. Change-Id: Icba274c904c58f62c1036deac936114b7deb8553 Bug: 220968335. Test: Manually.
This commit is contained in:
@@ -4096,12 +4096,6 @@
|
||||
<!-- Intent extra key for the event code int array while requesting ambient context consent. -->
|
||||
<string translatable="false" name="config_ambientContextEventArrayExtraKey"></string>
|
||||
|
||||
<!-- The component name for the system-wide captions service.
|
||||
This service must be trusted, as it controls part of the UI of the volume bar.
|
||||
Example: "com.android.captions/.SystemCaptionsService"
|
||||
-->
|
||||
<string name="config_defaultSystemCaptionsService" translatable="false"></string>
|
||||
|
||||
<!-- The component name for the system-wide captions manager service.
|
||||
This service must be trusted, as the system binds to it and keeps it running.
|
||||
Example: "com.android.captions/.SystemCaptionsManagerService"
|
||||
|
||||
@@ -3704,7 +3704,6 @@
|
||||
<java-symbol type="string" name="config_defaultMusicRecognitionService" />
|
||||
<java-symbol type="string" name="config_defaultAttentionService" />
|
||||
<java-symbol type="string" name="config_defaultRotationResolverService" />
|
||||
<java-symbol type="string" name="config_defaultSystemCaptionsService" />
|
||||
<java-symbol type="string" name="config_defaultSystemCaptionsManagerService" />
|
||||
<java-symbol type="string" name="config_defaultAmbientContextDetectionService" />
|
||||
<java-symbol type="string" name="config_defaultAmbientContextConsentComponent" />
|
||||
|
||||
@@ -49,7 +49,6 @@ import android.os.VibrationEffect;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.Condition;
|
||||
import android.service.notification.ZenModeConfig;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
@@ -418,41 +417,8 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
|
||||
}
|
||||
|
||||
private void onGetCaptionsComponentStateW(boolean fromTooltip) {
|
||||
if (mCaptioningManager.isSystemAudioCaptioningUiEnabled()) {
|
||||
mCallbacks.onCaptionComponentStateChanged(true, fromTooltip);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(b/220968335): Remove this check once system captions component migrates
|
||||
// to new CaptioningManager APIs.
|
||||
try {
|
||||
String componentNameString = mContext.getString(
|
||||
com.android.internal.R.string.config_defaultSystemCaptionsService);
|
||||
if (TextUtils.isEmpty(componentNameString)) {
|
||||
// component doesn't exist
|
||||
mCallbacks.onCaptionComponentStateChanged(false, fromTooltip);
|
||||
return;
|
||||
}
|
||||
|
||||
if (D.BUG) {
|
||||
Log.i(TAG, String.format(
|
||||
"isCaptionsServiceEnabled componentNameString=%s", componentNameString));
|
||||
}
|
||||
|
||||
ComponentName componentName = ComponentName.unflattenFromString(componentNameString);
|
||||
if (componentName == null) {
|
||||
mCallbacks.onCaptionComponentStateChanged(false, fromTooltip);
|
||||
return;
|
||||
}
|
||||
|
||||
mCallbacks.onCaptionComponentStateChanged(
|
||||
mPackageManager.getComponentEnabledSetting(componentName)
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_ENABLED, fromTooltip);
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG,
|
||||
"isCaptionsServiceEnabled failed to check for captions component", ex);
|
||||
mCallbacks.onCaptionComponentStateChanged(false, fromTooltip);
|
||||
}
|
||||
mCallbacks.onCaptionComponentStateChanged(
|
||||
mCaptioningManager.isSystemAudioCaptioningUiEnabled(), fromTooltip);
|
||||
}
|
||||
|
||||
private void onAccessibilityModeChanged(Boolean showA11yStream) {
|
||||
|
||||
@@ -803,7 +803,7 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub {
|
||||
public final String getSystemCaptionsServicePackageName() {
|
||||
return mService.ensureSystemPackageName(snapshot(),
|
||||
mService.getPackageFromComponentString(
|
||||
R.string.config_defaultSystemCaptionsService));
|
||||
R.string.config_defaultSystemCaptionsManagerService));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user