Update includes to begin isolating graphics classes.
GraphicsJNI.h will only be visible to files in the graphics component
and this CL begins to remove all usages of that header that are known
to be outside the graphic component.
Test: compile
Bug: 137655431
Change-Id: If310782e5d95d05ab7cbd54dafa5771d315707a7
diff --git a/core/jni/android/graphics/Bitmap.h b/core/jni/android/graphics/Bitmap.h
index 6934d26..06e31a1 100644
--- a/core/jni/android/graphics/Bitmap.h
+++ b/core/jni/android/graphics/Bitmap.h
@@ -18,8 +18,9 @@
#include <jni.h>
#include <android/bitmap.h>
-#include <SkBitmap.h>
-#include <SkImageInfo.h>
+
+class SkBitmap;
+struct SkImageInfo;
namespace android {
@@ -34,8 +35,8 @@
};
jobject createBitmap(JNIEnv* env, Bitmap* bitmap,
- int bitmapCreateFlags, jbyteArray ninePatchChunk = NULL,
- jobject ninePatchInsets = NULL, int density = -1);
+ int bitmapCreateFlags, jbyteArray ninePatchChunk = nullptr,
+ jobject ninePatchInsets = nullptr, int density = -1);
void toSkBitmap(jlong bitmapHandle, SkBitmap* outBitmap);
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 55abc93..58c5871 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -16,7 +16,6 @@
#include "jni.h"
#include <nativehelper/JNIHelp.h>
-#include "GraphicsJNI.h"
#include <math.h>
#include <stdio.h>
@@ -33,6 +32,7 @@
#include <SkBitmap.h>
#include "core_jni_helpers.h"
+#include "android/graphics/Bitmap.h"
#undef LOG_TAG
#define LOG_TAG "OpenGLUtil"
@@ -43,6 +43,10 @@
namespace android {
+static void doThrowIAE(JNIEnv* env, const char* msg = nullptr) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", msg);
+}
+
static inline
void mx4transform(float x, float y, float z, float w, const float* pM, float* pDest) {
pDest[0] = pM[0 + 4 * 0] * x + pM[0 + 4 * 1] * y + pM[0 + 4 * 2] * z + pM[0 + 4 * 3] * w;
@@ -706,7 +710,7 @@
jlong bitmapPtr)
{
SkBitmap nativeBitmap;
- bitmap::toBitmap(bitmapPtr).getSkBitmap(&nativeBitmap);
+ bitmap::toSkBitmap(bitmapPtr, &nativeBitmap);
return getInternalFormat(nativeBitmap.colorType());
}
@@ -714,7 +718,7 @@
jlong bitmapPtr)
{
SkBitmap nativeBitmap;
- bitmap::toBitmap(bitmapPtr).getSkBitmap(&nativeBitmap);
+ bitmap::toSkBitmap(bitmapPtr, &nativeBitmap);
return getType(nativeBitmap.colorType());
}
@@ -723,7 +727,7 @@
jlong bitmapPtr, jint type, jint border)
{
SkBitmap bitmap;
- bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
+ bitmap::toSkBitmap(bitmapPtr, &bitmap);
SkColorType colorType = bitmap.colorType();
if (internalformat < 0) {
internalformat = getInternalFormat(colorType);
@@ -751,7 +755,7 @@
jlong bitmapPtr, jint format, jint type)
{
SkBitmap bitmap;
- bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
+ bitmap::toSkBitmap(bitmapPtr, &bitmap);
SkColorType colorType = bitmap.colorType();
int internalFormat = getInternalFormat(colorType);
if (format < 0) {
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
index 93f2525..3a08148 100644
--- a/core/jni/android_app_ActivityThread.cpp
+++ b/core/jni/android_app_ActivityThread.cpp
@@ -15,7 +15,6 @@
*/
#include "jni.h"
-#include "GraphicsJNI.h"
#include <nativehelper/JNIHelp.h>
#include <minikin/Layout.h>
diff --git a/core/jni/android_nio_utils.h b/core/jni/android_nio_utils.h
index aa75dd0..4aaa0a7 100644
--- a/core/jni/android_nio_utils.h
+++ b/core/jni/android_nio_utils.h
@@ -17,7 +17,7 @@
#ifndef _ANDROID_NIO_UTILS_H_
#define _ANDROID_NIO_UTILS_H_
-#include <android_runtime/AndroidRuntime.h>
+#include <nativehelper/JNIHelp.h>
namespace android {
@@ -68,12 +68,12 @@
AutoBufferPointer() = delete;
AutoBufferPointer(AutoBufferPointer&) = delete;
AutoBufferPointer& operator=(AutoBufferPointer&) = delete;
- static void* operator new(std::size_t);
- static void* operator new[](std::size_t);
- static void* operator new(std::size_t, void*);
- static void* operator new[](std::size_t, void*);
- static void operator delete(void*, std::size_t);
- static void operator delete[](void*, std::size_t);
+ static void* operator new(size_t);
+ static void* operator new[](size_t);
+ static void* operator new(size_t, void*);
+ static void* operator new[](size_t, void*);
+ static void operator delete(void*, size_t);
+ static void operator delete[](void*, size_t);
};
} /* namespace android */
diff --git a/core/jni/android_view_RenderNodeAnimator.cpp b/core/jni/android_view_RenderNodeAnimator.cpp
index c9eac79..ca32b00 100644
--- a/core/jni/android_view_RenderNodeAnimator.cpp
+++ b/core/jni/android_view_RenderNodeAnimator.cpp
@@ -17,7 +17,6 @@
#define LOG_TAG "OpenGLRenderer"
#include "jni.h"
-#include "GraphicsJNI.h"
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 78dd1aa..a579229 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -21,10 +21,10 @@
#include "android_util_Binder.h"
#include "android_hardware_input_InputWindowHandle.h"
#include "android/graphics/Bitmap.h"
-#include "android/graphics/GraphicsJNI.h"
#include "android/graphics/Region.h"
#include "core_jni_helpers.h"
+#include <android_runtime/AndroidRuntime.h>
#include <android-base/chrono_utils.h>
#include <nativehelper/JNIHelp.h>
#include <nativehelper/ScopedUtfChars.h>
@@ -50,6 +50,14 @@
namespace android {
+static void doThrowNPE(JNIEnv* env) {
+ jniThrowNullPointerException(env, NULL);
+}
+
+static void doThrowIAE(JNIEnv* env, const char* msg = nullptr) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", msg);
+}
+
static const char* const OutOfResourcesException =
"android/view/Surface$OutOfResourcesException";
diff --git a/core/jni/com_android_internal_util_VirtualRefBasePtr.cpp b/core/jni/com_android_internal_util_VirtualRefBasePtr.cpp
index d20bae2..d629d63 100644
--- a/core/jni/com_android_internal_util_VirtualRefBasePtr.cpp
+++ b/core/jni/com_android_internal_util_VirtualRefBasePtr.cpp
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#include "jni.h"
#include <nativehelper/JNIHelp.h>
+#include <utils/LightRefBase.h>
#include "core_jni_helpers.h"
namespace android {
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 940ac22..5aea848 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -30,10 +30,6 @@
#include <gui/GLConsumer.h>
#include <gui/Surface.h>
-#include <GraphicsJNI.h>
-#include <SkBitmap.h>
-#include <SkPixelRef.h>
-
#include <ui/ANativeObjectBase.h>
namespace android {
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index 7269bca..16ec877 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -29,7 +29,6 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRect.h"
-#include "SkTDArray.h"
#include "SkTemplates.h"
#include <vector>
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index e50428b..40fbdff 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -16,6 +16,8 @@
#include "RenderProxy.h"
+#include <gui/Surface.h>
+
#include "DeferredLayerUpdater.h"
#include "DisplayList.h"
#include "Properties.h"
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index a0f08cb..c3eb6ed 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -19,7 +19,6 @@
#include <SkBitmap.h>
#include <cutils/compiler.h>
-#include <gui/Surface.h>
#include <utils/Functor.h>
#include "../FrameMetricsObserver.h"
@@ -30,6 +29,7 @@
namespace android {
class GraphicBuffer;
+class Surface;
namespace uirenderer {
diff --git a/libs/hwui/renderthread/VulkanSurface.h b/libs/hwui/renderthread/VulkanSurface.h
index 5fa860a..5717bb3 100644
--- a/libs/hwui/renderthread/VulkanSurface.h
+++ b/libs/hwui/renderthread/VulkanSurface.h
@@ -17,6 +17,7 @@
#include <system/graphics.h>
#include <system/window.h>
+#include <ui/BufferQueueDefs.h>
#include <vulkan/vulkan.h>
#include <SkRefCnt.h>