hwc: Handle validateAndSet failures in AD prepare call

When validateAndSet fails we must reset the mDoable flag to false and
close the fb device. This will prevent making a draw call using
invalid resource references and prevent any fd leaks.

Additionally, we should only turn AD on if there are no configuration
errors during prepare call. This will prevent toggling AD between
on/off state in the face of continuous failures.

Change-Id: I15502dbf64c6203092aa13e001bab5d27b0e17ec
3 files changed