diff --git a/res/values/bools.xml b/res/values/bools.xml index 4665f2eaed9..8b0c5984e95 100644 --- a/res/values/bools.xml +++ b/res/values/bools.xml @@ -153,6 +153,9 @@ true + + true + true diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml index d8459dd3c9f..c3f15b99ff5 100644 --- a/res/xml/system_dashboard_fragment.xml +++ b/res/xml/system_dashboard_fragment.xml @@ -46,7 +46,8 @@ android:summary="@string/reset_dashboard_summary" android:icon="@drawable/ic_restore" android:order="-50" - android:fragment="com.android.settings.system.ResetDashboardFragment" /> + android:fragment="com.android.settings.system.ResetDashboardFragment" + settings:controller="com.android.settings.system.ResetPreferenceController"/> false false false + false false false false diff --git a/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java new file mode 100644 index 00000000000..3869903c887 --- /dev/null +++ b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016 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.system; + +import static com.google.common.truth.Truth.assertThat; + +import android.content.Context; + +import com.android.settings.testutils.SettingsRobolectricTestRunner; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +@RunWith(SettingsRobolectricTestRunner.class) +public class ResetPreferenceControllerTest { + + private static final String KEY_RESET_DASHBOARD = "reset_dashboard"; + + private Context mContext; + private ResetPreferenceController mController; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mContext = RuntimeEnvironment.application; + mController = new ResetPreferenceController(mContext, KEY_RESET_DASHBOARD); + } + + @Test + public void isAvailable_byDefault_true() { + assertThat(mController.isAvailable()).isTrue(); + } + + @Test + @Config(qualifiers = "mcc999") + public void isAvailable_ifNotVisible_false() { + assertThat(mController.isAvailable()).isFalse(); + } +} \ No newline at end of file