1 /* 2 * Copyright (C) 2014 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.cts.verifier.sensors.base; 18 19 import android.content.ContentResolver; 20 import android.content.Intent; 21 22 /** 23 * An interface that defines a facade for {@link BaseSensorTestActivity}, so it can be consumed by 24 * other CtsVerifier Sensor Test Framework helper components. 25 */ 26 public interface ISensorTestStateContainer { 27 28 /** 29 * @return The current logger. 30 */ 31 BaseSensorTestActivity.SensorTestLogger getTestLogger(); 32 33 /** 34 * Waits for the operator to acknowledge to continue execution. 35 */ 36 void waitForUserToContinue() throws InterruptedException; 37 38 /** 39 * @param resId The resource Id to extract. 40 * @return The extracted string. 41 */ 42 String getString(int resId); 43 44 /** 45 * @param resId The resource Id to extract. 46 * @param params The parameters to format the string represented by the resource contents. 47 * @return The formatted extracted string. 48 */ 49 String getString(int resId, Object ... params); 50 51 /** 52 * Starts an Activity and blocks until it completes, then it returns its result back to the 53 * client. 54 * 55 * @param action The action to start the Activity. 56 * @return The Activity's result code. 57 */ 58 int executeActivity(String action) throws InterruptedException; 59 60 /** 61 * Starts an Activity and blocks until it completes, then it returns its result back to the 62 * client. 63 * 64 * @param intent The intent to start the Activity. 65 * @return The Activity's result code. 66 */ 67 int executeActivity(Intent intent) throws InterruptedException; 68 69 /** 70 * @return The {@link ContentResolver} associated with the test. 71 */ 72 ContentResolver getContentResolver(); 73 74 /** 75 * @param feature the feature being tested 76 * @return true if the specified feature is implemented; false otherwise. 77 */ 78 boolean hasSystemFeature(String feature); 79 80 /** 81 * @param action setting in the form of action name 82 * @return true if corresponding setting activity exists; false otherwise. 83 */ 84 boolean hasActivity(String action); 85 } 86