Merge "Fix typo in gralloc.h"
diff --git a/hardware.c b/hardware.c
index 3a5b9df..1f831cb 100644
--- a/hardware.c
+++ b/hardware.c
@@ -74,7 +74,7 @@
     handle = dlopen(path, RTLD_NOW);
     if (handle == NULL) {
         char const *err_str = dlerror();
-        LOGE("load: module=%s\n%s", path, err_str?err_str:"unknown");
+        ALOGE("load: module=%s\n%s", path, err_str?err_str:"unknown");
         status = -EINVAL;
         goto done;
     }
@@ -83,14 +83,14 @@
     const char *sym = HAL_MODULE_INFO_SYM_AS_STR;
     hmi = (struct hw_module_t *)dlsym(handle, sym);
     if (hmi == NULL) {
-        LOGE("load: couldn't find symbol %s", sym);
+        ALOGE("load: couldn't find symbol %s", sym);
         status = -EINVAL;
         goto done;
     }
 
     /* Check that the id matches */
     if (strcmp(id, hmi->id) != 0) {
-        LOGE("load: id=%s != hmi->id=%s", id, hmi->id);
+        ALOGE("load: id=%s != hmi->id=%s", id, hmi->id);
         status = -EINVAL;
         goto done;
     }
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 2d7f39d..ed97728 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -275,6 +275,7 @@
      * setMode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
      * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is
      * playing, and AUDIO_MODE_IN_CALL when a call is in progress.
+     * Actual type of mode is enum audio_mode_t defined in <system/audio.h>.
      */
     int (*set_mode)(struct audio_hw_device *dev, int mode);
 
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 5adab12..3dd75ab 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -111,19 +111,19 @@
 //  |                           |           | 1 requires device updates
 //  |                           |           | 2, 4 reserved
 //  +---------------------------+-----------+-----------------------------------
-//  | Sample input mode         | 12..13    | 1 direct: process() function or EFFECT_CMD_CONFIGURE
+//  | Sample input mode         | 12..13    | 1 direct: process() function or EFFECT_CMD_SET_CONFIG
 //  |                           |           |   command must specify a buffer descriptor
 //  |                           |           | 2 provider: process() function uses the
 //  |                           |           |   bufferProvider indicated by the
-//  |                           |           |   EFFECT_CMD_CONFIGURE command to request input.
+//  |                           |           |   EFFECT_CMD_SET_CONFIG command to request input.
 //  |                           |           |   buffers.
 //  |                           |           | 3 both: both input modes are supported
 //  +---------------------------+-----------+-----------------------------------
-//  | Sample output mode        | 14..15    | 1 direct: process() function or EFFECT_CMD_CONFIGURE
+//  | Sample output mode        | 14..15    | 1 direct: process() function or EFFECT_CMD_SET_CONFIG
 //  |                           |           |   command must specify a buffer descriptor
 //  |                           |           | 2 provider: process() function uses the
 //  |                           |           |   bufferProvider indicated by the
-//  |                           |           |   EFFECT_CMD_CONFIGURE command to request output
+//  |                           |           |   EFFECT_CMD_SET_CONFIG command to request output
 //  |                           |           |   buffers.
 //  |                           |           | 3 both: both output modes are supported
 //  +---------------------------+-----------+-----------------------------------
@@ -269,7 +269,7 @@
     //          (count and location) in input buffer descriptor and output processed
     //          samples as specified in output buffer descriptor. If the buffer descriptor
     //          is not specified the function must use either the buffer or the
-    //          buffer provider function installed by the EFFECT_CMD_CONFIGURE command.
+    //          buffer provider function installed by the EFFECT_CMD_SET_CONFIG command.
     //          The effect framework will call the process() function after the EFFECT_CMD_ENABLE
     //          command is received and until the EFFECT_CMD_DISABLE is received. When the engine
     //          receives the EFFECT_CMD_DISABLE command it should turn off the effect gracefully
@@ -284,10 +284,10 @@
     //          self:       handle to the effect interface this function
     //              is called on.
     //          inBuffer:   buffer descriptor indicating where to read samples to process.
-    //              If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE command.
+    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command.
     //
     //          outBuffer:   buffer descriptor indicating where to write processed samples.
-    //              If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE command.
+    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command.
     //
     //    Output:
     //        returned value:    0 successful operation
@@ -369,12 +369,12 @@
     //          self:       handle to the effect interface this function
     //              is called on.
     //          inBuffer:   buffer descriptor indicating where to read samples to process.
-    //              If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE_REVERSE command.
+    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command.
     //
     //          outBuffer:   buffer descriptor indicating where to write processed samples.
-    //              If NULL, use the configuration passed by EFFECT_CMD_CONFIGURE_REVERSE command.
+    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command.
     //              If the buffer and buffer provider in the configuration received by
-    //              EFFECT_CMD_CONFIGURE_REVERSE are also NULL, do not return modified reverse
+    //              EFFECT_CMD_SET_CONFIG_REVERSE are also NULL, do not return modified reverse
     //              stream data
     //
     //    Output:
