Loading cmds/screencap/screencap.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -45,13 +45,13 @@ using namespace android; #define COLORSPACE_SRGB 1 #define COLORSPACE_DISPLAY_P3 2 static void usage(const char* pname, PhysicalDisplayId displayId) static void usage(const char* pname, DisplayId displayId) { fprintf(stderr, "usage: %s [-hp] [-d display-id] [FILENAME]\n" " -h: this message\n" " -p: save the file as a png.\n" " -d: specify the physical display ID to capture (default: %s)\n" " -d: specify the display ID to capture (default: %s)\n" " see \"dumpsys SurfaceFlinger --display-id\" for valid display IDs.\n" "If FILENAME ends with .png it will be saved as a png.\n" "If FILENAME is not given, the results will be printed to stdout.\n", Loading Loading @@ -121,9 +121,9 @@ static status_t notifyMediaScanner(const char* fileName) { int main(int argc, char** argv) { std::optional<PhysicalDisplayId> displayId = SurfaceComposerClient::getInternalDisplayId(); std::optional<DisplayId> displayId = SurfaceComposerClient::getInternalDisplayId(); if (!displayId) { fprintf(stderr, "Failed to get token for internal display\n"); fprintf(stderr, "Failed to get ID for internal display\n"); return 1; } Loading @@ -136,7 +136,11 @@ int main(int argc, char** argv) png = true; break; case 'd': displayId = PhysicalDisplayId(atoll(optarg)); displayId = DisplayId::fromValue(atoll(optarg)); if (!displayId) { fprintf(stderr, "Invalid display ID\n"); return 1; } break; case '?': case 'h': Loading Loading @@ -182,7 +186,7 @@ int main(int argc, char** argv) ProcessState::self()->startThreadPool(); sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener(); status_t result = ScreenshotClient::captureDisplay(displayId->value, captureListener); status_t result = ScreenshotClient::captureDisplay(*displayId, captureListener); if (result != NO_ERROR) { close(fd); return 1; Loading core/jni/android_view_SurfaceControl.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -870,8 +870,9 @@ static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) { } static jobject nativeGetPhysicalDisplayToken(JNIEnv* env, jclass clazz, jlong physicalDisplayId) { sp<IBinder> token = SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId(physicalDisplayId)); const auto id = DisplayId::fromValue<PhysicalDisplayId>(physicalDisplayId); if (!id) return nullptr; sp<IBinder> token = SurfaceComposerClient::getPhysicalDisplayToken(*id); return javaObjectForIBinder(env, token); } Loading Loading
cmds/screencap/screencap.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -45,13 +45,13 @@ using namespace android; #define COLORSPACE_SRGB 1 #define COLORSPACE_DISPLAY_P3 2 static void usage(const char* pname, PhysicalDisplayId displayId) static void usage(const char* pname, DisplayId displayId) { fprintf(stderr, "usage: %s [-hp] [-d display-id] [FILENAME]\n" " -h: this message\n" " -p: save the file as a png.\n" " -d: specify the physical display ID to capture (default: %s)\n" " -d: specify the display ID to capture (default: %s)\n" " see \"dumpsys SurfaceFlinger --display-id\" for valid display IDs.\n" "If FILENAME ends with .png it will be saved as a png.\n" "If FILENAME is not given, the results will be printed to stdout.\n", Loading Loading @@ -121,9 +121,9 @@ static status_t notifyMediaScanner(const char* fileName) { int main(int argc, char** argv) { std::optional<PhysicalDisplayId> displayId = SurfaceComposerClient::getInternalDisplayId(); std::optional<DisplayId> displayId = SurfaceComposerClient::getInternalDisplayId(); if (!displayId) { fprintf(stderr, "Failed to get token for internal display\n"); fprintf(stderr, "Failed to get ID for internal display\n"); return 1; } Loading @@ -136,7 +136,11 @@ int main(int argc, char** argv) png = true; break; case 'd': displayId = PhysicalDisplayId(atoll(optarg)); displayId = DisplayId::fromValue(atoll(optarg)); if (!displayId) { fprintf(stderr, "Invalid display ID\n"); return 1; } break; case '?': case 'h': Loading Loading @@ -182,7 +186,7 @@ int main(int argc, char** argv) ProcessState::self()->startThreadPool(); sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener(); status_t result = ScreenshotClient::captureDisplay(displayId->value, captureListener); status_t result = ScreenshotClient::captureDisplay(*displayId, captureListener); if (result != NO_ERROR) { close(fd); return 1; Loading
core/jni/android_view_SurfaceControl.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -870,8 +870,9 @@ static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) { } static jobject nativeGetPhysicalDisplayToken(JNIEnv* env, jclass clazz, jlong physicalDisplayId) { sp<IBinder> token = SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId(physicalDisplayId)); const auto id = DisplayId::fromValue<PhysicalDisplayId>(physicalDisplayId); if (!id) return nullptr; sp<IBinder> token = SurfaceComposerClient::getPhysicalDisplayToken(*id); return javaObjectForIBinder(env, token); } Loading