Add null check around mImeRequester.getWindow()

mImeRequester is an InsetsControlTarget, which in some cases isn't
backed by a WindowState. Therefore we can't write window dump to
protobuf without checking if mImeRequester.getWindow() is null first.

Bug: 186006740
Test: Builds.
Change-Id: I3648763b4cee3a3d5cd1d39ebacbb00289f6fb33
This commit is contained in:
Garfield Tan
2021-04-21 12:44:24 -07:00
parent 19fb732416
commit 2b71400356

View File

@@ -257,8 +257,10 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
void dumpDebug(ProtoOutputStream proto, long fieldId, @WindowTraceLogLevel int logLevel) {
final long token = proto.start(fieldId);
super.dumpDebug(proto, INSETS_SOURCE_PROVIDER, logLevel);
if (mImeRequester != null) {
mImeRequester.getWindow().dumpDebug(proto, IME_TARGET_FROM_IME, logLevel);
final WindowState imeRequesterWindow =
mImeRequester != null ? mImeRequester.getWindow() : null;
if (imeRequesterWindow != null) {
imeRequesterWindow.dumpDebug(proto, IME_TARGET_FROM_IME, logLevel);
}
proto.write(IS_IME_LAYOUT_DRAWN, mIsImeLayoutDrawn);
proto.end(token);