Merge "Camera3: Documentation additions" into jb-mr2-dev
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index 183647c..458b5b4 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -800,9 +800,63 @@
  */
 typedef void (*gps_geofence_status_callback) (int32_t status, GpsLocation* last_location);
 
+/**
+ * The callback associated with the add_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - GPS_GEOFENCE_OPERATION_SUCCESS
+ *          GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES  - geofence limit has been reached.
+ *          GPS_GEOFENCE_ERROR_ID_EXISTS  - geofence with id already exists
+ *          GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an
+ *              invalid transition
+ *          GPS_GEOFENCE_ERROR_GENERIC - for other errors.
+ */
+typedef void (*gps_geofence_add_callback) (int32_t geofence_id, int32_t status);
+
+/**
+ * The callback associated with the remove_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - GPS_GEOFENCE_OPERATION_SUCCESS
+ *          GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ *          GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*gps_geofence_remove_callback) (int32_t geofence_id, int32_t status);
+
+
+/**
+ * The callback associated with the pause_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - GPS_GEOFENCE_OPERATION_SUCCESS
+ *          GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ *          GPS_GEOFENCE_ERROR_INVALID_TRANSITION -
+ *                    when monitor_transitions is invalid
+ *          GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*gps_geofence_pause_callback) (int32_t geofence_id, int32_t status);
+
+/**
+ * The callback associated with the resume_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - GPS_GEOFENCE_OPERATION_SUCCESS
+ *          GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ *          GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*gps_geofence_resume_callback) (int32_t geofence_id, int32_t status);
+
 typedef struct {
     gps_geofence_transition_callback geofence_transition_callback;
     gps_geofence_status_callback geofence_status_callback;
+    gps_geofence_add_callback geofence_add_callback;
+    gps_geofence_remove_callback geofence_remove_callback;
+    gps_geofence_pause_callback geofence_pause_callback;
+    gps_geofence_resume_callback geofence_resume_callback;
     gps_create_thread create_thread_cb;
 } GpsGeofenceCallbacks;
 
@@ -845,10 +899,8 @@
     *    unknown_timer_ms - The time limit after which the UNCERTAIN transition
     *       should be triggered. This paramter is defined in milliseconds.
     *       See above for a detailed explanation.
-    *    Return value: GPS_GEOFENCE_OPERATION_SUCCESS on success,
-    *                  or any of the GPS_GEOFENCE_ERRORS on failure.
     */
-   int (*add_geofence_area) (int32_t geofence_id, double latitude,
+   void (*add_geofence_area) (int32_t geofence_id, double latitude,
                                 double longitude, double radius_meters,
                                 int last_transition, int monitor_transitions,
                                 int notification_responsiveness_ms,
@@ -858,12 +910,8 @@
     * Pause monitoring a particular geofence.
     * Parameters:
     *   geofence_id - The id for the geofence.
-    *
-    * Return value: GPS_GEOFENCE_OPERATION_SUCCESS on success,
-    *               GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
-    *               GPS_GEOFENCE_ERROR_GENERIC for others.
     */
-   int (*pause_geofence) (int32_t geofence_id);
+   void (*pause_geofence) (int32_t geofence_id);
 
    /**
     * Resume monitoring a particular geofence.
@@ -874,26 +922,16 @@
     *       GPS_GEOFENCE_UNCERTAIN.
     *       This supersedes the value associated provided in the
     *       add_geofence_area call.
-    *
-    * Return value: GPS_GEOFENCE_OPERATION_SUCCESS on success,
-    *               GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
-    *               GPS_GEOFENCE_ERROR_INVALID_TRANSITION - when
-    *                   monitor_transitions is invalid
-    *               GPS_GEOFENCE_ERROR_GENERIC for others.
-    *
     */
-   int (*resume_geofence) (int32_t geofence_id, int monitor_transitions);
+   void (*resume_geofence) (int32_t geofence_id, int monitor_transitions);
 
    /**
     * Remove a geofence area. After the function returns, no notifications
     * should be sent.
     * Parameter:
     *   geofence_id - The id for the geofence.
-    * Return value: GPS_GEOFENCE_OPERATION_SUCCESS on success,
-    *               GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
-    *               GPS_GEOFENCE_ERROR_GENERIC for others.
     */
-   int (*remove_geofence_area) (int32_t geofence_id);
+   void (*remove_geofence_area) (int32_t geofence_id);
 } GpsGeofencingInterface;
 __END_DECLS
 
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h
index e1c502a..9d14fe0 100644
--- a/modules/gralloc/gralloc_priv.h
+++ b/modules/gralloc/gralloc_priv.h
@@ -74,18 +74,16 @@
     int     size;
     int     offset;
 
-    // FIXME: the attributes below should be out-of-line
+    // FIXME: this should be out-of-line
     int     base;
-    int     pid;
 
 #ifdef __cplusplus
-    static const int sNumInts = 6;
+    static const int sNumInts = 5;
     static const int sNumFds = 1;
     static const int sMagic = 0x3141592;
 
     private_handle_t(int fd, int size, int flags) :
-        fd(fd), magic(sMagic), flags(flags), size(size), offset(0),
-        base(0), pid(getpid())
+        fd(fd), magic(sMagic), flags(flags), size(size), offset(0), base(0)
     {
         version = sizeof(native_handle);
         numInts = sNumInts;
diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp
index c4096ae..8aadb4a 100644
--- a/modules/gralloc/mapper.cpp
+++ b/modules/gralloc/mapper.cpp
@@ -82,7 +82,7 @@
 
 /*****************************************************************************/
 
-static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; 
+static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER;
 
 /*****************************************************************************/
 
@@ -92,14 +92,8 @@
     if (private_handle_t::validate(handle) < 0)
         return -EINVAL;
 
-    // if this handle was created in this process, then we keep it as is.
-    int err = 0;
-    private_handle_t* hnd = (private_handle_t*)handle;
-    if (hnd->pid != getpid()) {
-        void *vaddr;
-        err = gralloc_map(module, handle, &vaddr);
-    }
-    return err;
+    void *vaddr;
+    return gralloc_map(module, handle, &vaddr);
 }
 
 int gralloc_unregister_buffer(gralloc_module_t const* module,
@@ -108,13 +102,10 @@
     if (private_handle_t::validate(handle) < 0)
         return -EINVAL;
 
-    // never unmap buffers that were created in this process
     private_handle_t* hnd = (private_handle_t*)handle;
-    if (hnd->pid != getpid()) {
-        if (hnd->base) {
-            gralloc_unmap(module, handle);
-        }
-    }
+    if (hnd->base)
+        gralloc_unmap(module, handle);
+
     return 0;
 }
 
@@ -157,7 +148,7 @@
     return 0;
 }
 
-int gralloc_unlock(gralloc_module_t const* module, 
+int gralloc_unlock(gralloc_module_t const* module,
         buffer_handle_t handle)
 {
     // we're done with a software buffer. nothing to do in this