Commit be53a159 authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Android: Remove unused suppressions and fix some

Remove test-specific suppressions. If and when we enable lint on test
targets again, blanket testonly suppressions should be added to lint.py
instead.

Fix some WrongConstant issues. These are useful to understand and make
sure we are passing the right @IntDef and @StringDef variables to
android APIs.

Bug: 1116130
Change-Id: I43bea517bca2436f2063829fe74d280b5df6bca5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375700Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarDan McArdle <dmcardle@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803198}
parent 8cd81957
......@@ -17,7 +17,6 @@ Still reading?
<!-- See https://crbug.com/827265 and comment in the file for context. -->
<ignore regexp="chrome/android/java/res/xml/network_security_config.xml"/>
<ignore regexp="android_webview/tools/system_webview_shell/apk/res/xml/network_security_config.xml"/>
<ignore regexp="test"/>
</issue>
<issue id="Autofill">
<!-- Filed https://crbug.com/1073966 to fix -->
......@@ -25,10 +24,6 @@ Still reading?
<ignore regexp="chrome/android/java/res/layout/password_entry_editor.xml"/>
<ignore regexp="components/browser_ui/widget/android/java/res/layout/radio_button_with_edit_text.xml"/>
</issue>
<issue id="AuthLeak">
<ignore regexp="chrome/android/javatests"/>
<ignore regexp="Test.java"/>
</issue>
<issue id="ButtonOrder">
<ignore regexp="chrome/android/java/res/layout/homepage_editor.xml"/>
</issue>
......@@ -101,8 +96,6 @@ Still reading?
<ignore regexp="chrome/android/webapk/shell_apk/res/mipmap-mdpi/ic_launcher_background.png"/>
</issue>
<issue id="IconLocation">
<!-- This is just for testing -->
<ignore regexp="chrome/test/chromedriver/test/webview_shell/java/res/drawable/icon.png"/>
<!-- It is OK for content_shell_apk to have missing assets. -->
<ignore regexp="content/shell/android/java/res/"/>
<!-- Memconsumer is only for tooling -->
......@@ -133,7 +126,6 @@ Still reading?
<!-- See https://crbug.com/827265 and comment in the file for context. -->
<ignore regexp="chrome/android/java/res/xml/network_security_config.xml"/>
<ignore regexp="android_webview/tools/system_webview_shell/apk/res/xml/network_security_config.xml"/>
<ignore regexp="test"/>
</issue>
<issue id="Instantiatable" severity="ignore"/>
<issue id="InconsistentArrays">
......@@ -184,14 +176,10 @@ Still reading?
<ignore regexp="Static interface method requires API level 24"/>
<!-- 1: TaskInfo is refactored at API 29. -->
<ignore regexp="Field requires API level .*`android.app.TaskInfo"/>
<!-- 1: This is for testonly target android_support_chromium_java in android_sdk. -->
<ignore regexp="third_party/android_sdk/public/extras/chromium/support/src/org/chromium/android/support/PackageManagerWrapper.java"/>
<!-- 1: TODO(crbug.com/1082222): Fix -->
<ignore regexp="chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java"/>
<!-- 1: TODO(crbug.com/1085410): Fix -->
<ignore regexp="components/content_capture/android/java/src/org/chromium/components/content_capture"/>
<!-- 1: TODO(crbug.com/1085487): Fix -->
<ignore regexp="chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionTestRule.java"/>
<!-- 1: TODO(wnwen): File bugs to fix -->
<ignore regexp="android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java"/>
<!-- Endnote: Please specify number of suppressions when adding more -->
......@@ -219,9 +207,6 @@ Still reading?
<issue id="Recycle" severity="ignore"/>
<issue id="Registered" severity="ignore"/>
<issue id="ResourceAsColor" severity="ignore"/>
<issue id="ResourceType">
<ignore regexp="/javatests/"/>
</issue>
<issue id="RtlCompat" severity="ignore"/>
<issue id="RtlEnabled" severity="ignore"/>
<issue id="RtlHardcoded">
......@@ -230,10 +215,6 @@ Still reading?
<ignore regexp="chrome/android/java/res/layout/sheet_tab_toolbar.xml"/>
</issue>
<issue id="RtlSymmetry" severity="ignore"/>
<issue id="SetTextI18n">
<!-- Tests can use setText without translating. -->
<ignore regexp="/javatests/"/>
</issue>
<issue id="SetJavaScriptEnabled" severity="ignore"/>
<issue id="SignatureOrSystemPermissions" severity="ignore"/>
<issue id="StaticFieldLeak">
......@@ -315,10 +296,6 @@ Still reading?
<ignore regexp="The resource `R.style.SplashTheme` appears to be unused"/>
<!-- 1 resource used by android webview glue layer, could be refactored -->
<ignore regexp="android_webview/java/res/drawable-hdpi/ic_play_circle_outline_black_48dp.png"/>
<!-- 3 resources test only, used in webview tests dynamically -->
<ignore regexp="android_webview/test/shell/res/raw/resource_file.html"/>
<ignore regexp="android_webview/test/shell/res/raw/resource_icon.png"/>
<ignore regexp="android_webview/tools/automated_ui_tests/java/res/layout/"/>
<!-- 1: resource in //ui because it's used by multiple deps. -->
<ignore regexp="The resource `R.drawable.*_expand_.*` appears to be unused"/>
<!-- 1 string used by Android's policies system, pulled from app directly -->
......@@ -399,8 +376,6 @@ Still reading?
<issue id="VectorPath" severity="ignore"/>
<issue id="ViewConstructor" severity="ignore"/>
<issue id="VisibleForTests">
<ignore regexp="/javatests/"/>
<ignore regexp="/test/"/>
<!-- TODO(crbug.com/757124): Remove all these specific Feedback files after underlying issue is resolved -->
<!-- Underlying issue is that Android FeedbackOptions.Builder using @VisibleForTesting without 'otherwise='. -->
<ignore regexp="clank/java/src/com/google/android/apps/chrome/feedback/FeedbackUtil.java"/>
......@@ -411,18 +386,7 @@ Still reading?
<issue id="WebViewApiAvailability" severity="ignore"/>
<issue id="WrongCall" severity="ignore"/>
<issue id="WrongConstant">
<ignore regexp="chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkItemsAdapter.java"/>
<ignore regexp="chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java"/>
<ignore regexp="chrome/android/java/src/org/chromium/chrome/browser/widget/prefeditor/EditorDialog.java"/>
<ignore regexp="components/browser_ui/client_certificate/android/java/src/org/chromium/components/browser_ui/client_certificate/SSLClientCertificateRequest.java"/>
<ignore regexp="third_party/android_data_chart/java/src/org/chromium/third_party/android/datausagechart/ChartDataUsageView.java"/>
<!-- 1: TODO(crbug.com/1085411): Fix -->
<ignore regexp="media/base/android/java/src/org/chromium/media/MediaCodecEncoder.java"/>
<!-- Discussed in crbug.com/1069204, ignoring this class of errors since these are Q+ constants. -->
<ignore regexp="Must be one of: LineBreaker.BREAK_STRATEGY_SIMPLE, LineBreaker.BREAK_STRATEGY_HIGH_QUALITY, LineBreaker.BREAK_STRATEGY_BALANCED"/>
</issue>
<issue id="WrongThread">
<!-- TODO(wnwen): File bug to fix -->
<ignore regexp="chrome/test/android/test_trusted_web_activity/src/org/chromium/chrome/browser/browserservices/TestTrustedWebActivityService.java"/>
</issue>
</lint>
......@@ -42,8 +42,9 @@ class BookmarkItemsAdapter extends DragReorderableListAdapter<BookmarkItem>
* Specifies the view types that the bookmark delegate screen can contain.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({ViewType.PERSONALIZED_SIGNIN_PROMO, ViewType.PERSONALIZED_SYNC_PROMO,
ViewType.SYNC_PROMO, ViewType.FOLDER, ViewType.BOOKMARK})
@IntDef({ViewType.INVALID_PROMO, ViewType.PERSONALIZED_SIGNIN_PROMO,
ViewType.PERSONALIZED_SYNC_PROMO, ViewType.SYNC_PROMO, ViewType.FOLDER,
ViewType.BOOKMARK})
private @interface ViewType {
int INVALID_PROMO = -1;
int PERSONALIZED_SIGNIN_PROMO = 0;
......@@ -60,6 +61,7 @@ class BookmarkItemsAdapter extends DragReorderableListAdapter<BookmarkItem>
// There can only be one promo header at a time. This takes on one of the values:
// ViewType.PERSONALIZED_SIGNIN_PROMO, ViewType.SYNC_PROMO, or ViewType.INVALID_PROMO
@ViewType
private int mPromoHeaderType = ViewType.INVALID_PROMO;
private BookmarkDelegate mDelegate;
private BookmarkPromoHeader mPromoHeaderManager;
......
......@@ -205,7 +205,10 @@ public class SSLClientCertificateRequest {
/**
* Calls KeyChain#choosePrivateKeyAlias with the provided arguments.
*
*/
// WrongConstant: @KeyProperties.KeyAlgorithmEnum for mKeyTypes is hidden with @hide.
@SuppressWarnings("WrongConstant")
public void choosePrivateKeyAlias() throws ActivityNotFoundException {
KeyChain.choosePrivateKeyAlias(mActivity, mCallback, mKeyTypes, mPrincipalsForCallback,
mHostName, mPort, mAlias);
......
......@@ -48,7 +48,8 @@ class MediaCodecEncoder extends MediaCodecBridge {
}
// Save the config frame(SPS/PPS NALs) and append it to each keyframe.
@SuppressWarnings("deprecation")
// WrongConstant: MediaCodec#dequeueOutputBuffer returns the index when successful.
@SuppressWarnings({"deprecation", "WrongConstant"})
@Override
protected int dequeueOutputBufferInternal(MediaCodec.BufferInfo info, long timeoutUs) {
int indexOrStatus = -1;
......
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