1 /**
2  * Copyright (c) 2016, 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.os.IDumpstateListener;
20 
21 /**
22   * Binder interface for the currently running dumpstate process.
23   * {@hide}
24   */
25 interface IDumpstate {
26 
27     // NOTE: If you add to or change these modes, please also change the corresponding enums
28     // in system server, in BugreportParams.java.
29 
30     // These modes encapsulate a set of run time options for generating bugreports.
31     // Takes a bugreport without user interference.
32     const int BUGREPORT_MODE_FULL = 0;
33 
34     // Interactive bugreport, i.e. triggered by the user.
35     const int BUGREPORT_MODE_INTERACTIVE = 1;
36 
37     // Remote bugreport triggered by DevicePolicyManager, for e.g.
38     const int BUGREPORT_MODE_REMOTE = 2;
39 
40     // Bugreport triggered on a wear device.
41     const int BUGREPORT_MODE_WEAR = 3;
42 
43     // Bugreport limited to only telephony info.
44     const int BUGREPORT_MODE_TELEPHONY = 4;
45 
46     // Bugreport limited to only wifi info.
47     const int BUGREPORT_MODE_WIFI = 5;
48 
49     // Default mode.
50     const int BUGREPORT_MODE_DEFAULT = 6;
51 
52     /*
53      * Starts a bugreport in the background.
54      *
55      *<p>Shows the user a dialog to get consent for sharing the bugreport with the calling
56      * application. If they deny {@link IDumpstateListener#onError} will be called. If they
57      * consent and bugreport generation is successful artifacts will be copied to the given fds and
58      * {@link IDumpstateListener#onFinished} will be called. If there
59      * are errors in bugreport generation {@link IDumpstateListener#onError} will be called.
60      *
61      * @param callingUid UID of the original application that requested the report.
62      * @param callingPackage package of the original application that requested the report.
63      * @param bugreportFd the file to which the zipped bugreport should be written
64      * @param screenshotFd the file to which screenshot should be written
65      * @param bugreportMode the mode that specifies other run time options; must be one of above
66      * @param listener callback for updates; optional
67      * @param isScreenshotRequested indicates screenshot is requested or not
68      */
startBugreport(int callingUid, @utf8InCpp String callingPackage, FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, IDumpstateListener listener, boolean isScreenshotRequested)69     void startBugreport(int callingUid, @utf8InCpp String callingPackage,
70                         FileDescriptor bugreportFd, FileDescriptor screenshotFd,
71                         int bugreportMode, IDumpstateListener listener,
72                         boolean isScreenshotRequested);
73 
74     /*
75      * Cancels the bugreport currently in progress.
76      */
cancelBugreport()77     void cancelBugreport();
78 }
79