Guard against NewAPI failures (flutter/engine#8048)

Adds minimum SDK checks around minimum APIs.

flutter/flutter#28848
This commit is contained in:
Michael Klimushyn
2019-03-08 13:33:58 -08:00
committed by GitHub
parent 8545cec8d6
commit 3bf53be79c
9 changed files with 122 additions and 486 deletions

View File

@@ -134,7 +134,7 @@ public class FlutterSurfaceView extends SurfaceView implements FlutterRenderer.R
if (flutterRenderer != null) {
// If we're attached to an Android window then we were rendering a Flutter UI. Now that
// this FlutterSurfaceView is detached from the FlutterRenderer, we need to stop rendering.
if (isAttachedToWindow()) {
if (getWindowToken() != null) {
disconnectSurfaceFromRenderer();
}

View File

@@ -145,7 +145,7 @@ public class FlutterTextureView extends TextureView implements FlutterRenderer.R
if (flutterRenderer != null) {
// If we're attached to an Android window then we were rendering a Flutter UI. Now that
// this FlutterTextureView is detached from the FlutterRenderer, we need to stop rendering.
if (isAttachedToWindow()) {
if (getWindowToken() != null) {
disconnectSurfaceFromRenderer();
}

View File

@@ -4,6 +4,7 @@
package io.flutter.embedding.engine.android;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -12,6 +13,7 @@ import android.os.LocaleList;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;
@@ -179,6 +181,8 @@ public class FlutterView extends FrameLayout {
* the wider than expected padding when the status and navigation bars are hidden.
*/
@Override
@TargetApi(20)
@RequiresApi(20)
public final WindowInsets onApplyWindowInsets(WindowInsets insets) {
WindowInsets newInsets = super.onApplyWindowInsets(insets);

View File

@@ -132,12 +132,15 @@ public class PlatformPlugin implements ActivityLifecycleListener {
return;
}
@SuppressWarnings("deprecation")
TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
? new TaskDescription(description.label, 0, description.color)
: new TaskDescription(description.label, null, description.color);
activity.setTaskDescription(taskDescription);
// Linter refuses to believe we're only executing this code in API 28 unless we use distinct if blocks and
// hardcode the API 28 constant.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P && Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
activity.setTaskDescription(new TaskDescription(description.label));
}
if (Build.VERSION.SDK_INT >= 28) {
TaskDescription taskDescription = new TaskDescription(description.label, 0, description.color);
activity.setTaskDescription(taskDescription);
}
}
private void setSystemChromeEnabledSystemUIOverlays(List<PlatformChannel.SystemUiOverlay> overlaysToShow) {

View File

@@ -4,12 +4,15 @@
package io.flutter.view;
import android.annotation.TargetApi;
import android.app.Activity;
import android.graphics.Rect;
import android.opengl.Matrix;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
@@ -84,10 +87,12 @@ class AccessibilityBridge
SHOW_ON_SCREEN(1 << 8),
MOVE_CURSOR_FORWARD_BY_CHARACTER(1 << 9),
MOVE_CURSOR_BACKWARD_BY_CHARACTER(1 << 10),
/** These actions are only supported on Android 4.3 and above. */
SET_SELECTION(1 << 11),
COPY(1 << 12),
CUT(1 << 13),
PASTE(1 << 14),
/** End 4.3 only supported actions. */
DID_GAIN_ACCESSIBILITY_FOCUS(1 << 15),
DID_LOSE_ACCESSIBILITY_FOCUS(1 << 16),
CUSTOM_ACTION(1 << 17),
@@ -233,17 +238,22 @@ class AccessibilityBridge
}
result.setMovementGranularities(granularities);
}
if (object.hasAction(Action.SET_SELECTION)) {
result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);
}
if (object.hasAction(Action.COPY)) {
result.addAction(AccessibilityNodeInfo.ACTION_COPY);
}
if (object.hasAction(Action.CUT)) {
result.addAction(AccessibilityNodeInfo.ACTION_CUT);
}
if (object.hasAction(Action.PASTE)) {
result.addAction(AccessibilityNodeInfo.ACTION_PASTE);
// These are non-ops on older devices. Attempting to interact with the text will cause Talkback to read the
// contents of the text box instead.
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (object.hasAction(Action.SET_SELECTION)) {
result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);
}
if (object.hasAction(Action.COPY)) {
result.addAction(AccessibilityNodeInfo.ACTION_COPY);
}
if (object.hasAction(Action.CUT)) {
result.addAction(AccessibilityNodeInfo.ACTION_CUT);
}
if (object.hasAction(Action.PASTE)) {
result.addAction(AccessibilityNodeInfo.ACTION_PASTE);
}
}
if (object.hasFlag(Flag.IS_BUTTON)) {
@@ -312,11 +322,14 @@ class AccessibilityBridge
// We should prefer setCollectionInfo to the class names, as this way we get "In List"
// and "Out of list" announcements. But we don't always know the counts, so we
// can fallback to the generic scroll view class names.
//
// On older APIs, we always fall back to the generic scroll view class names here.
//
// TODO(dnfield): We should add semantics properties for rows and columns in 2 dimensional lists, e.g.
// GridView. Right now, we're only supporting ListViews and only if they have scroll children.
if (object.hasFlag(Flag.HAS_IMPLICIT_SCROLLING)) {
if (object.hasAction(Action.SCROLL_LEFT) || object.hasAction(Action.SCROLL_RIGHT)) {
if (shouldSetCollectionInfo(object)) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && shouldSetCollectionInfo(object)) {
result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(
0, // rows
object.scrollChildren, // columns
@@ -325,7 +338,7 @@ class AccessibilityBridge
result.setClassName("android.widget.HorizontalScrollView");
}
} else {
if (shouldSetCollectionInfo(object)) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && shouldSetCollectionInfo(object)) {
result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(
object.scrollChildren, // rows
0, // columns
@@ -465,9 +478,21 @@ class AccessibilityBridge
return true;
}
case AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: {
// Text selection APIs aren't available until API 18. We can't handle the case here so return false
// instead. It's extremely unlikely that this case would ever be triggered in the first place in API <
// 18.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
return false;
}
return performCursorMoveAction(object, virtualViewId, arguments, false);
}
case AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: {
// Text selection APIs aren't available until API 18. We can't handle the case here so return false
// instead. It's extremely unlikely that this case would ever be triggered in the first place in API <
// 18.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
return false;
}
return performCursorMoveAction(object, virtualViewId, arguments, true);
}
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
@@ -502,6 +527,12 @@ class AccessibilityBridge
return true;
}
case AccessibilityNodeInfo.ACTION_SET_SELECTION: {
// Text selection APIs aren't available until API 18. We can't handle the case here so return false
// instead. It's extremely unlikely that this case would ever be triggered in the first place in API <
// 18.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
return false;
}
final Map<String, Integer> selection = new HashMap<>();
final boolean hasSelection = arguments != null
&& arguments.containsKey(
@@ -553,6 +584,8 @@ class AccessibilityBridge
return false;
}
@RequiresApi(18)
@TargetApi(18)
boolean performCursorMoveAction(
SemanticsObject object, int virtualViewId, Bundle arguments, boolean forward) {
final int granularity =

View File

@@ -4,6 +4,7 @@
package io.flutter.view;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
@@ -17,6 +18,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.LocaleList;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;
@@ -654,6 +656,8 @@ public class FlutterView extends SurfaceView
// be padded. When the on-screen keyboard is detected, we want to include the full inset
// but when the inset is just the hidden nav bar, we want to provide a zero inset so the space
// can be used.
@TargetApi(20)
@RequiresApi(20)
int calculateBottomKeyboardInset(WindowInsets insets) {
int screenHeight = getRootView().getHeight();
// Magic number due to this being a heuristic. This should be replaced, but we have not
@@ -672,6 +676,8 @@ public class FlutterView extends SurfaceView
// This callback is not present in API < 20, which means lower API devices will see
// the wider than expected padding when the status and navigation bars are hidden.
@Override
@TargetApi(20)
@RequiresApi(20)
public final WindowInsets onApplyWindowInsets(WindowInsets insets) {
boolean statusBarHidden =
(SYSTEM_UI_FLAG_FULLSCREEN & getWindowSystemUiVisibility()) != 0;
@@ -963,8 +969,9 @@ public class FlutterView extends SurfaceView
@Override
public void onChange(boolean selfChange, Uri uri) {
String value = Settings.Global.getString(getContext().getContentResolver(),
Settings.Global.TRANSITION_ANIMATION_SCALE);
String value = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ? null
: Settings.Global.getString(getContext().getContentResolver(),
Settings.Global.TRANSITION_ANIMATION_SCALE);
if (value != null && value.equals("0")) {
mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value;
} else {
@@ -974,6 +981,9 @@ public class FlutterView extends SurfaceView
}
}
// This is guarded at instantiation time.
@TargetApi(19)
@RequiresApi(19)
class TouchExplorationListener implements AccessibilityManager.TouchExplorationStateChangeListener {
@Override
public void onTouchExplorationStateChanged(boolean enabled) {

View File

@@ -4,6 +4,8 @@
package io.flutter.view;
import static java.util.Arrays.asList;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -16,6 +18,7 @@ import io.flutter.util.PathUtils;
import org.json.JSONObject;
import java.io.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.concurrent.CancellationException;
@@ -30,10 +33,12 @@ import java.util.zip.ZipFile;
class ResourceExtractor {
private static final String TAG = "ResourceExtractor";
private static final String TIMESTAMP_PREFIX = "res_timestamp-";
private static final String[] SUPPORTED_ABIS = getSupportedAbis();
@SuppressWarnings("deprecation")
static long getVersionCode(PackageInfo packageInfo) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// Linter needs P (28) hardcoded or else it will fail these lines.
if (Build.VERSION.SDK_INT >= 28) {
return packageInfo.getLongVersionCode();
} else {
return packageInfo.versionCode;
@@ -244,7 +249,7 @@ class ResourceExtractor {
ZipEntry entry = null;
if (asset.endsWith(".so")) {
// Replicate library lookup logic.
for (String abi : Build.SUPPORTED_ABIS) {
for (String abi : SUPPORTED_ABIS) {
resource = "lib/" + abi + "/" + asset;
entry = zipFile.getEntry(resource);
if (entry == null) {
@@ -403,4 +408,14 @@ class ResourceExtractor {
return null;
}
}
private static String[] getSupportedAbis() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.SUPPORTED_ABIS.length > 0) {
return Build.SUPPORTED_ABIS;
} else {
ArrayList<String> cpuAbis = new ArrayList<String>(asList(Build.CPU_ABI, Build.CPU_ABI2));
cpuAbis.removeAll(asList(null, ""));
return cpuAbis.toArray(new String[0]);
}
}
}

View File

@@ -8,7 +8,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="263"
line="273"
column="13"/>
</issue>
@@ -19,7 +19,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="266"
line="276"
column="13"/>
</issue>
@@ -30,7 +30,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="365"
line="378"
column="9"/>
</issue>
@@ -41,7 +41,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="611"
line="644"
column="9"/>
</issue>
@@ -52,7 +52,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="791"
line="824"
column="21"/>
</issue>
@@ -63,7 +63,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="792"
line="825"
column="21"/>
</issue>
@@ -74,7 +74,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="886"
line="919"
column="9"/>
</issue>
@@ -85,7 +85,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="920"
line="953"
column="9"/>
</issue>
@@ -96,7 +96,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="921"
line="954"
column="9"/>
</issue>
@@ -107,7 +107,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="1065"
line="1098"
column="13"/>
</issue>
@@ -118,7 +118,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="1194"
line="1227"
column="25"/>
</issue>
@@ -129,7 +129,7 @@
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="1216"
line="1249"
column="13"/>
</issue>
@@ -155,116 +155,6 @@
column="9"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_SET_SELECTION`"
errorLine1=" result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="237"
column="30"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_COPY`"
errorLine1=" result.addAction(AccessibilityNodeInfo.ACTION_COPY);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="240"
column="30"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_CUT`"
errorLine1=" result.addAction(AccessibilityNodeInfo.ACTION_CUT);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="243"
column="30"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_PASTE`"
errorLine1=" result.addAction(AccessibilityNodeInfo.ACTION_PASTE);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="246"
column="30"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_START_INT`"
errorLine1=" AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="508"
column="36"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_END_INT`"
errorLine1=" AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="510"
column="36"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_START_INT`"
errorLine1=" AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="514"
column="37"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_END_INT`"
errorLine1=" AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="517"
column="37"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.view.accessibility.AccessibilityNodeInfo#ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN`"
errorLine1=" AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="561"
column="17"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 17 (current min is 16): `android.provider.Settings.Global#TRANSITION_ANIMATION_SCALE`"
errorLine1=" Settings.Global.TRANSITION_ANIMATION_SCALE);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="956"
column="21"/>
</issue>
<issue
id="InlinedApi"
message="Field requires API level 18 (current min is 16): `android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER_PORTRAIT`"
@@ -316,7 +206,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
line="151"
line="154"
column="32"/>
</issue>
@@ -342,336 +232,6 @@
column="71"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.accessibility.AccessibilityNodeInfo#setCollectionInfo"
errorLine1=" result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain("
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="320"
column="32"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.accessibility.AccessibilityNodeInfo.CollectionInfo#obtain"
errorLine1=" result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain("
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="320"
column="87"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.accessibility.AccessibilityNodeInfo#setCollectionInfo"
errorLine1=" result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain("
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="329"
column="32"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.accessibility.AccessibilityNodeInfo.CollectionInfo#obtain"
errorLine1=" result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain("
errorLine2=" ~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="329"
column="87"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.View#isAttachedToWindow"
errorLine1=" if (isAttachedToWindow()) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java"
line="137"
column="11"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 19 (current min is 16): android.view.View#isAttachedToWindow"
errorLine1=" if (isAttachedToWindow()) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java"
line="148"
column="11"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetTop"
errorLine1=" viewportMetrics.paddingTop = insets.getSystemWindowInsetTop();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java"
line="186"
column="41"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetRight"
errorLine1=" viewportMetrics.paddingRight = insets.getSystemWindowInsetRight();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java"
line="187"
column="43"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetLeft"
errorLine1=" viewportMetrics.paddingLeft = insets.getSystemWindowInsetLeft();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java"
line="189"
column="42"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetBottom"
errorLine1=" viewportMetrics.viewInsetBottom = insets.getSystemWindowInsetBottom();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java"
line="194"
column="46"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetBottom"
errorLine1=" if (insets.getSystemWindowInsetBottom() &lt; screenHeight * keyboardHeightRatioHeuristic) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="651"
column="20"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetBottom"
errorLine1=" return insets.getSystemWindowInsetBottom();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="657"
column="27"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetTop"
errorLine1=" mMetrics.physicalPaddingTop = statusBarHidden ? 0 : insets.getSystemWindowInsetTop();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="678"
column="68"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetRight"
errorLine1=" zeroSides == ZeroSides.RIGHT || zeroSides == ZeroSides.BOTH ? 0 : insets.getSystemWindowInsetRight();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="680"
column="86"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetLeft"
errorLine1=" zeroSides == ZeroSides.LEFT || zeroSides == ZeroSides.BOTH ? 0 : insets.getSystemWindowInsetLeft();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="683"
column="85"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 20 (current min is 16): android.view.WindowInsets#getSystemWindowInsetBottom"
errorLine1=" navigationBarHidden ? calculateBottomKeyboardInset(insets) : insets.getSystemWindowInsetBottom();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="691"
column="81"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 17 (current min is 16): android.provider.Settings.Global#getString"
errorLine1=" String value = Settings.Global.getString(getContext().getContentResolver(),"
errorLine2=" ~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="955"
column="44"/>
</issue>
<issue
id="NewApi"
message="Class requires API level 19 (current min is 16): android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener"
errorLine1=" class TouchExplorationListener implements AccessibilityManager.TouchExplorationStateChangeListener {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="966"
column="47"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 28 (current min is 16): new android.app.ActivityManager.TaskDescription"
errorLine1=" ? new TaskDescription(description.label, 0, description.color)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
line="137"
column="15"/>
</issue>
<issue
id="NewApi"
message="Call requires API level 28 (current min is 16): android.content.pm.PackageInfo#getLongVersionCode"
errorLine1=" return packageInfo.getLongVersionCode();"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="37"
column="32"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = manager.open(asset);"
errorLine2=" ^">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="191"
column="22"/>
</issue>
<issue
id="NewApi"
message="Field requires API level 21 (current min is 16): `android.os.Build#SUPPORTED_ABIS`"
errorLine1=" for (String abi : Build.SUPPORTED_ABIS) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="247"
column="35"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = zipFile.getInputStream(entry)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="284"
column="26"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = apkFile.getInputStream(origEntry)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="300"
column="30"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = manager.open(asset)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="305"
column="30"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (OutputStream os = new FileOutputStream(output)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="312"
column="26"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = zipFile.getInputStream(entry);"
errorLine2=" ^">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="317"
column="26"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream input = connection.getInputStream()) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
line="132"
column="22"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (OutputStream output = new FileOutputStream(localFile)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
line="134"
column="26"/>
</issue>
<issue
id="NewApi"
message="Try-with-resources requires API level 19 (current min is 16)"
errorLine1=" try (InputStream is = manager.open(fn)) {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceUpdater.java"
line="329"
column="18"/>
</issue>
<issue
id="OldTargetApi"
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details."
@@ -745,7 +305,7 @@
errorLine2=" ~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="43"
line="47"
column="19"/>
</issue>
@@ -767,7 +327,7 @@
errorLine2=" ^">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="1082"
line="1115"
column="13"/>
</issue>
@@ -800,7 +360,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="196"
line="200"
column="17"/>
</issue>
@@ -811,7 +371,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java"
line="323"
line="327"
column="17"/>
</issue>
@@ -877,7 +437,7 @@
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="137"
line="142"
column="19"/>
</issue>
@@ -888,7 +448,7 @@
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="138"
line="143"
column="38"/>
</issue>
@@ -921,7 +481,7 @@
errorLine2=" ~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java"
line="307"
line="311"
column="18"/>
</issue>
@@ -932,7 +492,7 @@
errorLine2=" ~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="498"
line="511"
column="20"/>
</issue>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="NewApi">
<!-- The NewApi lint also catches the usage of Java 8 APIs. The engine
relies on being built with backwards support for Java 8 APIs enabled. BE
CAREFUL ADDING TO THIS LIST. Not all Java 8 APIs are backwards
compatible all the way back to API 16. See
https://developer.android.com/studio/write/java8-support.html#supported_features -->
<ignore regexp="^Try-with-resources requires API level 19"/>
</issue>
</lint>