Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 458f1de3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add calling uid and calling package to startBugreport"

parents a903d365 5c914204
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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 &&
+2 −1
Original line number Diff line number Diff line
@@ -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;

+12 −2
Original line number Diff line number Diff line
@@ -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);
}
+3 −0
Original line number Diff line number Diff line
@@ -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.
     */