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 android.platform.helpers; 18 19 /** An App Helper interface for the Quick Settings bar. */ 20 public interface IQuickSettingsHelper extends IAppHelper { 21 /** 22 * Represents the state of a Quick Setting. Currently this is limited to ON and OFF states; 23 * however, other states will be added in the future, for example to differentiate between 24 * paired and un-paired, active bluetooth states. 25 */ 26 public enum State { 27 ON, 28 OFF, 29 } 30 31 /** Represents a Quick Setting switch that can be toggled ON and OFF during a test. */ 32 public enum Setting { 33 AIRPLANE("Airplane", 1000), 34 AUTO_ROTATE("Auto-rotate", 1000), 35 BLUETOOTH("Bluetooth", 10000), 36 DO_NOT_DISTURB("Do Not Disturb", 1000), 37 FLASHLIGHT("Flashlight", 1000), 38 NIGHT_LIGHT("Night Light", 1000), 39 WIFI("Wi-Fi", 5000); 40 41 private final String mContentDescSubstring; 42 private final long mExpectedWait; 43 Setting(String substring, long wait)44 Setting(String substring, long wait) { 45 mContentDescSubstring = substring; 46 mExpectedWait = wait; 47 } 48 49 /** Returns a substring to identify the {@code Setting} by content description. */ getContentDescSubstring()50 public String getContentDescSubstring() { 51 return mContentDescSubstring; 52 } 53 54 /** Returns the longest expected wait time for this option to be toggled ON or OFF. */ getExpectedWait()55 public long getExpectedWait() { 56 return mExpectedWait; 57 } 58 } 59 60 /** 61 * Toggles a {@link Setting} either {@link State.ON} or {@link State.OFF}. If {@code setting} is 62 * already found to be in {@code state}, then no operation is performed. There are no setup 63 * requirements to call this method, except that {@code setting} is available from the test and 64 * in the Quick Settings menu. 65 */ toggleSetting(Setting setting, State state)66 public void toggleSetting(Setting setting, State state); 67 } 68