Skip to content
Snippets Groups Projects
Commit 82bcdaf2 authored by Naomi Musgrave's avatar Naomi Musgrave
Browse files

[MediaProjection] Handle null DisplayContent when trying to set the session

The VirtualDisplay may have already been removed by the time WindowManager
attempts to handle an incoming recording session. The returned DisplayContent
is then null.

Bug: 280596594
Test: Manual; no NPE when screenshot from Betterbug
Change-Id: Ie956a6b6fea0efd5bd35afa0f73b415a7f6ca346
parent 5cef355a
No related branches found
No related tags found
No related merge requests found
......@@ -2059,6 +2059,12 @@
"group": "WM_DEBUG_CONFIGURATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-233530384": {
"message": "Content Recording: Incoming session on display %d can't be set since it is already null; the corresponding VirtualDisplay must have already been removed.",
"level": "VERBOSE",
"group": "WM_DEBUG_CONTENT_RECORDING",
"at": "com\/android\/server\/wm\/ContentRecordingController.java"
},
"-230587670": {
"message": "SyncGroup %d: Unfinished container: %s",
"level": "VERBOSE",
......
......@@ -98,6 +98,13 @@ final class ContentRecordingController {
mSession == null ? null : mSession.getVirtualDisplayId());
incomingDisplayContent = wmService.mRoot.getDisplayContentOrCreate(
incomingSession.getVirtualDisplayId());
if (incomingDisplayContent == null) {
ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
"Content Recording: Incoming session on display %d can't be set since it "
+ "is already null; the corresponding VirtualDisplay must have "
+ "already been removed.", incomingSession.getVirtualDisplayId());
return;
}
incomingDisplayContent.setContentRecordingSession(incomingSession);
// TODO(b/270118861): When user grants consent to re-use, explicitly ask ContentRecorder
// to update, since no config/display change arrives. Mark recording as black.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment