Bug 1411654 - Part 5: Work through various new lint issues. r=mcomella
MozReview-Commit-ID: AhrT7jbztE3
--- a/mobile/android/app/src/main/res/drawable/ic_as_trending.xml
+++ b/mobile/android/app/src/main/res/drawable/ic_as_trending.xml
@@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="12.0"
android:viewportHeight="12.0">
<path
android:fillColor="@color/activity_stream_icon"
- android:pathData="M4.97.151l-2.819,6.5A.25.25,0,0,0,2.381,7H4.029a.25.25,0,0,1,.225.359L2,12,9.4,5.437A.25.25,0,0,0,9.234,5H6.791a.25.25,0,0,1-.19-.412L10.15.412A.25.25,0,0,0,9.959,0H5.2A.25.25,0,0,0,4.97.151Z"/>
+ android:pathData="M4.97,0.151l-2.819,6.5A0.25,0.25,0,0,0,2.381,7H4.029a0.25,0.25,0,0,1,0.225,0.359L2,12,9.4,5.437A0.25,0.25,0,0,0,9.234,5H6.791a0.25,0.25,0,0,1,-0.19,-0.412L10.15,0.412A0.25,0.25,0,0,0,9.959,0H5.2A0.25,0.25,0,0,0,4.97,0.151Z"/>
</vector>
--- a/mobile/android/app/src/main/res/layout/customtabs_action_bar_custom_view.xml
+++ b/mobile/android/app/src/main/res/layout/customtabs_action_bar_custom_view.xml
@@ -35,26 +35,25 @@
android:animateLayoutChanges="true"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/custom_tabs_action_bar_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:lines="1"
+ android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="14sp"
tools:text="Mozilla.org"/>
<TextView
android:id="@+id/custom_tabs_action_bar_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:lines="1"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="10sp"
android:ellipsize="middle"
android:scrollHorizontally="true"
tools:text="https://mozilla.org"/>
</LinearLayout>
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -1,11 +1,12 @@
#filter substitution
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="@ANDROID_PACKAGE_NAME@"
android:installLocation="internalOnly"
android:versionCode="@ANDROID_VERSION_CODE@"
android:versionName="@MOZ_APP_VERSION@"
#ifdef MOZ_ANDROID_SHARED_ID
android:sharedUserId="@MOZ_ANDROID_SHARED_ID@"
#endif
>
@@ -130,17 +131,17 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="org.mozilla.gecko.UPDATE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
- <intent-filter>
+ <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.WEB_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
@@ -156,27 +157,27 @@
used, so we use integer resources instead of drawables, because
setting a drawable referenced to 0 results in errors when used
as a real drawable resource somewhere else. -->
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@integer/assist_launch_icon_res"/>
<!-- For XPI installs from websites and the download manager. -->
- <intent-filter>
+ <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="application/x-xpinstall" />
</intent-filter>
<!-- For XPI installs from file: URLs. -->
- <intent-filter>
+ <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="" />
<data android:scheme="file" />
<data android:pathPattern=".*\\.xpi" />
</intent-filter>
#ifdef MOZ_ANDROID_BEAM
--- a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
@@ -47,17 +47,19 @@ import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
-@SuppressLint("Registered") // This activity is only registered in the manifest if MOZ_CRASHREPORTER is set
+// Registered: This activity is only registered in the manifest if MOZ_CRASHREPORTER is set.
+// CutPasteId: This lint is not worth fixing. To fix it, cache all the findViewById results.
+@SuppressLint("Registered,CutPasteId")
public class CrashReporter extends AppCompatActivity
{
private static final String LOGTAG = "GeckoCrashReporter";
private static final String PASSED_MINI_DUMP_KEY = "minidumpPath";
private static final String PASSED_MINI_DUMP_SUCCESS_KEY = "minidumpSuccess";
private static final String MINI_DUMP_PATH_KEY = "upload_file_minidump";
private static final String PAGE_URL_KEY = "URL";
--- a/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java
@@ -301,17 +301,21 @@ public class LocalBrowserDB extends Brow
// For now, each name is expected to be unique, and duplicate
// icons will be duplicated in the DB. See Bug 1040806 Comment 8.
if (iconValue != null) {
final int faviconID = faviconIDs.get(name);
iconValue.put("_id", faviconID);
bookmarkValue.put(Bookmarks.FAVICON_ID, faviconID);
faviconValues.add(iconValue);
}
- } catch (IllegalAccessException | IllegalArgumentException | NoSuchFieldException e) {
+ } catch (IllegalAccessException e) {
+ Log.wtf(LOGTAG, "Reflection failure.", e);
+ } catch (IllegalArgumentException e) {
+ Log.wtf(LOGTAG, "Reflection failure.", e);
+ } catch (NoSuchFieldException e) {
Log.wtf(LOGTAG, "Reflection failure.", e);
}
}
if (!faviconValues.isEmpty()) {
try {
cr.bulkInsert(mFaviconsUriWithProfile, faviconValues.toArray(new ContentValues[faviconValues.size()]));
} catch (Exception e) {
@@ -497,17 +501,23 @@ public class LocalBrowserDB extends Brow
try {
Class<?> drawablesClass = R.raw.class;
// Look for a favicon with the id R.raw.bookmarkdefaults_favicon_*.
Field faviconField = drawablesClass.getField(name.replace("_title_", "_favicon_"));
faviconField.setAccessible(true);
return faviconField.getInt(null);
- } catch (IllegalAccessException | NoSuchFieldException e) {
+ } catch (IllegalAccessException e) {
+ // We'll end up here for any default bookmark that doesn't have a favicon in
+ // resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
+ // fall back to the default branding icon for about pages. Non-about pages should always
+ // specify an icon; otherwise, the placeholder globe favicon will be used.
+ Log.d(LOGTAG, "No raw favicon resource found for " + name);
+ } catch (NoSuchFieldException e) {
// We'll end up here for any default bookmark that doesn't have a favicon in
// resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
// fall back to the default branding icon for about pages. Non-about pages should always
// specify an icon; otherwise, the placeholder globe favicon will be used.
Log.d(LOGTAG, "No raw favicon resource found for " + name);
}
Log.e(LOGTAG, "Failed to find favicon resource ID for " + name);