[Android] Fix NPE if onTrimMemory called before UI inflation completed

onTrimMemory tries to get a reference to the ControlContainer view and
calls getToolbarResourceAdapter().dropCachedBitmap() on it. If the UI
has not finished inflation yet, then the
findViewById(R.id.control_container) returns null causing a crash.

This cl adds a null check before calling methods on the
ControlContainer.

Bug: 853682
Change-Id: I621d21a92509c0c3211da99841cd59991cb38813
Reviewed-on: https://chromium-review.googlesource.com/1106900
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568616}
1 file changed