diff options
Diffstat (limited to 'core')
37 files changed, 428 insertions, 495 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index e6cd8ed..adeffad 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -11,249 +11,249 @@ LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses LOCAL_CPPFLAGS += -Wno-conversion-null ifeq ($(TARGET_ARCH), arm) - LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))" + LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))" else - LOCAL_CFLAGS += -DPACKED="" + LOCAL_CFLAGS += -DPACKED="" endif ifeq ($(USE_OPENGL_RENDERER),true) - LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER + LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER endif LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_SRC_FILES:= \ - AndroidRuntime.cpp \ - com_android_internal_content_NativeLibraryHelper.cpp \ - com_google_android_gles_jni_EGLImpl.cpp \ - com_google_android_gles_jni_GLImpl.cpp.arm \ - android_app_NativeActivity.cpp \ - android_opengl_EGL14.cpp \ - android_opengl_EGLExt.cpp \ - android_opengl_GLES10.cpp \ - android_opengl_GLES10Ext.cpp \ - android_opengl_GLES11.cpp \ - android_opengl_GLES11Ext.cpp \ - android_opengl_GLES20.cpp \ - android_opengl_GLES30.cpp \ - android_opengl_GLES31.cpp \ - android_opengl_GLES31Ext.cpp \ - android_database_CursorWindow.cpp \ - android_database_SQLiteCommon.cpp \ - android_database_SQLiteConnection.cpp \ - android_database_SQLiteGlobal.cpp \ - android_database_SQLiteDebug.cpp \ - android_emoji_EmojiFactory.cpp \ - android_view_DisplayEventReceiver.cpp \ - android_view_Surface.cpp \ - android_view_SurfaceControl.cpp \ - android_view_SurfaceSession.cpp \ - android_view_TextureView.cpp \ - android_view_InputChannel.cpp \ - android_view_InputDevice.cpp \ - android_view_InputEventReceiver.cpp \ - android_view_InputEventSender.cpp \ - android_view_InputQueue.cpp \ - android_view_KeyEvent.cpp \ - android_view_KeyCharacterMap.cpp \ - android_view_GraphicBuffer.cpp \ - android_view_GLES20Canvas.cpp \ - android_view_HardwareLayer.cpp \ - android_view_ThreadedRenderer.cpp \ - android_view_MotionEvent.cpp \ - android_view_PointerIcon.cpp \ - android_view_RenderNode.cpp \ - android_view_RenderNodeAnimator.cpp \ - android_view_VelocityTracker.cpp \ - android_text_AndroidCharacter.cpp \ - android_text_AndroidBidi.cpp \ - android_text_StaticLayout.cpp \ - android_os_Debug.cpp \ - android_os_MemoryFile.cpp \ - android_os_MessageQueue.cpp \ - android_os_Parcel.cpp \ - android_os_SELinux.cpp \ - android_os_SystemClock.cpp \ - android_os_SystemProperties.cpp \ - android_os_Trace.cpp \ - android_os_UEventObserver.cpp \ - android_net_LocalSocketImpl.cpp \ - android_net_NetUtils.cpp \ - android_net_TrafficStats.cpp \ - android_nio_utils.cpp \ - android_util_AssetManager.cpp \ - android_util_Binder.cpp \ - android_util_EventLog.cpp \ - android_util_Log.cpp \ - android_util_Process.cpp \ - android_util_StringBlock.cpp \ - android_util_XmlBlock.cpp \ - android_graphics_Canvas.cpp \ - android_graphics_Picture.cpp \ - android/graphics/AutoDecodeCancel.cpp \ - android/graphics/Bitmap.cpp \ - android/graphics/BitmapFactory.cpp \ - android/graphics/Camera.cpp \ - android/graphics/CanvasProperty.cpp \ - android/graphics/ColorFilter.cpp \ - android/graphics/DrawFilter.cpp \ - android/graphics/FontFamily.cpp \ - android/graphics/CreateJavaOutputStreamAdaptor.cpp \ - android/graphics/Graphics.cpp \ - android/graphics/HarfBuzzNGFaceSkia.cpp \ - android/graphics/Interpolator.cpp \ - android/graphics/MaskFilter.cpp \ - android/graphics/Matrix.cpp \ - android/graphics/MinikinSkia.cpp \ - android/graphics/MinikinUtils.cpp \ - android/graphics/Movie.cpp \ - android/graphics/NinePatch.cpp \ - android/graphics/NinePatchImpl.cpp \ - android/graphics/NinePatchPeeker.cpp \ - android/graphics/Paint.cpp \ - android/graphics/PaintImpl.cpp \ - android/graphics/Path.cpp \ - android/graphics/PathMeasure.cpp \ - android/graphics/PathEffect.cpp \ - android/graphics/Picture.cpp \ - android/graphics/PorterDuff.cpp \ - android/graphics/BitmapRegionDecoder.cpp \ - android/graphics/Rasterizer.cpp \ - android/graphics/Region.cpp \ - android/graphics/Shader.cpp \ - android/graphics/SkiaCanvas.cpp \ - android/graphics/SurfaceTexture.cpp \ - android/graphics/Typeface.cpp \ - android/graphics/TypefaceImpl.cpp \ - android/graphics/Utils.cpp \ - android/graphics/Xfermode.cpp \ - android/graphics/YuvToJpegEncoder.cpp \ - android/graphics/pdf/PdfDocument.cpp \ - android/graphics/pdf/PdfEditor.cpp \ - android/graphics/pdf/PdfRenderer.cpp \ - android_media_AudioRecord.cpp \ - android_media_AudioSystem.cpp \ - android_media_AudioTrack.cpp \ - android_media_JetPlayer.cpp \ - android_media_RemoteDisplay.cpp \ - android_media_ToneGenerator.cpp \ - android_hardware_Camera.cpp \ - android_hardware_camera2_CameraMetadata.cpp \ - android_hardware_camera2_legacy_LegacyCameraDevice.cpp \ - android_hardware_camera2_legacy_PerfMeasurement.cpp \ - android_hardware_camera2_DngCreator.cpp \ - android_hardware_SensorManager.cpp \ - android_hardware_SerialPort.cpp \ - android_hardware_SoundTrigger.cpp \ - android_hardware_UsbDevice.cpp \ - android_hardware_UsbDeviceConnection.cpp \ - android_hardware_UsbRequest.cpp \ - android_hardware_location_ActivityRecognitionHardware.cpp \ - android_util_FileObserver.cpp \ - android/opengl/poly_clip.cpp.arm \ - android/opengl/util.cpp.arm \ - android_server_FingerprintManager.cpp \ - android_server_NetworkManagementSocketTagger.cpp \ - android_server_Watchdog.cpp \ - android_ddm_DdmHandleNativeHeap.cpp \ - com_android_internal_os_ZygoteInit.cpp \ - android_backup_BackupDataInput.cpp \ - android_backup_BackupDataOutput.cpp \ - android_backup_FileBackupHelperBase.cpp \ - android_backup_BackupHelperDispatcher.cpp \ - android_app_backup_FullBackup.cpp \ - android_content_res_ObbScanner.cpp \ - android_content_res_Configuration.cpp \ - android_animation_PropertyValuesHolder.cpp \ - com_android_internal_net_NetworkStatsFactory.cpp \ - com_android_internal_os_Zygote.cpp \ - com_android_internal_util_VirtualRefBasePtr.cpp \ - com_android_internal_view_animation_NativeInterpolatorFactoryHelper.cpp + AndroidRuntime.cpp \ + com_android_internal_content_NativeLibraryHelper.cpp \ + com_google_android_gles_jni_EGLImpl.cpp \ + com_google_android_gles_jni_GLImpl.cpp.arm \ + android_app_NativeActivity.cpp \ + android_opengl_EGL14.cpp \ + android_opengl_EGLExt.cpp \ + android_opengl_GLES10.cpp \ + android_opengl_GLES10Ext.cpp \ + android_opengl_GLES11.cpp \ + android_opengl_GLES11Ext.cpp \ + android_opengl_GLES20.cpp \ + android_opengl_GLES30.cpp \ + android_opengl_GLES31.cpp \ + android_opengl_GLES31Ext.cpp \ + android_database_CursorWindow.cpp \ + android_database_SQLiteCommon.cpp \ + android_database_SQLiteConnection.cpp \ + android_database_SQLiteGlobal.cpp \ + android_database_SQLiteDebug.cpp \ + android_emoji_EmojiFactory.cpp \ + android_view_DisplayEventReceiver.cpp \ + android_view_Surface.cpp \ + android_view_SurfaceControl.cpp \ + android_view_SurfaceSession.cpp \ + android_view_TextureView.cpp \ + android_view_InputChannel.cpp \ + android_view_InputDevice.cpp \ + android_view_InputEventReceiver.cpp \ + android_view_InputEventSender.cpp \ + android_view_InputQueue.cpp \ + android_view_KeyEvent.cpp \ + android_view_KeyCharacterMap.cpp \ + android_view_GraphicBuffer.cpp \ + android_view_GLES20Canvas.cpp \ + android_view_HardwareLayer.cpp \ + android_view_ThreadedRenderer.cpp \ + android_view_MotionEvent.cpp \ + android_view_PointerIcon.cpp \ + android_view_RenderNode.cpp \ + android_view_RenderNodeAnimator.cpp \ + android_view_VelocityTracker.cpp \ + android_text_AndroidCharacter.cpp \ + android_text_AndroidBidi.cpp \ + android_text_StaticLayout.cpp \ + android_os_Debug.cpp \ + android_os_MemoryFile.cpp \ + android_os_MessageQueue.cpp \ + android_os_Parcel.cpp \ + android_os_SELinux.cpp \ + android_os_SystemClock.cpp \ + android_os_SystemProperties.cpp \ + android_os_Trace.cpp \ + android_os_UEventObserver.cpp \ + android_net_LocalSocketImpl.cpp \ + android_net_NetUtils.cpp \ + android_net_TrafficStats.cpp \ + android_nio_utils.cpp \ + android_util_AssetManager.cpp \ + android_util_Binder.cpp \ + android_util_EventLog.cpp \ + android_util_Log.cpp \ + android_util_Process.cpp \ + android_util_StringBlock.cpp \ + android_util_XmlBlock.cpp \ + android_graphics_Canvas.cpp \ + android_graphics_Picture.cpp \ + android/graphics/AutoDecodeCancel.cpp \ + android/graphics/Bitmap.cpp \ + android/graphics/BitmapFactory.cpp \ + android/graphics/Camera.cpp \ + android/graphics/CanvasProperty.cpp \ + android/graphics/ColorFilter.cpp \ + android/graphics/DrawFilter.cpp \ + android/graphics/FontFamily.cpp \ + android/graphics/CreateJavaOutputStreamAdaptor.cpp \ + android/graphics/Graphics.cpp \ + android/graphics/HarfBuzzNGFaceSkia.cpp \ + android/graphics/Interpolator.cpp \ + android/graphics/MaskFilter.cpp \ + android/graphics/Matrix.cpp \ + android/graphics/MinikinSkia.cpp \ + android/graphics/MinikinUtils.cpp \ + android/graphics/Movie.cpp \ + android/graphics/NinePatch.cpp \ + android/graphics/NinePatchImpl.cpp \ + android/graphics/NinePatchPeeker.cpp \ + android/graphics/Paint.cpp \ + android/graphics/PaintImpl.cpp \ + android/graphics/Path.cpp \ + android/graphics/PathMeasure.cpp \ + android/graphics/PathEffect.cpp \ + android/graphics/Picture.cpp \ + android/graphics/PorterDuff.cpp \ + android/graphics/BitmapRegionDecoder.cpp \ + android/graphics/Rasterizer.cpp \ + android/graphics/Region.cpp \ + android/graphics/Shader.cpp \ + android/graphics/SkiaCanvas.cpp \ + android/graphics/SurfaceTexture.cpp \ + android/graphics/Typeface.cpp \ + android/graphics/TypefaceImpl.cpp \ + android/graphics/Utils.cpp \ + android/graphics/Xfermode.cpp \ + android/graphics/YuvToJpegEncoder.cpp \ + android/graphics/pdf/PdfDocument.cpp \ + android/graphics/pdf/PdfEditor.cpp \ + android/graphics/pdf/PdfRenderer.cpp \ + android_media_AudioRecord.cpp \ + android_media_AudioSystem.cpp \ + android_media_AudioTrack.cpp \ + android_media_JetPlayer.cpp \ + android_media_RemoteDisplay.cpp \ + android_media_ToneGenerator.cpp \ + android_hardware_Camera.cpp \ + android_hardware_camera2_CameraMetadata.cpp \ + android_hardware_camera2_legacy_LegacyCameraDevice.cpp \ + android_hardware_camera2_legacy_PerfMeasurement.cpp \ + android_hardware_camera2_DngCreator.cpp \ + android_hardware_SensorManager.cpp \ + android_hardware_SerialPort.cpp \ + android_hardware_SoundTrigger.cpp \ + android_hardware_UsbDevice.cpp \ + android_hardware_UsbDeviceConnection.cpp \ + android_hardware_UsbRequest.cpp \ + android_hardware_location_ActivityRecognitionHardware.cpp \ + android_util_FileObserver.cpp \ + android/opengl/poly_clip.cpp.arm \ + android/opengl/util.cpp.arm \ + android_server_FingerprintManager.cpp \ + android_server_NetworkManagementSocketTagger.cpp \ + android_server_Watchdog.cpp \ + android_ddm_DdmHandleNativeHeap.cpp \ + com_android_internal_os_ZygoteInit.cpp \ + android_backup_BackupDataInput.cpp \ + android_backup_BackupDataOutput.cpp \ + android_backup_FileBackupHelperBase.cpp \ + android_backup_BackupHelperDispatcher.cpp \ + android_app_backup_FullBackup.cpp \ + android_content_res_ObbScanner.cpp \ + android_content_res_Configuration.cpp \ + android_animation_PropertyValuesHolder.cpp \ + com_android_internal_net_NetworkStatsFactory.cpp \ + com_android_internal_os_Zygote.cpp \ + com_android_internal_util_VirtualRefBasePtr.cpp \ + com_android_internal_view_animation_NativeInterpolatorFactoryHelper.cpp LOCAL_C_INCLUDES += \ - $(JNI_H_INCLUDE) \ - $(LOCAL_PATH)/android/graphics \ - $(LOCAL_PATH)/../../libs/hwui \ - $(LOCAL_PATH)/../../../native/opengl/libs \ - $(call include-path-for, bluedroid) \ - $(call include-path-for, libhardware)/hardware \ - $(call include-path-for, libhardware_legacy)/hardware_legacy \ - $(TOP)/bionic/libc/dns/include \ - $(TOP)/frameworks/av/include \ - $(TOP)/system/media/camera/include \ - $(TOP)/system/netd/include \ - external/icu/icu4c/source/common \ - external/pdfium/core/include/fpdfapi \ - external/pdfium/core/include/fpdfdoc \ - external/pdfium/fpdfsdk/include \ - external/skia/src/core \ - external/skia/src/effects \ - external/skia/src/images \ - external/sqlite/dist \ - external/sqlite/android \ - external/expat/lib \ - external/openssl/include \ - external/tremor/Tremor \ - external/jpeg \ - external/harfbuzz_ng/src \ - external/zlib \ - frameworks/opt/emoji \ - libcore/include \ - $(call include-path-for, audio-utils) \ - frameworks/minikin/include \ - external/freetype/include + $(JNI_H_INCLUDE) \ + $(LOCAL_PATH)/android/graphics \ + $(LOCAL_PATH)/../../libs/hwui \ + $(LOCAL_PATH)/../../../native/opengl/libs \ + $(call include-path-for, bluedroid) \ + $(call include-path-for, libhardware)/hardware \ + $(call include-path-for, libhardware_legacy)/hardware_legacy \ + $(TOP)/bionic/libc/dns/include \ + $(TOP)/frameworks/av/include \ + $(TOP)/system/media/camera/include \ + $(TOP)/system/netd/include \ + external/icu/icu4c/source/common \ + external/pdfium/core/include/fpdfapi \ + external/pdfium/core/include/fpdfdoc \ + external/pdfium/fpdfsdk/include \ + external/skia/src/core \ + external/skia/src/effects \ + external/skia/src/images \ + external/sqlite/dist \ + external/sqlite/android \ + external/expat/lib \ + external/openssl/include \ + external/tremor/Tremor \ + external/jpeg \ + external/harfbuzz_ng/src \ + external/zlib \ + frameworks/opt/emoji \ + libcore/include \ + $(call include-path-for, audio-utils) \ + frameworks/minikin/include \ + external/freetype/include # TODO: clean up Minikin so it doesn't need the freetype include LOCAL_SHARED_LIBRARIES := \ - libmemtrack \ - libandroidfw \ - libexpat \ - libnativehelper \ - liblog \ - libcutils \ - libutils \ - libbinder \ - libnetutils \ - libui \ - libgui \ - libinput \ - libinputflinger \ - libcamera_client \ - libcamera_metadata \ - libskia \ - libsqlite \ - libEGL \ - libGLESv1_CM \ - libGLESv2 \ - libETC1 \ - libhardware \ - libhardware_legacy \ - libselinux \ - libsonivox \ - libcrypto \ - libssl \ - libicuuc \ - libicui18n \ - libmedia \ - libjpeg \ - libusbhost \ - libharfbuzz_ng \ - libz \ - libaudioutils \ - libpdfium \ - libimg_utils \ - libnetd_client \ - libsoundtrigger \ - libminikin \ - libprocessgroup \ - libnativebridge \ + libmemtrack \ + libandroidfw \ + libexpat \ + libnativehelper \ + liblog \ + libcutils \ + libutils \ + libbinder \ + libnetutils \ + libui \ + libgui \ + libinput \ + libinputflinger \ + libcamera_client \ + libcamera_metadata \ + libskia \ + libsqlite \ + libEGL \ + libGLESv1_CM \ + libGLESv2 \ + libETC1 \ + libhardware \ + libhardware_legacy \ + libselinux \ + libsonivox \ + libcrypto \ + libssl \ + libicuuc \ + libicui18n \ + libmedia \ + libjpeg \ + libusbhost \ + libharfbuzz_ng \ + libz \ + libaudioutils \ + libpdfium \ + libimg_utils \ + libnetd_client \ + libsoundtrigger \ + libminikin \ + libprocessgroup \ + libnativebridge ifeq ($(USE_OPENGL_RENDERER),true) - LOCAL_SHARED_LIBRARIES += libhwui + LOCAL_SHARED_LIBRARIES += libhwui endif LOCAL_SHARED_LIBRARIES += \ - libdl + libdl # we need to access the private Bionic header # <bionic_tls.h> in com_google_android_gles_jni_GLImpl.cpp @@ -261,6 +261,8 @@ LOCAL_C_INCLUDES += bionic/libc/private LOCAL_MODULE:= libandroid_runtime +LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code + include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 7dd5c57..73ea54d 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -191,12 +191,6 @@ extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env); static AndroidRuntime* gCurRuntime = NULL; -static void doThrow(JNIEnv* env, const char* exc, const char* msg = NULL) -{ - if (jniThrowException(env, exc, msg) != 0) - assert(false); -} - /* * Code written in the Java Programming Language calls here from main(). */ @@ -1214,13 +1208,6 @@ static int register_jni_procs(const RegJNIRec array[], size_t count, JNIEnv* env return 0; } -static void register_jam_procs(const RegJAMProc array[], size_t count) -{ - for (size_t i = 0; i < count; i++) { - array[i](); - } -} - static const RegJNIRec gRegJNI[] = { REG_JNI(register_com_android_internal_os_RuntimeInit), REG_JNI(register_android_os_SystemClock), diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp index a67740c..7937941 100644 --- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp +++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp @@ -24,7 +24,6 @@ public: } virtual size_t read(void* buffer, size_t size) { - JNIEnv* env = fEnv; if (NULL == buffer) { if (0 == size) { return 0; diff --git a/core/jni/android/graphics/MinikinUtils.cpp b/core/jni/android/graphics/MinikinUtils.cpp index f64ad7d..7dabf6b 100644 --- a/core/jni/android/graphics/MinikinUtils.cpp +++ b/core/jni/android/graphics/MinikinUtils.cpp @@ -26,18 +26,6 @@ namespace android { -// Do an sprintf starting at offset n, abort on overflow -static int snprintfcat(char* buf, int off, int size, const char* format, ...) - __attribute__((__format__(__printf__, 4, 5))); -static int snprintfcat(char* buf, int off, int size, const char* format, ...) { - va_list args; - va_start(args, format); - int n = vsnprintf(buf + off, size - off, format, args); - LOG_ALWAYS_FATAL_IF(n >= size - off, "String overflow in setting layout properties"); - va_end(args); - return off + n; -} - void MinikinUtils::doLayout(Layout* layout, const Paint* paint, int bidiFlags, TypefaceImpl* typeface, const uint16_t* buf, size_t start, size_t count, size_t bufSize) { TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface); diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp index 6146fff..70a2fe5 100644 --- a/core/jni/android/graphics/Shader.cpp +++ b/core/jni/android/graphics/Shader.cpp @@ -13,11 +13,6 @@ using namespace android::uirenderer; -static struct { - jclass clazz; - jfieldID shader; -} gShaderClassInfo; - static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) { if (NULL == ptr) { doThrowIAE(env); diff --git a/core/jni/android/graphics/pdf/PdfRenderer.cpp b/core/jni/android/graphics/pdf/PdfRenderer.cpp index 357d3c0..2080f16 100644 --- a/core/jni/android/graphics/pdf/PdfRenderer.cpp +++ b/core/jni/android/graphics/pdf/PdfRenderer.cpp @@ -20,7 +20,11 @@ #include "SkBitmap.h" #include "SkMatrix.h" #include "fpdfview.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor" #include "fsdk_rendercontext.h" +#pragma GCC diagnostic pop #include <android_runtime/AndroidRuntime.h> #include <vector> @@ -237,7 +241,6 @@ static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong jlong bitmapPtr, jint destLeft, jint destTop, jint destRight, jint destBottom, jlong matrixPtr, jint renderMode) { - FPDF_DOCUMENT document = reinterpret_cast<FPDF_DOCUMENT>(documentPtr); FPDF_PAGE page = reinterpret_cast<FPDF_PAGE>(pagePtr); SkBitmap* skBitmap = reinterpret_cast<SkBitmap*>(bitmapPtr); SkMatrix* skMatrix = reinterpret_cast<SkMatrix*>(matrixPtr); diff --git a/core/jni/android/opengl/poly_clip.cpp b/core/jni/android/opengl/poly_clip.cpp index 04e4b17..5c65220 100644 --- a/core/jni/android/opengl/poly_clip.cpp +++ b/core/jni/android/opengl/poly_clip.cpp @@ -58,7 +58,6 @@ namespace android { void poly_clip_to_halfspace(Poly* p, Poly* q, int index, float sign, float k) { - unsigned long m; float *up, *vp, *wp; Poly_vert *v; int i; diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp index 89baef8..e0ca951 100644 --- a/core/jni/android/opengl/util.cpp +++ b/core/jni/android/opengl/util.cpp @@ -759,8 +759,6 @@ getPointer(JNIEnv *_env, jobject buffer, jint *remaining) jint limit; jint elementSizeShift; jlong pointer; - jint offset; - void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -900,10 +898,8 @@ static void etc1_encodeImage(JNIEnv *env, jclass clazz, } else if (outB.remaining() < encodedImageSize) { doThrowIAE(env, "out's remaining data < encoded image size"); } else { - int result = etc1_encode_image((etc1_byte*) inB.getData(), - width, height, pixelSize, - stride, - (etc1_byte*) outB.getData()); + etc1_encode_image((etc1_byte*) inB.getData(), width, height, pixelSize, stride, + (etc1_byte*) outB.getData()); } } } @@ -933,10 +929,8 @@ static void etc1_decodeImage(JNIEnv *env, jclass clazz, } else if (outB.remaining() < imageSize) { doThrowIAE(env, "out's remaining data < image size"); } else { - int result = etc1_decode_image((etc1_byte*) inB.getData(), - (etc1_byte*) outB.getData(), - width, height, pixelSize, - stride); + etc1_decode_image((etc1_byte*) inB.getData(), (etc1_byte*) outB.getData(), + width, height, pixelSize, stride); } } } diff --git a/core/jni/android_app_backup_FullBackup.cpp b/core/jni/android_app_backup_FullBackup.cpp index 3cfaa82..5e334c9 100644 --- a/core/jni/android_app_backup_FullBackup.cpp +++ b/core/jni/android_app_backup_FullBackup.cpp @@ -73,8 +73,6 @@ static struct { static jint backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj, jstring domainObj, jstring linkdomain, jstring rootpathObj, jstring pathObj, jobject dataOutputObj) { - int ret; - // Extract the various strings, allowing for null object pointers const char* packagenamechars = (packageNameObj) ? env->GetStringUTFChars(packageNameObj, NULL) : NULL; const char* rootchars = (rootpathObj) ? env->GetStringUTFChars(rootpathObj, NULL) : NULL; diff --git a/core/jni/android_backup_BackupDataOutput.cpp b/core/jni/android_backup_BackupDataOutput.cpp index 8244e1b..81f9ff4 100644 --- a/core/jni/android_backup_BackupDataOutput.cpp +++ b/core/jni/android_backup_BackupDataOutput.cpp @@ -85,7 +85,6 @@ writeEntityData_native(JNIEnv* env, jobject clazz, jlong w, jbyteArray data, jin static void setKeyPrefix_native(JNIEnv* env, jobject clazz, jlong w, jstring keyPrefixObj) { - int err; BackupDataWriter* writer = (BackupDataWriter*)w; const char* keyPrefixUTF = env->GetStringUTFChars(keyPrefixObj, NULL); diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp index ae56432..4378d1c 100644 --- a/core/jni/android_database_SQLiteConnection.cpp +++ b/core/jni/android_database_SQLiteConnection.cpp @@ -325,7 +325,6 @@ static void nativeFinalizeStatement(JNIEnv* env, jclass clazz, jlong connectionP static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jlong connectionPtr, jlong statementPtr) { - SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_bind_parameter_count(statement); @@ -333,7 +332,6 @@ static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jlong connectionP static jboolean nativeIsReadOnly(JNIEnv* env, jclass clazz, jlong connectionPtr, jlong statementPtr) { - SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_stmt_readonly(statement) != 0; @@ -341,7 +339,6 @@ static jboolean nativeIsReadOnly(JNIEnv* env, jclass clazz, jlong connectionPtr, static jint nativeGetColumnCount(JNIEnv* env, jclass clazz, jlong connectionPtr, jlong statementPtr) { - SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_column_count(statement); @@ -349,7 +346,6 @@ static jint nativeGetColumnCount(JNIEnv* env, jclass clazz, jlong connectionPtr, static jstring nativeGetColumnName(JNIEnv* env, jclass clazz, jlong connectionPtr, jlong statementPtr, jint index) { - SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); const jchar* name = static_cast<const jchar*>(sqlite3_column_name16(statement, index)); diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp index f127d29..655b400 100644 --- a/core/jni/android_emoji_EmojiFactory.cpp +++ b/core/jni/android_emoji_EmojiFactory.cpp @@ -265,14 +265,6 @@ static jclass make_globalref(JNIEnv* env, const char classname[]) return (jclass)env->NewGlobalRef(c); } -static jfieldID getFieldIDCheck(JNIEnv* env, jclass clazz, - const char fieldname[], const char type[]) -{ - jfieldID id = env->GetFieldID(clazz, fieldname, type); - SkASSERT(id); - return id; -} - int register_android_emoji_EmojiFactory(JNIEnv* env) { gEmojiFactory_class = make_globalref(env, "android/emoji/EmojiFactory"); gEmojiFactory_constructorMethodID = env->GetMethodID( diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp index 96607d2..507c165 100644 --- a/core/jni/android_graphics_Canvas.cpp +++ b/core/jni/android_graphics_Canvas.cpp @@ -556,42 +556,6 @@ static void drawTextRunString(JNIEnv* env, jobject obj, jlong canvasHandle, jstr env->ReleaseStringChars(text, jchars); } -static void drawPosTextChars(JNIEnv* env, jobject, jlong canvasHandle, jcharArray text, - jint index, jint count, jfloatArray pos, jlong paintHandle) { - Paint* paint = reinterpret_cast<Paint*>(paintHandle); - jchar* jchars = text ? env->GetCharArrayElements(text, NULL) : NULL; - float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL; - int posCount = pos ? env->GetArrayLength(pos) >> 1: 0; - - get_canvas(canvasHandle)->drawPosText(jchars + index, posArray, count << 1, posCount, *paint); - - if (text) { - env->ReleaseCharArrayElements(text, jchars, 0); - } - if (pos) { - env->ReleaseFloatArrayElements(pos, posArray, 0); - } -} - - -static void drawPosTextString(JNIEnv* env, jobject, jlong canvasHandle, jstring text, - jfloatArray pos, jlong paintHandle) { - Paint* paint = reinterpret_cast<Paint*>(paintHandle); - const jchar* jchars = text ? env->GetStringChars(text, NULL) : NULL; - int byteLength = text ? env->GetStringLength(text) : 0; - float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL; - int posCount = pos ? env->GetArrayLength(pos) >> 1: 0; - - get_canvas(canvasHandle)->drawPosText(jchars , posArray, byteLength << 1, posCount, *paint); - - if (text) { - env->ReleaseStringChars(text, jchars); - } - if (pos) { - env->ReleaseFloatArrayElements(pos, posArray, 0); - } -} - class DrawTextOnPathFunctor { public: DrawTextOnPathFunctor(const Layout& layout, Canvas* canvas, float hOffset, diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp index 7935329..a6a03e5 100644 --- a/core/jni/android_hardware_camera2_CameraMetadata.cpp +++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp @@ -315,7 +315,6 @@ static void CameraMetadata_writeValues(JNIEnv *env, jobject thiz, jint tag, jbyt "Tag (%d) did not have a type", tag); return; } - size_t tagSize = Helpers::getTypeSize(tagType); status_t res; @@ -617,7 +616,7 @@ static void CameraMetadata_classInit(JNIEnv *env, jobject thiz) { if (find_fields(env, fields_to_find, NELEM(fields_to_find)) < 0) return; - jclass clazz = env->FindClass(CAMERA_METADATA_CLASS_NAME); + env->FindClass(CAMERA_METADATA_CLASS_NAME); } static jint CameraMetadata_getTagFromKey(JNIEnv *env, jobject thiz, jstring keyName) { diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp index 533313a..cd60f42 100644 --- a/core/jni/android_hardware_camera2_DngCreator.cpp +++ b/core/jni/android_hardware_camera2_DngCreator.cpp @@ -427,7 +427,6 @@ InputStripSource::InputStripSource(JNIEnv* env, Input& input, uint32_t ifd, uint InputStripSource::~InputStripSource() {} status_t InputStripSource::writeToStream(Output& stream, uint32_t count) { - status_t err = OK; uint32_t fullSize = mWidth * mHeight * mBytesPerSample * mSamplesPerPixel; jlong offset = mOffset; @@ -853,7 +852,6 @@ static void DngCreator_init(JNIEnv* env, jobject thiz, jobject characteristicsPt const uint32_t samplesPerPixel = 1; const uint32_t bitsPerSample = BITS_PER_SAMPLE; - const uint32_t bitsPerByte = BITS_PER_SAMPLE / BYTES_PER_SAMPLE; uint32_t imageWidth = 0; uint32_t imageHeight = 0; @@ -1637,7 +1635,7 @@ static void DngCreator_nativeSetThumbnail(JNIEnv* env, jobject thiz, jobject buf size_t fullSize = width * height * BYTES_PER_RGB_PIXEL; jlong capacity = env->GetDirectBufferCapacity(buffer); - if (capacity != fullSize) { + if (static_cast<uint64_t>(capacity) != static_cast<uint64_t>(fullSize)) { jniThrowExceptionFmt(env, "java/lang/AssertionError", "Invalid size %d for thumbnail, expected size was %d", capacity, fullSize); diff --git a/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp b/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp index b8fa04c..470c5ba 100644 --- a/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp +++ b/core/jni/android_hardware_location_ActivityRecognitionHardware.cpp @@ -123,7 +123,7 @@ static void activity_callback( detach_thread(); } -activity_recognition_callback_procs_t sCallbacks { +activity_recognition_callback_procs_t sCallbacks = { activity_callback, }; diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index 4b4b367..638b903 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -1064,7 +1064,7 @@ exit: return jStatus; } -static int +static jint android_media_AudioSystem_releaseAudioPatch(JNIEnv *env, jobject clazz, jobject jPatch) { @@ -1086,7 +1086,7 @@ android_media_AudioSystem_releaseAudioPatch(JNIEnv *env, jobject clazz, status_t status = AudioSystem::releaseAudioPatch(handle); ALOGV("AudioSystem::releaseAudioPatch() returned %d", status); jint jStatus = nativeToJavaStatus(status); - return status; + return jStatus; } static jint diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp index a408a96..97abe6b 100644 --- a/core/jni/android_net_LocalSocketImpl.cpp +++ b/core/jni/android_net_LocalSocketImpl.cpp @@ -39,6 +39,9 @@ namespace android { +template <typename T> +void UNUSED(T t) {} + static jfieldID field_inboundFileDescriptors; static jfieldID field_outboundFileDescriptors; static jclass class_Credentials; @@ -492,7 +495,6 @@ static ssize_t socket_read_all(JNIEnv *env, jobject thisJ, int fd, void *buffer, size_t len) { ssize_t ret; - ssize_t bytesread = 0; struct msghdr msg; struct iovec iv; unsigned char *buf = (unsigned char *)buffer; @@ -722,7 +724,7 @@ static void socket_write (JNIEnv *env, jobject object, } err = socket_write_all(env, object, fd, &b, 1); - + UNUSED(err); // A return of -1 above means an exception is pending } @@ -758,7 +760,7 @@ static void socket_writeba (JNIEnv *env, jobject object, err = socket_write_all(env, object, fd, byteBuffer + off, len); - + UNUSED(err); // A return of -1 above means an exception is pending env->ReleaseByteArrayElements(buffer, byteBuffer, JNI_ABORT); diff --git a/core/jni/android_nio_utils.cpp b/core/jni/android_nio_utils.cpp index 59d6e41..64597cc 100644 --- a/core/jni/android_nio_utils.cpp +++ b/core/jni/android_nio_utils.cpp @@ -86,13 +86,6 @@ static jmethodID findStaticMethod(JNIEnv* env, jclass c, const char method[], return m; } -static jfieldID getFieldID(JNIEnv* env, jclass c, const char name[], - const char type[]) { - jfieldID f = env->GetFieldID(c, name, type); - LOG_FATAL_IF(!f, "Unable to find field %s", name); - return f; -} - namespace android { int register_android_nio_utils(JNIEnv* env) { diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 178bab6..1b57048 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -224,13 +224,12 @@ static void read_mapinfo(FILE *fp, stats_t* stats) int len, nameLen; bool skip, done = false; - unsigned size = 0, resident = 0, pss = 0, swappable_pss = 0; + unsigned pss = 0, swappable_pss = 0; float sharing_proportion = 0.0; unsigned shared_clean = 0, shared_dirty = 0; unsigned private_clean = 0, private_dirty = 0; unsigned swapped_out = 0; bool is_swappable = false; - unsigned referenced = 0; unsigned temp; uint64_t start; @@ -352,9 +351,9 @@ static void read_mapinfo(FILE *fp, stats_t* stats) } if (line[0] == 'S' && sscanf(line, "Size: %d kB", &temp) == 1) { - size = temp; + /* size = temp; */ } else if (line[0] == 'R' && sscanf(line, "Rss: %d kB", &temp) == 1) { - resident = temp; + /* resident = temp; */ } else if (line[0] == 'P' && sscanf(line, "Pss: %d kB", &temp) == 1) { pss = temp; } else if (line[0] == 'S' && sscanf(line, "Shared_Clean: %d kB", &temp) == 1) { @@ -366,7 +365,7 @@ static void read_mapinfo(FILE *fp, stats_t* stats) } else if (line[0] == 'P' && sscanf(line, "Private_Dirty: %d kB", &temp) == 1) { private_dirty = temp; } else if (line[0] == 'R' && sscanf(line, "Referenced: %d kB", &temp) == 1) { - referenced = temp; + /* referenced = temp; */ } else if (line[0] == 'S' && sscanf(line, "Swap: %d kB", &temp) == 1) { swapped_out = temp; } else if (sscanf(line, "%" SCNx64 "-%" SCNx64 " %*s %*x %*x:%*x %*d", &start, &end) == 2) { @@ -490,7 +489,6 @@ static jlong android_os_Debug_getPssPid(JNIEnv *env, jobject clazz, jint pid, jl char line[1024]; jlong pss = 0; jlong uss = 0; - unsigned temp; char tmp[128]; FILE *fp; diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp index 15d62a2..96a3e37 100644 --- a/core/jni/android_os_MessageQueue.cpp +++ b/core/jni/android_os_MessageQueue.cpp @@ -169,6 +169,7 @@ int register_android_os_MessageQueue(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/os/MessageQueue", gMessageQueueMethods, NELEM(gMessageQueueMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; jclass clazz; FIND_CLASS(clazz, "android/os/MessageQueue"); diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 960acc0..0269507 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -654,8 +654,6 @@ static void android_os_Parcel_writeInterfaceToken(JNIEnv* env, jclass clazz, jlo static void android_os_Parcel_enforceInterface(JNIEnv* env, jclass clazz, jlong nativePtr, jstring name) { - jboolean ret = JNI_FALSE; - Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr); if (parcel != NULL) { const jchar* str = env->GetStringCritical(name, 0); diff --git a/core/jni/android_os_Trace.cpp b/core/jni/android_os_Trace.cpp index b11c5bb..37d51cc 100644 --- a/core/jni/android_os_Trace.cpp +++ b/core/jni/android_os_Trace.cpp @@ -54,7 +54,6 @@ static void android_os_Trace_nativeTraceCounter(JNIEnv* env, jclass clazz, static void android_os_Trace_nativeTraceBegin(JNIEnv* env, jclass clazz, jlong tag, jstring nameStr) { - const size_t MAX_SECTION_NAME_LEN = 127; ScopedStringChars jchars(env, nameStr); String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size()); sanitizeString(utf8Chars); @@ -72,7 +71,6 @@ static void android_os_Trace_nativeTraceEnd(JNIEnv* env, jclass clazz, static void android_os_Trace_nativeAsyncTraceBegin(JNIEnv* env, jclass clazz, jlong tag, jstring nameStr, jint cookie) { - const size_t MAX_SECTION_NAME_LEN = 127; ScopedStringChars jchars(env, nameStr); String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size()); sanitizeString(utf8Chars); @@ -83,7 +81,6 @@ static void android_os_Trace_nativeAsyncTraceBegin(JNIEnv* env, jclass clazz, static void android_os_Trace_nativeAsyncTraceEnd(JNIEnv* env, jclass clazz, jlong tag, jstring nameStr, jint cookie) { - const size_t MAX_SECTION_NAME_LEN = 127; ScopedStringChars jchars(env, nameStr); String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size()); sanitizeString(utf8Chars); @@ -138,6 +135,7 @@ int register_android_os_Trace(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/os/Trace", gTraceMethods, NELEM(gTraceMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; return 0; } diff --git a/core/jni/android_server_FingerprintManager.cpp b/core/jni/android_server_FingerprintManager.cpp index 4e2d93e..cb17481 100644 --- a/core/jni/android_server_FingerprintManager.cpp +++ b/core/jni/android_server_FingerprintManager.cpp @@ -84,6 +84,7 @@ static void hal_notify_callback(fingerprint_msg_t msg) { ALOGE("fingerprint: invalid msg: %d", msg.type); return; } + (void)arg3; //ALOG(LOG_VERBOSE, LOG_TAG, "hal_notify(msg=%d, arg1=%d, arg2=%d)\n", msg.type, arg1, arg2); // TODO: fix gross hack to attach JNI to calling thread diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index 28ee1e4..d2d8c7d 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -17,9 +17,6 @@ #define LOG_TAG "asset" -#define DEBUG_STYLES(x) //x -#define THROW_ON_BAD_ID 0 - #include <android_runtime/android_util_AssetManager.h> #include "jni.h" @@ -48,6 +45,9 @@ extern "C" int capset(cap_user_header_t hdrp, const cap_user_data_t datap); namespace android { +static const bool kThrowOnBadId = false; +static const bool kDebugStyles = false; + // ---------------------------------------------------------------------------- static struct typedvalue_offsets_t @@ -803,21 +803,21 @@ static jint android_content_AssetManager_loadResourceValue(JNIEnv* env, jobject ResTable_config config; uint32_t typeSpecFlags; ssize_t block = res.getResource(ident, &value, false, density, &typeSpecFlags, &config); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return 0; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } } -#endif uint32_t ref = ident; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags, &config); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return 0; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } } -#endif } if (block >= 0) { return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags, &config); @@ -863,12 +863,12 @@ static jint android_content_AssetManager_loadResourceBagValue(JNIEnv* env, jobje uint32_t ref = ident; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return 0; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } } -#endif } if (block >= 0) { return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags); @@ -978,12 +978,12 @@ static jint android_content_AssetManager_loadThemeAttributeValue( uint32_t ref = 0; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return 0; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } } -#endif } return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags) : block; } @@ -994,6 +994,7 @@ static void android_content_AssetManager_dumpTheme(JNIEnv* env, jobject clazz, { ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle); const ResTable& res(theme->getResTable()); + (void)res; // XXX Need to use params. theme->dumpToLog(); @@ -1021,8 +1022,10 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c return JNI_FALSE; } - DEBUG_STYLES(ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x", - themeToken, defStyleAttr, defStyleRes)); + if (kDebugStyles) { + ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x", + themeToken, defStyleAttr, defStyleRes); + } ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken); const ResTable& res = theme->getResTable(); @@ -1089,7 +1092,9 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c for (jsize ii=0; ii<NI; ii++) { const uint32_t curIdent = (uint32_t)src[ii]; - DEBUG_STYLES(ALOGI("RETRIEVING ATTR 0x%08x...", curIdent)); + if (kDebugStyles) { + ALOGI("RETRIEVING ATTR 0x%08x...", curIdent); + } // Try to find a value for this attribute... we prioritize values // coming from, first XML attributes, then XML style, then default @@ -1104,8 +1109,9 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c block = -1; value.dataType = Res_value::TYPE_ATTRIBUTE; value.data = srcValues[ii]; - DEBUG_STYLES(ALOGI("-> From values: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From values: type=0x%x, data=0x%08x", value.dataType, value.data); + } } // Skip through the default style values until the end or the next possible match. @@ -1118,8 +1124,9 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c block = defStyleEnt->stringBlock; typeSetFlags = defStyleTypeSetFlags; value = defStyleEnt->map.value; - DEBUG_STYLES(ALOGI("-> From def style: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data); + } } defStyleEnt++; } @@ -1130,39 +1137,46 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c ssize_t newBlock = theme->resolveAttributeReference(&value, block, &resid, &typeSetFlags, &config); if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data); + } } else { // If we still don't have a value for this attribute, try to find // it in the theme! ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags); if (newBlock >= 0) { - DEBUG_STYLES(ALOGI("-> From theme: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data); + } newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); -#if THROW_ON_BAD_ID - if (newBlock == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return JNI_FALSE; + if (kThrowOnBadId) { + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } } -#endif if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data); + } } } // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { - DEBUG_STYLES(ALOGI("-> Setting to @null!")); + if (kDebugStyles) { + ALOGI("-> Setting to @null!"); + } value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = -1; } - DEBUG_STYLES(ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", - curIdent, value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", curIdent, value.dataType, + value.data); + } // Write the final value back to Java. dest[STYLE_TYPE] = value.dataType; @@ -1216,8 +1230,10 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla return JNI_FALSE; } - DEBUG_STYLES(ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x", - themeToken, defStyleAttr, defStyleRes, xmlParserToken)); + if (kDebugStyles) { + ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x", + themeToken, defStyleAttr, defStyleRes, xmlParserToken); + } ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken); const ResTable& res = theme->getResTable(); @@ -1314,7 +1330,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla for (jsize ii=0; ii<NI; ii++) { const uint32_t curIdent = (uint32_t)src[ii]; - DEBUG_STYLES(ALOGI("RETRIEVING ATTR 0x%08x...", curIdent)); + if (kDebugStyles) { + ALOGI("RETRIEVING ATTR 0x%08x...", curIdent); + } // Try to find a value for this attribute... we prioritize values // coming from, first XML attributes, then XML style, then default @@ -1335,8 +1353,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla xmlParser->getAttributeValue(ix, &value); ix++; curXmlAttr = xmlParser->getAttributeNameResID(ix); - DEBUG_STYLES(ALOGI("-> From XML: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From XML: type=0x%x, data=0x%08x", value.dataType, value.data); + } } // Skip through the style values until the end or the next possible match. @@ -1349,8 +1368,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla block = styleEnt->stringBlock; typeSetFlags = styleTypeSetFlags; value = styleEnt->map.value; - DEBUG_STYLES(ALOGI("-> From style: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType, value.data); + } } styleEnt++; } @@ -1365,8 +1385,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla block = defStyleEnt->stringBlock; typeSetFlags = defStyleTypeSetFlags; value = defStyleEnt->map.value; - DEBUG_STYLES(ALOGI("-> From def style: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data); + } } defStyleEnt++; } @@ -1377,39 +1398,45 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla ssize_t newBlock = theme->resolveAttributeReference(&value, block, &resid, &typeSetFlags, &config); if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data); + } } else { // If we still don't have a value for this attribute, try to find // it in the theme! ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags); if (newBlock >= 0) { - DEBUG_STYLES(ALOGI("-> From theme: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data); + } newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); -#if THROW_ON_BAD_ID - if (newBlock == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return JNI_FALSE; + if (kThrowOnBadId) { + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } } -#endif if (newBlock >= 0) block = newBlock; - DEBUG_STYLES(ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", - value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data); + } } } // Deal with the special @null value -- it turns back to TYPE_NULL. if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) { - DEBUG_STYLES(ALOGI("-> Setting to @null!")); + if (kDebugStyles) { + ALOGI("-> Setting to @null!"); + } value.dataType = Res_value::TYPE_NULL; value.data = Res_value::DATA_NULL_UNDEFINED; block = kXmlBlock; } - DEBUG_STYLES(ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", - curIdent, value.dataType, value.data)); + if (kDebugStyles) { + ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", curIdent, value.dataType, value.data); + } // Write the final value back to Java. dest[STYLE_TYPE] = value.dataType; @@ -1538,12 +1565,12 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job //printf("Resolving attribute reference\n"); ssize_t newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); -#if THROW_ON_BAD_ID - if (newBlock == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return JNI_FALSE; + if (kThrowOnBadId) { + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } } -#endif if (newBlock >= 0) block = newBlock; } @@ -1652,12 +1679,12 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz //printf("Resolving attribute reference\n"); ssize_t newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); -#if THROW_ON_BAD_ID - if (newBlock == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return JNI_FALSE; + if (kThrowOnBadId) { + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } } -#endif if (newBlock >= 0) block = newBlock; } @@ -1765,12 +1792,12 @@ static jintArray android_content_AssetManager_getArrayStringInfo(JNIEnv* env, jo stringIndex = value.data; } -#if THROW_ON_BAD_ID - if (stringBlock == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return array; + if (kThrowOnBadId) { + if (stringBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } } -#endif //todo: It might be faster to allocate a C array to contain // the blocknums and indices, put them in there and then @@ -1813,12 +1840,12 @@ static jobjectArray android_content_AssetManager_getArrayStringResource(JNIEnv* // Take care of resolving the found resource to its final value. ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return array; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } } -#endif if (value.dataType == Res_value::TYPE_STRING) { const ResStringPool* pool = res.getTableStringBlock(block); const char* str8 = pool->string8At(value.data, &strLen); @@ -1876,12 +1903,12 @@ static jintArray android_content_AssetManager_getArrayIntResource(JNIEnv* env, j // Take care of resolving the found resource to its final value. ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL); -#if THROW_ON_BAD_ID - if (block == BAD_INDEX) { - jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); - return array; + if (kThrowOnBadId) { + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } } -#endif if (value.dataType >= Res_value::TYPE_FIRST_INT && value.dataType <= Res_value::TYPE_LAST_INT) { int intVal = value.data; @@ -1913,7 +1940,6 @@ static jintArray android_content_AssetManager_getStyleAttributes(JNIEnv* env, jo return NULL; } - Res_value value; const ResTable::bag_entry* bag = startOfBag; for (size_t i=0; ((ssize_t)i)<N; i++, bag++) { int resourceId = bag->map.name.ident; diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index a78c386..1dd6378 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -85,15 +85,6 @@ static struct binderinternal_offsets_t // ---------------------------------------------------------------------------- -static struct debug_offsets_t -{ - // Class state. - jclass mClass; - -} gDebugOffsets; - -// ---------------------------------------------------------------------------- - static struct error_offsets_t { jclass mClass; @@ -1024,7 +1015,9 @@ static bool push_eventlog_int(char** pos, const char* end, jint val) { } // From frameworks/base/core/java/android/content/EventLogTags.logtags: -#define ENABLE_BINDER_SAMPLE 0 + +static const bool kEnableBinderSample = false; + #define LOGTAG_BINDER_OPERATION 52004 static void conditionally_log_binder_call(int64_t start_millis, @@ -1095,24 +1088,28 @@ static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj, ALOGV("Java code calling transact on %p in Java object %p with code %" PRId32 "\n", target, obj, code); -#if ENABLE_BINDER_SAMPLE - // Only log the binder call duration for things on the Java-level main thread. - // But if we don't - const bool time_binder_calls = should_time_binder_calls(); + bool time_binder_calls; int64_t start_millis; - if (time_binder_calls) { - start_millis = uptimeMillis(); + if (kEnableBinderSample) { + // Only log the binder call duration for things on the Java-level main thread. + // But if we don't + time_binder_calls = should_time_binder_calls(); + + if (time_binder_calls) { + start_millis = uptimeMillis(); + } } -#endif + //printf("Transact from Java code to %p sending: ", target); data->print(); status_t err = target->transact(code, *data, reply, flags); //if (reply) printf("Transact from Java code to %p received: ", target); reply->print(); -#if ENABLE_BINDER_SAMPLE - if (time_binder_calls) { - conditionally_log_binder_call(start_millis, target, code); + + if (kEnableBinderSample) { + if (time_binder_calls) { + conditionally_log_binder_call(start_millis, target, code); + } } -#endif if (err == NO_ERROR) { return JNI_TRUE; diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 2b0960f..839a883 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -43,13 +43,13 @@ #include <sys/types.h> #include <unistd.h> -#define POLICY_DEBUG 0 #define GUARD_THREAD_PRIORITY 0 -#define DEBUG_PROC(x) //x - using namespace android; +static const bool kDebugPolicy = false; +static const bool kDebugProc = false; + #if GUARD_THREAD_PRIORITY Mutex gKeyCreateMutex; static pthread_key_t gBgKey = -1; @@ -175,7 +175,6 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin { ALOGV("%s pid=%d grp=%" PRId32, __func__, pid, grp); DIR *d; - FILE *fp; char proc_path[255]; struct dirent *de; @@ -191,26 +190,27 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin } SchedPolicy sp = (SchedPolicy) grp; -#if POLICY_DEBUG - char cmdline[32]; - int fd; + if (kDebugPolicy) { + char cmdline[32]; + int fd; - strcpy(cmdline, "unknown"); + strcpy(cmdline, "unknown"); - sprintf(proc_path, "/proc/%d/cmdline", pid); - fd = open(proc_path, O_RDONLY); - if (fd >= 0) { - int rc = read(fd, cmdline, sizeof(cmdline)-1); - cmdline[rc] = 0; - close(fd); - } + sprintf(proc_path, "/proc/%d/cmdline", pid); + fd = open(proc_path, O_RDONLY); + if (fd >= 0) { + int rc = read(fd, cmdline, sizeof(cmdline)-1); + cmdline[rc] = 0; + close(fd); + } - if (sp == SP_BACKGROUND) { - ALOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline); - } else { - ALOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline); + if (sp == SP_BACKGROUND) { + ALOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline); + } else { + ALOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline); + } } -#endif + sprintf(proc_path, "/proc/%d/task", pid); if (!(d = opendir(proc_path))) { // If the process exited on us, don't generate an exception @@ -729,7 +729,9 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz, const char term = (char)(mode&PROC_TERM_MASK); const jsize start = i; if (i >= endIndex) { - DEBUG_PROC(ALOGW("Ran off end of data @%d", i)); + if (kDebugProc) { + ALOGW("Ran off end of data @%d", i); + } res = JNI_FALSE; break; } @@ -829,7 +831,9 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, int fd = open(file8, O_RDONLY); if (fd < 0) { - DEBUG_PROC(ALOGW("Unable to open process file: %s\n", file8)); + if (kDebugProc) { + ALOGW("Unable to open process file: %s\n", file8); + } env->ReleaseStringUTFChars(file, file8); return JNI_FALSE; } @@ -840,7 +844,9 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, close(fd); if (len < 0) { - DEBUG_PROC(ALOGW("Unable to open process file: %s fd=%d\n", file8, fd)); + if (kDebugProc) { + ALOGW("Unable to open process file: %s fd=%d\n", file8, fd); + } return JNI_FALSE; } buffer[len] = 0; diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index d4cc159..1ccf419 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -273,6 +273,7 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/DisplayEventReceiver", gMethods, NELEM(gMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; FIND_CLASS(gDisplayEventReceiverClassInfo.clazz, "android/view/DisplayEventReceiver"); diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp index d667920..b64b7c6 100644 --- a/core/jni/android_view_InputChannel.cpp +++ b/core/jni/android_view_InputChannel.cpp @@ -292,6 +292,7 @@ int register_android_view_InputChannel(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/InputChannel", gInputChannelMethods, NELEM(gInputChannelMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; FIND_CLASS(gInputChannelClassInfo.clazz, "android/view/InputChannel"); diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp index f36bf31..093dde8 100644 --- a/core/jni/android_view_InputEventReceiver.cpp +++ b/core/jni/android_view_InputEventReceiver.cpp @@ -421,6 +421,7 @@ int register_android_view_InputEventReceiver(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/InputEventReceiver", gMethods, NELEM(gMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; FIND_CLASS(gInputEventReceiverClassInfo.clazz, "android/view/InputEventReceiver"); diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp index f156b9a..e697531 100644 --- a/core/jni/android_view_InputEventSender.cpp +++ b/core/jni/android_view_InputEventSender.cpp @@ -312,6 +312,7 @@ int register_android_view_InputEventSender(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/InputEventSender", gMethods, NELEM(gMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; FIND_CLASS(gInputEventSenderClassInfo.clazz, "android/view/InputEventSender"); diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp index a590dbf..318acbb 100644 --- a/core/jni/android_view_MotionEvent.cpp +++ b/core/jni/android_view_MotionEvent.cpp @@ -296,7 +296,6 @@ static void pointerCoordsFromNative(JNIEnv* env, const PointerCoords* rawPointer jfloat* outValues = static_cast<jfloat*>(env->GetPrimitiveArrayCritical( outValuesArray, NULL)); - const float* values = rawPointerCoords->values; uint32_t index = 0; do { uint32_t axis = bits.clearFirstMarkedBit(); @@ -873,6 +872,7 @@ int register_android_view_MotionEvent(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/MotionEvent", gMotionEventMethods, NELEM(gMotionEventMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; FIND_CLASS(gMotionEventClassInfo.clazz, "android/view/MotionEvent"); gMotionEventClassInfo.clazz = jclass(env->NewGlobalRef(gMotionEventClassInfo.clazz)); diff --git a/core/jni/android_view_RenderNodeAnimator.cpp b/core/jni/android_view_RenderNodeAnimator.cpp index 84b7913..ae42219 100644 --- a/core/jni/android_view_RenderNodeAnimator.cpp +++ b/core/jni/android_view_RenderNodeAnimator.cpp @@ -148,11 +148,6 @@ static void setStartDelay(JNIEnv* env, jobject clazz, jlong animatorPtr, jlong s animator->setStartDelay(startDelay); } -static jlong getStartDelay(JNIEnv* env, jobject clazz, jlong animatorPtr) { - BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr); - return static_cast<jlong>(animator->startDelay()); -} - static void setInterpolator(JNIEnv* env, jobject clazz, jlong animatorPtr, jlong interpolatorPtr) { BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr); Interpolator* interpolator = reinterpret_cast<Interpolator*>(interpolatorPtr); diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 06c22ae..adfcdb0 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -134,7 +134,7 @@ static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz, status_t res; if (allLayers) { minLayer = 0; - maxLayer = -1UL; + maxLayer = -1; } res = screenshot->update(displayToken, sourceCrop, width, height, diff --git a/core/jni/android_view_VelocityTracker.cpp b/core/jni/android_view_VelocityTracker.cpp index 1e36932..49d4da0 100644 --- a/core/jni/android_view_VelocityTracker.cpp +++ b/core/jni/android_view_VelocityTracker.cpp @@ -254,6 +254,7 @@ int register_android_view_VelocityTracker(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/view/VelocityTracker", gVelocityTrackerMethods, NELEM(gVelocityTrackerMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); + (void)res; jclass clazz; FIND_CLASS(clazz, "android/view/VelocityTracker$Estimator"); diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp index 226b764..545cb3e 100644 --- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp +++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp @@ -117,7 +117,7 @@ isFileDifferent(const char* filePath, size_t fileSize, time_t modifiedTime, return true; } - if (st->st_size != fileSize) { + if (static_cast<uint64_t>(st->st_size) != static_cast<uint64_t>(fileSize)) { return true; } @@ -430,7 +430,6 @@ static int findSupportedAbi(JNIEnv *env, jlong apkHandle, jobjectArray supported } ZipEntryRO entry = NULL; - char fileName[PATH_MAX]; int status = NO_NATIVE_LIBRARIES; while ((entry = it->next()) != NULL) { // We're currently in the lib/ directory of the APK, so it does have some native diff --git a/core/jni/com_android_internal_net_NetworkStatsFactory.cpp b/core/jni/com_android_internal_net_NetworkStatsFactory.cpp index 2e2d0c7..1fbe016 100644 --- a/core/jni/com_android_internal_net_NetworkStatsFactory.cpp +++ b/core/jni/com_android_internal_net_NetworkStatsFactory.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "NetworkStats" #include <errno.h> +#include <inttypes.h> #include <sys/stat.h> #include <sys/types.h> @@ -187,7 +188,7 @@ static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats, if (endPos - pos == 3) { rawTag = 0; } else { - if (sscanf(pos, "%llx", &rawTag) != 1) { + if (sscanf(pos, "%" PRIx64, &rawTag) != 1) { ALOGE("bad tag: %s", pos); fclose(fp); return -1; @@ -204,7 +205,7 @@ static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats, while (*pos == ' ') pos++; // Parse remaining fields. - if (sscanf(pos, "%u %u %llu %llu %llu %llu", + if (sscanf(pos, "%u %u %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64, &s.uid, &s.set, &s.rxBytes, &s.rxPackets, &s.txBytes, &s.txPackets) == 6) { if (limitUid != -1 && limitUid != s.uid) { |