1 /*
2  * Copyright (C) 2015 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 package android.cts.util;
17 
18 import android.os.Bundle;
19 
20 public class BroadcastUtils {
21     public enum TestcaseType {
22         ZEN_MODE_ON,
23         ZEN_MODE_OFF,
24         AIRPLANE_MODE_ON,
25         AIRPLANE_MODE_OFF,
26         BATTERYSAVER_MODE_ON,
27         BATTERYSAVER_MODE_OFF,
28         THEATER_MODE_ON,
29         THEATER_MODE_OFF
30     }
31     public static final String TESTCASE_TYPE = "Testcase_type";
32     public static final String BROADCAST_INTENT =
33             "android.intent.action.FROM_UTIL_CTS_TEST_";
34     public static final int NUM_MINUTES_FOR_ZENMODE = 10;
35 
toBundleString(Bundle bundle)36     public static final String toBundleString(Bundle bundle) {
37         if (bundle == null) {
38             return "*** Bundle is null ****";
39         }
40         StringBuilder buf = new StringBuilder();
41         if (bundle != null) {
42             buf.append("extras: ");
43             for (String s : bundle.keySet()) {
44                 buf.append("(" + s + " = " + bundle.get(s) + "), ");
45             }
46         }
47         return buf.toString();
48     }
49 }
50