@@ -395,7 +395,7 @@
 //
 enum effect_command_e {
    EFFECT_CMD_INIT,                 // initialize effect engine
-   EFFECT_CMD_CONFIGURE,            // configure effect engine (see effect_config_t)
+   EFFECT_CMD_SET_CONFIG,           // configure effect engine (see effect_config_t)
    EFFECT_CMD_RESET,                // reset effect engine
    EFFECT_CMD_ENABLE,               // enable effect process
    EFFECT_CMD_DISABLE,              // disable effect process
@@ -406,8 +406,10 @@
    EFFECT_CMD_SET_DEVICE,           // set audio device (see audio.h, audio_devices_t)
    EFFECT_CMD_SET_VOLUME,           // set volume
    EFFECT_CMD_SET_AUDIO_MODE,       // set the audio mode (normal, ring, ...)
-   EFFECT_CMD_CONFIGURE_REVERSE,    // configure effect engine reverse stream(see effect_config_t)
+   EFFECT_CMD_SET_CONFIG_REVERSE,   // configure effect engine reverse stream(see effect_config_t)
    EFFECT_CMD_SET_INPUT_DEVICE,     // set capture device (see audio.h, audio_devices_t)
+   EFFECT_CMD_GET_CONFIG,           // read effect engine configuration
+   EFFECT_CMD_GET_CONFIG_REVERSE,   // read configure effect engine reverse stream configuration
    EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code
 };
 
@@ -425,7 +427,7 @@
 //  size: sizeof(int)
 //  data: status
 //==================================================================================================
-// command: EFFECT_CMD_CONFIGURE
+// command: EFFECT_CMD_SET_CONFIG
 //--------------------------------------------------------------------------------------------------
 // description:
 //  Apply new audio parameters configurations for input and output buffers
@@ -585,10 +587,11 @@
 //  size: 0
 //  data: N/A
 //==================================================================================================
-// command: EFFECT_CMD_CONFIGURE_REVERSE
+// command: EFFECT_CMD_SET_CONFIG_REVERSE
 //--------------------------------------------------------------------------------------------------
 // description:
-//  Apply new audio parameters configurations for input and output buffers of reverse stream
+//  Apply new audio parameters configurations for input and output buffers of reverse stream.
+//  An example of reverse stream is the echo reference supplied to an Acoustic Echo Canceler.
 //--------------------------------------------------------------------------------------------------
 // command format:
 //  size: sizeof(effect_config_t)
@@ -614,6 +617,32 @@
 //  size: 0
 //  data: N/A
 //==================================================================================================
+// command: EFFECT_CMD_GET_CONFIG
+//--------------------------------------------------------------------------------------------------
+// description:
+//  Read audio parameters configurations for input and output buffers
+//--------------------------------------------------------------------------------------------------
+// command format:
+//  size: 0
+//  data: N/A
+//--------------------------------------------------------------------------------------------------
+// reply format:
+//  size: sizeof(effect_config_t)
+//  data: effect_config_t
+//==================================================================================================
+// command: EFFECT_CMD_GET_CONFIG_REVERSE
+//--------------------------------------------------------------------------------------------------
+// description:
+//  Read audio parameters configurations for input and output buffers of reverse stream
+//--------------------------------------------------------------------------------------------------
+// command format:
+//  size: 0
+//  data: N/A
+//--------------------------------------------------------------------------------------------------
+// reply format:
+//  size: sizeof(effect_config_t)
+//  data: effect_config_t
+//==================================================================================================
 // command: EFFECT_CMD_FIRST_PROPRIETARY
 //--------------------------------------------------------------------------------------------------
 // description:
@@ -649,7 +678,7 @@
 // with getBuffer() is not needed anymore.
 // The process function should use the buffer provider mechanism to retrieve
 // input or output buffer if the inBuffer or outBuffer passed as argument is NULL
-// and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_CONFIGURE
+// and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_SET_CONFIG
 // command did not specify an audio buffer.
 
 typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer);
@@ -664,7 +693,7 @@
 // The buffer_config_s structure specifies the input or output audio format
 // to be used by the effect engine. It is part of the effect_config_t
 // structure that defines both input and output buffer configurations and is
-// passed by the EFFECT_CMD_CONFIGURE or EFFECT_CMD_CONFIGURE_REVERSE command.
+// passed by the EFFECT_CMD_SET_CONFIG or EFFECT_CMD_SET_CONFIG_REVERSE command.
 typedef struct buffer_config_s {
     audio_buffer_t  buffer;     // buffer for use by process() function if not passed explicitly
     uint32_t   samplingRate;    // sampling rate
@@ -685,7 +714,7 @@
 };
 
 // Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
-// in buffer_config_t must be taken into account when executing the EFFECT_CMD_CONFIGURE command
+// in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command
 #define EFFECT_CONFIG_BUFFER    0x0001  // buffer field must be taken into account
 #define EFFECT_CONFIG_SMP_RATE  0x0002  // samplingRate field must be taken into account
 #define EFFECT_CONFIG_CHANNELS  0x0004  // channels field must be taken into account
