Fix Live Caption does not follow caption size if caption is not enabled

Root cause: Changing captions style without turning on the preference WHILE Live Caption is running works when it shouldn't.
Solution: Turn on the show caption if users change caption size and style by UX suggestion.

Bug: 221051127
Test: Manual testing
  1. Turning on/off Live Caption and Caption Manager
  2. Changing styles when Caption Manager is off
Change-Id: Ie6cfb9e0b7325c2e469ac8b6a7d359b843cc173a
This commit is contained in:
menghanli
2022-04-21 16:55:47 +08:00
parent 3adc967449
commit 0d47c548d9

View File

@@ -16,6 +16,8 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import android.app.settings.SettingsEnums;
import android.content.ContentResolver;
import android.content.Context;
@@ -400,6 +402,7 @@ public class CaptionAppearanceFragment extends DashboardFragment
}
refreshPreviewText();
enableCaptioningManager();
}
@Override
@@ -409,16 +412,26 @@ public class CaptionAppearanceFragment extends DashboardFragment
Settings.Secure.putString(
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE, (String) value);
refreshPreviewText();
enableCaptioningManager();
} else if (mFontSize == preference) {
Settings.Secure.putFloat(
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
Float.parseFloat((String) value));
refreshPreviewText();
enableCaptioningManager();
}
return true;
}
private void enableCaptioningManager() {
if (mCaptioningManager.isEnabled()) {
return;
}
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON);
}
@Override
public int getHelpResource() {
return R.string.help_url_caption;