Fix/suppress potential nullptr dereference warnings.

These are probably all false positives if
the dynamic_cast can never fail.
Yet we need to help the static analyzer
with the additional checks to suppress the warnings.
It might not matter if we return false,
or call abort or exit for those unreachable cases.

Bug: 263274255
Test: presubmit; make tidy-frameworks-compile_subset
Change-Id: Ie29a17672534ce0f64e2e6ccded6781a668449ac
4 files changed