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

Commit eafc18ad authored by Wenhui Yang's avatar Wenhui Yang
Browse files

Capture transaction traces before system reboot

Bug: 299937754
Test: bugreport - data/misc/wmtrace/systemRestart_transactions.winscope
Test: go/winscope
Change-Id: Icfb10a9e69fd2ca7f4657564b109f8da126f7dc7
parent 5c636e3b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3113,6 +3113,10 @@ status_t SurfaceComposerClient::removeWindowInfosListener(
            ->removeWindowInfosListener(windowInfosListener,
                                        ComposerServiceAIDL::getComposerService());
}

void SurfaceComposerClient::notifyShutdown() {
    ComposerServiceAIDL::getComposerService()->notifyShutdown();
}
// ----------------------------------------------------------------------------

status_t ScreenshotClient::captureDisplay(const DisplayCaptureArgs& captureArgs,
+7 −0
Original line number Diff line number Diff line
@@ -571,4 +571,11 @@ interface ISurfaceComposer {
    @nullable StalledTransactionInfo getStalledTransactionInfo(int pid);

    SchedulingPolicy getSchedulingPolicy();

    /**
     * Notifies the SurfaceFlinger that the ShutdownThread is running. When it is called,
     * transaction traces will be captured and writted into a file.
     * This method should not block the ShutdownThread therefore it's handled asynchronously.
     */
    oneway void notifyShutdown();
}
+2 −0
Original line number Diff line number Diff line
@@ -825,6 +825,8 @@ public:
                    nullptr);
    status_t removeWindowInfosListener(const sp<gui::WindowInfosListener>& windowInfosListener);

    static void notifyShutdown();

protected:
    ReleaseCallbackThread mReleaseCallbackThread;

+2 −0
Original line number Diff line number Diff line
@@ -984,6 +984,8 @@ public:
        return binder::Status::ok();
    }

    binder::Status notifyShutdown() override { return binder::Status::ok(); }

protected:
    IBinder* onAsBinder() override { return nullptr; }

+7 −1
Original line number Diff line number Diff line
@@ -984,8 +984,9 @@ void SurfaceFlinger::initTransactionTraceWriter() {
                        ALOGD("TransactionTraceWriter: file=%s already exists", filename.c_str());
                        return;
                    }
                    mTransactionTracing->flush();
                    ALOGD("TransactionTraceWriter: writing file=%s", filename.c_str());
                    mTransactionTracing->writeToFile(filename);
                    mTransactionTracing->flush();
                };
                if (std::this_thread::get_id() == mMainThreadId) {
                    writeFn();
@@ -10343,6 +10344,11 @@ binder::Status SurfaceComposerAIDL::getSchedulingPolicy(gui::SchedulingPolicy* o
    return gui::getSchedulingPolicy(outPolicy);
}

binder::Status SurfaceComposerAIDL::notifyShutdown() {
    TransactionTraceWriter::getInstance().invoke("systemShutdown_", /* overwrite= */ false);
    return ::android::binder::Status::ok();
}

status_t SurfaceComposerAIDL::checkAccessPermission(bool usePermissionCache) {
    if (!mFlinger->callingThreadHasUnscopedSurfaceFlingerAccess(usePermissionCache)) {
        IPCThreadState* ipc = IPCThreadState::self();
Loading