Revert "Added a flag to APIs for rsObj creation"

This reverts commit a7725cbfcdfe2eaf868571c77f004a4d7208e8ef.

Change-Id: Ie6a1a14023a2a7f1df732bb73c27db79a3e6aa9f
diff --git a/rs.spec b/rs.spec
index def73dc..608f324 100644
--- a/rs.spec
+++ b/rs.spec
@@ -44,14 +44,12 @@
     param bool mipmaps
     param bool faces
     param uint32_t yuv
-    param bool fromJava
     ret RsType
 }
 
 TypeCreate2 {
     direct
     param const RsTypeCreateParams *dat
-    param bool fromJava
     ret RsType
 }
 
@@ -61,7 +59,6 @@
     param RsAllocationMipmapControl mipmaps
     param uint32_t usages
     param uintptr_t ptr
-    param bool fromJava
     ret RsAllocation
 }
 
@@ -71,7 +68,6 @@
     param RsAllocationMipmapControl mipmaps
     param const void *data
     param uint32_t usages
-    param bool fromJava
     ret RsAllocation
 }
 
@@ -81,7 +77,6 @@
     param RsAllocationMipmapControl mipmaps
     param const void *data
     param uint32_t usages
-    param bool fromJava
     ret RsAllocation
 }
 
@@ -153,7 +148,6 @@
     param RsDataKind mKind
     param bool mNormalized
     param uint32_t mVectorSize
-    param bool fromJava
     ret RsElement
     }
 
@@ -162,7 +156,6 @@
     param const RsElement * elements
     param const char ** names
     param const uint32_t * arraySize
-    param bool fromJava
     ret RsElement
     }
 
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index c06eece..da70cd2 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -778,15 +778,12 @@
 
 RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype,
                                        RsAllocationMipmapControl mipmaps,
-                                       uint32_t usages, uintptr_t ptr, bool fromJava) {
+                                       uint32_t usages, uintptr_t ptr) {
     Allocation * alloc = Allocation::createAllocation(rsc, static_cast<Type *>(vtype), usages, mipmaps, (void*)ptr);
-    if (alloc) {
-        if (fromJava) {
-            alloc->incUserRef();
-        } else {
-            alloc->incSysRef();
-        }
+    if (!alloc) {
+        return nullptr;
     }
+    alloc->incUserRef();
     return alloc;
 }
 
@@ -805,10 +802,10 @@
 
 RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, RsType vtype,
                                             RsAllocationMipmapControl mipmaps,
-                                            const void *data, size_t sizeBytes, uint32_t usages, bool fromJava) {
+                                            const void *data, size_t sizeBytes, uint32_t usages) {
     Type *t = static_cast<Type *>(vtype);
 
-    RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0, fromJava);
+    RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
     Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
     if (texAlloc == nullptr) {
         ALOGE("Memory allocation failure");
@@ -827,14 +824,13 @@
 
 RsAllocation rsi_AllocationCubeCreateFromBitmap(Context *rsc, RsType vtype,
                                                 RsAllocationMipmapControl mipmaps,
-                                                const void *data, size_t sizeBytes, uint32_t usages,
-                                                bool fromJava) {
+                                                const void *data, size_t sizeBytes, uint32_t usages) {
     Type *t = static_cast<Type *>(vtype);
 
     // Cubemap allocation's faces should be Width by Width each.
     // Source data should have 6 * Width by Width pixels
     // Error checking is done in the java layer
-    RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0, fromJava);
+    RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
     Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
     if (texAlloc == nullptr) {
         ALOGE("Memory allocation failure");
diff --git a/rsElement.cpp b/rsElement.cpp
index fedb334..a734400 100644
--- a/rsElement.cpp
+++ b/rsElement.cpp
@@ -139,8 +139,7 @@
                                           component.getType(),
                                           component.getKind(),
                                           component.getIsNormalized(),
-                                          component.getVectorSize(),
-                                          true  /* Java only */);
+                                          component.getVectorSize());
     }
 
     const Element **subElems = new const Element *[fieldCount];
@@ -156,8 +155,7 @@
     }
 
     const Element *elem = Element::create(rsc, fieldCount, subElems, subElemNames,
-                                          subElemNamesLengths, arraySizes,
-                                          true /* Java only */);
+                                          subElemNamesLengths, arraySizes);
     for (uint32_t ct = 0; ct < fieldCount; ct ++) {
         delete [] subElemNames[ct];
         subElems[ct]->decUserRef();
@@ -416,10 +414,8 @@
                             RsDataType dt,
                             RsDataKind dk,
                             bool norm,
-                            uint32_t vecSize,
-                            bool fromJava) {
-    const Element* ret = Element::create(rsc, dt, dk, norm, vecSize, fromJava);
-    return (RsElement) ret;
+                            uint32_t vecSize) {
+    return (RsElement)Element::create(rsc, dt, dk, norm, vecSize);
 }
 
 
@@ -432,10 +428,9 @@
                              const size_t * nameLengths,
 
                              const uint32_t * arraySizes,
-                             size_t arraySizes_length,
-                             bool fromJava) {
+                             size_t arraySizes_length) {
     return (RsElement)Element::create(rsc, ein_length, (const Element **)ein,
-                                      names, nameLengths, arraySizes, fromJava);
+                                      names, nameLengths, arraySizes);
 }
 
 }
