From e1a3957f7bff359c6e9140ad88ad65b5d6bee45d Mon Sep 17 00:00:00 2001 From: Dominik Laskowski Date: Mon, 18 Nov 2019 13:38:00 -0800 Subject: [PATCH] screenrecord: Use ui::Rotation Bug: 144601064 Test: Build Change-Id: I12d27e78d271a57d7bed46485d260ecd50d3ef8f --- cmds/screenrecord/screenrecord.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp index b534f8a8f6..c66dea2133 100644 --- a/cmds/screenrecord/screenrecord.cpp +++ b/cmds/screenrecord/screenrecord.cpp @@ -84,14 +84,13 @@ using android::Vector; using android::sp; using android::status_t; -using android::DISPLAY_ORIENTATION_0; -using android::DISPLAY_ORIENTATION_180; -using android::DISPLAY_ORIENTATION_90; using android::INVALID_OPERATION; using android::NAME_NOT_FOUND; using android::NO_ERROR; using android::UNKNOWN_ERROR; +namespace ui = android::ui; + static const uint32_t kMinBitRate = 100000; // 0.1Mbps static const uint32_t kMaxBitRate = 200 * 1000000; // 200Mbps static const uint32_t kMaxTimeLimitSec = 180; // 3 minutes @@ -328,7 +327,7 @@ static status_t setDisplayProjection( } t.setDisplayProjection(dpy, - gRotate ? DISPLAY_ORIENTATION_90 : DISPLAY_ORIENTATION_0, + gRotate ? ui::ROTATION_90 : ui::ROTATION_0, layerStackRect, displayRect); return NO_ERROR; } @@ -414,7 +413,7 @@ static status_t writeWinscopeMetadata(const Vector& timestamps, */ static status_t runEncoder(const sp& encoder, AMediaMuxer *muxer, FILE* rawFp, const sp& display, - const sp& virtualDpy, uint8_t orientation) { + const sp& virtualDpy, ui::Rotation orientation) { static int kTimeout = 250000; // be responsive on signal status_t err; ssize_t trackIdx = -1; @@ -484,7 +483,7 @@ static status_t runEncoder(const sp& encoder, if (err != NO_ERROR) { ALOGW("getDisplayInfo(main) failed: %d", err); } else if (orientation != displayInfo.orientation) { - ALOGD("orientation changed, now %d", displayInfo.orientation); + ALOGD("orientation changed, now %s", toCString(displayInfo.orientation)); SurfaceComposerClient::Transaction t; setDisplayProjection(t, virtualDpy, displayInfo); t.apply(); @@ -691,9 +690,9 @@ static status_t recordScreen(const char* fileName) { } if (gVerbose) { - printf("Display is %dx%d @%.2ffps (orientation=%u), layerStack=%u\n", + printf("Display is %dx%d @%.2ffps (orientation=%s), layerStack=%u\n", displayInfo.viewportW, displayInfo.viewportH, displayInfo.fps, - displayInfo.orientation, displayInfo.layerStack); + toCString(displayInfo.orientation), displayInfo.layerStack); fflush(stdout); }