@@ -697,7 +726,7 @@
                            EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER)
 
 
-// effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_CONFIGURE
+// effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_CONFIG
 // command to configure audio parameters and buffers for effect engine input and output.
 typedef struct effect_config_s {
     buffer_config_t   inputCfg;
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index f908976..a37e2c0 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -98,7 +98,7 @@
         m->info.activate = FB_ACTIVATE_VBL;
         m->info.yoffset = offset / m->finfo.line_length;
         if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
-            LOGE("FBIOPUT_VSCREENINFO failed");
+            ALOGE("FBIOPUT_VSCREENINFO failed");
             m->base.unlock(&m->base, buffer); 
             return -errno;
         }
@@ -181,14 +181,14 @@
     if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
+        ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
     }
 
     if (info.yres_virtual < info.yres * 2) {
         // we need at least 2 for page-flipping
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
+        ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
                 info.yres_virtual, info.yres*2);
     }
 
@@ -222,7 +222,7 @@
     float ydpi = (info.yres * 25.4f) / info.height;
     float fps  = refreshRate / 1000.0f;
 
-    LOGI(   "using (fd=%d)\n"
+    ALOGI(   "using (fd=%d)\n"
             "id           = %s\n"
             "xres         = %d px\n"
             "yres         = %d px\n"
@@ -244,7 +244,7 @@
             info.blue.offset, info.blue.length
     );
 
-    LOGI(   "width        = %d mm (%f dpi)\n"
+    ALOGI(   "width        = %d mm (%f dpi)\n"
             "height       = %d mm (%f dpi)\n"
             "refresh rate = %.2f Hz\n",
             info.width,  xdpi,
@@ -280,7 +280,7 @@
 
     void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (vaddr == MAP_FAILED) {
-        LOGE("Error mapping the framebuffer (%s)", strerror(errno));
+        ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
         return -errno;
     }
     module->framebuffer->base = intptr_t(vaddr);
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index dcd2e2b..a6b4edd 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -175,7 +175,7 @@
     
     fd = ashmem_create_region("gralloc-buffer", size);
     if (fd < 0) {
-        LOGE("couldn't create ashmem (%s)", strerror(-errno));
+        ALOGE("couldn't create ashmem (%s)", strerror(-errno));
         err = -errno;
     }
 
@@ -189,7 +189,7 @@
         }
     }
     
-    LOGE_IF(err, "gralloc failed err=%s", strerror(-err));
+    ALOGE_IF(err, "gralloc failed err=%s", strerror(-err));
     
     return err;
 }
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h
index 75bcd1d..e1c502a 100644
--- a/modules/gralloc/gralloc_priv.h
+++ b/modules/gralloc/gralloc_priv.h
@@ -101,7 +101,7 @@
                 h->numInts != sNumInts || h->numFds != sNumFds ||
                 hnd->magic != sMagic) 
         {
-            LOGE("invalid gralloc handle (at %p)", h);
+            ALOGE("invalid gralloc handle (at %p)", h);
             return -EINVAL;
         }
         return 0;
diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp
index 33d0958..c4096ae 100644
--- a/modules/gralloc/mapper.cpp
+++ b/modules/gralloc/mapper.cpp
@@ -53,11 +53,11 @@
         void* mappedAddress = mmap(0, size,
                 PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
         if (mappedAddress == MAP_FAILED) {
-            LOGE("Could not mmap %s", strerror(errno));
+            ALOGE("Could not mmap %s", strerror(errno));
             return -errno;
         }
         hnd->base = intptr_t(mappedAddress) + hnd->offset;
-        //LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
+        //ALOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
         //        hnd->fd, hnd->offset, hnd->size, mappedAddress);
     }
     *vaddr = (void*)hnd->base;
@@ -71,9 +71,9 @@
     if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
         void* base = (void*)hnd->base;
         size_t size = hnd->size;
-        //LOGD("unmapping from %p, size=%d", base, size);
+        //ALOGD("unmapping from %p, size=%d", base, size);
         if (munmap(base, size) < 0) {
-            LOGE("Could not unmap %s", strerror(errno));
+            ALOGE("Could not unmap %s", strerror(errno));
         }
     }
     hnd->base = 0;
diff --git a/modules/hwcomposer/hwcomposer.cpp b/modules/hwcomposer/hwcomposer.cpp
index 68b7070..0e04cac 100644
--- a/modules/hwcomposer/hwcomposer.cpp
+++ b/modules/hwcomposer/hwcomposer.cpp
@@ -55,7 +55,7 @@
 /*****************************************************************************/
 
 static void dump_layer(hwc_layer_t const* l) {
-    LOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
+    ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
             l->compositionType, l->flags, l->handle, l->transform, l->blending,
             l->sourceCrop.left,
             l->sourceCrop.top,