diff --git a/rsElement.h b/rsElement.h
index 27aeb9c..9374c64 100644
--- a/rsElement.h
+++ b/rsElement.h
@@ -115,28 +115,18 @@
                                  RsDataType dt,
                                  RsDataKind dk,
                                  bool isNorm,
-                                 uint32_t vecSize,
-                                 bool fromJava) {
+                                 uint32_t vecSize) {
         ObjectBaseRef<const Element> elem = createRef(rsc, dt, dk, isNorm, vecSize);
-        if (fromJava) {
-            elem->incUserRef();
-        } else {
-            elem->incSysRef();
-        }
+        elem->incUserRef();
         return elem.get();
     }
     static const Element* create(Context *rsc, size_t count,
                                  const Element **ein,
                                  const char **nin,
                                  const size_t * lengths = nullptr,
-                                 const uint32_t *asin = nullptr,
-                                 bool fromJava = true) {
+                                 const uint32_t *asin = nullptr) {
         ObjectBaseRef<const Element> elem = createRef(rsc, count, ein, nin, lengths, asin);
-        if (fromJava) {
-            elem->incUserRef();
-        } else {
-            elem->incSysRef();
-        }
+        elem->incUserRef();
         return elem.get();
     }
 
diff --git a/rsScriptC_Lib.cpp b/rsScriptC_Lib.cpp
index 26b7333..d07fdef 100644
--- a/rsScriptC_Lib.cpp
+++ b/rsScriptC_Lib.cpp
@@ -273,19 +273,19 @@
 
 RsElement rsrElementCreate(Context *rsc, RsDataType dt, RsDataKind dk,
                            bool norm, uint32_t vecSize) {
-    return rsi_ElementCreate(rsc, dt, dk, norm, vecSize, false);
+    return rsi_ElementCreate(rsc, dt, dk, norm, vecSize);
 }
 
 RsType rsrTypeCreate(Context *rsc, const RsElement element, uint32_t dimX,
                      uint32_t dimY, uint32_t dimZ, bool mipmaps, bool faces,
                      uint32_t yuv) {
-    return rsi_TypeCreate(rsc, element, dimX, dimY, dimZ, mipmaps, faces, yuv, false);
+    return rsi_TypeCreate(rsc, element, dimX, dimY, dimZ, mipmaps, faces, yuv);
 }
 
 RsAllocation rsrAllocationCreateTyped(Context *rsc, const RsType type,
                                       RsAllocationMipmapControl mipmaps,
                                       uint32_t usages, uintptr_t ptr) {
-    return rsi_AllocationCreateTyped(rsc, type, mipmaps, usages, ptr, false);
+    return rsi_AllocationCreateTyped(rsc, type, mipmaps, usages, ptr);
 }
 
 }
diff --git a/rsType.cpp b/rsType.cpp
index bf35bb4..d45de2d 100644
--- a/rsType.cpp
+++ b/rsType.cpp
@@ -198,8 +198,7 @@
     p.dimZ = stream->loadU32();
     p.mipmaps = stream->loadU8();
     p.faces = stream->loadU8();
-    Type *type = Type::getType(rsc, elem, &p, sizeof(p),
-                               true  /*createFromStream is currently only supported in Java API */);
+    Type *type = Type::getType(rsc, elem, &p, sizeof(p));
     elem->decUserRef();
 
     delete [] name;
@@ -363,8 +362,7 @@
 namespace renderscript {
 
 RsType rsi_TypeCreate(Context *rsc, RsElement _e, uint32_t dimX,
-                      uint32_t dimY, uint32_t dimZ, bool mipmaps, bool faces, uint32_t yuv,
-                      bool fromJava) {
+                     uint32_t dimY, uint32_t dimZ, bool mipmaps, bool faces, uint32_t yuv) {
     Element *e = static_cast<Element *>(_e);
 
     RsTypeCreateParams p;
@@ -375,12 +373,12 @@
     p.mipmaps = mipmaps;
     p.faces = faces;
     p.yuv = yuv;
-    return Type::getType(rsc, e, &p, sizeof(p), fromJava);
+    return Type::getType(rsc, e, &p, sizeof(p));
 }
 
-RsType rsi_TypeCreate2(Context *rsc, const RsTypeCreateParams *p, size_t len, bool fromJava) {
+RsType rsi_TypeCreate2(Context *rsc, const RsTypeCreateParams *p, size_t len) {
     Element *e = static_cast<Element *>(p->e);
-    return Type::getType(rsc, e, p, len, fromJava);
+    return Type::getType(rsc, e, p, len);
 }
 
 }
diff --git a/rsType.h b/rsType.h
index 9f53b20..6ae8446 100644
--- a/rsType.h
+++ b/rsType.h
@@ -112,13 +112,9 @@
                                           const RsTypeCreateParams *params, size_t len);
 
     static Type* getType(Context *rsc, const Element *e,
-                         const RsTypeCreateParams *params, size_t len, bool fromJava) {
+                         const RsTypeCreateParams *params, size_t len) {
         ObjectBaseRef<Type> type = getTypeRef(rsc, e, params, len);
-        if (fromJava) {
-            type->incUserRef();
-        } else {
-            type->incSysRef();
-        }
+        type->incUserRef();
         return type.get();
     }