1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.notification; 18 19 import android.app.AutomaticZenRule; 20 import android.app.NotificationManager; 21 import android.service.notification.ZenPolicy; 22 23 import org.junit.runner.RunWith; 24 import org.robolectric.RobolectricTestRunner; 25 26 @RunWith(RobolectricTestRunner.class) 27 abstract class ZenRuleCustomPrefContrTestBase { 28 public static final String RULE_ID = "test_rule_id"; 29 public static final String PREF_KEY = "main_pref"; 30 31 AutomaticZenRule mRule = new AutomaticZenRule("test", null, null, null, null, 32 NotificationManager.INTERRUPTION_FILTER_PRIORITY, true); 33 getController()34 abstract AbstractZenCustomRulePreferenceController getController(); 35 updateControllerZenPolicy(ZenPolicy policy)36 void updateControllerZenPolicy(ZenPolicy policy) { 37 mRule.setZenPolicy(policy); 38 getController().onResume(mRule, RULE_ID); 39 } 40 } 41