diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml index 90b7528c175..e610df29658 100644 --- a/res/xml/sound_settings.xml +++ b/res/xml/sound_settings.xml @@ -103,14 +103,14 @@ settings:useAdminDisabledSummary="true" settings:keywords="@string/keywords_sounds_and_notifications_interruptions" settings:allowDividerAbove="true" - settings:controller="com.android.settings.notification.ZenModePreferenceController" /> + settings:controller="com.android.settings.notification.ZenModeSoundSettingsPreferenceController"/> + settings:controller="com.android.settings.gestures.PreventRingingParentPreferenceController"/> + android:title="@string/dial_pad_tones_title"/> + android:title="@string/screen_locking_sounds_title"/> + android:title="@string/charging_sounds_title"/> + android:title="@string/docking_sounds_title"/> + android:title="@string/touch_sounds_title"/> + android:summary="%s"/> + android:title="@string/boot_sounds_title"/> + android:summary="%s"/> + android:disableDependentsState="true"/> + android:dependency="work_use_personal_sounds"/> + android:dependency="work_use_personal_sounds"/> + android:dependency="work_use_personal_sounds"/> diff --git a/src/com/android/settings/notification/ZenModePreferenceController.java b/src/com/android/settings/notification/ZenModePreferenceController.java index 22eb0c098d6..44ad2ffb6d1 100644 --- a/src/com/android/settings/notification/ZenModePreferenceController.java +++ b/src/com/android/settings/notification/ZenModePreferenceController.java @@ -35,9 +35,6 @@ import com.android.settingslib.core.lifecycle.events.OnResume; public class ZenModePreferenceController extends BasePreferenceController implements LifecycleObserver, OnResume, OnPause { - - public static final String ZEN_MODE_KEY = "zen_mode"; - private SettingObserver mSettingObserver; private ZenModeSettings.SummaryBuilder mSummaryBuilder; diff --git a/src/com/android/settings/notification/ZenModeSliceBuilder.java b/src/com/android/settings/notification/ZenModeSliceBuilder.java index ceb36feba55..e8b181a6e69 100644 --- a/src/com/android/settings/notification/ZenModeSliceBuilder.java +++ b/src/com/android/settings/notification/ZenModeSliceBuilder.java @@ -18,7 +18,7 @@ package com.android.settings.notification; import static android.app.slice.Slice.EXTRA_TOGGLE_STATE; -import static com.android.settings.notification.ZenModePreferenceController.ZEN_MODE_KEY; +import static com.android.settings.notification.ZenModeSoundSettingsPreferenceController.ZEN_MODE_KEY; import android.annotation.ColorInt; import android.app.NotificationManager; diff --git a/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceController.java b/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceController.java new file mode 100644 index 00000000000..842c49d7b5a --- /dev/null +++ b/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceController.java @@ -0,0 +1,33 @@ +/* + * 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.notification; + +import android.content.Context; + +public class ZenModeSoundSettingsPreferenceController extends ZenModePreferenceController { + + public static final String ZEN_MODE_KEY = "zen_mode"; + + public ZenModeSoundSettingsPreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + return AVAILABLE; + } +} diff --git a/src/com/android/settings/slices/CustomSliceRegistry.java b/src/com/android/settings/slices/CustomSliceRegistry.java index fe000d14cd3..e4008153954 100644 --- a/src/com/android/settings/slices/CustomSliceRegistry.java +++ b/src/com/android/settings/slices/CustomSliceRegistry.java @@ -19,7 +19,7 @@ package com.android.settings.slices; import static android.provider.SettingsSlicesContract.KEY_LOCATION; import static android.provider.SettingsSlicesContract.KEY_WIFI; -import static com.android.settings.notification.ZenModePreferenceController.ZEN_MODE_KEY; +import static com.android.settings.notification.ZenModeSoundSettingsPreferenceController.ZEN_MODE_KEY; import android.content.ContentResolver; import android.net.Uri; diff --git a/tests/robotests/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceControllerTest.java new file mode 100644 index 00000000000..a08a4d72700 --- /dev/null +++ b/tests/robotests/src/com/android/settings/notification/ZenModeSoundSettingsPreferenceControllerTest.java @@ -0,0 +1,50 @@ +/* + * 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.notification; + +import static com.android.settings.core.BasePreferenceController.AVAILABLE; + +import static com.google.common.truth.Truth.assertThat; + +import android.content.Context; + +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 ZenModeSoundSettingsPreferenceControllerTest { + + private Context mContext; + private ZenModeSoundSettingsPreferenceController mController; + private static final String KEY_ZEN_MODE = "zen_mode"; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mContext = RuntimeEnvironment.application; + mController = new ZenModeSoundSettingsPreferenceController(mContext, KEY_ZEN_MODE); + } + + @Test + public void getAvailabilityStatus_available() { + assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE); + } +}