Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83955cb2 authored by Aaron Whyte's avatar Aaron Whyte Committed by Justin Koh
Browse files

Catch OperationUnsupportedException when linkifying using WebView

This fixes a CTS test for Wearable. We cannot check for FEATURE_WEBVIEW, because
there's no way to get a PackageManager from within these static methods.
Bug: 15131296

Change-Id: I7bf7564b6209f330a413ed54a94be1e07fedb30d
parent 3f175a35
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -465,6 +465,7 @@ public class Linkify {
        String address;
        int base = 0;

        try {
            while ((address = WebView.findAddress(string)) != null) {
                int start = string.indexOf(address);

@@ -492,6 +493,12 @@ public class Linkify {
                spec.url = "geo:0,0?q=" + encodedAddress;
                links.add(spec);
            }
        } catch (UnsupportedOperationException e) {
            // findAddress may fail with an unsupported exception on platforms without a WebView.
            // In this case, we will not append anything to the links variable: it would have died
            // in WebView.findAddress.
            return;
        }
    }

    private static final void pruneOverlaps(ArrayList<LinkSpec> links) {