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

Android: Remove unused strings

Update suppressions from android_tools upgrades resulting in unused
resources (mostly strings) being left behind after their feature is
removed.

Also update some suppressions as expected.

BUG=799070,806060
TBR=nyquist@chromium.org

Change-Id: I30d35320ad20b318a921972529f139b3b3e65453
Reviewed-on: https://chromium-review.googlesource.com/886863
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532433}
parent 90356b5f
......@@ -222,12 +222,12 @@ Still reading?
<ignore regexp="Call requires API level 19.*`java.lang.Throwable#addSuppressed`"/>
<!-- We support default methods via desugar. -->
<ignore regexp="Default method requires API level 24"/>
<!-- Seems like these work via desugar. -->
<ignore regexp="Static interface method requires API level 24"/>
<!-- TODO(crbug.com/805479): Remove the following suppression and fix. -->
<ignore regexp="Call requires API level 18.*android.view.View#setClipBounds"/>
<!-- TODO(crbug.com/805509): Remove the following suppression and fix. -->
<ignore regexp="Call requires API level 19.*new java.lang.AssertionError"/>
<!-- TODO(crbug.com/799070): Fix these after lint upgrade. -->
<ignore regexp="Static interface method requires API level 24"/>
<!-- Suppressions below this line need rationale :( -->
<ignore regexp="Attribute `paddingStart` referenced here can result in a crash on some specific devices older than API 17"/>
<ignore regexp="chrome/android/java/res/values-v17/styles.xml"/>
......@@ -253,7 +253,7 @@ Still reading?
<!-- TODO(crbug.com/635567): Fix this properly. -->
<ignore regexp="sdk/extras/chromium/support/src/org/chromium/android/support/PackageManagerWrapper.java"/>
</issue>
<!-- TODO(crbug.com/799070): Re-enable this -->
<!-- This warning just adds a lot of false positives. -->
<issue id="ObsoleteSdkInt" severity="ignore"/>
<issue id="OldTargetApi">
<ignore path="AndroidManifest.xml"/>
......@@ -300,7 +300,7 @@ Still reading?
<ignore regexp="chromecast/internal"/>
</issue>
<issue id="StaticFieldLeak">
<!-- TODO(crbug.com/799070): Fix after upgrading lint. -->
<!-- Nice to fix, but not necessary or performance critical. -->
<ignore regexp="This AsyncTask class should be static or leaks might occur"/>
</issue>
<issue id="StringFormatCount" severity="Error">
......@@ -342,15 +342,12 @@ Still reading?
</issue>
<!-- Our generated enums are allowed to have the same values. -->
<issue id="UniqueConstants" severity="ignore"/>
<!-- Do not add new suppressions without very good rationale. -->
<issue id="UnusedResources">
<!-- Do not add new suppressions without rationale. -->
<!-- 3 raw resources are accessed by URL in various places -->
<ignore regexp="PRODUCT_DIR/gen/remoting/android/.*/res/raw/credits.html"/>
<ignore regexp="PRODUCT_DIR/gen/remoting/android/.*/res/raw/credits_css.css"/>
<ignore regexp="PRODUCT_DIR/gen/remoting/android/.*/res/raw/credits_js.js"/>
<!-- 2 dimens override support library's res, will be changing soon -->
<ignore regexp="R.dimen.design_bottom_navigation_text_size"/>
<ignore regexp="R.dimen.design_bottom_navigation_active_text_size"/>
<!-- 1 string test only, used in CronetSmokeTestCase dynamically -->
<ignore regexp="R.string.TestSupportImplClass"/>
<!-- 1 string used by Android's policies system, pulled from app directly -->
......@@ -362,24 +359,14 @@ Still reading?
<!-- 2 resources used by android webview glue layer, could be refactored -->
<ignore regexp="android_webview/java/res/drawable-hdpi/ic_play_circle_outline_black_48dp.png"/>
<ignore regexp="R.string.private_browsing_warning"/>
<!-- 9 OMR1 SDK roll mystery. TODO(jbudorick): Remove this after rolling lint. -->
<ignore regexp="chrome/android/chrome_strings_grd.resources.zip/values/android_chrome_strings.xml"/>
<ignore regexp="chrome/android/java/res/layout/location_bar.xml"/>
<ignore regexp="chrome/android/java/res/values/colors.xml"/>
<ignore regexp="chrome/android/java/res/values/dimens.xml"/>
<ignore regexp="chrome/android/java/res/drawable-hdpi/ic_omnibox_magnifier.png"/>
<ignore regexp="chrome/android/java/res/drawable-hdpi/omnibox_https_invalid.png"/>
<ignore regexp="chrome/android/java/res/drawable-hdpi/omnibox_info.png"/>
<ignore regexp="clank/java/clank_strings_grd.resources.zip/values/android_internal_strings.xml"/>
<ignore regexp="tools/android/audio_focus_grabber/java/res/drawable-hdpi/notification_icon.png"/>
<!-- TODO(crbug.com/799070): Fix these. -->
<!-- TODO(crbug.com/806060): Remove or add rationale. -->
<ignore regexp="ui/android/java/res/values/colors.xml"/>
<ignore regexp="ui/android/java/res/values/dimens.xml"/>
<ignore regexp="ui/android/java/res/values-v17/styles.xml"/>
<ignore regexp="chrome/android/java/res/anim/fullscreen_notification_in.xml"/>
<ignore regexp="chrome/android/java/res/values-v17/styles.xml"/>
<ignore regexp="chrome/android/java/res/values-v21/styles.xml"/>
<!-- Endnote: Please specify number of resources when adding more suppressions -->
<!-- Endnote: Please specify number of suppressions when adding more -->
</issue>
<issue id="UseCompoundDrawables">
<!-- Upscaling 24dp to 48dp doesn't work as expected with a TextView compound drawable. -->
......
......@@ -508,8 +508,6 @@
<dimen name="chrome_home_min_full_half_distance">160dp</dimen>
<dimen name="chrome_home_progress_bar_height">4dp</dimen>
<dimen name="chrome_home_incognito_ntp_bottom_margin">32dp</dimen>
<dimen name="chrome_home_promo_illustration_width">108dp</dimen>
<dimen name="chrome_home_promo_illustration_height">206dp</dimen>
<!-- TextBubble dimensions -->
<dimen name="text_bubble_margin">4dp</dimen>
......
......@@ -1126,17 +1126,6 @@ To obtain new licenses, connect to the internet and play your downloaded content
This feature may interfere with access to premium data services provided by your carrier.
</message>
<!-- Old Data Saver stats page strings-->
<message name="IDS_DATA_REDUCTION_STATS_TITLE" desc="Data reduction statistics title.">
Data savings
</message>
<message name="IDS_DATA_REDUCTION_ORIGINAL_SIZE_LABEL" desc="Data Reduction statistics original size label">
Original size
</message>
<message name="IDS_DATA_REDUCTION_COMPRESSED_SIZE_LABEL" desc="Data Reduction statistics compressed size label">
After compression
</message>
<!-- Data Saver Promo and FRE card -->
<message name="IDS_DATA_REDUCTION_PROMO_TITLE" desc="The title for the promo inviting users to enable Data Saver" >
Save data and browse faster
......@@ -1322,9 +1311,6 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_SIGNOUT_DIALOG_POSITIVE_BUTTON" desc="Button to sign out of Chrome">
Sign out
</message>
<message name="IDS_SIGN_IN_BUTTON" desc="Label for a button to sign in">
Sign in
</message>
<message name="IDS_SIGN_IN_GETTING_ACCOUNT_MANAGEMENT_POLICY" desc="Title of progress bar dialog for getting management policy">
Contacting Google. This may take a minute…
</message>
......@@ -1360,13 +1346,6 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_SYNC_YOUR_BOOKMARKS" desc="Title for the prompt to signin and enable sync to sync their bookmarks">
Sync your bookmarks
</message>
<!-- TODO(crbug.com/737743): Remove the old promo strings after the new signin promos roll out to 100%. -->
<message name="IDS_BOOKMARK_SIGN_IN_PROMO_DESCRIPTION" desc="Description for bookmark UI sign-in promotion.">
To get your bookmarks on all your devices, sign in to Chrome.
</message>
<message name="IDS_RECENT_TABS_SIGN_IN_PROMO_DESCRIPTION" desc="Description for recent tabs UI sign-in promotion.">
To get your tabs from your other devices, sign in to Chrome.
</message>
<message name="IDS_ENABLE_SYNC_BUTTON" desc="Text that displayed or button that allows the user to open Chrome settings to enable sync.">
Open settings
</message>
......@@ -1635,54 +1614,15 @@ To obtain new licenses, connect to the internet and play your downloaded content
</message>
<!-- TranslateInfoBar -->
<message name="IDS_TRANSLATE_INFOBAR_TEXT" desc="Text to display on the translate infobar to offer a translate. [CHAR-LIMIT=64]" meaning="Android">
This page is in <ph name="SOURCE_LANGUAGE">^1<ex>English</ex></ph>. Translate it to <ph name="TARGET_LANGUAGE">^2<ex>FRENCH</ex></ph>?
</message>
<message name="IDS_TRANSLATE_INFOBAR_CHANGE_LANGUAGES" desc="link text to offer to change languages.">
Change languages
</message>
<message name="IDS_TRANSLATE_INFOBAR_TRANSLATION_DONE">
Translated to <ph name="TARGET_LANGUAGE">%1$s<ex>FRENCH</ex></ph>.
</message>
<message name="IDS_TRANSLATE_INFOBAR_TRANSLATING">
Translating page to <ph name="SOURCE_LANGUAGE">%1$s<ex>English</ex></ph>
</message>
<message name="IDS_TRANSLATE_INFOBAR_ERROR">
Oops. This page could not be translated.
</message>
<message name="IDS_TRANSLATE_ALWAYS_TEXT" desc="checkbox to always translate a language pair">
Always translate <ph name="SOURCE_LANGUAGE">%1$s<ex>French</ex></ph>
</message>
<message name="IDS_TRANSLATE_NEVER_TRANSLATE_MESSAGE_TEXT">
Would you like Google Chrome to offer to translate <ph name="LANGUAGE">%1$s<ex>French</ex></ph> pages from this site next time?
</message>
<message name="IDS_TRANSLATE_BUTTON" desc="Possible texts to display on the translate infobar buttons. [CHAR-LIMIT=24]">
Translate
</message>
<message name="IDS_TRANSLATE_NOPE" desc="Button text for rejecting infobar translations">
Nope
</message>
<message name="IDS_TRANSLATE_SHOW_ORIGINAL">
Show original
</message>
<message name="IDS_TRANSLATE_RETRY">
Try again
</message>
<message name="IDS_TRANSLATE_OPTIONS_SOURCE_HINT" desc="Language drop down text for the source language. [CHAR-LIMIT=64]">
Page Language:
</message>
<message name="IDS_TRANSLATE_OPTIONS_TARGET_HINT" desc="Language drop down text for the target language. [CHAR-LIMIT=64]">
Translation Language:
</message>
<message name="IDS_TRANSLATE_BUTTON_DONE" desc="Text to display on the translate infobar button to apply new languages. [CHAR-LIMIT=24]">
Done
</message>
<message name="IDS_TRANSLATE_NEVER_TRANSLATE_SITE" desc="Text to display on the never translate site (like www.google.com) button. [CHAR-LIMIT=64]">
Never translate this site
</message>
<message name="IDS_TRANSLATE_NEVER_TRANSLATE_LANGUAGE" desc="Text that appears on a button. Chrome asks the user if they want to translate a page from the source language into another, target language that the user may have shown interest in before. User can click the 'Never Translate' button to indicate that they never want Chrome to translate pages in this language. Imperative. [CHAR-LIMIT=64]">
Never translate <ph name="LANGUAGE">%1$s<ex>French</ex></ph>
</message>
<message name="IDS_TRANSLATE_OPTION_ALWAYS_TRANSLATE" desc="Option in the Chrome menu. User can click the 'Always Translate' option to indicate that they want Chrome to translate pages in this language automatically. Imperative.">
Always translate pages in <ph name="SOURCE_LANGUAGE">%1$s<ex>French</ex></ph>
......
......@@ -4,12 +4,8 @@
package org.chromium.chrome.test.util;
import android.app.Activity;
import android.app.Instrumentation;
import android.text.SpannableString;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import org.junit.Assert;
......@@ -21,50 +17,11 @@ import org.chromium.chrome.browser.infobar.translate.TranslateMenu;
import org.chromium.chrome.browser.infobar.translate.TranslateTabLayout;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.TestTouchUtils;
/**
* Utility functions for dealing with Translate InfoBars.
*/
public class TranslateUtil {
/**
* Finds the first clickable span inside a TextView and clicks it.
*/
public static void openLanguagePanel(
Instrumentation instrumentation, Activity activity, InfoBar infoBar) {
View view = infoBar.getView().findViewById(R.id.infobar_message);
Assert.assertNotNull(view);
TextView text = (TextView) view.findViewById(R.id.infobar_message);
SpannableString spannable = (SpannableString) text.getText();
ClickableSpan[] clickable =
spannable.getSpans(0, spannable.length() - 1, ClickableSpan.class);
Assert.assertTrue(clickable.length > 0);
// Find the approximate coordinates of the first link of the first line of text so we can
// click there. Clicking on any character of the link will work so instead of focusing on
// the beginning of the link we add one more character so that finding a valid coordinate
// is more reliable.
int x = spannable.getSpanStart(clickable[0]) + 1;
float nChars = text.getLayout().getLineVisibleEnd(0);
// Not all characters have the same width but this is a good approximation.
float sizePerChar = text.getLayout().getLineWidth(0) / nChars;
float xPos = text.getPaddingLeft() + (sizePerChar * x);
float yPos = text.getHeight() / (float) 2;
TestTouchUtils.singleClickView(instrumentation, text, (int) xPos, (int) yPos);
assertInfoBarText(infoBar, activity.getString(R.string.translate_infobar_change_languages));
}
public static void assertInfoBarText(InfoBar infoBar, String expectedText) {
View view = infoBar.getView().findViewById(R.id.infobar_message);
Assert.assertNotNull(view);
String actualText = findInfoBarText(view);
Assert.assertEquals(expectedText, actualText);
}
public static void assertCompactTranslateInfoBar(InfoBar infoBar) {
Assert.assertTrue(infoBar.getView() instanceof InfoBarCompactLayout);
......@@ -143,8 +100,4 @@ public class TranslateUtil {
});
}
private static String findInfoBarText(View view) {
TextView text = (TextView) view.findViewById(R.id.infobar_message);
return text != null ? text.getText().toString() : null;
}
}
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