Add checks missing from commit 9fbc205f. Bug: 123166278 Bug: 111812273 Test: make Change-Id: Ia8ec35163c30e24fcfd9454ea8f7e9139610b4d7