Remove asserts and add BuildConfig (flutter/engine#8821)
This commit is contained in:
@@ -89,6 +89,23 @@ shared_library("flutter_shell_native") {
|
||||
ldflags = [ "-Wl,--version-script=" + rebase_path("android_exports.lst") ]
|
||||
}
|
||||
|
||||
action("gen_android_build_config_java") {
|
||||
script = "$flutter_root/tools/gen_android_buildconfig.py"
|
||||
|
||||
build_config_java = "$target_gen_dir/io/flutter/BuildConfig.java"
|
||||
|
||||
outputs = [
|
||||
build_config_java,
|
||||
]
|
||||
|
||||
args = [
|
||||
"--out",
|
||||
rebase_path(build_config_java),
|
||||
"--runtime-mode",
|
||||
flutter_runtime_mode,
|
||||
]
|
||||
}
|
||||
|
||||
action("flutter_shell_java") {
|
||||
script = "//build/android/gyp/javac.py"
|
||||
depfile = "$target_gen_dir/$target_name.d"
|
||||
@@ -173,6 +190,8 @@ action("flutter_shell_java") {
|
||||
"io/flutter/view/VsyncWaiter.java",
|
||||
]
|
||||
|
||||
sources += get_target_outputs(":gen_android_build_config_java")
|
||||
|
||||
sources += [ "$flutter_root/third_party/bsdiff/io/flutter/util/BSDiff.java" ]
|
||||
|
||||
android_support_jars = [
|
||||
@@ -208,6 +227,10 @@ action("flutter_shell_java") {
|
||||
]
|
||||
|
||||
args += rebase_path(sources, root_build_dir)
|
||||
|
||||
deps = [
|
||||
":gen_android_build_config_java",
|
||||
]
|
||||
}
|
||||
|
||||
action("icudtl_object") {
|
||||
|
||||
@@ -7,6 +7,7 @@ package io.flutter.plugin.common;
|
||||
import android.util.Log;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryReply;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler;
|
||||
|
||||
@@ -39,9 +40,17 @@ public final class BasicMessageChannel<T> {
|
||||
* @param codec a {@link MessageCodec}.
|
||||
*/
|
||||
public BasicMessageChannel(BinaryMessenger messenger, String name, MessageCodec<T> codec) {
|
||||
assert messenger != null;
|
||||
assert name != null;
|
||||
assert codec != null;
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (messenger == null) {
|
||||
throw new AssertionError("Parameter messenger must not be null.");
|
||||
}
|
||||
if (name == null) {
|
||||
throw new AssertionError("Parameter name must not be null.");
|
||||
}
|
||||
if (codec == null) {
|
||||
throw new AssertionError("Parameter codec must not be null.");
|
||||
}
|
||||
}
|
||||
this.messenger = messenger;
|
||||
this.name = name;
|
||||
this.codec = codec;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
package io.flutter.plugin.common;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryReply;
|
||||
|
||||
@@ -55,9 +57,17 @@ public final class EventChannel {
|
||||
* @param codec a {@link MessageCodec}.
|
||||
*/
|
||||
public EventChannel(BinaryMessenger messenger, String name, MethodCodec codec) {
|
||||
assert messenger != null;
|
||||
assert name != null;
|
||||
assert codec != null;
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (messenger == null) {
|
||||
throw new AssertionError("Parameter messenger must not be null.");
|
||||
}
|
||||
if (name == null) {
|
||||
throw new AssertionError("Parameter name must not be null.");
|
||||
}
|
||||
if (codec == null) {
|
||||
throw new AssertionError("Parameter codec must not be null.");
|
||||
}
|
||||
}
|
||||
this.messenger = messenger;
|
||||
this.name = name;
|
||||
this.codec = codec;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package io.flutter.plugin.common;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
|
||||
/**
|
||||
* Thrown to indicate that a Flutter method invocation failed on the Flutter side.
|
||||
*/
|
||||
@@ -13,7 +15,9 @@ public class FlutterException extends RuntimeException {
|
||||
|
||||
FlutterException(String code, String message, Object details) {
|
||||
super(message);
|
||||
assert code != null;
|
||||
if (BuildConfig.DEBUG && code == null) {
|
||||
throw new AssertionError("Parameter code must not be null.");
|
||||
}
|
||||
this.code = code;
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.support.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
|
||||
/**
|
||||
* Command object representing a method call on a {@link MethodChannel}.
|
||||
*/
|
||||
@@ -33,7 +35,9 @@ public final class MethodCall {
|
||||
* @param arguments the arguments, a value supported by the channel's message codec.
|
||||
*/
|
||||
public MethodCall(String method, Object arguments) {
|
||||
assert method != null;
|
||||
if (BuildConfig.DEBUG && method == null) {
|
||||
throw new AssertionError("Parameter method must not be null.");
|
||||
}
|
||||
this.method = method;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,11 @@ package io.flutter.plugin.common;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler;
|
||||
import io.flutter.plugin.common.BinaryMessenger.BinaryReply;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
@@ -53,9 +56,17 @@ public final class MethodChannel {
|
||||
* @param codec a {@link MessageCodec}.
|
||||
*/
|
||||
public MethodChannel(BinaryMessenger messenger, String name, MethodCodec codec) {
|
||||
assert messenger != null;
|
||||
assert name != null;
|
||||
assert codec != null;
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (messenger == null) {
|
||||
throw new AssertionError("Parameter messenger must not be null.");
|
||||
}
|
||||
if (name == null) {
|
||||
throw new AssertionError("Parameter name must not be null.");
|
||||
}
|
||||
if (codec == null) {
|
||||
throw new AssertionError("Parameter codec must not be null.");
|
||||
}
|
||||
}
|
||||
this.messenger = messenger;
|
||||
this.name = name;
|
||||
this.codec = codec;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package io.flutter.plugin.common;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -15,8 +17,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* MessageCodec using the Flutter standard binary encoding.
|
||||
*
|
||||
@@ -109,7 +109,9 @@ public class StandardMessageCodec implements MessageCodec<Object> {
|
||||
* Uses an expanding code of 1 to 5 bytes to optimize for small values.
|
||||
*/
|
||||
protected static final void writeSize(ByteArrayOutputStream stream, int value) {
|
||||
assert 0 <= value;
|
||||
if (BuildConfig.DEBUG && 0 > value) {
|
||||
throw new AssertionError("Attempted to write a negative size.");
|
||||
}
|
||||
if (value < 254) {
|
||||
stream.write(value);
|
||||
} else if (value <= 0xffff) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.view.accessibility.AccessibilityNodeProvider;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
import io.flutter.embedding.engine.systemchannels.AccessibilityChannel;
|
||||
import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate;
|
||||
import io.flutter.util.Predicate;
|
||||
@@ -594,10 +595,14 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
}
|
||||
|
||||
if (semanticsNode.parent != null) {
|
||||
assert semanticsNode.id > ROOT_NODE_ID;
|
||||
if (BuildConfig.DEBUG && semanticsNode.id <= ROOT_NODE_ID) {
|
||||
throw new AssertionError("Semantics node id is not > ROOT_NODE_ID.");
|
||||
}
|
||||
result.setParent(rootAccessibilityView, semanticsNode.parent.id);
|
||||
} else {
|
||||
assert semanticsNode.id == ROOT_NODE_ID;
|
||||
if (BuildConfig.DEBUG && semanticsNode.id != ROOT_NODE_ID) {
|
||||
throw new AssertionError("Semantics node id does not equal ROOT_NODE_ID.");
|
||||
}
|
||||
result.setParent(rootAccessibilityView);
|
||||
}
|
||||
|
||||
@@ -706,7 +711,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
|
||||
boolean hasCheckedState = semanticsNode.hasFlag(Flag.HAS_CHECKED_STATE);
|
||||
boolean hasToggledState = semanticsNode.hasFlag(Flag.HAS_TOGGLED_STATE);
|
||||
assert !(hasCheckedState && hasToggledState);
|
||||
if (BuildConfig.DEBUG && (hasCheckedState && hasToggledState)) {
|
||||
throw new AssertionError("Expected semanticsNode to have checked state and toggled state.");
|
||||
}
|
||||
result.setCheckable(hasCheckedState || hasToggledState);
|
||||
if (hasCheckedState) {
|
||||
result.setChecked(semanticsNode.hasFlag(Flag.IS_CHECKED));
|
||||
@@ -1055,7 +1062,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
* Returns the {@link SemanticsNode} at the root of Flutter's semantics tree.
|
||||
*/
|
||||
private SemanticsNode getRootSemanticsNode() {
|
||||
assert flutterSemanticsTree.containsKey(0);
|
||||
if (BuildConfig.DEBUG && !flutterSemanticsTree.containsKey(0)) {
|
||||
throw new AssertionError("Attempted to getRootSemanticsNode without a root sematnics node.");
|
||||
}
|
||||
return flutterSemanticsTree.get(0);
|
||||
}
|
||||
|
||||
@@ -1317,8 +1326,14 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
visibleChildren += 1;
|
||||
}
|
||||
}
|
||||
assert(object.scrollIndex + visibleChildren <= object.scrollChildren);
|
||||
assert(!object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN));
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (object.scrollIndex + visibleChildren > object.scrollChildren) {
|
||||
throw new AssertionError("Scroll index is out of bounds.");
|
||||
}
|
||||
if (object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN)) {
|
||||
throw new AssertionError("Attempted to move Accessibility Focus to hidden child.");
|
||||
}
|
||||
}
|
||||
// The setToIndex should be the index of the last visible child. Because we counted all
|
||||
// children, including the first index we need to subtract one.
|
||||
//
|
||||
@@ -1470,7 +1485,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
* invoked to create an {@link AccessibilityEvent} for the {@link #rootAccessibilityView}.
|
||||
*/
|
||||
private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) {
|
||||
assert virtualViewId != ROOT_NODE_ID;
|
||||
if (BuildConfig.DEBUG && virtualViewId == ROOT_NODE_ID) {
|
||||
throw new AssertionError("VirtualView node must not be the root node.");
|
||||
}
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
|
||||
event.setPackageName(rootAccessibilityView.getContext().getPackageName());
|
||||
event.setSource(rootAccessibilityView, virtualViewId);
|
||||
@@ -1482,8 +1499,14 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
* semantics tree.
|
||||
*/
|
||||
private void willRemoveSemanticsNode(SemanticsNode semanticsNodeToBeRemoved) {
|
||||
assert flutterSemanticsTree.containsKey(semanticsNodeToBeRemoved.id);
|
||||
assert flutterSemanticsTree.get(semanticsNodeToBeRemoved.id) == semanticsNodeToBeRemoved;
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (!flutterSemanticsTree.containsKey(semanticsNodeToBeRemoved.id)) {
|
||||
throw new AssertionError("Attempted to remove a node that is not in the tree.");
|
||||
}
|
||||
if (flutterSemanticsTree.get(semanticsNodeToBeRemoved.id) != semanticsNodeToBeRemoved) {
|
||||
throw new AssertionError("Flutter semantics tree failed to get expected node when searching by id.");
|
||||
}
|
||||
}
|
||||
// TODO(mattcarroll): should parent be set to "null" here? Changing the parent seems like the
|
||||
// behavior of a method called "removeSemanticsNode()". The same is true
|
||||
// for null'ing accessibilityFocusedSemanticsNode, inputFocusedSemanticsNode,
|
||||
@@ -1779,7 +1802,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
}
|
||||
|
||||
private boolean hadFlag(@NonNull Flag flag) {
|
||||
assert hadPreviousConfig;
|
||||
if (BuildConfig.DEBUG && !hadPreviousConfig) {
|
||||
throw new AssertionError("Attempted to check hadFlag but had no previous config.");
|
||||
}
|
||||
return (previousFlags & flag.value) != 0;
|
||||
}
|
||||
|
||||
@@ -1909,7 +1934,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
} else {
|
||||
// If we receive a different overrideId it means that we were passed
|
||||
// a standard action to override that we don't yet support.
|
||||
assert action.overrideId == -1;
|
||||
if (BuildConfig.DEBUG && action.overrideId != -1) {
|
||||
throw new AssertionError("Expected action.overrideId to be -1.");
|
||||
}
|
||||
customAccessibilityActions.add(action);
|
||||
}
|
||||
customAccessibilityActions.add(action);
|
||||
@@ -1931,7 +1958,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
}
|
||||
|
||||
private Rect getGlobalRect() {
|
||||
assert !globalGeometryDirty;
|
||||
if (BuildConfig.DEBUG && globalGeometryDirty) {
|
||||
throw new AssertionError("Attempted to getGlobalRect with a dirty geometry.");
|
||||
}
|
||||
return globalRect;
|
||||
}
|
||||
|
||||
@@ -2052,8 +2081,14 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
|
||||
globalGeometryDirty = false;
|
||||
}
|
||||
|
||||
assert globalTransform != null;
|
||||
assert globalRect != null;
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (globalTransform == null) {
|
||||
throw new AssertionError("Expected globalTransform to not be null.");
|
||||
}
|
||||
if (globalRect == null) {
|
||||
throw new AssertionError("Expected globalRect to not be null.");
|
||||
}
|
||||
}
|
||||
|
||||
if (childrenInTraversalOrder != null) {
|
||||
for (int i = 0; i < childrenInTraversalOrder.size(); ++i) {
|
||||
|
||||
@@ -13,8 +13,11 @@ import android.content.res.AssetManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import io.flutter.BuildConfig;
|
||||
import io.flutter.util.BSDiff;
|
||||
import io.flutter.util.PathUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.*;
|
||||
@@ -95,7 +98,9 @@ class ResourceExtractor {
|
||||
}
|
||||
|
||||
ResourceExtractor start() {
|
||||
assert mExtractTask == null;
|
||||
if (BuildConfig.DEBUG && mExtractTask != null) {
|
||||
throw new AssertionError("Attempted to start resource extraction while another extraction was in progress.");
|
||||
}
|
||||
mExtractTask = new ExtractTask();
|
||||
mExtractTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
return this;
|
||||
|
||||
@@ -1,160 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<issues format="4" by="lint 26.1.1">
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert semanticsNode.id > ROOT_NODE_ID;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="537"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert semanticsNode.id == ROOT_NODE_ID;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="540"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert !(hasCheckedState && hasToggledState);"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="649"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert flutterSemanticsTree.containsKey(0);"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="984"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert(object.scrollIndex + visibleChildren <= object.scrollChildren);"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1240"
|
||||
column="21"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert(!object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN));"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1241"
|
||||
column="21"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert virtualViewId != ROOT_NODE_ID;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1393"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert flutterSemanticsTree.containsKey(semanticsNodeToBeRemoved.id);"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1405"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert flutterSemanticsTree.get(semanticsNodeToBeRemoved.id) == semanticsNodeToBeRemoved;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1406"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert hadPreviousConfig;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1701"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert action.overrideId == -1;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1830"
|
||||
column="25"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert !globalGeometryDirty;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1852"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert packet.position() % (POINTER_DATA_FIELD_COUNT * BYTE_PER_FIELD) == 0;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java"
|
||||
line="80"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Assert"
|
||||
message="Assertions are unreliable in Dalvik and unimplemented in ART. Use `BuildConfig.DEBUG` conditional checks instead."
|
||||
errorLine1=" assert 0 <= value;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java"
|
||||
line="112"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="InlinedApi"
|
||||
message="Field requires API level 18 (current min is 16): `android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER_PORTRAIT`"
|
||||
@@ -217,7 +63,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
|
||||
line="336"
|
||||
line="370"
|
||||
column="29"/>
|
||||
</issue>
|
||||
|
||||
@@ -228,7 +74,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
|
||||
line="336"
|
||||
line="370"
|
||||
column="71"/>
|
||||
</issue>
|
||||
|
||||
@@ -254,28 +100,6 @@
|
||||
column="82"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnsafeDynamicallyLoadedCode"
|
||||
message="Dynamically loading code using `load` is risky, please use `loadLibrary` instead when possible"
|
||||
errorLine1=" System.load(lib.getAbsolutePath());"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java"
|
||||
line="164"
|
||||
column="17"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StaticFieldLeak"
|
||||
message="Do not place Android context classes in static fields (static reference to `ResourceUpdater` which has field `context` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
|
||||
errorLine1=" private static ResourceUpdater sResourceUpdater;"
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java"
|
||||
line="80"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StaticFieldLeak"
|
||||
message="Do not place Android context classes in static fields (static reference to `ResourceExtractor` which has field `mContext` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
|
||||
@@ -283,7 +107,7 @@
|
||||
errorLine2=" ~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java"
|
||||
line="81"
|
||||
line="77"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
@@ -305,18 +129,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
|
||||
line="48"
|
||||
column="19"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StaticFieldLeak"
|
||||
message="This AsyncTask class should be static or leaks might occur (io.flutter.view.ResourceUpdater.DownloadTask)"
|
||||
errorLine1=" private class DownloadTask extends AsyncTask<String, String, Void> {"
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="92"
|
||||
line="51"
|
||||
column="19"/>
|
||||
</issue>
|
||||
|
||||
@@ -327,7 +140,7 @@
|
||||
errorLine2=" ^">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="1718"
|
||||
line="1824"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
@@ -360,76 +173,10 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
|
||||
line="201"
|
||||
line="168"
|
||||
column="17"/>
|
||||
</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, "Extracted override resource " + entry.getName());"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
|
||||
line="328"
|
||||
column="17"/>
|
||||
</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, "Checking for updates at " + unresolvedURL);"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="102"
|
||||
column="17"/>
|
||||
</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, "Resolved update URL " + resolvedURL);"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="117"
|
||||
column="17"/>
|
||||
</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, "HTTP response code " + responseCode);"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="120"
|
||||
column="17"/>
|
||||
</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, "Downloading update " + unresolvedURL);"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="133"
|
||||
column="21"/>
|
||||
</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, "Update downloaded in " + totalMillis / 100 / 10. + "s");"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
|
||||
line="142"
|
||||
column="25"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UseSparseArrays"
|
||||
message="Use `new SparseArray<SemanticsNode>(...)` instead for better performance"
|
||||
@@ -437,7 +184,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="135"
|
||||
line="130"
|
||||
column="70"/>
|
||||
</issue>
|
||||
|
||||
@@ -448,7 +195,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
|
||||
line="160"
|
||||
line="155"
|
||||
column="88"/>
|
||||
</issue>
|
||||
|
||||
@@ -470,7 +217,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
|
||||
line="57"
|
||||
line="61"
|
||||
column="25"/>
|
||||
</issue>
|
||||
|
||||
@@ -481,7 +228,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java"
|
||||
line="311"
|
||||
line="367"
|
||||
column="18"/>
|
||||
</issue>
|
||||
|
||||
@@ -492,7 +239,7 @@
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
|
||||
line="508"
|
||||
line="391"
|
||||
column="20"/>
|
||||
</issue>
|
||||
|
||||
|
||||
@@ -13,6 +13,13 @@
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/util/Preconditions.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/util/Predicate.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/util/PathUtils.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/android/AndroidKeyProcessor.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java" />
|
||||
@@ -29,13 +36,6 @@
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java" />
|
||||
@@ -43,7 +43,9 @@
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/AccessibilityEventsDelegate.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java" />
|
||||
@@ -66,7 +68,6 @@
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java" />
|
||||
@@ -77,5 +78,6 @@
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/ResourceCleaner.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java" />
|
||||
<src file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java" />
|
||||
</module>
|
||||
</project>
|
||||
|
||||
45
engine/src/flutter/tools/gen_android_buildconfig.py
Normal file
45
engine/src/flutter/tools/gen_android_buildconfig.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
BUILD_CONFIG_TEMPLATE = """
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
||||
// THIS FILE IS AUTO_GENERATED
|
||||
// DO NOT EDIT THE VALUES HERE - SEE $flutter_root/tools/gen_android_buildconfig.py
|
||||
package io.flutter;
|
||||
|
||||
public final class BuildConfig {{
|
||||
private BuildConfig() {{}}
|
||||
|
||||
public final static boolean DEBUG = {0};
|
||||
public final static boolean PROFILE = {1};
|
||||
public final static boolean RELEASE = {2};
|
||||
}}
|
||||
"""
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Generate BuildConfig.java for Android')
|
||||
parser.add_argument('--runtime-mode', type=str, required=True)
|
||||
parser.add_argument('--out', type=str, required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
release ='release' in args.runtime_mode.lower()
|
||||
profile = not release and 'profile' in args.runtime_mode.lower()
|
||||
debug = not release and not profile and 'debug' in args.runtime_mode.lower()
|
||||
assert debug or profile or release
|
||||
|
||||
with open(os.path.abspath(args.out), 'w+') as output_file:
|
||||
output_file.write(BUILD_CONFIG_TEMPLATE.format(str(debug).lower(), str(profile).lower(), str(release).lower()))
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user