gralloc: Return an error if the buffer was not mapped

In some cases, the framework attempts to lock a secure buffer.
Since it does not get an error code from the lock, it proceeds to
dereference the base address (which is invalid). Return an error
code when a secure buffer is attempted to be locked, while still
ensuring that the metadata is mapped.

Since we return a proper error in lock(), register buffer fails.
Since a map should not be done in registerBuffer per the gralloc
spec, only map the metadata here. Clients that need to access
memory in CPU after registerBuffer should do a lock().

Note, this is a resubmission of a previous change whose Change-Id
was I74204931fa61524f1601dd99ab266219d4be2c82. Patch set 4 was
initially submitted instead of patch set 6.

Change-Id: I68124902d0b614702622dc948e13270fc86e16a6
CRs-fixed: 1010697
Bug: 28526999
1 file changed
tree: 88cebe2373ee7a40319e55e709fa632769b025cb
  1. msm8084/
  2. msm8226/
  3. msm8909/
  4. msm8960/
  5. msm8994/
  6. msm8996/
  7. Android.mk