Merge "Add camera bayer image format."
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 6767747..58c79fc 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1708,6 +1708,7 @@
         private static final String PIXEL_FORMAT_YUV420P = "yuv420p";
         private static final String PIXEL_FORMAT_RGB565 = "rgb565";
         private static final String PIXEL_FORMAT_JPEG = "jpeg";
+        private static final String PIXEL_FORMAT_BAYER_RGGB = "bayer-rggb";
 
         private HashMap<String, String> mMap;
 
@@ -2258,6 +2259,7 @@
             case ImageFormat.YV12:      return PIXEL_FORMAT_YUV420P;
             case ImageFormat.RGB_565:   return PIXEL_FORMAT_RGB565;
             case ImageFormat.JPEG:      return PIXEL_FORMAT_JPEG;
+            case ImageFormat.BAYER_RGGB: return PIXEL_FORMAT_BAYER_RGGB;
             default:                    return null;
             }
         }
diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java
index b8e9384..7269a71 100644
--- a/graphics/java/android/graphics/ImageFormat.java
+++ b/graphics/java/android/graphics/ImageFormat.java
@@ -84,9 +84,19 @@
     public static final int JPEG = 0x100;
 
     /**
+     * Raw bayer format used for images, which is 10 bit precision samples
+     * stored in 16 bit words. The filter pattern is RGGB. Whether this format
+     * is supported by the camera hardware can be determined by
+     * {@link android.hardware.Camera.Parameters#getSupportedPreviewFormats()}.
+     *
+     * @hide
+     */
+    public static final int BAYER_RGGB = 0x200;
+
+    /**
      * Use this function to retrieve the number of bits per pixel of an
      * ImageFormat.
-     * 
+     *
      * @param format
      * @return the number of bits per pixel of the given format or -1 if the
      *         format doesn't exist or is not supported.
@@ -103,6 +113,8 @@
                 return 12;
             case NV21:
                 return 12;
+            case BAYER_RGGB:
+                return 16;
         }
         return -1;
     }
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 48483fd..b661496 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -573,6 +573,9 @@
     static const char PIXEL_FORMAT_RGB565[];
     static const char PIXEL_FORMAT_RGBA8888[];
     static const char PIXEL_FORMAT_JPEG[];
+    // Raw bayer format used for images, which is 10 bit precision samples
+    // stored in 16 bit words. The filter pattern is RGGB.
+    static const char PIXEL_FORMAT_BAYER_RGGB[];
 
     // Values for focus mode settings.
     // Auto-focus mode. Applications should call
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp
index 251615d..51b96c1 100644
--- a/libs/camera/CameraParameters.cpp
+++ b/libs/camera/CameraParameters.cpp
@@ -151,6 +151,7 @@
 const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565";
 const char CameraParameters::PIXEL_FORMAT_RGBA8888[] = "rgba8888";
 const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg";
+const char CameraParameters::PIXEL_FORMAT_BAYER_RGGB[] = "bayer-rggb";
 
 // Values for focus mode settings.
 const char CameraParameters::FOCUS_MODE_AUTO[] = "auto";