1 /*
2  * Copyright (C) 2019 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.os;
18 
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 import android.annotation.TestApi;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Parameters that specify what kind of bugreport should be taken.
28  *
29  * @hide
30  */
31 @SystemApi
32 @TestApi
33 public final class BugreportParams {
34     private final int mMode;
35 
BugreportParams(@ugreportMode int mode)36     public BugreportParams(@BugreportMode int mode) {
37         mMode = mode;
38     }
39 
getMode()40     public int getMode() {
41         return mMode;
42     }
43 
44     /**
45      * Defines acceptable types of bugreports.
46      * @hide
47      */
48     @Retention(RetentionPolicy.SOURCE)
49     @IntDef(prefix = { "BUGREPORT_MODE_" }, value = {
50             BUGREPORT_MODE_FULL,
51             BUGREPORT_MODE_INTERACTIVE,
52             BUGREPORT_MODE_REMOTE,
53             BUGREPORT_MODE_WEAR,
54             BUGREPORT_MODE_TELEPHONY,
55             BUGREPORT_MODE_WIFI
56     })
57     public @interface BugreportMode {}
58 
59     /**
60      * Options for a bugreport without user interference (and hence causing less
61      * interference to the system), but includes all sections.
62      */
63     public static final int BUGREPORT_MODE_FULL = IDumpstate.BUGREPORT_MODE_FULL;
64 
65     /**
66      * Options that allow user to monitor progress and enter additional data; might not
67      * include all sections.
68      */
69     public static final int BUGREPORT_MODE_INTERACTIVE = IDumpstate.BUGREPORT_MODE_INTERACTIVE;
70 
71     /**
72      * Options for a bugreport requested remotely by administrator of the Device Owner app,
73      * not the device's user.
74      */
75     public static final int BUGREPORT_MODE_REMOTE = IDumpstate.BUGREPORT_MODE_REMOTE;
76 
77     /**
78      * Options for a bugreport on a wearable device.
79      */
80     public static final int BUGREPORT_MODE_WEAR = IDumpstate.BUGREPORT_MODE_WEAR;
81 
82     /**
83      * Options for a lightweight version of bugreport that only includes a few, urgent
84      * sections used to report telephony bugs.
85      */
86     public static final int BUGREPORT_MODE_TELEPHONY = IDumpstate.BUGREPORT_MODE_TELEPHONY;
87 
88     /**
89      * Options for a lightweight bugreport that only includes a few sections related to
90      * Wifi.
91      */
92     public static final int BUGREPORT_MODE_WIFI = IDumpstate.BUGREPORT_MODE_WIFI;
93 }
94