diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 66e98087c4e5c..a4fb16e88ce5a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -95,7 +95,7 @@ public class FlutterJNI { @UiThread public static native String nativeGetObservatoryUri(); - + private Long nativePlatformViewId; private FlutterRenderer.RenderSurface renderSurface; private AccessibilityDelegate accessibilityDelegate; diff --git a/shell/platform/android/io/flutter/plugin/common/ErrorLogResult.java b/shell/platform/android/io/flutter/plugin/common/ErrorLogResult.java index bfa8c2fd0d458..9c6aa67cc9d16 100644 --- a/shell/platform/android/io/flutter/plugin/common/ErrorLogResult.java +++ b/shell/platform/android/io/flutter/plugin/common/ErrorLogResult.java @@ -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 void success(@Nullable Object 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"); + } } } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ebd9552b43fc1..3aaf574eca698 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1821,16 +1821,18 @@ private boolean didChangeLabel() { } 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); + } } } } diff --git a/shell/platform/android/io/flutter/view/ResourceCleaner.java b/shell/platform/android/io/flutter/view/ResourceCleaner.java index babc53f6e0dfd..f1a27f133e646 100644 --- a/shell/platform/android/io/flutter/view/ResourceCleaner.java +++ b/shell/platform/android/io/flutter/view/ResourceCleaner.java @@ -9,6 +9,8 @@ import android.os.Handler; import android.util.Log; +import io.flutter.BuildConfig; + import java.io.File; import java.io.FilenameFilter; @@ -32,7 +34,9 @@ boolean hasFilesToDelete() { @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); diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index e7ff841148dd1..44f9e93f213bc 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -164,9 +164,9 @@ private boolean extractAPK(File dataDir) { 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 @@ private String checkTimestamp(File dataDir) { 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; } diff --git a/third_party/bsdiff/io/flutter/util/BSDiff.java b/third_party/bsdiff/io/flutter/util/BSDiff.java index 135882033cbc8..231b5a729e8dd 100644 --- a/third_party/bsdiff/io/flutter/util/BSDiff.java +++ b/third_party/bsdiff/io/flutter/util/BSDiff.java @@ -4,6 +4,8 @@ package io.flutter.util; +import io.flutter.BuildConfig; + import java.io.*; import java.util.zip.GZIPInputStream; diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml index 15319be270cfb..bf85990e5b034 100644 --- a/tools/android_lint/baseline.xml +++ b/tools/android_lint/baseline.xml @@ -118,7 +118,7 @@ errorLine2=" ~~~~~~~~~"> @@ -129,54 +129,10 @@ errorLine2=" ~~~~~~~~~~~"> - - - - - - - - - - - - - - - -