Merge "jni: isLoggable: adapt to removal of property name size limit" am: cf39eea407 am: 5f98be7f11

am: 3da7584dc4

Change-Id: I2fd96c0c9cae8043bb5fabaa32b542b6965abcf7
This commit is contained in:
Mark Salyzyn
2017-04-11 23:44:04 +00:00
committed by android-build-merger
2 changed files with 4 additions and 11 deletions

View File

@@ -212,7 +212,9 @@ public final class Log {
* @param tag The tag to check.
* @param level The level to check.
* @return Whether or not that this is allowed to be logged.
* @throws IllegalArgumentException is thrown if the tag.length() > 23.
* @throws IllegalArgumentException is thrown if the tag.length() > 23
* for Nougat (7.0) releases (API <= 23) and prior, there is no
* tag limit of concern after this API level.
*/
public static native boolean isLoggable(String tag, int level);

View File

@@ -58,16 +58,7 @@ static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring
return false;
}
jboolean result = false;
if ((strlen(chars)+sizeof(LOG_NAMESPACE)) > PROPERTY_KEY_MAX) {
char buf2[200];
snprintf(buf2, sizeof(buf2), "Log tag \"%s\" exceeds limit of %zu characters\n",
chars, PROPERTY_KEY_MAX - sizeof(LOG_NAMESPACE));
jniThrowException(env, "java/lang/IllegalArgumentException", buf2);
} else {
result = isLoggable(chars, level);
}
jboolean result = isLoggable(chars, level);
env->ReleaseStringUTFChars(tag, chars);
return result;