Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2018, 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.IIncidentAuthListener; |
Joe Onorato | 1c36d75 | 2019-03-17 18:26:43 -0700 | [diff] [blame] | 20 | import android.os.IncidentManager; |
Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Helper service for incidentd and dumpstated to provide user feedback |
| 24 | * and authorization for bug and inicdent reports to be taken. |
| 25 | * |
| 26 | * @hide |
| 27 | */ |
| 28 | interface IIncidentCompanion { |
| 29 | /** |
| 30 | * Request an authorization for an incident or bug report. |
| 31 | * // TODO(b/111441001): Add the permission |
| 32 | * <p> |
| 33 | * This function requires the ___ permission. |
| 34 | * |
| 35 | * @param callingUid The original application that requested the report. This function |
| 36 | * returns via the callback whether the application should be trusted. It is up |
| 37 | * to the caller to actually implement the restriction to take or not take |
| 38 | * the incident or bug report. |
Joe Onorato | 1c36d75 | 2019-03-17 18:26:43 -0700 | [diff] [blame] | 39 | * @param receiverClass The class that will be the eventual broacast receiver for the |
| 40 | * INCIDENT_REPORT_READY message. Used as part of the id in incidentd. |
| 41 | * @param reportId The incident report ID. Incidentd should call with this parameter, but |
| 42 | * everyone else should pass null or empty string. |
Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 43 | * @param flags FLAG_CONFIRMATION_DIALOG (0x1) - to show this as a dialog. Otherwise |
| 44 | * a dialog will be shown as a notification. |
| 45 | * @param callback Interface to receive results. The results may not come back for |
| 46 | * a long (user's choice) time, or ever (if they never respond to the notification). |
| 47 | * Authorization requests are not persisted across reboot. It is up to the calling |
| 48 | * service to request another authorization after reboot if they still would like |
| 49 | * to send their report. |
| 50 | */ |
| 51 | oneway void authorizeReport(int callingUid, String callingPackage, |
Joe Onorato | 1c36d75 | 2019-03-17 18:26:43 -0700 | [diff] [blame] | 52 | String receiverClass, String reportId, |
Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 53 | int flags, IIncidentAuthListener callback); |
| 54 | |
| 55 | /** |
| 56 | * Cancel an authorization. |
| 57 | */ |
| 58 | oneway void cancelAuthorization(IIncidentAuthListener callback); |
| 59 | |
| 60 | /** |
Joe Onorato | 1c36d75 | 2019-03-17 18:26:43 -0700 | [diff] [blame] | 61 | * Send the report ready broadcast on behalf of incidentd. |
| 62 | */ |
| 63 | oneway void sendReportReadyBroadcast(String pkg, String cls); |
| 64 | |
| 65 | /** |
Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 66 | * Return the list of pending approvals. |
| 67 | */ |
| 68 | List<String> getPendingReports(); |
| 69 | |
| 70 | /** |
| 71 | * The user has authorized the report to be shared. |
| 72 | * |
| 73 | * @param uri the report. |
| 74 | */ |
| 75 | void approveReport(String uri); |
| 76 | |
| 77 | /** |
| 78 | * The user has denied the report from being shared. |
| 79 | * |
| 80 | * @param uri the report. |
| 81 | */ |
| 82 | void denyReport(String uri); |
Joe Onorato | 1c36d75 | 2019-03-17 18:26:43 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * List the incident reports for the given ComponentName. The receiver |
| 86 | * must be for a package inside the caller. |
| 87 | */ |
| 88 | List<String> getIncidentReportList(String pkg, String cls); |
| 89 | |
| 90 | /** |
| 91 | * Get the IncidentReport object. |
| 92 | */ |
| 93 | IncidentManager.IncidentReport getIncidentReport(String pkg, String cls, String id); |
| 94 | |
| 95 | /** |
| 96 | * Signal that the client is done with this incident report and it can be deleted. |
| 97 | */ |
| 98 | void deleteIncidentReports(String pkg, String cls, String id); |
| 99 | |
| 100 | /** |
| 101 | * Signal that the client is done with all incident reports from this package. |
| 102 | * Especially useful for testing. |
| 103 | */ |
| 104 | void deleteAllIncidentReports(String pkg); |
Joe Onorato | 2927da9 | 2018-12-11 14:24:49 -0800 | [diff] [blame] | 105 | } |