Fix two crash causes in Flattener related to hashing

First: Add an ID check to isSameStack in Flattener. Without this check,
mergeWithCachedSets may try to update the override buffer from a cached
set containing a constituent layer that no longer exists, because that
layer was replaced by another layer with the same geometry.

Second: Replace the finger print check for identifying a cached set with
checking the first layer's ID. Otherwise, if there are two cached sets
whose first layer happens to hash to the same value because their
geometries are the same, then the incorrect cached set may be updated,
which breaks the entire skipLayers logic.

Bug: 186438649
Test: Idling in maps does not crash
Test: Incoming notifications while maps is onscreen does not crash the
device.

Change-Id: Idc050d13b840342725a0ea24f1dd512d19868416
3 files changed