diff options
| author | 2022-10-07 19:24:00 -0700 | |
|---|---|---|
| committer | 2022-10-10 20:52:56 +0000 | |
| commit | 6f645f7093e48459589496358ed3ef7395eb0e3d (patch) | |
| tree | 77ee9db3a977087de8342812068ab3d14dc8a662 | |
| parent | 5ef5f5172bff29a7e506b338434857fe091749b4 (diff) | |
Capture first display for multi-display devices
When no display id is explicitly specified, the first display is
captured, and a warning message is printed out. This is to make
the utility to be backward compatible with previous versions so
tools depending on it continue to work.
Bug: 241285477
Test: manual, run screencap command to verify
Change-Id: I713e1e5c625fd80ecb5587e0b2313f58baaffd40
| -rw-r--r-- | cmds/screencap/screencap.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 44fb6b320102..d7222d248911 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -159,12 +159,14 @@ int main(int argc, char** argv) } if (!displayId) { // no diplsay id is specified - if (ids.size() == 1) { - displayId = ids.front(); - } else { - fprintf(stderr, "Please specify a display ID (-d display-id) for multi-display device.\n"); + displayId = ids.front(); + if (ids.size() > 1) { + fprintf(stderr, + "[Warning] Multiple displays were found, but no display id was specified! " + "Defaulting to the first display found, however this default is not guaranteed " + "to be consistent across captures. A display id should be specified.\n"); + fprintf(stderr, "A display ID can be specified with the [-d display-id] option.\n"); fprintf(stderr, "See \"dumpsys SurfaceFlinger --display-id\" for valid display IDs.\n"); - return 1; } } |