Merge "Clean up captions service checks" into tm-dev

This commit is contained in:
Nadav Bar
2022-03-30 16:05:36 +00:00
committed by Android (Google) Code Review
4 changed files with 3 additions and 44 deletions

View File

@@ -4105,12 +4105,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"

View File

@@ -3708,7 +3708,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" />

View File

@@ -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) {

View File

@@ -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