Update Linux Renderscript prebuits with fp16 support

Bug: 7342860
Change-Id: I40578da88d0962ab10f1ded2244a51f3689d4130
diff --git a/renderscript/include/rs_allocation_data.rsh b/renderscript/include/rs_allocation_data.rsh
index d8785a2..69e9baf 100644
--- a/renderscript/include/rs_allocation_data.rsh
+++ b/renderscript/include/rs_allocation_data.rsh
@@ -2524,6 +2524,66 @@
     rsGetElementAt_ulong4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+    rsGetElementAt_half(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+    rsGetElementAt_half2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+    rsGetElementAt_half3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+    rsGetElementAt_half4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+    rsGetElementAt_half(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+    rsGetElementAt_half2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+    rsGetElementAt_half3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+    rsGetElementAt_half4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+    rsGetElementAt_half(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+    rsGetElementAt_half2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+    rsGetElementAt_half3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+    rsGetElementAt_half4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
 /*
  * rsGetElementAtYuv_uchar_U: Get the U component of an allocation of YUVs
  *
@@ -3234,4 +3294,64 @@
     rsSetElementAt_ulong4(rs_allocation a, ulong4 val, uint32_t x, uint32_t y, uint32_t z);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half(rs_allocation a, half val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half(rs_allocation a, half val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half(rs_allocation a, half val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
 #endif // RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
diff --git a/renderscript/include/rs_convert.rsh b/renderscript/include/rs_convert.rsh
index 7cf6c50..66e47c6 100644
--- a/renderscript/include/rs_convert.rsh
+++ b/renderscript/include/rs_convert.rsh
@@ -1249,9 +1249,13 @@
 /*
  * rsPackColorTo8888: Create a uchar4 RGBA from floats
  *
- * Packs three or four floating point RGBA values into a uchar4.  The RGBA values should be
- * between 0.0 and 1.0 inclusive.  Values outside of this range are clamped to this range.
- * However numbers greater than INT_MAX or less than INT_MIN can result in undefined behavior.
+ * Packs three or four floating point RGBA values into a uchar4.
+ *
+ * The input values are typically between 0.0 and 1.0 inclusive.  For input values outside
+ * of this range, the resulting outputs will be clamped to be between 0 and 255.  As this
+ * clamping may be done after the input is multiplied by 255.f and converted to an integer,
+ * input numbers greater than INT_MAX/255.f or less than INT_MIN/255.f can result in
+ * undefined behavior.
  *
  * If the alpha component is not specified, it is assumed to be 1.0, i.e. the result will
  * have an alpha set to 255.
diff --git a/renderscript/include/rs_graphics.rsh b/renderscript/include/rs_graphics.rsh
index 5439f06..2a78018 100644
--- a/renderscript/include/rs_graphics.rsh
+++ b/renderscript/include/rs_graphics.rsh
@@ -19,7 +19,7 @@
 /*
  * rs_graphics.rsh: Graphics Functions and Types
  *
- * The graphics subsystem of RenderScript has been deprecated.
+ * The graphics subsystem of RenderScript was removed at API level 23.
  */
 
 #ifndef RENDERSCRIPT_RS_GRAPHICS_RSH
@@ -40,8 +40,12 @@
  *
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-typedef enum {
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
     RS_BLEND_SRC_ZERO = 0,
     RS_BLEND_SRC_ONE = 1,
     RS_BLEND_SRC_DST_COLOR = 2,
@@ -63,8 +67,12 @@
  *
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-typedef enum {
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
     RS_BLEND_DST_ZERO = 0,
     RS_BLEND_DST_ONE = 1,
     RS_BLEND_DST_SRC_COLOR = 2,
@@ -85,8 +93,12 @@
  *
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-typedef enum {
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
     RS_CULL_BACK = 0,
     RS_CULL_FRONT = 1,
     RS_CULL_NONE = 2,
@@ -104,8 +116,12 @@
  * depth to that found in the depth buffer.
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-typedef enum {
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
     RS_DEPTH_FUNC_ALWAYS = 0, // Always drawn
     RS_DEPTH_FUNC_LESS = 1, // Drawn if the incoming depth value is less than that in the depth buffer
     RS_DEPTH_FUNC_LEQUAL = 2, // Drawn if the incoming depth value is less or equal to that in the depth buffer
@@ -126,8 +142,12 @@
  * Describes the way mesh vertex data is interpreted when rendering
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-typedef enum {
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
     RS_PRIMITIVE_POINT = 0, // Vertex data will be rendered as a series of points
     RS_PRIMITIVE_LINE = 1, // Vertex pairs will be rendered as lines
     RS_PRIMITIVE_LINE_STRIP = 2, // Vertex data will be rendered as a connected line strip
@@ -148,7 +168,13 @@
  * See: android.renderscript.Font
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_font;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_font;
+#endif
 #endif
 
 /*
@@ -160,7 +186,13 @@
  * See: android.renderscript.Mesh
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_mesh;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_mesh;
+#endif
 #endif
 
 /*
@@ -172,7 +204,13 @@
  * See: android.renderscript.ProgramFragment
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_program_fragment;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_fragment;
+#endif
 #endif
 
 /*
@@ -184,7 +222,13 @@
  * See: android.renderscript.ProgramVertex
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_program_vertex;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_vertex;
+#endif
 #endif
 
 /*
@@ -196,7 +240,13 @@
  * See: android.renderscript.ProgramRaster
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_program_raster;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_raster;
+#endif
 #endif
 
 /*
@@ -208,7 +258,13 @@
  * See: android.renderscript.ProgramStore
  */
 #ifndef __LP64__
-typedef _RS_HANDLE rs_program_store;
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef _RS_HANDLE __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_store;
+#endif
 #endif
 
 /*
@@ -220,34 +276,46 @@
  * After calling this function, *dst will be set to an empty handle.  See rsIsObject().
  */
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsClearObject(rs_mesh* dst);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsClearObject(rs_program_fragment* dst);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsClearObject(rs_program_vertex* dst);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsClearObject(rs_program_raster* dst);
 #endif
-
-#ifndef __LP64__
-extern void __attribute__((overloadable))
-    rsClearObject(rs_program_store* dst);
 #endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+    rsClearObject(rs_program_store* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsClearObject(rs_font* dst);
 #endif
+#endif
 
 /*
  * rsIsObject: Check for an empty handle
@@ -261,68 +329,92 @@
  * or see if rsClearObject() has been called on a handle.
  */
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern bool __attribute__((overloadable))
     rsIsObject(rs_mesh v);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern bool __attribute__((overloadable))
     rsIsObject(rs_program_fragment v);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern bool __attribute__((overloadable))
     rsIsObject(rs_program_vertex v);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern bool __attribute__((overloadable))
     rsIsObject(rs_program_raster v);
 #endif
-
-#ifndef __LP64__
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_program_store v);
 #endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_program_store v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern bool __attribute__((overloadable))
     rsIsObject(rs_font v);
 #endif
+#endif
 
 /*
  * rsSetObject: For internal use.
  *
  */
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsSetObject(rs_mesh* dst, rs_mesh src);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsSetObject(rs_program_fragment* dst, rs_program_fragment src);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsSetObject(rs_program_vertex* dst, rs_program_vertex src);
 #endif
+#endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsSetObject(rs_program_raster* dst, rs_program_raster src);
 #endif
-
-#ifndef __LP64__
-extern void __attribute__((overloadable))
-    rsSetObject(rs_program_store* dst, rs_program_store src);
 #endif
 
 #ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+    rsSetObject(rs_program_store* dst, rs_program_store src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
 extern void __attribute__((overloadable))
     rsSetObject(rs_font* dst, rs_font src);
 #endif
+#endif
 
 /*
  * rsgAllocationSyncAll: Sync the contents of an allocation
@@ -337,13 +429,23 @@
  * memory spaces.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgAllocationSyncAll(rs_allocation alloc);
 #endif
+#endif
 
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgAllocationSyncAll(rs_allocation alloc, rs_allocation_usage_type source);
 #endif
 #endif
@@ -356,8 +458,12 @@
  * Set the color target used for all subsequent rendering calls
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindColorTarget(rs_allocation colorTarget, uint slot);
 #endif
 #endif
@@ -377,14 +483,26 @@
  *   pv: program vertex object
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
 #endif
+#endif
 
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
 #endif
+#endif
 
 /*
  * rsgBindDepthTarget: Set the depth target
@@ -394,8 +512,12 @@
  * Set the depth target used for all subsequent rendering calls
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindDepthTarget(rs_allocation depthTarget);
 #endif
 #endif
@@ -411,9 +533,15 @@
  *   font: object to bind
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindFont(rs_font font);
 #endif
+#endif
 
 /*
  * rsgBindProgramFragment: Bind a ProgramFragment
@@ -423,9 +551,15 @@
  * Bind a new ProgramFragment to the rendering context.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindProgramFragment(rs_program_fragment pf);
 #endif
+#endif
 
 /*
  * rsgBindProgramRaster: Bind a ProgramRaster
@@ -435,9 +569,15 @@
  * Bind a new ProgramRaster to the rendering context.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindProgramRaster(rs_program_raster pr);
 #endif
+#endif
 
 /*
  * rsgBindProgramStore: Bind a ProgramStore
@@ -447,9 +587,15 @@
  * Bind a new ProgramStore to the rendering context.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindProgramStore(rs_program_store ps);
 #endif
+#endif
 
 /*
  * rsgBindProgramVertex: Bind a ProgramVertex
@@ -459,9 +605,15 @@
  * Bind a new ProgramVertex to the rendering context.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindProgramVertex(rs_program_vertex pv);
 #endif
+#endif
 
 /*
  * rsgBindSampler: Bind a sampler
@@ -472,9 +624,15 @@
  * operate on the texture bound at the matching slot.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindSampler(rs_program_fragment fragment, uint slot, rs_sampler sampler);
 #endif
+#endif
 
 /*
  * rsgBindTexture: Bind a texture allocation
@@ -487,9 +645,15 @@
  * matching slot.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgBindTexture(rs_program_fragment v, uint slot, rs_allocation alloc);
 #endif
+#endif
 
 /*
  * rsgClearAllRenderTargets: Clear all color and depth targets
@@ -500,8 +664,12 @@
  * the framebuffer
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgClearAllRenderTargets(void);
 #endif
 #endif
@@ -514,9 +682,15 @@
  * Clears the rendering surface to the specified color.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgClearColor(float r, float g, float b, float a);
 #endif
+#endif
 
 /*
  * rsgClearColorTarget: Clear the color target
@@ -526,8 +700,12 @@
  * Clear the previously set color target
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgClearColorTarget(uint slot);
 #endif
 #endif
@@ -540,9 +718,15 @@
  * Clears the depth suface to the specified value.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgClearDepth(float value);
 #endif
+#endif
 
 /*
  * rsgClearDepthTarget: Clear the depth target
@@ -552,8 +736,12 @@
  * Clear the previously set depth target
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern void __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgClearDepthTarget(void);
 #endif
 #endif
@@ -578,19 +766,37 @@
  *   len: number of indices to draw
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawMesh(rs_mesh ism);
 #endif
-
-#ifndef __LP64__
-extern void __attribute__((overloadable))
-    rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
 #endif
 
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+    rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
 #endif
+#endif
 
 /*
  * rsgDrawQuad: Draw a quad
@@ -601,10 +807,16 @@
  * drawing large quantities of geometry.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawQuad(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3,
                 float z3, float x4, float y4, float z4);
 #endif
+#endif
 
 /*
  * rsgDrawQuadTexCoords: Draw a textured quad
@@ -615,11 +827,17 @@
  * for drawing large quantities of geometry.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2,
                          float z2, float u2, float v2, float x3, float y3, float z3, float u3,
                          float v3, float x4, float y4, float z4, float u4, float v4);
 #endif
+#endif
 
 /*
  * rsgDrawRect: Draw a rectangle
@@ -630,9 +848,15 @@
  * intended for drawing large quantities of geometry.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawRect(float x1, float y1, float x2, float y2, float z);
 #endif
+#endif
 
 /*
  * rsgDrawSpriteScreenspace: Draw rectangles in screenspace
@@ -645,9 +869,15 @@
  * for drawing in shipping applications.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
 #endif
+#endif
 
 /*
  * rsgDrawText: Draw a text string
@@ -657,14 +887,26 @@
  * Draws text given a string and location
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawText(const char* text, int x, int y);
 #endif
+#endif
 
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgDrawText(rs_allocation alloc, int x, int y);
 #endif
+#endif
 
 /*
  * rsgFinish: End rendering commands
@@ -674,8 +916,12 @@
  * Force RenderScript to finish all rendering commands
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-extern uint __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgFinish(void);
 #endif
 #endif
@@ -694,9 +940,15 @@
  *   a: alpha component
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgFontColor(float r, float g, float b, float a);
 #endif
+#endif
 
 /*
  * rsgGetHeight: Get the surface height
@@ -706,9 +958,15 @@
  * Get the height of the current rendering surface.
  */
 #ifndef __LP64__
-extern uint __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgGetHeight(void);
 #endif
+#endif
 
 /*
  * rsgGetWidth: Get the surface width
@@ -718,9 +976,15 @@
  * Get the width of the current rendering surface.
  */
 #ifndef __LP64__
-extern uint __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgGetWidth(void);
 #endif
+#endif
 
 /*
  * rsgMeasureText: Get the bounding box for a text string
@@ -731,14 +995,26 @@
  * Any of left, right, top, bottom could be NULL
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeasureText(const char* text, int* left, int* right, int* top, int* bottom);
 #endif
+#endif
 
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeasureText(rs_allocation alloc, int* left, int* right, int* top, int* bottom);
 #endif
+#endif
 
 /*
  * rsgMeshComputeBoundingBox: Compute a bounding box
@@ -748,13 +1024,24 @@
  * Computes an axis aligned bounding box of a mesh object
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshComputeBoundingBox(rs_mesh mesh, float* minX, float* minY, float* min, float* maxX,
                               float* maxY, float* maxZ);
 #endif
+#endif
 
 #ifndef __LP64__
-static inline void __attribute__((always_inline, overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+static inline void __attribute__((always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshComputeBoundingBox(rs_mesh mesh, float3* bBoxMin, float3* bBoxMax) {
     float x1, y1, z1, x2, y2, z2;
     rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
@@ -766,6 +1053,7 @@
     bBoxMax->z = z2;
 }
 #endif
+#endif
 
 /*
  * rsgMeshGetIndexAllocation: Return an allocation containing index data
@@ -782,8 +1070,12 @@
  * Returns: allocation containing index data
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_allocation __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index);
 #endif
 #endif
@@ -803,8 +1095,12 @@
  * Returns: primitive describing how the mesh is rendered
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_primitive __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_primitive __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshGetPrimitive(rs_mesh m, uint32_t index);
 #endif
 #endif
@@ -823,8 +1119,12 @@
  * Returns: number of primitive groups in the mesh. This would include simple primitives as well as allocations containing index data
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern uint32_t __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint32_t __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshGetPrimitiveCount(rs_mesh m);
 #endif
 #endif
@@ -844,8 +1144,12 @@
  * Returns: allocation containing vertex data
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_allocation __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
 #endif
 #endif
@@ -864,8 +1168,12 @@
  * Returns: number of allocations in the mesh that contain vertex data
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern uint32_t __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint32_t __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgMeshGetVertexAllocationCount(rs_mesh m);
 #endif
 #endif
@@ -878,9 +1186,15 @@
  * Set the constant color for a fixed function emulation program.
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
 #endif
+#endif
 
 /*
  * rsgProgramVertexGetProjectionMatrix: Get the projection matrix for a fixed function vertex program
@@ -895,9 +1209,15 @@
  *   proj: matrix to store the current projection matrix into
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramVertexGetProjectionMatrix(rs_matrix4x4* proj);
 #endif
+#endif
 
 /*
  * rsgProgramVertexLoadModelMatrix: Load the model matrix for a bound fixed function vertex program
@@ -912,9 +1232,15 @@
  *   model: model matrix
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramVertexLoadModelMatrix(const rs_matrix4x4* model);
 #endif
+#endif
 
 /*
  * rsgProgramVertexLoadProjectionMatrix: Load the projection matrix for a bound fixed function vertex program
@@ -929,9 +1255,15 @@
  *   proj: projection matrix
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4* proj);
 #endif
+#endif
 
 /*
  * rsgProgramVertexLoadTextureMatrix: Load the texture matrix for a bound fixed function vertex program
@@ -946,9 +1278,15 @@
  *   tex: texture matrix
  */
 #ifndef __LP64__
-extern void __attribute__((overloadable))
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4* tex);
 #endif
+#endif
 
 /*
  * rsgProgramRasterGetCullMode: Get program raster cull mode
@@ -961,8 +1299,12 @@
  *   pr: program raster to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_cull_mode __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_cull_mode __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramRasterGetCullMode(rs_program_raster pr);
 #endif
 #endif
@@ -978,8 +1320,12 @@
  *   pr: program raster to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramRasterIsPointSpriteEnabled(rs_program_raster pr);
 #endif
 #endif
@@ -995,8 +1341,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_blend_dst_func __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_blend_dst_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
 #endif
 #endif
@@ -1012,8 +1362,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_blend_src_func __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_blend_src_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
 #endif
 #endif
@@ -1029,8 +1383,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern rs_depth_func __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_depth_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreGetDepthFunc(rs_program_store ps);
 #endif
 #endif
@@ -1046,8 +1404,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsColorMaskAlphaEnabled(rs_program_store ps);
 #endif
 #endif
@@ -1063,8 +1425,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsColorMaskBlueEnabled(rs_program_store ps);
 #endif
 #endif
@@ -1080,8 +1446,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsColorMaskGreenEnabled(rs_program_store ps);
 #endif
 #endif
@@ -1097,8 +1467,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsColorMaskRedEnabled(rs_program_store ps);
 #endif
 #endif
@@ -1114,8 +1488,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsDepthMaskEnabled(rs_program_store ps);
 #endif
 #endif
@@ -1131,8 +1509,12 @@
  *   ps: program store to query
  */
 #ifndef __LP64__
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-extern bool __attribute__((overloadable))
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
     rsgProgramStoreIsDitherEnabled(rs_program_store ps);
 #endif
 #endif
diff --git a/renderscript/include/rs_math.rsh b/renderscript/include/rs_math.rsh
index 7ab6975..9125854 100644
--- a/renderscript/include/rs_math.rsh
+++ b/renderscript/include/rs_math.rsh
@@ -4083,22 +4083,46 @@
  *   low: Lower bound.
  *   high: Upper bound.
  */
-extern char __attribute__((const, always_inline, overloadable))
+extern char __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(char amount, char low, char high);
 
-extern uchar __attribute__((const, always_inline, overloadable))
+extern uchar __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(uchar amount, uchar low, uchar high);
 
-extern short __attribute__((const, always_inline, overloadable))
+extern short __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(short amount, short low, short high);
 
-extern ushort __attribute__((const, always_inline, overloadable))
+extern ushort __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(ushort amount, ushort low, ushort high);
 
-extern int __attribute__((const, always_inline, overloadable))
+extern int __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(int amount, int low, int high);
 
-extern uint __attribute__((const, always_inline, overloadable))
+extern uint __attribute__((const, always_inline, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
     rsClamp(uint amount, uint low, uint high);
 
 /*
@@ -4108,7 +4132,11 @@
  *
  * Returns the fractional part of a float
  */
-extern float __attribute__((const, overloadable))
+extern float __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use fract() instead.")
+#endif
+))
     rsFrac(float v);
 
 /*
diff --git a/renderscript/include/rs_object_info.rsh b/renderscript/include/rs_object_info.rsh
index 4305f2a..d4c40fe 100644
--- a/renderscript/include/rs_object_info.rsh
+++ b/renderscript/include/rs_object_info.rsh
@@ -373,7 +373,11 @@
  * Returns the Allocation for a given pointer.  The pointer should point within a valid
  * allocation.  The results are undefined if the pointer is not from a valid Allocation.
  */
-extern rs_allocation __attribute__((overloadable))
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("This function is deprecated and will be removed from the SDK in a future release.")
+#endif
+))
     rsGetAllocation(const void* p);
 
 /*
diff --git a/renderscript/include/rs_value_types.rsh b/renderscript/include/rs_value_types.rsh
index 9dc7259..faf397c 100644
--- a/renderscript/include/rs_value_types.rsh
+++ b/renderscript/include/rs_value_types.rsh
@@ -26,7 +26,7 @@
  *                    8 bits           16 bits            32 bits          64 bits
  * Integer:           char, int8_t     short, int16_t     int32_t          long, long long, int64_t
  * Unsigned integer:  uchar, uint8_t   ushort, uint16_t   uint, uint32_t   ulong, uint64_t
- * Floating point:                                        float            double
+ * Floating point:                     half               float            double
  *
  *
  * Vectors:
@@ -92,6 +92,45 @@
 #define RENDERSCRIPT_RS_VALUE_TYPES_RSH
 
 /*
+ * half: 16 bit floating point value
+ *
+ * A 16 bit floating point value.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef __fp16 half;
+#endif
+
+/*
+ * half2: Two 16 bit floats
+ *
+ * Vector version of the half float type. Provides two half fields packed
+ * into a single 32 bit field with 32 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(2))) half2;
+#endif
+
+/*
+ * half3: Three 16 bit floats
+ *
+ * Vector version of the half float type. Provides three half fields packed
+ * into a single 64 bit field with 64 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(3))) half3;
+#endif
+
+/*
+ * half4: Four 16 bit floats
+ *
+ * Vector version of the half float type. Provides four half fields packed
+ * into a single 64 bit field with 64 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(4))) half4;
+#endif
+
+/*
  * int8_t: 8 bit signed integer
  *
  * 8 bit signed integer type.
diff --git a/renderscript/lib/arm/libRSSupport.so b/renderscript/lib/arm/libRSSupport.so
index 975dc54..83f2bfc 100755
--- a/renderscript/lib/arm/libRSSupport.so
+++ b/renderscript/lib/arm/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/arm/libRSSupportIO.so b/renderscript/lib/arm/libRSSupportIO.so
index c6700be..1eeede8 100755
--- a/renderscript/lib/arm/libRSSupportIO.so
+++ b/renderscript/lib/arm/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/arm/libc.so b/renderscript/lib/arm/libc.so
index 76c73ee..eb2cd89 100755
--- a/renderscript/lib/arm/libc.so
+++ b/renderscript/lib/arm/libc.so
Binary files differ
diff --git a/renderscript/lib/arm/libclcore.bc b/renderscript/lib/arm/libclcore.bc
index 2136af9..501e898 100644
--- a/renderscript/lib/arm/libclcore.bc
+++ b/renderscript/lib/arm/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/arm/libm.so b/renderscript/lib/arm/libm.so
index 855e964..5c8bbfd 100755
--- a/renderscript/lib/arm/libm.so
+++ b/renderscript/lib/arm/libm.so
Binary files differ
diff --git a/renderscript/lib/arm/librsjni.so b/renderscript/lib/arm/librsjni.so
index baf730b..ec8b093 100755
--- a/renderscript/lib/arm/librsjni.so
+++ b/renderscript/lib/arm/librsjni.so
Binary files differ
diff --git a/renderscript/lib/arm/librsrt_arm.bc b/renderscript/lib/arm/librsrt_arm.bc
index 2136af9..501e898 100644
--- a/renderscript/lib/arm/librsrt_arm.bc
+++ b/renderscript/lib/arm/librsrt_arm.bc
Binary files differ
diff --git a/renderscript/lib/javalib.jar b/renderscript/lib/javalib.jar
index 0058d42..25a2e18 100644
--- a/renderscript/lib/javalib.jar
+++ b/renderscript/lib/javalib.jar
Binary files differ
diff --git a/renderscript/lib/mips/libRSSupport.so b/renderscript/lib/mips/libRSSupport.so
index 9b360a3..1b80d8e 100755
--- a/renderscript/lib/mips/libRSSupport.so
+++ b/renderscript/lib/mips/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/mips/libRSSupportIO.so b/renderscript/lib/mips/libRSSupportIO.so
index 6ccbff3..3f476dc 100755
--- a/renderscript/lib/mips/libRSSupportIO.so
+++ b/renderscript/lib/mips/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/mips/libc.so b/renderscript/lib/mips/libc.so
index 3f37e8b..31f94b9 100755
--- a/renderscript/lib/mips/libc.so
+++ b/renderscript/lib/mips/libc.so
Binary files differ
diff --git a/renderscript/lib/mips/libclcore.bc b/renderscript/lib/mips/libclcore.bc
index 2136af9..501e898 100644
--- a/renderscript/lib/mips/libclcore.bc
+++ b/renderscript/lib/mips/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/mips/libm.so b/renderscript/lib/mips/libm.so
index d275296..d05747f 100755
--- a/renderscript/lib/mips/libm.so
+++ b/renderscript/lib/mips/libm.so
Binary files differ
diff --git a/renderscript/lib/mips/librsjni.so b/renderscript/lib/mips/librsjni.so
index bf1cd74..f27bb7d 100755
--- a/renderscript/lib/mips/librsjni.so
+++ b/renderscript/lib/mips/librsjni.so
Binary files differ
diff --git a/renderscript/lib/mips/librsrt_mips.bc b/renderscript/lib/mips/librsrt_mips.bc
index 2136af9..501e898 100644
--- a/renderscript/lib/mips/librsrt_mips.bc
+++ b/renderscript/lib/mips/librsrt_mips.bc
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupport.so b/renderscript/lib/x86/libRSSupport.so
index 3a07846..9934943 100755
--- a/renderscript/lib/x86/libRSSupport.so
+++ b/renderscript/lib/x86/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupportIO.so b/renderscript/lib/x86/libRSSupportIO.so
index 5f5e49a..0c81a92 100755
--- a/renderscript/lib/x86/libRSSupportIO.so
+++ b/renderscript/lib/x86/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/x86/libc.so b/renderscript/lib/x86/libc.so
index 80886c2..65c1148 100755
--- a/renderscript/lib/x86/libc.so
+++ b/renderscript/lib/x86/libc.so
Binary files differ
diff --git a/renderscript/lib/x86/libclcore.bc b/renderscript/lib/x86/libclcore.bc
index 00e424c..b757b6e 100644
--- a/renderscript/lib/x86/libclcore.bc
+++ b/renderscript/lib/x86/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/x86/libm.so b/renderscript/lib/x86/libm.so
index fbd135f..ab55501 100755
--- a/renderscript/lib/x86/libm.so
+++ b/renderscript/lib/x86/libm.so
Binary files differ
diff --git a/renderscript/lib/x86/librsjni.so b/renderscript/lib/x86/librsjni.so
index 54428b8..fa648d1 100755
--- a/renderscript/lib/x86/librsjni.so
+++ b/renderscript/lib/x86/librsjni.so
Binary files differ
diff --git a/renderscript/lib/x86/librsrt_x86.bc b/renderscript/lib/x86/librsrt_x86.bc
index e939eb5..cb8488e 100644
--- a/renderscript/lib/x86/librsrt_x86.bc
+++ b/renderscript/lib/x86/librsrt_x86.bc
Binary files differ
diff --git a/tools/linux/bin/bcc_compat b/tools/linux/bin/bcc_compat
index 462b765..ca231aa 100755
--- a/tools/linux/bin/bcc_compat
+++ b/tools/linux/bin/bcc_compat
Binary files differ
diff --git a/tools/linux/bin/llvm-rs-cc b/tools/linux/bin/llvm-rs-cc
index e0b6f24..2f72b6b 100755
--- a/tools/linux/bin/llvm-rs-cc
+++ b/tools/linux/bin/llvm-rs-cc
Binary files differ
diff --git a/tools/linux/lib/libc++.so b/tools/linux/lib/libc++.so
index 004d009..1ec1778 100755
--- a/tools/linux/lib/libc++.so
+++ b/tools/linux/lib/libc++.so
Binary files differ
diff --git a/tools/linux/lib64/libLLVM.so b/tools/linux/lib64/libLLVM.so
index 8ea4ec7..6d79aa1 100755
--- a/tools/linux/lib64/libLLVM.so
+++ b/tools/linux/lib64/libLLVM.so
Binary files differ
diff --git a/tools/linux/lib64/libbcc.so b/tools/linux/lib64/libbcc.so
index 75e873a..0b2c18e 100755
--- a/tools/linux/lib64/libbcc.so
+++ b/tools/linux/lib64/libbcc.so
Binary files differ
diff --git a/tools/linux/lib64/libbcinfo.so b/tools/linux/lib64/libbcinfo.so
index 51acb16..6585dca 100755
--- a/tools/linux/lib64/libbcinfo.so
+++ b/tools/linux/lib64/libbcinfo.so
Binary files differ
diff --git a/tools/linux/lib64/libc++.so b/tools/linux/lib64/libc++.so
index 5db20e6..2312dda 100755
--- a/tools/linux/lib64/libc++.so
+++ b/tools/linux/lib64/libc++.so
Binary files differ
diff --git a/tools/linux/lib64/libclang.so b/tools/linux/lib64/libclang.so
index 674aea7..70e02c8 100755
--- a/tools/linux/lib64/libclang.so
+++ b/tools/linux/lib64/libclang.so
Binary files differ