Merge "Frameworks/base: Wall Werror in core/jni"
This commit is contained in:
@@ -246,7 +246,7 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
libsoundtrigger \
|
libsoundtrigger \
|
||||||
libminikin \
|
libminikin \
|
||||||
libprocessgroup \
|
libprocessgroup \
|
||||||
libnativebridge \
|
libnativebridge
|
||||||
|
|
||||||
ifeq ($(USE_OPENGL_RENDERER),true)
|
ifeq ($(USE_OPENGL_RENDERER),true)
|
||||||
LOCAL_SHARED_LIBRARIES += libhwui
|
LOCAL_SHARED_LIBRARIES += libhwui
|
||||||
@@ -261,6 +261,8 @@ LOCAL_C_INCLUDES += bionic/libc/private
|
|||||||
|
|
||||||
LOCAL_MODULE:= libandroid_runtime
|
LOCAL_MODULE:= libandroid_runtime
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||||
|
|||||||
@@ -191,12 +191,6 @@ extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env);
|
|||||||
|
|
||||||
static AndroidRuntime* gCurRuntime = NULL;
|
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().
|
* 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;
|
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[] = {
|
static const RegJNIRec gRegJNI[] = {
|
||||||
REG_JNI(register_com_android_internal_os_RuntimeInit),
|
REG_JNI(register_com_android_internal_os_RuntimeInit),
|
||||||
REG_JNI(register_android_os_SystemClock),
|
REG_JNI(register_android_os_SystemClock),
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t read(void* buffer, size_t size) {
|
virtual size_t read(void* buffer, size_t size) {
|
||||||
JNIEnv* env = fEnv;
|
|
||||||
if (NULL == buffer) {
|
if (NULL == buffer) {
|
||||||
if (0 == size) {
|
if (0 == size) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -26,18 +26,6 @@
|
|||||||
|
|
||||||
namespace android {
|
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,
|
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) {
|
const uint16_t* buf, size_t start, size_t count, size_t bufSize) {
|
||||||
TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface);
|
TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface);
|
||||||
|
|||||||
@@ -13,11 +13,6 @@
|
|||||||
|
|
||||||
using namespace android::uirenderer;
|
using namespace android::uirenderer;
|
||||||
|
|
||||||
static struct {
|
|
||||||
jclass clazz;
|
|
||||||
jfieldID shader;
|
|
||||||
} gShaderClassInfo;
|
|
||||||
|
|
||||||
static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) {
|
static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) {
|
||||||
if (NULL == ptr) {
|
if (NULL == ptr) {
|
||||||
doThrowIAE(env);
|
doThrowIAE(env);
|
||||||
|
|||||||
@@ -20,7 +20,11 @@
|
|||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkMatrix.h"
|
#include "SkMatrix.h"
|
||||||
#include "fpdfview.h"
|
#include "fpdfview.h"
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
|
||||||
#include "fsdk_rendercontext.h"
|
#include "fsdk_rendercontext.h"
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <android_runtime/AndroidRuntime.h>
|
#include <android_runtime/AndroidRuntime.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -228,7 +232,6 @@ static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong
|
|||||||
jlong bitmapPtr, jint destLeft, jint destTop, jint destRight, jint destBottom,
|
jlong bitmapPtr, jint destLeft, jint destTop, jint destRight, jint destBottom,
|
||||||
jlong matrixPtr, jint renderMode) {
|
jlong matrixPtr, jint renderMode) {
|
||||||
|
|
||||||
FPDF_DOCUMENT document = reinterpret_cast<FPDF_DOCUMENT>(documentPtr);
|
|
||||||
FPDF_PAGE page = reinterpret_cast<FPDF_PAGE>(pagePtr);
|
FPDF_PAGE page = reinterpret_cast<FPDF_PAGE>(pagePtr);
|
||||||
SkBitmap* skBitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
|
SkBitmap* skBitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
|
||||||
SkMatrix* skMatrix = reinterpret_cast<SkMatrix*>(matrixPtr);
|
SkMatrix* skMatrix = reinterpret_cast<SkMatrix*>(matrixPtr);
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ namespace android {
|
|||||||
|
|
||||||
void poly_clip_to_halfspace(Poly* p, Poly* q, int index, float sign, float k)
|
void poly_clip_to_halfspace(Poly* p, Poly* q, int index, float sign, float k)
|
||||||
{
|
{
|
||||||
unsigned long m;
|
|
||||||
float *up, *vp, *wp;
|
float *up, *vp, *wp;
|
||||||
Poly_vert *v;
|
Poly_vert *v;
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -759,8 +759,6 @@ getPointer(JNIEnv *_env, jobject buffer, jint *remaining)
|
|||||||
jint limit;
|
jint limit;
|
||||||
jint elementSizeShift;
|
jint elementSizeShift;
|
||||||
jlong pointer;
|
jlong pointer;
|
||||||
jint offset;
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
position = _env->GetIntField(buffer, positionID);
|
position = _env->GetIntField(buffer, positionID);
|
||||||
limit = _env->GetIntField(buffer, limitID);
|
limit = _env->GetIntField(buffer, limitID);
|
||||||
@@ -900,9 +898,7 @@ static void etc1_encodeImage(JNIEnv *env, jclass clazz,
|
|||||||
} else if (outB.remaining() < encodedImageSize) {
|
} else if (outB.remaining() < encodedImageSize) {
|
||||||
doThrowIAE(env, "out's remaining data < encoded image size");
|
doThrowIAE(env, "out's remaining data < encoded image size");
|
||||||
} else {
|
} else {
|
||||||
int result = etc1_encode_image((etc1_byte*) inB.getData(),
|
etc1_encode_image((etc1_byte*) inB.getData(), width, height, pixelSize, stride,
|
||||||
width, height, pixelSize,
|
|
||||||
stride,
|
|
||||||
(etc1_byte*) outB.getData());
|
(etc1_byte*) outB.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -933,10 +929,8 @@ static void etc1_decodeImage(JNIEnv *env, jclass clazz,
|
|||||||
} else if (outB.remaining() < imageSize) {
|
} else if (outB.remaining() < imageSize) {
|
||||||
doThrowIAE(env, "out's remaining data < image size");
|
doThrowIAE(env, "out's remaining data < image size");
|
||||||
} else {
|
} else {
|
||||||
int result = etc1_decode_image((etc1_byte*) inB.getData(),
|
etc1_decode_image((etc1_byte*) inB.getData(), (etc1_byte*) outB.getData(),
|
||||||
(etc1_byte*) outB.getData(),
|
width, height, pixelSize, stride);
|
||||||
width, height, pixelSize,
|
|
||||||
stride);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ static struct {
|
|||||||
static jint backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj,
|
static jint backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj,
|
||||||
jstring domainObj, jstring linkdomain,
|
jstring domainObj, jstring linkdomain,
|
||||||
jstring rootpathObj, jstring pathObj, jobject dataOutputObj) {
|
jstring rootpathObj, jstring pathObj, jobject dataOutputObj) {
|
||||||
int ret;
|
|
||||||
|
|
||||||
// Extract the various strings, allowing for null object pointers
|
// Extract the various strings, allowing for null object pointers
|
||||||
const char* packagenamechars = (packageNameObj) ? env->GetStringUTFChars(packageNameObj, NULL) : NULL;
|
const char* packagenamechars = (packageNameObj) ? env->GetStringUTFChars(packageNameObj, NULL) : NULL;
|
||||||
const char* rootchars = (rootpathObj) ? env->GetStringUTFChars(rootpathObj, NULL) : NULL;
|
const char* rootchars = (rootpathObj) ? env->GetStringUTFChars(rootpathObj, NULL) : NULL;
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ writeEntityData_native(JNIEnv* env, jobject clazz, jlong w, jbyteArray data, jin
|
|||||||
static void
|
static void
|
||||||
setKeyPrefix_native(JNIEnv* env, jobject clazz, jlong w, jstring keyPrefixObj)
|
setKeyPrefix_native(JNIEnv* env, jobject clazz, jlong w, jstring keyPrefixObj)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
BackupDataWriter* writer = (BackupDataWriter*)w;
|
BackupDataWriter* writer = (BackupDataWriter*)w;
|
||||||
|
|
||||||
const char* keyPrefixUTF = env->GetStringUTFChars(keyPrefixObj, NULL);
|
const char* keyPrefixUTF = env->GetStringUTFChars(keyPrefixObj, NULL);
|
||||||
|
|||||||
@@ -325,7 +325,6 @@ static void nativeFinalizeStatement(JNIEnv* env, jclass clazz, jlong connectionP
|
|||||||
|
|
||||||
static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jlong connectionPtr,
|
static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jlong connectionPtr,
|
||||||
jlong statementPtr) {
|
jlong statementPtr) {
|
||||||
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
|
|
||||||
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
||||||
|
|
||||||
return sqlite3_bind_parameter_count(statement);
|
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,
|
static jboolean nativeIsReadOnly(JNIEnv* env, jclass clazz, jlong connectionPtr,
|
||||||
jlong statementPtr) {
|
jlong statementPtr) {
|
||||||
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
|
|
||||||
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
||||||
|
|
||||||
return sqlite3_stmt_readonly(statement) != 0;
|
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,
|
static jint nativeGetColumnCount(JNIEnv* env, jclass clazz, jlong connectionPtr,
|
||||||
jlong statementPtr) {
|
jlong statementPtr) {
|
||||||
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
|
|
||||||
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
||||||
|
|
||||||
return sqlite3_column_count(statement);
|
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,
|
static jstring nativeGetColumnName(JNIEnv* env, jclass clazz, jlong connectionPtr,
|
||||||
jlong statementPtr, jint index) {
|
jlong statementPtr, jint index) {
|
||||||
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
|
|
||||||
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
|
||||||
|
|
||||||
const jchar* name = static_cast<const jchar*>(sqlite3_column_name16(statement, index));
|
const jchar* name = static_cast<const jchar*>(sqlite3_column_name16(statement, index));
|
||||||
|
|||||||
@@ -265,14 +265,6 @@ static jclass make_globalref(JNIEnv* env, const char classname[])
|
|||||||
return (jclass)env->NewGlobalRef(c);
|
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) {
|
int register_android_emoji_EmojiFactory(JNIEnv* env) {
|
||||||
gEmojiFactory_class = make_globalref(env, "android/emoji/EmojiFactory");
|
gEmojiFactory_class = make_globalref(env, "android/emoji/EmojiFactory");
|
||||||
gEmojiFactory_constructorMethodID = env->GetMethodID(
|
gEmojiFactory_constructorMethodID = env->GetMethodID(
|
||||||
|
|||||||
@@ -556,42 +556,6 @@ static void drawTextRunString(JNIEnv* env, jobject obj, jlong canvasHandle, jstr
|
|||||||
env->ReleaseStringChars(text, jchars);
|
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 {
|
class DrawTextOnPathFunctor {
|
||||||
public:
|
public:
|
||||||
DrawTextOnPathFunctor(const Layout& layout, Canvas* canvas, float hOffset,
|
DrawTextOnPathFunctor(const Layout& layout, Canvas* canvas, float hOffset,
|
||||||
|
|||||||
@@ -315,7 +315,6 @@ static void CameraMetadata_writeValues(JNIEnv *env, jobject thiz, jint tag, jbyt
|
|||||||
"Tag (%d) did not have a type", tag);
|
"Tag (%d) did not have a type", tag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size_t tagSize = Helpers::getTypeSize(tagType);
|
|
||||||
|
|
||||||
status_t res;
|
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)
|
if (find_fields(env, fields_to_find, NELEM(fields_to_find)) < 0)
|
||||||
return;
|
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) {
|
static jint CameraMetadata_getTagFromKey(JNIEnv *env, jobject thiz, jstring keyName) {
|
||||||
|
|||||||
@@ -427,7 +427,6 @@ InputStripSource::InputStripSource(JNIEnv* env, Input& input, uint32_t ifd, uint
|
|||||||
InputStripSource::~InputStripSource() {}
|
InputStripSource::~InputStripSource() {}
|
||||||
|
|
||||||
status_t InputStripSource::writeToStream(Output& stream, uint32_t count) {
|
status_t InputStripSource::writeToStream(Output& stream, uint32_t count) {
|
||||||
status_t err = OK;
|
|
||||||
uint32_t fullSize = mWidth * mHeight * mBytesPerSample * mSamplesPerPixel;
|
uint32_t fullSize = mWidth * mHeight * mBytesPerSample * mSamplesPerPixel;
|
||||||
jlong offset = mOffset;
|
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 samplesPerPixel = 1;
|
||||||
const uint32_t bitsPerSample = BITS_PER_SAMPLE;
|
const uint32_t bitsPerSample = BITS_PER_SAMPLE;
|
||||||
const uint32_t bitsPerByte = BITS_PER_SAMPLE / BYTES_PER_SAMPLE;
|
|
||||||
uint32_t imageWidth = 0;
|
uint32_t imageWidth = 0;
|
||||||
uint32_t imageHeight = 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;
|
size_t fullSize = width * height * BYTES_PER_RGB_PIXEL;
|
||||||
jlong capacity = env->GetDirectBufferCapacity(buffer);
|
jlong capacity = env->GetDirectBufferCapacity(buffer);
|
||||||
if (capacity != fullSize) {
|
if (static_cast<uint64_t>(capacity) != static_cast<uint64_t>(fullSize)) {
|
||||||
jniThrowExceptionFmt(env, "java/lang/AssertionError",
|
jniThrowExceptionFmt(env, "java/lang/AssertionError",
|
||||||
"Invalid size %d for thumbnail, expected size was %d",
|
"Invalid size %d for thumbnail, expected size was %d",
|
||||||
capacity, fullSize);
|
capacity, fullSize);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ static void activity_callback(
|
|||||||
detach_thread();
|
detach_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
activity_recognition_callback_procs_t sCallbacks {
|
activity_recognition_callback_procs_t sCallbacks = {
|
||||||
activity_callback,
|
activity_callback,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1059,7 +1059,7 @@ exit:
|
|||||||
return jStatus;
|
return jStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static jint
|
||||||
android_media_AudioSystem_releaseAudioPatch(JNIEnv *env, jobject clazz,
|
android_media_AudioSystem_releaseAudioPatch(JNIEnv *env, jobject clazz,
|
||||||
jobject jPatch)
|
jobject jPatch)
|
||||||
{
|
{
|
||||||
@@ -1081,7 +1081,7 @@ android_media_AudioSystem_releaseAudioPatch(JNIEnv *env, jobject clazz,
|
|||||||
status_t status = AudioSystem::releaseAudioPatch(handle);
|
status_t status = AudioSystem::releaseAudioPatch(handle);
|
||||||
ALOGV("AudioSystem::releaseAudioPatch() returned %d", status);
|
ALOGV("AudioSystem::releaseAudioPatch() returned %d", status);
|
||||||
jint jStatus = nativeToJavaStatus(status);
|
jint jStatus = nativeToJavaStatus(status);
|
||||||
return status;
|
return jStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint
|
static jint
|
||||||
|
|||||||
@@ -39,6 +39,9 @@
|
|||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void UNUSED(T t) {}
|
||||||
|
|
||||||
static jfieldID field_inboundFileDescriptors;
|
static jfieldID field_inboundFileDescriptors;
|
||||||
static jfieldID field_outboundFileDescriptors;
|
static jfieldID field_outboundFileDescriptors;
|
||||||
static jclass class_Credentials;
|
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)
|
void *buffer, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
ssize_t bytesread = 0;
|
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iv;
|
struct iovec iv;
|
||||||
unsigned char *buf = (unsigned char *)buffer;
|
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);
|
err = socket_write_all(env, object, fd, &b, 1);
|
||||||
|
UNUSED(err);
|
||||||
// A return of -1 above means an exception is pending
|
// 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,
|
err = socket_write_all(env, object, fd,
|
||||||
byteBuffer + off, len);
|
byteBuffer + off, len);
|
||||||
|
UNUSED(err);
|
||||||
// A return of -1 above means an exception is pending
|
// A return of -1 above means an exception is pending
|
||||||
|
|
||||||
env->ReleaseByteArrayElements(buffer, byteBuffer, JNI_ABORT);
|
env->ReleaseByteArrayElements(buffer, byteBuffer, JNI_ABORT);
|
||||||
|
|||||||
@@ -86,13 +86,6 @@ static jmethodID findStaticMethod(JNIEnv* env, jclass c, const char method[],
|
|||||||
return m;
|
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 {
|
namespace android {
|
||||||
|
|
||||||
int register_android_nio_utils(JNIEnv* env) {
|
int register_android_nio_utils(JNIEnv* env) {
|
||||||
|
|||||||
@@ -222,13 +222,12 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
|
|||||||
int len, nameLen;
|
int len, nameLen;
|
||||||
bool skip, done = false;
|
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;
|
float sharing_proportion = 0.0;
|
||||||
unsigned shared_clean = 0, shared_dirty = 0;
|
unsigned shared_clean = 0, shared_dirty = 0;
|
||||||
unsigned private_clean = 0, private_dirty = 0;
|
unsigned private_clean = 0, private_dirty = 0;
|
||||||
unsigned swapped_out = 0;
|
unsigned swapped_out = 0;
|
||||||
bool is_swappable = false;
|
bool is_swappable = false;
|
||||||
unsigned referenced = 0;
|
|
||||||
unsigned temp;
|
unsigned temp;
|
||||||
|
|
||||||
uint64_t start;
|
uint64_t start;
|
||||||
@@ -346,9 +345,9 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (line[0] == 'S' && sscanf(line, "Size: %d kB", &temp) == 1) {
|
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) {
|
} 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) {
|
} else if (line[0] == 'P' && sscanf(line, "Pss: %d kB", &temp) == 1) {
|
||||||
pss = temp;
|
pss = temp;
|
||||||
} else if (line[0] == 'S' && sscanf(line, "Shared_Clean: %d kB", &temp) == 1) {
|
} else if (line[0] == 'S' && sscanf(line, "Shared_Clean: %d kB", &temp) == 1) {
|
||||||
@@ -360,7 +359,7 @@ static void read_mapinfo(FILE *fp, stats_t* stats)
|
|||||||
} else if (line[0] == 'P' && sscanf(line, "Private_Dirty: %d kB", &temp) == 1) {
|
} else if (line[0] == 'P' && sscanf(line, "Private_Dirty: %d kB", &temp) == 1) {
|
||||||
private_dirty = temp;
|
private_dirty = temp;
|
||||||
} else if (line[0] == 'R' && sscanf(line, "Referenced: %d kB", &temp) == 1) {
|
} 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) {
|
} else if (line[0] == 'S' && sscanf(line, "Swap: %d kB", &temp) == 1) {
|
||||||
swapped_out = temp;
|
swapped_out = temp;
|
||||||
} else if (sscanf(line, "%" SCNx64 "-%" SCNx64 " %*s %*x %*x:%*x %*d", &start, &end) == 2) {
|
} else if (sscanf(line, "%" SCNx64 "-%" SCNx64 " %*s %*x %*x:%*x %*d", &start, &end) == 2) {
|
||||||
@@ -484,7 +483,6 @@ static jlong android_os_Debug_getPssPid(JNIEnv *env, jobject clazz, jint pid, jl
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
jlong pss = 0;
|
jlong pss = 0;
|
||||||
jlong uss = 0;
|
jlong uss = 0;
|
||||||
unsigned temp;
|
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ int register_android_os_MessageQueue(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/os/MessageQueue",
|
int res = jniRegisterNativeMethods(env, "android/os/MessageQueue",
|
||||||
gMessageQueueMethods, NELEM(gMessageQueueMethods));
|
gMessageQueueMethods, NELEM(gMessageQueueMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
FIND_CLASS(clazz, "android/os/MessageQueue");
|
FIND_CLASS(clazz, "android/os/MessageQueue");
|
||||||
|
|||||||
@@ -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)
|
static void android_os_Parcel_enforceInterface(JNIEnv* env, jclass clazz, jlong nativePtr, jstring name)
|
||||||
{
|
{
|
||||||
jboolean ret = JNI_FALSE;
|
|
||||||
|
|
||||||
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
|
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
|
||||||
if (parcel != NULL) {
|
if (parcel != NULL) {
|
||||||
const jchar* str = env->GetStringCritical(name, 0);
|
const jchar* str = env->GetStringCritical(name, 0);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ static void android_os_Trace_nativeTraceCounter(JNIEnv* env, jclass clazz,
|
|||||||
|
|
||||||
static void android_os_Trace_nativeTraceBegin(JNIEnv* env, jclass clazz,
|
static void android_os_Trace_nativeTraceBegin(JNIEnv* env, jclass clazz,
|
||||||
jlong tag, jstring nameStr) {
|
jlong tag, jstring nameStr) {
|
||||||
const size_t MAX_SECTION_NAME_LEN = 127;
|
|
||||||
ScopedStringChars jchars(env, nameStr);
|
ScopedStringChars jchars(env, nameStr);
|
||||||
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
||||||
sanitizeString(utf8Chars);
|
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,
|
static void android_os_Trace_nativeAsyncTraceBegin(JNIEnv* env, jclass clazz,
|
||||||
jlong tag, jstring nameStr, jint cookie) {
|
jlong tag, jstring nameStr, jint cookie) {
|
||||||
const size_t MAX_SECTION_NAME_LEN = 127;
|
|
||||||
ScopedStringChars jchars(env, nameStr);
|
ScopedStringChars jchars(env, nameStr);
|
||||||
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
||||||
sanitizeString(utf8Chars);
|
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,
|
static void android_os_Trace_nativeAsyncTraceEnd(JNIEnv* env, jclass clazz,
|
||||||
jlong tag, jstring nameStr, jint cookie) {
|
jlong tag, jstring nameStr, jint cookie) {
|
||||||
const size_t MAX_SECTION_NAME_LEN = 127;
|
|
||||||
ScopedStringChars jchars(env, nameStr);
|
ScopedStringChars jchars(env, nameStr);
|
||||||
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
String8 utf8Chars(reinterpret_cast<const char16_t*>(jchars.get()), jchars.size());
|
||||||
sanitizeString(utf8Chars);
|
sanitizeString(utf8Chars);
|
||||||
@@ -138,6 +135,7 @@ int register_android_os_Trace(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/os/Trace",
|
int res = jniRegisterNativeMethods(env, "android/os/Trace",
|
||||||
gTraceMethods, NELEM(gTraceMethods));
|
gTraceMethods, NELEM(gTraceMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ static void hal_notify_callback(fingerprint_msg_t msg) {
|
|||||||
ALOGE("fingerprint: invalid msg: %d", msg.type);
|
ALOGE("fingerprint: invalid msg: %d", msg.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
(void)arg3;
|
||||||
//ALOG(LOG_VERBOSE, LOG_TAG, "hal_notify(msg=%d, arg1=%d, arg2=%d)\n", msg.type, arg1, arg2);
|
//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
|
// TODO: fix gross hack to attach JNI to calling thread
|
||||||
|
|||||||
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
#define LOG_TAG "asset"
|
#define LOG_TAG "asset"
|
||||||
|
|
||||||
#define DEBUG_STYLES(x) //x
|
|
||||||
#define THROW_ON_BAD_ID 0
|
|
||||||
|
|
||||||
#include <android_runtime/android_util_AssetManager.h>
|
#include <android_runtime/android_util_AssetManager.h>
|
||||||
|
|
||||||
#include "jni.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 {
|
namespace android {
|
||||||
|
|
||||||
|
static const bool kThrowOnBadId = false;
|
||||||
|
static const bool kDebugStyles = false;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static struct typedvalue_offsets_t
|
static struct typedvalue_offsets_t
|
||||||
@@ -803,21 +803,21 @@ static jint android_content_AssetManager_loadResourceValue(JNIEnv* env, jobject
|
|||||||
ResTable_config config;
|
ResTable_config config;
|
||||||
uint32_t typeSpecFlags;
|
uint32_t typeSpecFlags;
|
||||||
ssize_t block = res.getResource(ident, &value, false, density, &typeSpecFlags, &config);
|
ssize_t block = res.getResource(ident, &value, false, density, &typeSpecFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
uint32_t ref = ident;
|
uint32_t ref = ident;
|
||||||
if (resolve) {
|
if (resolve) {
|
||||||
block = res.resolveReference(&value, block, &ref, &typeSpecFlags, &config);
|
block = res.resolveReference(&value, block, &ref, &typeSpecFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
if (block >= 0) {
|
if (block >= 0) {
|
||||||
return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags, &config);
|
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;
|
uint32_t ref = ident;
|
||||||
if (resolve) {
|
if (resolve) {
|
||||||
block = res.resolveReference(&value, block, &ref, &typeSpecFlags);
|
block = res.resolveReference(&value, block, &ref, &typeSpecFlags);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
if (block >= 0) {
|
if (block >= 0) {
|
||||||
return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags);
|
return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags);
|
||||||
@@ -978,12 +978,12 @@ static jint android_content_AssetManager_loadThemeAttributeValue(
|
|||||||
uint32_t ref = 0;
|
uint32_t ref = 0;
|
||||||
if (resolve) {
|
if (resolve) {
|
||||||
block = res.resolveReference(&value, block, &ref, &typeSpecFlags);
|
block = res.resolveReference(&value, block, &ref, &typeSpecFlags);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags) : block;
|
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);
|
ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle);
|
||||||
const ResTable& res(theme->getResTable());
|
const ResTable& res(theme->getResTable());
|
||||||
|
(void)res;
|
||||||
|
|
||||||
// XXX Need to use params.
|
// XXX Need to use params.
|
||||||
theme->dumpToLog();
|
theme->dumpToLog();
|
||||||
@@ -1021,8 +1022,10 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c
|
|||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_STYLES(ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x",
|
if (kDebugStyles) {
|
||||||
themeToken, defStyleAttr, defStyleRes));
|
ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x",
|
||||||
|
themeToken, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken);
|
ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken);
|
||||||
const ResTable& res = theme->getResTable();
|
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++) {
|
for (jsize ii=0; ii<NI; ii++) {
|
||||||
const uint32_t curIdent = (uint32_t)src[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
|
// Try to find a value for this attribute... we prioritize values
|
||||||
// coming from, first XML attributes, then XML style, then default
|
// 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;
|
block = -1;
|
||||||
value.dataType = Res_value::TYPE_ATTRIBUTE;
|
value.dataType = Res_value::TYPE_ATTRIBUTE;
|
||||||
value.data = srcValues[ii];
|
value.data = srcValues[ii];
|
||||||
DEBUG_STYLES(ALOGI("-> From values: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
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.
|
// 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;
|
block = defStyleEnt->stringBlock;
|
||||||
typeSetFlags = defStyleTypeSetFlags;
|
typeSetFlags = defStyleTypeSetFlags;
|
||||||
value = defStyleEnt->map.value;
|
value = defStyleEnt->map.value;
|
||||||
DEBUG_STYLES(ALOGI("-> From def style: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defStyleEnt++;
|
defStyleEnt++;
|
||||||
}
|
}
|
||||||
@@ -1130,38 +1137,45 @@ static jboolean android_content_AssetManager_resolveAttrs(JNIEnv* env, jobject c
|
|||||||
ssize_t newBlock = theme->resolveAttributeReference(&value, block,
|
ssize_t newBlock = theme->resolveAttributeReference(&value, block,
|
||||||
&resid, &typeSetFlags, &config);
|
&resid, &typeSetFlags, &config);
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
DEBUG_STYLES(ALOGI("-> Resolved attr: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we still don't have a value for this attribute, try to find
|
// If we still don't have a value for this attribute, try to find
|
||||||
// it in the theme!
|
// it in the theme!
|
||||||
ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags);
|
ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags);
|
||||||
if (newBlock >= 0) {
|
if (newBlock >= 0) {
|
||||||
DEBUG_STYLES(ALOGI("-> From theme: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
newBlock = res.resolveReference(&value, block, &resid,
|
newBlock = res.resolveReference(&value, block, &resid,
|
||||||
&typeSetFlags, &config);
|
&typeSetFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (newBlock == BAD_INDEX) {
|
if (newBlock == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
DEBUG_STYLES(ALOGI("-> Resolved theme: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
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.
|
// Deal with the special @null value -- it turns back to TYPE_NULL.
|
||||||
if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) {
|
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.dataType = Res_value::TYPE_NULL;
|
||||||
block = -1;
|
block = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_STYLES(ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
curIdent, value.dataType, value.data));
|
ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", curIdent, value.dataType,
|
||||||
|
value.data);
|
||||||
|
}
|
||||||
|
|
||||||
// Write the final value back to Java.
|
// Write the final value back to Java.
|
||||||
dest[STYLE_TYPE] = value.dataType;
|
dest[STYLE_TYPE] = value.dataType;
|
||||||
@@ -1215,8 +1229,10 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_STYLES(ALOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x",
|
if (kDebugStyles) {
|
||||||
themeToken, defStyleAttr, defStyleRes, xmlParserToken));
|
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);
|
ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken);
|
||||||
const ResTable& res = theme->getResTable();
|
const ResTable& res = theme->getResTable();
|
||||||
@@ -1313,7 +1329,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
for (jsize ii=0; ii<NI; ii++) {
|
for (jsize ii=0; ii<NI; ii++) {
|
||||||
const uint32_t curIdent = (uint32_t)src[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
|
// Try to find a value for this attribute... we prioritize values
|
||||||
// coming from, first XML attributes, then XML style, then default
|
// coming from, first XML attributes, then XML style, then default
|
||||||
@@ -1334,8 +1352,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
xmlParser->getAttributeValue(ix, &value);
|
xmlParser->getAttributeValue(ix, &value);
|
||||||
ix++;
|
ix++;
|
||||||
curXmlAttr = xmlParser->getAttributeNameResID(ix);
|
curXmlAttr = xmlParser->getAttributeNameResID(ix);
|
||||||
DEBUG_STYLES(ALOGI("-> From XML: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
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.
|
// Skip through the style values until the end or the next possible match.
|
||||||
@@ -1348,8 +1367,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
block = styleEnt->stringBlock;
|
block = styleEnt->stringBlock;
|
||||||
typeSetFlags = styleTypeSetFlags;
|
typeSetFlags = styleTypeSetFlags;
|
||||||
value = styleEnt->map.value;
|
value = styleEnt->map.value;
|
||||||
DEBUG_STYLES(ALOGI("-> From style: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
styleEnt++;
|
styleEnt++;
|
||||||
}
|
}
|
||||||
@@ -1364,8 +1384,9 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
block = defStyleEnt->stringBlock;
|
block = defStyleEnt->stringBlock;
|
||||||
typeSetFlags = defStyleTypeSetFlags;
|
typeSetFlags = defStyleTypeSetFlags;
|
||||||
value = defStyleEnt->map.value;
|
value = defStyleEnt->map.value;
|
||||||
DEBUG_STYLES(ALOGI("-> From def style: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defStyleEnt++;
|
defStyleEnt++;
|
||||||
}
|
}
|
||||||
@@ -1376,38 +1397,44 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla
|
|||||||
ssize_t newBlock = theme->resolveAttributeReference(&value, block,
|
ssize_t newBlock = theme->resolveAttributeReference(&value, block,
|
||||||
&resid, &typeSetFlags, &config);
|
&resid, &typeSetFlags, &config);
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
DEBUG_STYLES(ALOGI("-> Resolved attr: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we still don't have a value for this attribute, try to find
|
// If we still don't have a value for this attribute, try to find
|
||||||
// it in the theme!
|
// it in the theme!
|
||||||
ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags);
|
ssize_t newBlock = theme->getAttribute(curIdent, &value, &typeSetFlags);
|
||||||
if (newBlock >= 0) {
|
if (newBlock >= 0) {
|
||||||
DEBUG_STYLES(ALOGI("-> From theme: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data);
|
||||||
|
}
|
||||||
newBlock = res.resolveReference(&value, block, &resid,
|
newBlock = res.resolveReference(&value, block, &resid,
|
||||||
&typeSetFlags, &config);
|
&typeSetFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (newBlock == BAD_INDEX) {
|
if (newBlock == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
DEBUG_STYLES(ALOGI("-> Resolved theme: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
value.dataType, value.data));
|
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.
|
// Deal with the special @null value -- it turns back to TYPE_NULL.
|
||||||
if (value.dataType == Res_value::TYPE_REFERENCE && value.data == 0) {
|
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.dataType = Res_value::TYPE_NULL;
|
||||||
block = kXmlBlock;
|
block = kXmlBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_STYLES(ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x",
|
if (kDebugStyles) {
|
||||||
curIdent, value.dataType, value.data));
|
ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", curIdent, value.dataType, value.data);
|
||||||
|
}
|
||||||
|
|
||||||
// Write the final value back to Java.
|
// Write the final value back to Java.
|
||||||
dest[STYLE_TYPE] = value.dataType;
|
dest[STYLE_TYPE] = value.dataType;
|
||||||
@@ -1536,12 +1563,12 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job
|
|||||||
//printf("Resolving attribute reference\n");
|
//printf("Resolving attribute reference\n");
|
||||||
ssize_t newBlock = res.resolveReference(&value, block, &resid,
|
ssize_t newBlock = res.resolveReference(&value, block, &resid,
|
||||||
&typeSetFlags, &config);
|
&typeSetFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (newBlock == BAD_INDEX) {
|
if (newBlock == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1649,12 +1676,12 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz
|
|||||||
//printf("Resolving attribute reference\n");
|
//printf("Resolving attribute reference\n");
|
||||||
ssize_t newBlock = res.resolveReference(&value, block, &resid,
|
ssize_t newBlock = res.resolveReference(&value, block, &resid,
|
||||||
&typeSetFlags, &config);
|
&typeSetFlags, &config);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (newBlock == BAD_INDEX) {
|
if (newBlock == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (newBlock >= 0) block = newBlock;
|
if (newBlock >= 0) block = newBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1761,12 +1788,12 @@ static jintArray android_content_AssetManager_getArrayStringInfo(JNIEnv* env, jo
|
|||||||
stringIndex = value.data;
|
stringIndex = value.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (stringBlock == BAD_INDEX) {
|
if (stringBlock == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
//todo: It might be faster to allocate a C array to contain
|
//todo: It might be faster to allocate a C array to contain
|
||||||
// the blocknums and indices, put them in there and then
|
// the blocknums and indices, put them in there and then
|
||||||
@@ -1809,12 +1836,12 @@ static jobjectArray android_content_AssetManager_getArrayStringResource(JNIEnv*
|
|||||||
|
|
||||||
// Take care of resolving the found resource to its final value.
|
// Take care of resolving the found resource to its final value.
|
||||||
ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL);
|
ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (value.dataType == Res_value::TYPE_STRING) {
|
if (value.dataType == Res_value::TYPE_STRING) {
|
||||||
const ResStringPool* pool = res.getTableStringBlock(block);
|
const ResStringPool* pool = res.getTableStringBlock(block);
|
||||||
const char* str8 = pool->string8At(value.data, &strLen);
|
const char* str8 = pool->string8At(value.data, &strLen);
|
||||||
@@ -1872,12 +1899,12 @@ static jintArray android_content_AssetManager_getArrayIntResource(JNIEnv* env, j
|
|||||||
|
|
||||||
// Take care of resolving the found resource to its final value.
|
// Take care of resolving the found resource to its final value.
|
||||||
ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL);
|
ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL);
|
||||||
#if THROW_ON_BAD_ID
|
if (kThrowOnBadId) {
|
||||||
if (block == BAD_INDEX) {
|
if (block == BAD_INDEX) {
|
||||||
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
if (value.dataType >= Res_value::TYPE_FIRST_INT
|
if (value.dataType >= Res_value::TYPE_FIRST_INT
|
||||||
&& value.dataType <= Res_value::TYPE_LAST_INT) {
|
&& value.dataType <= Res_value::TYPE_LAST_INT) {
|
||||||
int intVal = value.data;
|
int intVal = value.data;
|
||||||
@@ -1909,7 +1936,6 @@ static jintArray android_content_AssetManager_getStyleAttributes(JNIEnv* env, jo
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Res_value value;
|
|
||||||
const ResTable::bag_entry* bag = startOfBag;
|
const ResTable::bag_entry* bag = startOfBag;
|
||||||
for (size_t i=0; ((ssize_t)i)<N; i++, bag++) {
|
for (size_t i=0; ((ssize_t)i)<N; i++, bag++) {
|
||||||
int resourceId = bag->map.name.ident;
|
int resourceId = bag->map.name.ident;
|
||||||
|
|||||||
@@ -85,15 +85,6 @@ static struct binderinternal_offsets_t
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static struct debug_offsets_t
|
|
||||||
{
|
|
||||||
// Class state.
|
|
||||||
jclass mClass;
|
|
||||||
|
|
||||||
} gDebugOffsets;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static struct error_offsets_t
|
static struct error_offsets_t
|
||||||
{
|
{
|
||||||
jclass mClass;
|
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:
|
// From frameworks/base/core/java/android/content/EventLogTags.logtags:
|
||||||
#define ENABLE_BINDER_SAMPLE 0
|
|
||||||
|
static const bool kEnableBinderSample = false;
|
||||||
|
|
||||||
#define LOGTAG_BINDER_OPERATION 52004
|
#define LOGTAG_BINDER_OPERATION 52004
|
||||||
|
|
||||||
static void conditionally_log_binder_call(int64_t start_millis,
|
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",
|
ALOGV("Java code calling transact on %p in Java object %p with code %" PRId32 "\n",
|
||||||
target, obj, code);
|
target, obj, code);
|
||||||
|
|
||||||
#if ENABLE_BINDER_SAMPLE
|
|
||||||
|
bool time_binder_calls;
|
||||||
|
int64_t start_millis;
|
||||||
|
if (kEnableBinderSample) {
|
||||||
// Only log the binder call duration for things on the Java-level main thread.
|
// Only log the binder call duration for things on the Java-level main thread.
|
||||||
// But if we don't
|
// But if we don't
|
||||||
const bool time_binder_calls = should_time_binder_calls();
|
time_binder_calls = should_time_binder_calls();
|
||||||
|
|
||||||
int64_t start_millis;
|
|
||||||
if (time_binder_calls) {
|
if (time_binder_calls) {
|
||||||
start_millis = uptimeMillis();
|
start_millis = uptimeMillis();
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
//printf("Transact from Java code to %p sending: ", target); data->print();
|
//printf("Transact from Java code to %p sending: ", target); data->print();
|
||||||
status_t err = target->transact(code, *data, reply, flags);
|
status_t err = target->transact(code, *data, reply, flags);
|
||||||
//if (reply) printf("Transact from Java code to %p received: ", target); reply->print();
|
//if (reply) printf("Transact from Java code to %p received: ", target); reply->print();
|
||||||
#if ENABLE_BINDER_SAMPLE
|
|
||||||
|
if (kEnableBinderSample) {
|
||||||
if (time_binder_calls) {
|
if (time_binder_calls) {
|
||||||
conditionally_log_binder_call(start_millis, target, code);
|
conditionally_log_binder_call(start_millis, target, code);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (err == NO_ERROR) {
|
if (err == NO_ERROR) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
|
|||||||
@@ -43,13 +43,13 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define POLICY_DEBUG 0
|
|
||||||
#define GUARD_THREAD_PRIORITY 0
|
#define GUARD_THREAD_PRIORITY 0
|
||||||
|
|
||||||
#define DEBUG_PROC(x) //x
|
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
|
|
||||||
|
static const bool kDebugPolicy = false;
|
||||||
|
static const bool kDebugProc = false;
|
||||||
|
|
||||||
#if GUARD_THREAD_PRIORITY
|
#if GUARD_THREAD_PRIORITY
|
||||||
Mutex gKeyCreateMutex;
|
Mutex gKeyCreateMutex;
|
||||||
static pthread_key_t gBgKey = -1;
|
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);
|
ALOGV("%s pid=%d grp=%" PRId32, __func__, pid, grp);
|
||||||
DIR *d;
|
DIR *d;
|
||||||
FILE *fp;
|
|
||||||
char proc_path[255];
|
char proc_path[255];
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
@@ -191,7 +190,7 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
|
|||||||
}
|
}
|
||||||
SchedPolicy sp = (SchedPolicy) grp;
|
SchedPolicy sp = (SchedPolicy) grp;
|
||||||
|
|
||||||
#if POLICY_DEBUG
|
if (kDebugPolicy) {
|
||||||
char cmdline[32];
|
char cmdline[32];
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@@ -210,7 +209,8 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
|
|||||||
} else {
|
} else {
|
||||||
ALOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
|
ALOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
sprintf(proc_path, "/proc/%d/task", pid);
|
sprintf(proc_path, "/proc/%d/task", pid);
|
||||||
if (!(d = opendir(proc_path))) {
|
if (!(d = opendir(proc_path))) {
|
||||||
// If the process exited on us, don't generate an exception
|
// 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 char term = (char)(mode&PROC_TERM_MASK);
|
||||||
const jsize start = i;
|
const jsize start = i;
|
||||||
if (i >= endIndex) {
|
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;
|
res = JNI_FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -829,7 +831,9 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz,
|
|||||||
int fd = open(file8, O_RDONLY);
|
int fd = open(file8, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0) {
|
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);
|
env->ReleaseStringUTFChars(file, file8);
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
@@ -840,7 +844,9 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz,
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (len < 0) {
|
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;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/DisplayEventReceiver",
|
int res = jniRegisterNativeMethods(env, "android/view/DisplayEventReceiver",
|
||||||
gMethods, NELEM(gMethods));
|
gMethods, NELEM(gMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
FIND_CLASS(gDisplayEventReceiverClassInfo.clazz, "android/view/DisplayEventReceiver");
|
FIND_CLASS(gDisplayEventReceiverClassInfo.clazz, "android/view/DisplayEventReceiver");
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ int register_android_view_InputChannel(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/InputChannel",
|
int res = jniRegisterNativeMethods(env, "android/view/InputChannel",
|
||||||
gInputChannelMethods, NELEM(gInputChannelMethods));
|
gInputChannelMethods, NELEM(gInputChannelMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
FIND_CLASS(gInputChannelClassInfo.clazz, "android/view/InputChannel");
|
FIND_CLASS(gInputChannelClassInfo.clazz, "android/view/InputChannel");
|
||||||
|
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ int register_android_view_InputEventReceiver(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/InputEventReceiver",
|
int res = jniRegisterNativeMethods(env, "android/view/InputEventReceiver",
|
||||||
gMethods, NELEM(gMethods));
|
gMethods, NELEM(gMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
FIND_CLASS(gInputEventReceiverClassInfo.clazz, "android/view/InputEventReceiver");
|
FIND_CLASS(gInputEventReceiverClassInfo.clazz, "android/view/InputEventReceiver");
|
||||||
|
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ int register_android_view_InputEventSender(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/InputEventSender",
|
int res = jniRegisterNativeMethods(env, "android/view/InputEventSender",
|
||||||
gMethods, NELEM(gMethods));
|
gMethods, NELEM(gMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
FIND_CLASS(gInputEventSenderClassInfo.clazz, "android/view/InputEventSender");
|
FIND_CLASS(gInputEventSenderClassInfo.clazz, "android/view/InputEventSender");
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,6 @@ static void pointerCoordsFromNative(JNIEnv* env, const PointerCoords* rawPointer
|
|||||||
jfloat* outValues = static_cast<jfloat*>(env->GetPrimitiveArrayCritical(
|
jfloat* outValues = static_cast<jfloat*>(env->GetPrimitiveArrayCritical(
|
||||||
outValuesArray, NULL));
|
outValuesArray, NULL));
|
||||||
|
|
||||||
const float* values = rawPointerCoords->values;
|
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
do {
|
do {
|
||||||
uint32_t axis = bits.clearFirstMarkedBit();
|
uint32_t axis = bits.clearFirstMarkedBit();
|
||||||
@@ -873,6 +872,7 @@ int register_android_view_MotionEvent(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/MotionEvent",
|
int res = jniRegisterNativeMethods(env, "android/view/MotionEvent",
|
||||||
gMotionEventMethods, NELEM(gMotionEventMethods));
|
gMotionEventMethods, NELEM(gMotionEventMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
FIND_CLASS(gMotionEventClassInfo.clazz, "android/view/MotionEvent");
|
FIND_CLASS(gMotionEventClassInfo.clazz, "android/view/MotionEvent");
|
||||||
gMotionEventClassInfo.clazz = jclass(env->NewGlobalRef(gMotionEventClassInfo.clazz));
|
gMotionEventClassInfo.clazz = jclass(env->NewGlobalRef(gMotionEventClassInfo.clazz));
|
||||||
|
|||||||
@@ -148,11 +148,6 @@ static void setStartDelay(JNIEnv* env, jobject clazz, jlong animatorPtr, jlong s
|
|||||||
animator->setStartDelay(startDelay);
|
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) {
|
static void setInterpolator(JNIEnv* env, jobject clazz, jlong animatorPtr, jlong interpolatorPtr) {
|
||||||
BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr);
|
BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr);
|
||||||
Interpolator* interpolator = reinterpret_cast<Interpolator*>(interpolatorPtr);
|
Interpolator* interpolator = reinterpret_cast<Interpolator*>(interpolatorPtr);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz,
|
|||||||
status_t res;
|
status_t res;
|
||||||
if (allLayers) {
|
if (allLayers) {
|
||||||
minLayer = 0;
|
minLayer = 0;
|
||||||
maxLayer = -1UL;
|
maxLayer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = screenshot->update(displayToken, sourceCrop, width, height,
|
res = screenshot->update(displayToken, sourceCrop, width, height,
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ int register_android_view_VelocityTracker(JNIEnv* env) {
|
|||||||
int res = jniRegisterNativeMethods(env, "android/view/VelocityTracker",
|
int res = jniRegisterNativeMethods(env, "android/view/VelocityTracker",
|
||||||
gVelocityTrackerMethods, NELEM(gVelocityTrackerMethods));
|
gVelocityTrackerMethods, NELEM(gVelocityTrackerMethods));
|
||||||
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||||
|
(void)res;
|
||||||
|
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
FIND_CLASS(clazz, "android/view/VelocityTracker$Estimator");
|
FIND_CLASS(clazz, "android/view/VelocityTracker$Estimator");
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ isFileDifferent(const char* filePath, size_t fileSize, time_t modifiedTime,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->st_size != fileSize) {
|
if (static_cast<uint64_t>(st->st_size) != static_cast<uint64_t>(fileSize)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,6 @@ static int findSupportedAbi(JNIEnv *env, jlong apkHandle, jobjectArray supported
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipEntryRO entry = NULL;
|
ZipEntryRO entry = NULL;
|
||||||
char fileName[PATH_MAX];
|
|
||||||
int status = NO_NATIVE_LIBRARIES;
|
int status = NO_NATIVE_LIBRARIES;
|
||||||
while ((entry = it->next()) != NULL) {
|
while ((entry = it->next()) != NULL) {
|
||||||
// We're currently in the lib/ directory of the APK, so it does have some native
|
// We're currently in the lib/ directory of the APK, so it does have some native
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define LOG_TAG "NetworkStats"
|
#define LOG_TAG "NetworkStats"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
@@ -187,7 +188,7 @@ static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats,
|
|||||||
if (endPos - pos == 3) {
|
if (endPos - pos == 3) {
|
||||||
rawTag = 0;
|
rawTag = 0;
|
||||||
} else {
|
} else {
|
||||||
if (sscanf(pos, "%llx", &rawTag) != 1) {
|
if (sscanf(pos, "%" PRIx64, &rawTag) != 1) {
|
||||||
ALOGE("bad tag: %s", pos);
|
ALOGE("bad tag: %s", pos);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -204,7 +205,7 @@ static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats,
|
|||||||
while (*pos == ' ') pos++;
|
while (*pos == ' ') pos++;
|
||||||
|
|
||||||
// Parse remaining fields.
|
// 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.uid, &s.set, &s.rxBytes, &s.rxPackets,
|
||||||
&s.txBytes, &s.txPackets) == 6) {
|
&s.txBytes, &s.txPackets) == 6) {
|
||||||
if (limitUid != -1 && limitUid != s.uid) {
|
if (limitUid != -1 && limitUid != s.uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user