diff options
| author | 2019-01-19 06:12:13 -0800 | |
|---|---|---|
| committer | 2019-01-19 06:12:13 -0800 | |
| commit | 461060c7e350ed5ccaeb57454ff88c9d272318d3 (patch) | |
| tree | af274269d5e020f80019e0d02eb40f9feb15e244 | |
| parent | f8052b7af02fca397b0a8798db595f53912559d7 (diff) | |
| parent | da9d6ea2ae3f7ef398a528bbb199b871598e339e (diff) | |
Merge "Add calling uid and calling package to startBugreport" am: 458f1de39d
am: da9d6ea2ae
Change-Id: Iaddc6878f2b2d085b794b1e942f4a9ed9517a455
| -rw-r--r-- | cmds/dumpstate/DumpstateService.cpp | 9 | ||||
| -rw-r--r-- | cmds/dumpstate/DumpstateService.h | 3 | ||||
| -rw-r--r-- | cmds/dumpstate/binder/android/os/IDumpstate.aidl | 14 | ||||
| -rw-r--r-- | cmds/dumpstate/binder/android/os/IDumpstateListener.aidl | 3 |
4 files changed, 24 insertions, 5 deletions
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp index 6596fa246c..1d5b738c04 100644 --- a/cmds/dumpstate/DumpstateService.cpp +++ b/cmds/dumpstate/DumpstateService.cpp @@ -43,7 +43,6 @@ static binder::Status error(uint32_t code, const std::string& msg) { static void* callAndNotify(void* data) { Dumpstate& ds = *static_cast<Dumpstate*>(data); - // TODO(111441001): Return status on listener. ds.Run(); MYLOGE("Finished Run()\n"); return nullptr; @@ -98,10 +97,16 @@ binder::Status DumpstateService::setListener(const std::string& name, return binder::Status::ok(); } -binder::Status DumpstateService::startBugreport(const android::base::unique_fd& bugreport_fd, +// TODO(b/111441001): Hook up to consent service & copy final br only if user approves. +binder::Status DumpstateService::startBugreport(int32_t /* calling_uid */, + const std::string& /* calling_package */, + const android::base::unique_fd& bugreport_fd, const android::base::unique_fd& screenshot_fd, int bugreport_mode, const sp<IDumpstateListener>& listener) { + // TODO(b/111441001): + // 1. check DUMP permission (again)? + // 2. check if primary user? If non primary user the consent service will reject anyway. MYLOGI("startBugreport() with mode: %d\n", bugreport_mode); if (bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_FULL && diff --git a/cmds/dumpstate/DumpstateService.h b/cmds/dumpstate/DumpstateService.h index 1705317bdb..b6ba32d695 100644 --- a/cmds/dumpstate/DumpstateService.h +++ b/cmds/dumpstate/DumpstateService.h @@ -42,7 +42,8 @@ class DumpstateService : public BinderService<DumpstateService>, public BnDumpst bool getSectionDetails, sp<IDumpstateToken>* returned_token) override; - binder::Status startBugreport(const android::base::unique_fd& bugreport_fd, + binder::Status startBugreport(int32_t calling_uid, const std::string& calling_package, + const android::base::unique_fd& bugreport_fd, const android::base::unique_fd& screenshot_fd, int bugreport_mode, const sp<IDumpstateListener>& listener) override; diff --git a/cmds/dumpstate/binder/android/os/IDumpstate.aidl b/cmds/dumpstate/binder/android/os/IDumpstate.aidl index d24c953fa2..26351572db 100644 --- a/cmds/dumpstate/binder/android/os/IDumpstate.aidl +++ b/cmds/dumpstate/binder/android/os/IDumpstate.aidl @@ -59,14 +59,24 @@ interface IDumpstate { // Default mode. const int BUGREPORT_MODE_DEFAULT = 6; + // TODO(b/111441001): Should the args be for the consuming application rather than triggering? /* * Starts a bugreport in the background. * + *<p>Shows the user a dialog to get consent for sharing the bugreport with the calling + * application. If they deny {@link IDumpstateListener#onError} will be called. If they + * consent and bugreport generation is successful artifacts will be copied to the given fds and + * {@link IDumpstateListener#onFinished} will be called. If there + * are errors in bugreport generation {@link IDumpstateListener#onError} will be called. + * + * @param callingUid UID of the original application that requested the report. + * @param callingPackage package of the original application that requested the report. * @param bugreportFd the file to which the zipped bugreport should be written * @param screenshotFd the file to which screenshot should be written; optional * @param bugreportMode the mode that specifies other run time options; must be one of above * @param listener callback for updates; optional */ - void startBugreport(FileDescriptor bugreportFd, FileDescriptor screenshotFd, int bugreportMode, - IDumpstateListener listener); + void startBugreport(int callingUid, @utf8InCpp String callingPackage, + FileDescriptor bugreportFd, FileDescriptor screenshotFd, + int bugreportMode, IDumpstateListener listener); } diff --git a/cmds/dumpstate/binder/android/os/IDumpstateListener.aidl b/cmds/dumpstate/binder/android/os/IDumpstateListener.aidl index 2966c86ee9..bcd0cb7966 100644 --- a/cmds/dumpstate/binder/android/os/IDumpstateListener.aidl +++ b/cmds/dumpstate/binder/android/os/IDumpstateListener.aidl @@ -35,6 +35,9 @@ interface IDumpstateListener { /* Bugreport encountered a runtime error */ const int BUGREPORT_ERROR_RUNTIME_ERROR = 2; + /* User denied consent to share the bugreport with the specified app */ + const int BUGREPORT_ERROR_USER_DENIED_CONSENT = 3; + /** * Called on an error condition with one of the error codes listed above. */ |