Commit 93ede3b9 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW: don't use string constants for Dev UI

No change to logic. This inlines strings for the Dev UI, as we don't aim
to translate them anyway. Inlining strings is preferable to
translateable="false" entries in GRD files (see bug for rationale).

This adds lint suppressions as necessary.

Bug: 1014805
Test: adb shell am start com.google.android.webview/org.chromium.android_webview.ui.CrashesListActivity
Test: Manually verify the UI looks right
Change-Id: I67e66ced3ae7d9adbc61e68b92751e6865e1b0a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866269Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707197}
parent 4ca8eca6
...@@ -38,8 +38,9 @@ ...@@ -38,8 +38,9 @@
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
<!--suppress HardcodedText -->
<activity android:name="org.chromium.android_webview.ui.CrashesListActivity" <activity android:name="org.chromium.android_webview.ui.CrashesListActivity"
android:label="@string/crashes_list_activity_title" android:label="WebView Crashes"
android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #} android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #}
</activity> </activity>
<provider android:name="com.android.webview.chromium.LicenseContentProvider" <provider android:name="com.android.webview.chromium.LicenseContentProvider"
......
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:textIsSelectable="true"/> android:textIsSelectable="true"/>
<!--suppress HardcodedText -->
<Button <Button
android:id="@+id/crash_report_button" android:id="@+id/crash_report_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/crash_report_button_text"/> android:text="Provide more info"/>
</LinearLayout> </LinearLayout>
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu 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">
<!--suppress HardcodedText -->
<item <item
android:id="@+id/options_menu_refresh" android:id="@+id/options_menu_refresh"
android:title="@string/menu_refresh" android:title="Refresh"
android:showAsAction="never" /> android:showAsAction="never" />
</menu> </menu>
...@@ -25,6 +25,7 @@ import org.chromium.android_webview.ui.util.WebViewCrashInfoCollector; ...@@ -25,6 +25,7 @@ import org.chromium.android_webview.ui.util.WebViewCrashInfoCollector;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
* An activity to show a list of recent WebView crashes. * An activity to show a list of recent WebView crashes.
...@@ -37,11 +38,41 @@ public class CrashesListActivity extends Activity { ...@@ -37,11 +38,41 @@ public class CrashesListActivity extends Activity {
private TextView mCrashesSummaryView; private TextView mCrashesSummaryView;
private WebViewCrashInfoCollector mCrashCollector; private WebViewCrashInfoCollector mCrashCollector;
private static final String CRASH_REPORT_TEMPLATE = ""
+ "IMPORTANT: Your crash has already been automatically reported to our crash system. "
+ "You only need to fill this out if you can share more information like steps to "
+ "reproduce the crash.\n"
+ "\n"
+ "Device name:\n"
+ "Android OS version:\n"
+ "WebView version (On Android L-M, this is the version of the 'Android System "
+ "WebView' app. On Android N-P, it's most likely Chrome's version. You can find the "
+ "version of any app under Settings > Apps > the 3 dots in the upper right > Show "
+ "system.):\n"
+ "Application: (Please link to its Play Store page if possible. You can get the link "
+ "from inside the Play Store app by tapping the 3 dots in the upper right > Share > "
+ "Copy to clipboard. Or you can find the app on the Play Store website: "
+ "https://play.google.com/store/apps.)\n"
+ "Application version:\n"
+ "\n"
+ "\n"
+ "Steps to reproduce:\n"
+ "(1)\n"
+ "(2)\n"
+ "(3)\n"
+ "\n"
+ "\n"
+ "Expected result:\n"
+ "(What should have happened?)\n"
+ "\n"
+ "\n"
+ "****DO NOT CHANGE BELOW THIS LINE****\n"
+ "Crash ID: http://crash/%s\n";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setTitle(R.string.crashes_list_activity_title);
setContentView(R.layout.activity_crashes_list); setContentView(R.layout.activity_crashes_list);
mCrashListView = findViewById(R.id.crashes_list); mCrashListView = findViewById(R.id.crashes_list);
...@@ -94,7 +125,7 @@ public class CrashesListActivity extends Activity { ...@@ -94,7 +125,7 @@ public class CrashesListActivity extends Activity {
private String getCrashInfoLabelText(CrashInfo crashInfo) { private String getCrashInfoLabelText(CrashInfo crashInfo) {
String status = String status =
crashInfo.uploadState == null ? "UNKOWN" : crashInfo.uploadState.toString(); crashInfo.uploadState == null ? "UNKOWN" : crashInfo.uploadState.toString();
return getString(R.string.crash_label, crashInfo.localId, status); return String.format(Locale.US, "Crash (%s) - [%s]", crashInfo.localId, status);
} }
/** /**
...@@ -144,7 +175,7 @@ public class CrashesListActivity extends Activity { ...@@ -144,7 +175,7 @@ public class CrashesListActivity extends Activity {
.path("/p/chromium/issues/entry") .path("/p/chromium/issues/entry")
.appendQueryParameter("template", "Webview+Bugs") .appendQueryParameter("template", "Webview+Bugs")
.appendQueryParameter("comment", .appendQueryParameter("comment",
getString(R.string.crash_report_template, crashInfo.uploadId)) String.format(Locale.US, CRASH_REPORT_TEMPLATE, crashInfo.uploadId))
.appendQueryParameter("labels", "User-Submitted") .appendQueryParameter("labels", "User-Submitted")
.build(); .build();
} }
...@@ -154,7 +185,7 @@ public class CrashesListActivity extends Activity { ...@@ -154,7 +185,7 @@ public class CrashesListActivity extends Activity {
List<CrashInfo> crashesList = mCrashCollector.loadCrashesInfo(MAX_CRASHES_NUMBER); List<CrashInfo> crashesList = mCrashCollector.loadCrashesInfo(MAX_CRASHES_NUMBER);
mCrashListView.setAdapter(new CrashListAdapter(crashesList)); mCrashListView.setAdapter(new CrashListAdapter(crashesList));
mCrashesSummaryView.setText(getString(R.string.crashes_num, crashesList.size())); mCrashesSummaryView.setText(String.format(Locale.US, "Crashes (%d)", crashesList.size()));
} }
@Override @Override
......
...@@ -117,45 +117,6 @@ ...@@ -117,45 +117,6 @@
<message name="IDS_LICENSE_ACTIVITY_TITLE" desc="The title of the activity that displays licenses of WebView. [CHAR-LIMIT=50]"> <message name="IDS_LICENSE_ACTIVITY_TITLE" desc="The title of the activity that displays licenses of WebView. [CHAR-LIMIT=50]">
System WebView licenses System WebView licenses
</message> </message>
<!-- All WebView Developer UI strings below this line are intentionally marked as not translateable -->
<message name="IDS_CRASHES_LIST_ACTIVITY_TITLE" translateable="false">
WebView Crashes
</message>
<message name="IDS_MENU_REFRESH" translateable="false">
Refresh
</message>
<message name="IDS_CRASHES_NUM" translateable="false">
Crashes (<ph name="CRASHES_NUMBER"><ex>10</ex>%1$d</ph>)
</message>
<message name="IDS_CRASH_LABEL" translateable="false">
Crash (<ph name="CRASH_LOCAL_ID"><ex>abde213122d3ff0</ex>%1$s</ph>) - [<ph name="CRASH_STATUS"><ex>UPLOADED</ex>%2$s</ph>]
</message>
<message name="IDS_CRASH_REPORT_BUTTON_TEXT" translateable="false">
Provide more info
</message>
<message name="IDS_CRASH_REPORT_TEMPLATE" translateable="false">
IMPORTANT: Your crash has already been automatically reported to our crash system. You only need to fill this out if you can share more information like steps to reproduce the crash.
Device name:
Android OS version:
WebView version (On Android L-M, this is the version of the "Android System WebView" app. On Android N-P, it's most likely Chrome's version. You can find the version of any app under Settings > Apps > the 3 dots in the upper right > Show system.):
Application: (Please link to its Play Store page if possible. You can get the link from inside the Play Store app by tapping the 3 dots in the upper right > Share > Copy to clipboard. Or you can find the app on the Play Store website: https://play.google.com/store/apps .)
Application version:
Steps to reproduce:
(1)
(2)
(3)
Expected result:
(What should have happened?)
****DO NOT CHANGE BELOW THIS LINE****
Crash ID: http://crash/<ph name="CRASH_UPLOAD_ID"><ex>277008e5bac834706c</ex>%1$s</ph>
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
...@@ -977,10 +977,6 @@ ...@@ -977,10 +977,6 @@
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:label="@string/crashes_list_activity_title"
android:name="org.chromium.android_webview.ui.CrashesListActivity"
android:process=":webview_apk"/>
<activity <activity
android:label="@string/license_activity_title" android:label="@string/license_activity_title"
android:name="com.android.webview.chromium.LicenseActivity" android:name="com.android.webview.chromium.LicenseActivity"
...@@ -993,6 +989,11 @@ ...@@ -993,6 +989,11 @@
android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true"/> android:value="true"/>
</activity> </activity>
<activity
android:label="WebView
Crashes"
android:name="org.chromium.android_webview.ui.CrashesListActivity"
android:process=":webview_apk"/>
<activity <activity
android:enabled="false" android:enabled="false"
android:excludeFromRecents="true" android:excludeFromRecents="true"
......
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