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.alarmclock.common;
17 
18 import android.os.Bundle;
19 
20 public class Utils {
21     // private constructor - so it can't be instantiated.
Utils()22     private Utils() {
23     }
24 
25     public enum TestcaseType {
26         DISMISS_ALARM,
27         SET_ALARM,
28         SET_ALARM_FOR_DISMISSAL,
29         SNOOZE_ALARM,
30     }
31     public static final String TESTCASE_TYPE = "Testcase_type";
32     public static final String BROADCAST_INTENT =
33             "android.intent.action.FROM_ALARMCLOCK_CTS_TEST_";
34     public static final String TEST_RESULT = "test_result";
35     public static final String COMPLETION_RESULT = "completion";
36     public static final String ABORT_RESULT = "abort";
37 
toBundleString(Bundle bundle)38     public static final String toBundleString(Bundle bundle) {
39         if (bundle == null) {
40             return "*** Bundle is null ****";
41         }
42         StringBuilder buf = new StringBuilder();
43         if (bundle != null) {
44             buf.append("extras: ");
45             for (String s : bundle.keySet()) {
46                 buf.append("(" + s + " = " + bundle.get(s) + "), ");
47             }
48         }
49         return buf.toString();
50     }
51 }
52