Adapt to the new API of `ShadowCaptioningManager`.

Test: Presubmit.
Change-Id: If90894a2438ff5e0aec8e727036f7a656f4c712a
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java
index 74fb440..b9de66d 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java
@@ -17,8 +17,10 @@
 package com.android.settings.accessibility;
 
 import static com.google.common.truth.Truth.assertThat;
+import static org.robolectric.Shadows.shadowOf;
 
 import android.content.Context;
+import android.os.Looper;
 import android.provider.Settings;
 import android.view.accessibility.CaptioningManager;
 
@@ -68,7 +70,9 @@
 
     @Test
     public void getSummary_smallestScale_shouldReturnExpectedSummary() {
-        mShadowCaptioningManager.setFontScale(0.25f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.25f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         final String expectedSummary =
                 getSummaryCombo(/* fontScaleIndex= */ 0, DEFAULT_PRESET_INDEX);
@@ -77,7 +81,9 @@
 
     @Test
     public void getSummary_smallScale_shouldReturnExpectedSummary() {
-        mShadowCaptioningManager.setFontScale(0.5f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.5f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         final String expectedSummary =
                 getSummaryCombo(/* fontScaleIndex= */ 1, DEFAULT_PRESET_INDEX);
@@ -86,7 +92,9 @@
 
     @Test
     public void getSummary_mediumScale_shouldReturnExpectedSummary() {
-        mShadowCaptioningManager.setFontScale(1.0f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.0f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         final String expectedSummary =
                 getSummaryCombo(/* fontScaleIndex= */ 2, DEFAULT_PRESET_INDEX);
@@ -95,7 +103,9 @@
 
     @Test
     public void getSummary_largeScale_shouldReturnExpectedSummary() {
-        mShadowCaptioningManager.setFontScale(1.5f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.5f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         final String expectedSummary =
                 getSummaryCombo(/* fontScaleIndex= */ 3, DEFAULT_PRESET_INDEX);
@@ -104,7 +114,9 @@
 
     @Test
     public void getSummary_largestScale_shouldReturnExpectedSummary() {
-        mShadowCaptioningManager.setFontScale(2.0f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 2.0f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         final String expectedSummary =
                 getSummaryCombo(/* fontScaleIndex= */ 4, DEFAULT_PRESET_INDEX);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java
index 0ea7a41..e847f43 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java
@@ -127,7 +127,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0xFFFF0000);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java
index 56a61ec..5036ba0 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java
@@ -103,7 +103,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0x80FFFFFF);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java
index f1a8566..c55e087 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java
@@ -101,7 +101,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0xFFFF0000);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java
index 11871f8..354115f 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java
@@ -103,7 +103,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, CaptionStyle.EDGE_TYPE_OUTLINE);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java
index 8aeb37e..b00d8d8 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java
@@ -23,7 +23,10 @@
 
 import static org.mockito.Mockito.when;
 
+import static org.robolectric.Shadows.shadowOf;
+
 import android.content.Context;
+import android.os.Looper;
 import android.provider.Settings;
 import android.view.accessibility.CaptioningManager;
 
@@ -85,7 +88,9 @@
 
     @Test
     public void updateState_bySmallValue_shouldReturnSmall() {
-        mShadowCaptioningManager.setFontScale(0.5f);
+        Settings.Secure.putFloat(mContext.getContentResolver(),
+            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.5f);
+        shadowOf(Looper.getMainLooper()).idle();
 
         mController.updateState(mPreference);
 
@@ -94,7 +99,8 @@
 
     @Test
     public void onPreferenceChange_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onPreferenceChange(mPreference, "0.5");
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java
index 8991bad..9e9c926 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java
@@ -127,7 +127,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0xFFFF0000);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java
index 1ffff60..a88b5f5 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java
@@ -103,7 +103,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0x80FFFFFF);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java
index c91baa2..1614c8f 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java
@@ -103,7 +103,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, CaptionStyle.PRESET_CUSTOM);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java
index e0a04bc..7523db6 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java
@@ -82,7 +82,8 @@
 
     @Test
     public void displayPreference_captionEnabled_shouldSetChecked() {
-        mShadowCaptioningManager.setEnabled(true);
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON);
 
         mController.displayPreference(mScreen);
 
@@ -91,7 +92,8 @@
 
     @Test
     public void displayPreference_captionDisabled_shouldSetUnchecked() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
 
         mController.displayPreference(mScreen);
 
@@ -100,7 +102,8 @@
 
     @Test
     public void performClick_captionEnabled_shouldSetCaptionDisabled() {
-        mShadowCaptioningManager.setEnabled(true);
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON);
         mController.displayPreference(mScreen);
 
         mSwitchPreference.performClick();
@@ -111,7 +114,8 @@
 
     @Test
     public void performClick_captionDisabled_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mSwitchPreference.performClick();
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java
index 4d33fb3..aa7d3eb 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java
@@ -95,7 +95,8 @@
 
     @Test
     public void onPreferenceChange_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onPreferenceChange(mPreference, "serif");
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java
index f916778..1258214 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java
@@ -128,7 +128,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0xFFFF0000);
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java
index 99eb1e5..0e872a0 100644
--- a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java
@@ -102,7 +102,8 @@
 
     @Test
     public void onValueChanged_shouldSetCaptionEnabled() {
-        mShadowCaptioningManager.setEnabled(false);
+        Settings.Secure.putInt(
+            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
         mController.displayPreference(mScreen);
 
         mController.onValueChanged(mPreference, 0x80FFFFFF);