This commit is contained in:
Dan Field 2019-05-03 14:32:29 -07:00 committed by GitHub
parent c33363a729
commit 5fc7feffe7
7 changed files with 42 additions and 66 deletions

View File

@ -95,7 +95,7 @@ public class FlutterJNI {
@UiThread
public static native String nativeGetObservatoryUri();
private Long nativePlatformViewId;
private FlutterRenderer.RenderSurface renderSurface;
private AccessibilityDelegate accessibilityDelegate;

View File

@ -4,6 +4,8 @@
package io.flutter.plugin.common;
import io.flutter.BuildConfig;
import android.support.annotation.Nullable;
import android.util.Log;
@ -30,11 +32,15 @@ public class ErrorLogResult implements MethodChannel.Result {
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
String details = (errorDetails != null) ? " details: " + errorDetails : "";
Log.println(level, tag, errorMessage + details);
if (level >= Log.WARN || BuildConfig.DEBUG) {
Log.println(level, tag, errorMessage + details);
}
}
@Override
public void notImplemented() {
Log.println(level, tag, "method not implemented");
if (level >= Log.WARN || BuildConfig.DEBUG) {
Log.println(level, tag, "method not implemented");
}
}
}

View File

@ -1821,16 +1821,18 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
}
private void log(@NonNull String indent, boolean recursive) {
Log.i(TAG,
indent + "SemanticsNode id=" + id + " label=" + label + " actions=" + actions
+ " flags=" + flags + "\n" + indent + " +-- textDirection="
+ textDirection + "\n" + indent + " +-- rect.ltrb=(" + left + ", "
+ top + ", " + right + ", " + bottom + ")\n" + indent
+ " +-- transform=" + Arrays.toString(transform) + "\n");
if (childrenInTraversalOrder != null && recursive) {
String childIndent = indent + " ";
for (SemanticsNode child : childrenInTraversalOrder) {
child.log(childIndent, recursive);
if (BuildConfig.DEBUG) {
Log.i(TAG,
indent + "SemanticsNode id=" + id + " label=" + label + " actions=" + actions
+ " flags=" + flags + "\n" + indent + " +-- textDirection="
+ textDirection + "\n" + indent + " +-- rect.ltrb=(" + left + ", "
+ top + ", " + right + ", " + bottom + ")\n" + indent
+ " +-- transform=" + Arrays.toString(transform) + "\n");
if (childrenInTraversalOrder != null && recursive) {
String childIndent = indent + " ";
for (SemanticsNode child : childrenInTraversalOrder) {
child.log(childIndent, recursive);
}
}
}
}

View File

@ -9,6 +9,8 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import io.flutter.BuildConfig;
import java.io.File;
import java.io.FilenameFilter;
@ -32,7 +34,9 @@ class ResourceCleaner {
@Override
protected Void doInBackground(Void... unused) {
Log.i(TAG, "Cleaning " + mFilesToDelete.length + " resources.");
if (BuildConfig.DEBUG) {
Log.i(TAG, "Cleaning " + mFilesToDelete.length + " resources.");
}
for (File file : mFilesToDelete) {
if (file.exists()) {
deleteRecursively(file);

View File

@ -164,9 +164,9 @@ class ResourceExtractor {
OutputStream os = new FileOutputStream(output)) {
copy(is, os);
}
Log.i(TAG, "Extracted baseline resource " + resource);
if (BuildConfig.DEBUG) {
Log.i(TAG, "Extracted baseline resource " + resource);
}
} catch (FileNotFoundException fnfe) {
continue;
@ -202,17 +202,23 @@ class ResourceExtractor {
final String[] existingTimestamps = getExistingTimestamps(dataDir);
if (existingTimestamps == null) {
Log.i(TAG, "No extracted resources found");
if (BuildConfig.DEBUG) {
Log.i(TAG, "No extracted resources found");
}
return expectedTimestamp;
}
if (existingTimestamps.length == 1) {
Log.i(TAG, "Found extracted resources " + existingTimestamps[0]);
if (BuildConfig.DEBUG) {
Log.i(TAG, "Found extracted resources " + existingTimestamps[0]);
}
}
if (existingTimestamps.length != 1
|| !expectedTimestamp.equals(existingTimestamps[0])) {
Log.i(TAG, "Resource version mismatch " + expectedTimestamp);
if (BuildConfig.DEBUG) {
Log.i(TAG, "Resource version mismatch " + expectedTimestamp);
}
return expectedTimestamp;
}

View File

@ -4,6 +4,8 @@
package io.flutter.util;
import io.flutter.BuildConfig;
import java.io.*;
import java.util.zip.GZIPInputStream;

View File

@ -118,7 +118,7 @@
errorLine2=" ~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceCleaner.java"
line="22"
line="24"
column="19"/>
</issue>
@ -129,54 +129,10 @@
errorLine2=" ~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="51"
line="52"
column="19"/>
</issue>
<issue
id="LogConditional"
message="The log call Log.i(...) should be conditional: surround with `if (Log.isLoggable(...))` or `if (BuildConfig.DEBUG) { ... }`"
errorLine1=" Log.i(TAG,"
errorLine2=" ^">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="1824"
column="13"/>
</issue>
<issue
id="LogConditional"
message="The log call Log.println(...) should be conditional: surround with `if (Log.isLoggable(...))` or `if (BuildConfig.DEBUG) { ... }`"
errorLine1=" Log.println(level, tag, errorMessage + details);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/common/ErrorLogResult.java"
line="33"
column="9"/>
</issue>
<issue
id="LogConditional"
message="The log call Log.i(...) should be conditional: surround with `if (Log.isLoggable(...))` or `if (BuildConfig.DEBUG) { ... }`"
errorLine1=" Log.i(TAG, &quot;Cleaning &quot; + mFilesToDelete.length + &quot; resources.&quot;);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceCleaner.java"
line="35"
column="13"/>
</issue>
<issue
id="LogConditional"
message="The log call Log.i(...) should be conditional: surround with `if (Log.isLoggable(...))` or `if (BuildConfig.DEBUG) { ... }`"
errorLine1=" Log.i(TAG, &quot;Extracted baseline resource &quot; + resource);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="168"
column="17"/>
</issue>
<issue
id="UseSparseArrays"
message="Use `new SparseArray&lt;SemanticsNode>(...)` instead for better performance"