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

Commit 45df074c authored by Huihong Luo's avatar Huihong Luo
Browse files

Sync with ISurfaceComposer changes

The old android::ISurfaceComposer interface is migrating to
aidl based android::gui::ISurfaceComposer.

Bug: 220043617
Bug: 219574942
Test: manual
Change-Id: I8d38ae04bb08677a5c985a5e2df5a8cfc59e34b2
parent 7ea0d1b3
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
#include <utils/String16.h>

#include <binder/IServiceManager.h>
#include <gui/ISurfaceComposer.h>
#include <ui/DisplayStatInfo.h>
#include <android/gui/ISurfaceComposer.h>
#include <android/gui/DisplayStatInfo.h>

#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AUtils.h>
@@ -39,21 +39,22 @@ void VideoFrameScheduler::updateVsync() {
    mVsyncTime = 0;
    mVsyncPeriod = 0;

    // TODO(b/220021255): wrap this into SurfaceComposerClient
    if (mComposer == NULL) {
        String16 name("SurfaceFlinger");
        String16 name("SurfaceFlingerAIDL");
        sp<IServiceManager> sm = defaultServiceManager();
        mComposer = interface_cast<ISurfaceComposer>(sm->checkService(name));
        mComposer = interface_cast<gui::ISurfaceComposer>(sm->checkService(name));
    }
    if (mComposer != NULL) {
        DisplayStatInfo stats;
        status_t res = mComposer->getDisplayStats(NULL /* display */, &stats);
        if (res == OK) {
        gui::DisplayStatInfo stats;
        binder::Status status = mComposer->getDisplayStats(nullptr/* display */, &stats);
        if (status.isOk()) {
            ALOGV("vsync time:%lld period:%lld",
                    (long long)stats.vsyncTime, (long long)stats.vsyncPeriod);
            mVsyncTime = stats.vsyncTime;
            mVsyncPeriod = stats.vsyncPeriod;
        } else {
            ALOGW("getDisplayStats returned %d", res);
            ALOGW("getDisplayStats returned %d", status.transactionError());
        }
    } else {
        ALOGW("could not get surface mComposer service");
+4 −2
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@

namespace android {

namespace gui {
    class ISurfaceComposer;
}

struct VideoFrameScheduler : public VideoFrameSchedulerBase {
    VideoFrameScheduler();
@@ -32,7 +34,7 @@ protected:

private:
    void updateVsync() override;
    sp<ISurfaceComposer> mComposer;
    sp<gui::ISurfaceComposer> mComposer;
};

}  // namespace android