diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8d8513e2c72..28f9d2e9e95 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4270,8 +4270,6 @@
Cancel
Magnification settings
-
- Magnify with triple-tap
Magnify with shortcut
diff --git a/res/xml/accessibility_magnification_service_settings.xml b/res/xml/accessibility_magnification_service_settings.xml
deleted file mode 100644
index e80d936a51a..00000000000
--- a/res/xml/accessibility_magnification_service_settings.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/res/xml/accessibility_magnification_settings.xml b/res/xml/accessibility_magnification_settings.xml
deleted file mode 100644
index 83ce79b9240..00000000000
--- a/res/xml/accessibility_magnification_settings.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 111091481a0..6d430636387 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -62,7 +62,7 @@
settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
activeServices =
- am.getEnabledAccessibilityServiceList(
- AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
- final int serviceCount = activeServices.size();
- for (int i = 0; i < serviceCount; i++) {
- final AccessibilityServiceInfo info = activeServices.get(i);
- if (info.getComponentName().equals(assignedComponentName)) {
- final CharSequence assignedServiceName = info.getResolveInfo().loadLabel(
- context.getPackageManager());
- final int messageId = AccessibilityUtil.isGestureNavigateEnabled(context)
- ? R.string.accessibility_screen_magnification_gesture_navigation_warning
- : R.string.accessibility_screen_magnification_navbar_configuration_warning;
- return context.getString(messageId, assignedServiceName);
- }
- }
- }
- return null;
- }
-
- static boolean isChecked(ContentResolver contentResolver, String settingsKey) {
- return Settings.Secure.getInt(contentResolver, settingsKey, OFF) == ON;
- }
-
- static boolean setChecked(ContentResolver contentResolver, String settingsKey,
- boolean isChecked) {
- return Settings.Secure.putInt(contentResolver, settingsKey, isChecked ? ON : OFF);
- }
-
- /**
- * @return {@code true} if this fragment should be shown, {@code false} otherwise. This
- * fragment is shown in the case that more than one magnification mode is available.
- */
- static boolean isApplicable(Resources res) {
- return res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
- }
-
- public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.accessibility_magnification_settings) {
-
- @Override
- protected boolean isPageSearchEnabled(Context context) {
- return isApplicable(context.getResources());
- }
- };
-}
diff --git a/src/com/android/settings/accessibility/MagnificationSettingsFragment.java b/src/com/android/settings/accessibility/MagnificationSettingsFragment.java
deleted file mode 100644
index a898076033c..00000000000
--- a/src/com/android/settings/accessibility/MagnificationSettingsFragment.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-
-import com.android.settings.DialogCreatable;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-/** Settings page for magnification. */
-@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
-public class MagnificationSettingsFragment extends DashboardFragment implements
- MagnificationModePreferenceController.DialogHelper {
-
- private static final String TAG = "MagnificationSettingsFragment";
-
- private DialogCreatable mDialogDelegate;
-
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.ACCESSIBILITY_MAGNIFICATION_SETTINGS;
- }
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- use(MagnificationModePreferenceController.class).setDialogHelper(this);
- }
-
- @Override
- public void showDialog(int dialogId) {
- super.showDialog(dialogId);
- }
-
- @Override
- public void setDialogDelegate(DialogCreatable delegate) {
- mDialogDelegate = delegate;
- }
-
- @Override
- public int getDialogMetricsCategory(int dialogId) {
- if (mDialogDelegate != null) {
- return mDialogDelegate.getDialogMetricsCategory(dialogId);
- }
- return 0;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.accessibility_magnification_service_settings;
- }
-
- @Override
- public Dialog onCreateDialog(int dialogId) {
- if (mDialogDelegate != null) {
- final Dialog dialog = mDialogDelegate.onCreateDialog(dialogId);
- if (dialog != null) {
- return dialog;
- }
- }
- throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
- }
-
- public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.accessibility_magnification_service_settings);
-}
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 201172575ed..7a9b959cc76 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -225,10 +225,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
protected void onProcessArguments(Bundle arguments) {
Context context = getContext();
- // This Fragment may get arguments from MagnificationGesturesPreferenceController or
- // MagnificationNavbarPreferenceController and it's necessary to check if a key exists
- // before putting a new value into arguments.
-
if (!arguments.containsKey(AccessibilitySettings.EXTRA_PREFERENCE_KEY)) {
arguments.putString(AccessibilitySettings.EXTRA_PREFERENCE_KEY,
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
@@ -531,7 +527,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends
preferenceKey)) {
showDialog(DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL);
}
- MagnificationPreferenceFragment.setChecked(getContentResolver(), preferenceKey, enabled);
+ Settings.Secure.putInt(getContentResolver(), preferenceKey, enabled ? ON : OFF);
}
@Override
diff --git a/res/raw/accessibility_screen_magnification.mp4 b/tests/robotests/res/raw/sample_video.mp4
similarity index 100%
rename from res/raw/accessibility_screen_magnification.mp4
rename to tests/robotests/res/raw/sample_video.mp4
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationGesturesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationGesturesPreferenceControllerTest.java
deleted file mode 100644
index c7d70e0da75..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationGesturesPreferenceControllerTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.android.settings.accessibility.MagnificationPreferenceFragment.OFF;
-import static com.android.settings.accessibility.MagnificationPreferenceFragment.ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class MagnificationGesturesPreferenceControllerTest {
-
- private Context mContext;
- private MagnificationGesturesPreferenceController mController;
- private Preference mPreference;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mController = new MagnificationGesturesPreferenceController(mContext, "pref_key");
- mPreference = new Preference(mContext);
- mController.updateState(mPreference);
- }
-
- @Test
- public void isAlwaysAvailable() {
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(BasePreferenceController.AVAILABLE);
- }
-
- @Test
- public void updateState_shouldRefreshSummary() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, ON);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getString(R.string.accessibility_feature_state_on));
-
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, OFF);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getString(R.string.accessibility_feature_state_off));
- }
-
- @Test
- public void updateState_shouldRefreshSummarySuw() {
- mController.setIsFromSUW(true);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getString(R.string.
- accessibility_screen_magnification_short_summary));
- }
-
- @Test
- public void isChecked_enabled() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, ON);
-
- assertThat(mController.isChecked()).isTrue();
- }
-
- @Test
- public void isChecked_disabled() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, OFF);
-
- assertThat(mController.isChecked()).isFalse();
- }
-
- @Test
- public void setChecked_enabled() {
- mController.setChecked(true);
-
- assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, -1))
- .isEqualTo(ON);
- }
-
- @Test
- public void setChecked_disabled() {
- mController.setChecked(false);
-
- assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, -1))
- .isEqualTo(OFF);
- }
-
- @Test
- public void isSliceableCorrectKey_returnsTrue() {
- final MagnificationGesturesPreferenceController controller =
- new MagnificationGesturesPreferenceController(mContext,
- "screen_magnification_gestures_preference_screen");
- assertThat(controller.isSliceable()).isTrue();
- }
-
- @Test
- public void isSliceableIncorrectKey_returnsFalse() {
- final MagnificationGesturesPreferenceController controller =
- new MagnificationGesturesPreferenceController(mContext, "bad_key");
- assertThat(controller.isSliceable()).isFalse();
- }
-
- @Test
- public void isPublicSlice_returnTrue() {
- assertThat(mController.isPublicSlice()).isTrue();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationModePreferenceControllerTest.java
index 30ba9b6170e..f0719185dcb 100644
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/MagnificationModePreferenceControllerTest.java
@@ -16,9 +16,9 @@
package com.android.settings.accessibility;
+import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.android.settings.accessibility.MagnificationCapabilities.MagnificationMode;
import static com.android.settings.accessibility.MagnificationModePreferenceController.MagnificationModeInfo;
-import static com.android.settings.accessibility.MagnificationPreferenceFragment.ON;
import static com.google.common.truth.Truth.assertThat;
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationNavbarPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationNavbarPreferenceControllerTest.java
deleted file mode 100644
index 83fe496f52d..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationNavbarPreferenceControllerTest.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.android.settings.accessibility.MagnificationPreferenceFragment.OFF;
-import static com.android.settings.accessibility.MagnificationPreferenceFragment.ON;
-import static com.android.settings.core.BasePreferenceController.AVAILABLE;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.annotation.Resetter;
-
-@RunWith(RobolectricTestRunner.class)
-public class MagnificationNavbarPreferenceControllerTest {
-
- private Context mContext;
- private MagnificationNavbarPreferenceController mController;
- private Preference mPreference;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(RuntimeEnvironment.application);
- mController = new MagnificationNavbarPreferenceController(mContext, "test_key");
- mPreference = new Preference(mContext);
- mController.updateState(mPreference);
- }
-
- @After
- public void tearDown() {
- ShadowMagnificationPreferenceFragment.reset();
- }
-
- @Test
- @Config(shadows = ShadowMagnificationPreferenceFragment.class)
- public void isAvailable_unsupported_shouldNotBeAvailable() {
- ShadowMagnificationPreferenceFragment.setApplicable(false);
-
- assertThat(mController.getAvailabilityStatus())
- .isNotEqualTo(AVAILABLE);
- }
-
- @Test
- @Config(shadows = ShadowMagnificationPreferenceFragment.class)
- public void isAvailable_supported_shouldBeAvailable() {
- ShadowMagnificationPreferenceFragment.setApplicable(true);
-
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(AVAILABLE);
- }
-
- @Test
- public void updateState_shouldRefreshSummary() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, ON);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getText(R.string.accessibility_feature_state_on));
-
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, OFF);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getText(R.string.accessibility_feature_state_off));
- }
-
- @Test
- public void updateState_shouldRefreshSummarySuw() {
- mController.setIsFromSUW(true);
- mController.updateState(mPreference);
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getString(R.string.
- accessibility_screen_magnification_navbar_short_summary));
- }
-
- @Test
- public void isChecked_enabled() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, ON);
-
- assertThat(mController.isChecked()).isTrue();
- }
-
- @Test
- public void isChecked_disabled() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, OFF);
-
- assertThat(mController.isChecked()).isFalse();
- }
-
- @Test
- public void setChecked_enabled() {
- mController.setChecked(true);
-
- assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, -1))
- .isEqualTo(ON);
- }
-
- @Test
- public void setChecked_disabled() {
- mController.setChecked(false);
-
- assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED, -1))
- .isEqualTo(OFF);
- }
-
- @Implements(MagnificationPreferenceFragment.class)
- public static class ShadowMagnificationPreferenceFragment {
- private static boolean sIsApplicable;
-
- @Resetter
- static void reset() {
- sIsApplicable = false;
- }
-
- @Implementation
- protected static boolean isApplicable(Resources res) {
- return sIsApplicable;
- }
-
- static void setApplicable(boolean applicable) {
- sIsApplicable = applicable;
- }
- }
-
- @Test
- public void isSliceableCorrectKey_returnsTrue() {
- final MagnificationNavbarPreferenceController controller =
- new MagnificationNavbarPreferenceController(mContext,
- "screen_magnification_navbar_preference_screen");
- assertThat(controller.isSliceable()).isTrue();
- }
-
- @Test
- public void isSliceableIncorrectKey_returnsFalse() {
- final MagnificationNavbarPreferenceController controller =
- new MagnificationNavbarPreferenceController(mContext, "bad_key");
- assertThat(controller.isSliceable()).isFalse();
- }
-
- @Test
- public void isPublicSlice_returnTrue() {
- assertThat(mController.isPublicSlice()).isTrue();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationSettingsFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationSettingsFragmentTest.java
deleted file mode 100644
index a1a146d9c60..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationSettingsFragmentTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.os.Bundle;
-
-import androidx.fragment.app.FragmentManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.DialogCreatable;
-import com.android.settings.R;
-import com.android.settings.testutils.XmlTestUtils;
-import com.android.settings.testutils.shadow.ShadowDashboardFragment;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
-
-import java.util.List;
-
-/** Tests for {@link MagnificationSettingsFragment} */
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowDashboardFragment.class)
-public class MagnificationSettingsFragmentTest {
-
- private final Context mContext = ApplicationProvider.getApplicationContext();
- private MagnificationSettingsFragment mFragment;
- private PreferenceScreen mScreen;
-
- @Before
- public void setup() {
- mContext.setTheme(R.style.Theme_AppCompat);
- mFragment = spy(new MagnificationSettingsFragment());
- mScreen = new PreferenceScreen(mContext, null);
-
- doReturn(mContext).when(mFragment).getContext();
- doReturn(mScreen).when(mFragment).getPreferenceScreen();
- doReturn(mock(FragmentManager.class, Answers.RETURNS_DEEP_STUBS)).when(
- mFragment).getChildFragmentManager();
- }
-
- @Test
- public void showPreferenceOnTheScreen_setDialogHelper() {
- showPreferenceOnTheScreen(null);
-
- verify(mFragment).setDialogDelegate(any(MagnificationModePreferenceController.class));
- }
-
- @Test
- public void onCreateDialog_setDialogDelegate_invokeDialogDelegate() {
- final DialogCreatable dialogDelegate = mock(DialogCreatable.class, RETURNS_DEEP_STUBS);
- when(dialogDelegate.getDialogMetricsCategory(anyInt())).thenReturn(1);
-
- mFragment.setDialogDelegate(dialogDelegate);
-
- mFragment.onCreateDialog(1);
- mFragment.getDialogMetricsCategory(1);
-
- verify(dialogDelegate).onCreateDialog(1);
- verify(dialogDelegate).getDialogMetricsCategory(1);
- }
-
- @Test
- public void getMetricsCategory_returnsCorrectCategory() {
- assertThat(mFragment.getMetricsCategory()).isEqualTo(
- SettingsEnums.ACCESSIBILITY_MAGNIFICATION_SETTINGS);
- }
-
- @Test
- public void getPreferenceScreenResId_returnsCorrectXml() {
- assertThat(mFragment.getPreferenceScreenResId()).isEqualTo(
- R.xml.accessibility_magnification_service_settings);
- }
-
- @Test
- public void getLogTag_returnsCorrectTag() {
- assertThat(mFragment.getLogTag()).isEqualTo("MagnificationSettingsFragment");
- }
-
- @Test
- public void getNonIndexableKeys_existInXmlLayout() {
- final List niks =
- ShortcutsSettingsFragment.SEARCH_INDEX_DATA_PROVIDER
- .getNonIndexableKeys(mContext);
- final List keys =
- XmlTestUtils.getKeysFromPreferenceXml(mContext,
- R.xml.accessibility_magnification_service_settings);
- assertThat(keys).containsAtLeastElementsIn(niks);
- }
-
- private void showPreferenceOnTheScreen(Bundle savedInstanceState) {
- mFragment.onAttach(mContext);
- mFragment.onCreate(savedInstanceState);
- mFragment.onResume();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 46b582f9ac2..2492de1e58b 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -71,7 +71,7 @@ public class VideoPreferenceTest {
mContext = RuntimeEnvironment.application;
mAnimationController = spy(
- new MediaAnimationController(mContext, R.raw.accessibility_screen_magnification));
+ new MediaAnimationController(mContext, R.raw.sample_video));
mVideoPreference = new VideoPreference(mContext, null /* attrs */);
mVideoPreference.mAnimationController = mAnimationController;
when(mAnimationController.getVideoWidth()).thenReturn(VIDEO_WIDTH);