Commit 17d65456 authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Reland "Android: Roll android_tools and fix lint errors"

Original CL: https://crrev.com/c/1327157

Fixes:
- Cronet target: cronet_sample_apk_java__lint
- Removes suppression for autofill

TBR=mheikal@chromium.org

Bug: 900912
Change-Id: Ib3c7fd69e394ade0b2b80aed72a993e02b0a153c
Reviewed-on: https://chromium-review.googlesource.com/c/1331011
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607231}
parent 1d9fadb6
......@@ -486,7 +486,7 @@ deps = {
},
'src/third_party/android_tools': {
'url': Var('chromium_git') + '/android_tools.git' + '@' + '130499e25286f4d56acafa252fee09f3cc595c49',
'url': Var('chromium_git') + '/android_tools.git' + '@' + '6fecaa542f73dd5aeed170d9a4cf340159b42976',
'condition': 'checkout_android_native_support',
},
......
......@@ -4,6 +4,7 @@
package org.chromium.android_webview;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
......@@ -166,6 +167,7 @@ public class AwSettings {
EventHandler() {
}
@SuppressLint("HandlerLeak")
void bindUiThread() {
if (mHandler != null) return;
mHandler = new Handler(ThreadUtils.getUiThreadLooper()) {
......
......@@ -179,6 +179,7 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
}
@Override
@SuppressLint("HandlerLeak")
public void showRepostFormWarningDialog() {
// TODO(mkosiba) We should be using something akin to the JsResultReceiver as the
// callback parameter (instead of WebContents) and implement a way of converting
......
......@@ -4,6 +4,7 @@
package org.chromium.android_webview;
import android.annotation.SuppressLint;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
......@@ -81,6 +82,7 @@ public class CleanupReference extends WeakReference<Object> {
* This is lazily initialized as ThreadUtils.getUiThreadLooper() may not be
* set yet early in startup.
*/
@SuppressLint("HandlerLeak")
private static class LazyHolder {
static final Handler sHandler = new Handler(ThreadUtils.getUiThreadLooper()) {
@Override
......
......@@ -4,6 +4,7 @@
package org.chromium.support_lib_glue;
import android.annotation.SuppressLint;
import android.webkit.SafeBrowsingResponse;
import android.webkit.ServiceWorkerWebSettings;
import android.webkit.WebMessagePort;
......@@ -48,6 +49,7 @@ class SupportLibWebkitToCompatConverterAdapter implements WebkitToCompatConverte
}
// ServiceWorkerWebSettingsBoundaryInterface
@SuppressLint("NewApi")
@Override
public InvocationHandler convertServiceWorkerSettings(
/* ServiceWorkerWebSettings */ Object serviceWorkerWebSettings) {
......@@ -66,6 +68,7 @@ class SupportLibWebkitToCompatConverterAdapter implements WebkitToCompatConverte
return new ServiceWorkerSettingsAdapter(supportLibWebSettings.getAwServiceWorkerSettings());
}
@SuppressLint("NewApi")
@Override
public /* SupportLibWebResourceError */ InvocationHandler convertWebResourceError(
/* WebResourceError */ Object webResourceError) {
......@@ -83,6 +86,7 @@ class SupportLibWebkitToCompatConverterAdapter implements WebkitToCompatConverte
return new WebResourceErrorAdapter(supportLibError.getAwWebResourceError());
}
@SuppressLint("NewApi")
@Override
public /* SupportLibSafeBrowsingResponse */ InvocationHandler convertSafeBrowsingResponse(
/* SafeBrowsingResponse */ Object safeBrowsingResponse) {
......@@ -102,6 +106,7 @@ class SupportLibWebkitToCompatConverterAdapter implements WebkitToCompatConverte
supportLibResponse.getAwSafeBrowsingResponseCallback());
}
@SuppressLint("NewApi")
@Override
public /* SupportLibWebMessagePort */ InvocationHandler convertWebMessagePort(
/* WebMessagePort */ Object webMessagePort) {
......
......@@ -15,6 +15,7 @@
android:layout_width="match_parent"
android:layout_height="280dp" />
<EditText
tools:ignore="LabelFor"
android:id="@+id/edittext"
android:inputType="text"
android:layout_below="@+id/webview"
......
......@@ -15,7 +15,9 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/url_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -226,23 +226,13 @@ def _OnStaleMd5(lint_path, config_path, processed_config_path,
print 'File contents:'
with open(result_path) as f:
print f.read()
if not can_fail_build:
if can_fail_build:
traceback.print_exc()
if can_fail_build:
raise
else:
return
if can_fail_build and not silent:
traceback.print_exc()
# There are actual lint issues
try:
num_issues = _ParseAndShowResultFile()
except Exception: # pylint: disable=broad-except
if not silent:
print 'Lint created unparseable xml file...'
print 'File contents:'
with open(result_path) as f:
print f.read()
raise
_ProcessResultFile()
if num_issues == 0 and include_unexpected:
msg = 'Please refer to output above for unexpected lint failures.\n'
......
......@@ -185,6 +185,12 @@ Still reading?
<issue id="LogConditional" severity="ignore"/>
<issue id="LongLogTag" severity="ignore"/>
<issue id="MissingApplicationIcon" severity="ignore"/>
<issue id="MissingDefaultResource">
<!-- Only used by ToolbarControlContainer guarded by tablet form-factor. -->
<ignore regexp="toolbar_background.9.png"/>
<!-- Only used by FirstRunFlowSequencer guarded by tablet form-factor. -->
<ignore regexp="window_background.xml"/>
</issue>
<issue id="MissingPermission" severity="ignore"/>
<!-- TODO(yolandyan) remove this once all tests are converted to junit4 -->
<issue id="MissingPrefix" severity="ignore"/>
......@@ -254,12 +260,18 @@ Still reading?
<ignore regexp="chrome/android/chrome_strings_grd.resources.zip/values/android_chrome_strings.xml"/>
</issue>
<issue id="PrivateApi" severity="ignore"/>
<!-- Chrome is a system app. -->
<issue id="ProtectedPermissions" severity="ignore"/>
<issue id="Recycle" severity="ignore"/>
<issue id="Registered" severity="ignore"/>
<issue id="ResourceAsColor" severity="ignore"/>
<issue id="ResourceType" severity="Error">
<ignore regexp="/javatests/"/>
</issue>
<issue id="RedundantNamespace">
<!-- Please do not add any additional suppressions here with the exception of the 1 file below -->
<ignore regexp="chrome/android/java/res_autofill_assistant/layout/init_screen.xml"/>
</issue>
<!-- TODO(crbug.com/831774): Play Services starts complaining about RestrictedApi. Needs investigation -->
<issue id="RestrictedApi" severity="ignore"/>
<issue id="RtlCompat" severity="ignore"/>
......
......@@ -840,7 +840,7 @@ if (enable_java_templates) {
lint_suppressions_file = "//build/android/lint/suppressions.xml"
}
_lint_path = "$lint_android_sdk_root/tools/bin/lint"
_lint_path = "$lint_android_sdk_root/tools-lint/bin/lint"
_cache_dir = "$root_build_dir/android_lint_cache"
_result_path = "$target_gen_dir/$target_name/result.xml"
_config_path = "$target_gen_dir/$target_name/config.xml"
......
......@@ -10,10 +10,9 @@
<solid android:color="@color/modern_grey_200" />
</shape>
</item>
<item xmlns:android="http://schemas.android.com/apk/res/android"
android:bottom="1dp">
<item android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
</layer-list>
......@@ -60,7 +60,9 @@
android:orientation="horizontal"
android:visibility="gone">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/expiration_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -77,7 +79,9 @@
android:layout_height="wrap_content"
android:text="@string/autofill_card_unmask_expiration_date_separator" />
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/expiration_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -89,7 +93,9 @@
android:hint="@string/card_unmask_year_hint" />
</LinearLayout>
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/card_unmask_input"
android:inputType="number"
android:layout_height="wrap_content"
......
......@@ -5,7 +5,8 @@
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!-- Name -->
<org.chromium.chrome.browser.widget.CompatibilityTextInputLayout
......@@ -16,7 +17,9 @@
android:layout_marginTop="@dimen/pref_autofill_field_large_top_margin"
android:layout_marginBottom="@dimen/pref_autofill_field_bottom_margin">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/credit_card_name_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -35,7 +38,9 @@
android:layout_marginTop="@dimen/pref_autofill_field_top_margin"
android:layout_marginBottom="@dimen/pref_autofill_field_bottom_margin">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/credit_card_number_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -29,7 +29,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill,LabelFor"
android:id="@+id/cc_name_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -6,6 +6,7 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
......@@ -26,7 +27,9 @@
style="@style/PreferenceScreenLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill"
android:id="@+id/homepage_url_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -5,6 +5,7 @@
<org.chromium.chrome.browser.ntp.NewTabPageLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ntp_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -40,7 +41,9 @@
android:orientation="horizontal"
android:paddingStart="@dimen/location_bar_lateral_padding"
android:paddingEnd="@dimen/location_bar_lateral_padding" >
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill,LabelFor"
style="@style/TextAppearance.NewTabPageSearchBoxText"
android:id="@+id/search_box_text"
android:layout_width="0dp"
......
......@@ -9,7 +9,6 @@
android:layout_height="match_parent" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scroll_view"
......
......@@ -16,7 +16,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<AutoCompleteTextView
tools:ignore="LabelFor"
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -50,4 +52,4 @@
tools:ignore="ContentDescription"
android:visibility="gone"/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
</FrameLayout>
......@@ -6,13 +6,16 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="gone" >
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="Autofill,LabelFor"
android:id="@+id/search_text"
android:layout_width="0dp"
android:layout_height="match_parent"
......
......@@ -3,5 +3,5 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<string name="manage_space_activity">org.chromium.chrome.browser.preferences.website.ManageSpaceActivity</string>
</resources>
\ No newline at end of file
<string translatable="false" name="manage_space_activity">org.chromium.chrome.browser.preferences.website.ManageSpaceActivity</string>
</resources>
......@@ -3,7 +3,7 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Connection info popup dimensions -->
<dimen name="connection_info_padding_wide">24dp</dimen>
<dimen name="connection_info_padding_thin">16dp</dimen>
......@@ -231,11 +231,12 @@
<!-- Find in Page dimensions -->
<dimen name="find_result_bar_touch_width">68dp</dimen>
<dimen name="find_result_bar_draw_width">46dp</dimen>
<dimen name="find_result_bar_result_min_height">8px</dimen>
<dimen name="find_result_bar_active_min_height">16px</dimen>
<dimen name="find_result_bar_vertical_padding">8px</dimen>
<dimen name="find_result_bar_min_gap_between_stacks">3px</dimen>
<dimen name="find_result_bar_stacked_result_height">3px</dimen>
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<dimen tools:ignore="PxUsage" name="find_result_bar_result_min_height">8px</dimen>
<dimen tools:ignore="PxUsage" name="find_result_bar_active_min_height">16px</dimen>
<dimen tools:ignore="PxUsage" name="find_result_bar_vertical_padding">8px</dimen>
<dimen tools:ignore="PxUsage" name="find_result_bar_min_gap_between_stacks">3px</dimen>
<dimen tools:ignore="PxUsage" name="find_result_bar_stacked_result_height">3px</dimen>
<dimen name="find_in_page_separator_width">1dp</dimen>
<dimen name="find_in_page_popup_width">375dp</dimen>
<dimen name="find_in_page_popup_height">60dp</dimen>
......@@ -315,7 +316,8 @@
<dimen name="tile_view_width_condensed">64dp</dimen>
<dimen name="tile_view_icon_size">48dp</dimen>
<dimen name="tile_view_icon_size_modern">24dp</dimen>
<dimen name="tile_view_icon_min_size">24px</dimen>
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<dimen tools:ignore="PxUsage" name="tile_view_icon_min_size">24px</dimen>
<dimen name="tile_view_icon_corner_radius">4dp</dimen>
<dimen name="tile_view_icon_text_size">20dp</dimen>
<dimen name="tile_view_monogram_size_modern">26dp</dimen>
......@@ -409,7 +411,8 @@
<dimen name="default_favicon_size">16dp</dimen>
<dimen name="default_favicon_corner_radius">3dp</dimen>
<dimen name="default_favicon_icon_text_size">10dp</dimen>
<dimen name="default_favicon_min_size">16px</dimen>
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<dimen tools:ignore="PxUsage" name="default_favicon_min_size">16px</dimen>
<dimen name="circular_monogram_size">20dp</dimen>
<dimen name="circular_monogram_text_size">14dp</dimen>
......
......@@ -11,7 +11,6 @@
android:layout_height="wrap_content">
<View
android:id="@+id/divider"
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/HorizontalDivider" />
<Space
......
......@@ -8,6 +8,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.RectF;
......@@ -71,9 +72,11 @@ class AutofillAssistantUiDelegate {
/** How long the snackbars created by {@link #showAutofillAssistantStoppedSnackbar} stay up. */
static final int SNACKBAR_DELAY_MS = 5_000;
// TODO(crbug.com/806868): Use correct user locale.
// TODO(crbug.com/806868): Use correct user locale and remove suppressions.
@SuppressLint("ConstantLocale")
private static final SimpleDateFormat sDetailsTimeFormat =
new SimpleDateFormat("H:mma", Locale.getDefault());
@SuppressLint("ConstantLocale")
private static final SimpleDateFormat sDetailsDateFormat =
new SimpleDateFormat("EEE, MMM d", Locale.getDefault());
......
......@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.autofill_assistant.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
......@@ -171,6 +172,7 @@ public class TouchEventFilter extends View implements ChromeFullscreenManager.Fu
/** Returns the origin of the visual viewport in this view. */
@Override
@SuppressLint("CanvasSize")
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!mEnabled) {
......
......@@ -202,6 +202,8 @@ public class TranslateTabLayout extends TabLayout {
/**
* Perform the scrolling animation if this tablayout has any scrollable distance.
*/
// TODO(crbug.com/900912): Figure out whether setScrollX is actually available.
@SuppressLint("ObjectAnimatorBinding")
public void startScrollingAnimationIfNeeded() {
int maxScrollDistance = maxScrollDistance();
if (maxScrollDistance == 0) {
......
......@@ -59,7 +59,8 @@ public class ApplicationTestUtils {
// Make sure the screen is on during test runs.
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
sWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, TAG);
| PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
"Chromium:" + TAG);
sWakeLock.acquire();
// Disable Omaha related activities.
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
......@@ -12,7 +13,9 @@
android:textSize="16sp"
android:text="@string/urlText" />
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="LabelFor"
android:id="@+id/urlText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -27,7 +30,9 @@
android:textSize="16sp"
android:text="@string/postText" />
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText
tools:ignore="LabelFor"
android:id="@+id/postText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -6,11 +6,14 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:padding="24dp">
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<EditText android:id="@+id/pin_dialog_text"
tools:ignore="Autofill,LabelFor"
android:inputType="numberPassword"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
......
......@@ -30,7 +30,7 @@
android:ems="10"
android:id="@+id/url_text" />
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
......
......@@ -43,5 +43,6 @@
cannot be retrieved by name.
Note: Constants taken directly from Android's core/res/values/config.xml.
-->
<dimen name="config_min_scaling_span">12.0mm</dimen>
<!-- TODO(crbug.com/900912): Fix and remove lint ignore -->
<dimen name="config_min_scaling_span" tools:ignore="InOrMmUsage">12.0mm</dimen>
</resources>
......@@ -219,6 +219,7 @@ public class DisplayAndroidManager {
return ContextUtils.getApplicationContext();
}
@SuppressLint("NewApi")
private static DisplayManager getDisplayManager() {
return (DisplayManager) getContext().getSystemService(Context.DISPLAY_SERVICE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment