AndroidManifest.xml: remove filter for intents once thrown by Google Maps, Google Now and Google Calendar

This commit is contained in:
Andreas Schildbach 2022-08-23 16:45:37 +02:00
parent c8fc8f0ffb
commit da08b96180
3 changed files with 1 additions and 311 deletions

View file

@ -294,207 +294,6 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="google.navigation" />
</intent-filter>
<!-- thrown by google now, and google calendar for plain addresses -->
<intent-filter android:label="@string/directions_intentfilter_title">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="maps.google.com" />
<data android:host="maps.google.cat" />
<data android:host="maps.google.it.ao" />
<data android:host="mapy.google.pl" />
<data android:host="local.google.com" />
<!-- maps.google.co.tld -->
<data android:host="maps.google.co.ao" />
<data android:host="maps.google.co.bw" />
<data android:host="maps.google.co.ck" />
<data android:host="maps.google.co.cr" />
<data android:host="maps.google.co.id" />
<data android:host="maps.google.co.il" />
<data android:host="maps.google.co.in" />
<data android:host="maps.google.co.jp" />
<data android:host="maps.google.co.ke" />
<data android:host="maps.google.co.kr" />
<data android:host="maps.google.co.ls" />
<data android:host="maps.google.co.ma" />
<data android:host="maps.google.co.mz" />
<data android:host="maps.google.co.nz" />
<data android:host="maps.google.co.th" />
<data android:host="maps.google.co.tz" />
<data android:host="maps.google.co.ug" />
<data android:host="maps.google.co.uk" />
<data android:host="maps.google.co.ve" />
<data android:host="maps.google.co.vi" />
<data android:host="maps.google.co.za" />
<data android:host="maps.google.co.zm" />
<data android:host="maps.google.co.zw" />
<!-- maps.google.com.tld -->
<data android:host="maps.google.com.ag" />
<data android:host="maps.google.com.ai" />
<data android:host="maps.google.com.ar" />
<data android:host="maps.google.com.au" />
<data android:host="maps.google.com.bd" />
<data android:host="maps.google.com.bh" />
<data android:host="maps.google.com.bn" />
<data android:host="maps.google.com.bo" />
<data android:host="maps.google.com.br" />
<data android:host="maps.google.com.bz" />
<data android:host="maps.google.com.co" />
<data android:host="maps.google.com.cu" />
<data android:host="maps.google.com.do" />
<data android:host="maps.google.com.ec" />
<data android:host="maps.google.com.eg" />
<data android:host="maps.google.com.et" />
<data android:host="maps.google.com.fj" />
<data android:host="maps.google.com.gh" />
<data android:host="maps.google.com.gi" />
<data android:host="maps.google.com.gt" />
<data android:host="maps.google.com.hk" />
<data android:host="maps.google.com.iq" />
<data android:host="maps.google.com.jm" />
<data android:host="maps.google.com.kh" />
<data android:host="maps.google.com.kw" />
<data android:host="maps.google.com.lb" />
<data android:host="maps.google.com.lv" />
<data android:host="maps.google.com.ly" />
<data android:host="maps.google.com.mm" />
<data android:host="maps.google.com.mt" />
<data android:host="maps.google.com.mx" />
<data android:host="maps.google.com.my" />
<data android:host="maps.google.com.na" />
<data android:host="maps.google.com.ng" />
<data android:host="maps.google.com.ni" />
<data android:host="maps.google.com.np" />
<data android:host="maps.google.com.om" />
<data android:host="maps.google.com.pa" />
<data android:host="maps.google.com.pe" />
<data android:host="maps.google.com.pg" />
<data android:host="maps.google.com.ph" />
<data android:host="maps.google.com.pr" />
<data android:host="maps.google.com.py" />
<data android:host="maps.google.com.qa" />
<data android:host="maps.google.com.sa" />
<data android:host="maps.google.com.sb" />
<data android:host="maps.google.com.sg" />
<data android:host="maps.google.com.sl" />
<data android:host="maps.google.com.sv" />
<data android:host="maps.google.com.tr" />
<data android:host="maps.google.com.tw" />
<data android:host="maps.google.com.ua" />
<data android:host="maps.google.com.uy" />
<data android:host="maps.google.com.vc" />
<!-- maps.google.tld -->
<data android:host="maps.google.ad" />
<data android:host="maps.google.ae" />
<data android:host="maps.google.as" />
<data android:host="maps.google.at" />
<data android:host="maps.google.ba" />
<data android:host="maps.google.be" />
<data android:host="maps.google.bf" />
<data android:host="maps.google.bg" />
<data android:host="maps.google.bi" />
<data android:host="maps.google.bj" />
<data android:host="maps.google.bs" />
<data android:host="maps.google.bt" />
<data android:host="maps.google.by" />
<data android:host="maps.google.ca" />
<data android:host="maps.google.cd" />
<data android:host="maps.google.cf" />
<data android:host="maps.google.cg" />
<data android:host="maps.google.ch" />
<data android:host="maps.google.ci" />
<data android:host="maps.google.cl" />
<data android:host="maps.google.cm" />
<data android:host="maps.google.cn" />
<data android:host="maps.google.cv" />
<data android:host="maps.google.cz" />
<data android:host="maps.google.de" />
<data android:host="maps.google.dj" />
<data android:host="maps.google.dk" />
<data android:host="maps.google.dm" />
<data android:host="maps.google.dz" />
<data android:host="maps.google.ee" />
<data android:host="maps.google.es" />
<data android:host="maps.google.fi" />
<data android:host="maps.google.fm" />
<data android:host="maps.google.fr" />
<data android:host="maps.google.ga" />
<data android:host="maps.google.ge" />
<data android:host="maps.google.gg" />
<data android:host="maps.google.gl" />
<data android:host="maps.google.gm" />
<data android:host="maps.google.gp" />
<data android:host="maps.google.gr" />
<data android:host="maps.google.gy" />
<data android:host="maps.google.hk" />
<data android:host="maps.google.hn" />
<data android:host="maps.google.hr" />
<data android:host="maps.google.ht" />
<data android:host="maps.google.hu" />
<data android:host="maps.google.ie" />
<data android:host="maps.google.im" />
<data android:host="maps.google.iq" />
<data android:host="maps.google.is" />
<data android:host="maps.google.it" />
<data android:host="maps.google.je" />
<data android:host="maps.google.jo" />
<data android:host="maps.google.jp" />
<data android:host="maps.google.kg" />
<data android:host="maps.google.ki" />
<data android:host="maps.google.kz" />
<data android:host="maps.google.la" />
<data android:host="maps.google.li" />
<data android:host="maps.google.lk" />
<data android:host="maps.google.lt" />
<data android:host="maps.google.lu" />
<data android:host="maps.google.lv" />
<data android:host="maps.google.md" />
<data android:host="maps.google.mg" />
<data android:host="maps.google.mk" />
<data android:host="maps.google.ml" />
<data android:host="maps.google.mn" />
<data android:host="maps.google.ms" />
<data android:host="maps.google.mt" />
<data android:host="maps.google.mu" />
<data android:host="maps.google.mv" />
<data android:host="maps.google.mw" />
<data android:host="maps.google.ne" />
<data android:host="maps.google.nf" />
<data android:host="maps.google.ng" />
<data android:host="maps.google.nl" />
<data android:host="maps.google.no" />
<data android:host="maps.google.nr" />
<data android:host="maps.google.nu" />
<data android:host="maps.google.pl" />
<data android:host="maps.google.pn" />
<data android:host="maps.google.pt" />
<data android:host="maps.google.ro" />
<data android:host="maps.google.rs" />
<data android:host="maps.google.ru" />
<data android:host="maps.google.rw" />
<data android:host="maps.google.sc" />
<data android:host="maps.google.se" />
<data android:host="maps.google.sh" />
<data android:host="maps.google.si" />
<data android:host="maps.google.sk" />
<data android:host="maps.google.sm" />
<data android:host="maps.google.sn" />
<data android:host="maps.google.so" />
<data android:host="maps.google.st" />
<data android:host="maps.google.td" />
<data android:host="maps.google.tg" />
<data android:host="maps.google.tk" />
<data android:host="maps.google.ti" />
<data android:host="maps.google.tl" />
<data android:host="maps.google.tn" />
<data android:host="maps.google.to" />
<data android:host="maps.google.tt" />
<data android:host="maps.google.vg" />
<data android:host="maps.google.vu" />
<data android:host="maps.google.ws" />
<data android:pathPrefix="/" />
</intent-filter>
</activity>
<activity

View file

@ -42,30 +42,8 @@ public class LocationUriParser {
}
final String scheme = uri.getScheme();
final String host = uri.getHost();
final String query = uri.getQuery();
if (("http".equals(scheme) || "https".equals(scheme)) && "maps.google.com".equals(host)) {
final String q = getQueryParameter(query, "q");
final String saddr = getQueryParameter(query, "saddr");
final String sll = getQueryParameter(query, "sll");
final Location fromLocation;
if (saddr != null)
fromLocation = parseAddrParam(saddr, null);
else if (sll != null)
fromLocation = parseAddrParam(sll, q);
else if (q != null)
fromLocation = new Location(LocationType.ANY, null, null, q);
else
fromLocation = null;
final String daddr = getQueryParameter(query, "daddr");
if (daddr != null)
return new Location[] { fromLocation, parseAddrParam(daddr, null) };
else
return new Location[] { fromLocation };
} else if ("google.navigation".equals(scheme)) {
if ("google.navigation".equals(scheme)) {
final Location location;
if (uri.isOpaque())
location = parseGoogleNavigation(uri.getSchemeSpecificPart());

View file

@ -23,66 +23,6 @@ import org.junit.Assert;
import org.junit.Test;
public class LocationUriParserTest {
@Test
public void googleNow() throws Exception {
final Location[] results = LocationUriParser.parseLocations(
"http://maps.google.com/maps/?saddr=@53.5878849,9.9050791&daddr=home@52.36894989013672,9.719719886779785&layer=t&dirflg=d");
Assert.assertEquals(2, results.length);
final Location fromLocation = results[0];
final Location toLocation = results[1];
Assert.assertEquals(LocationType.ADDRESS, fromLocation.type);
Assert.assertEquals(9905079, fromLocation.getLonAs1E6());
Assert.assertEquals(53587885, fromLocation.getLatAs1E6());
Assert.assertNull(fromLocation.name);
Assert.assertEquals(LocationType.ADDRESS, toLocation.type);
Assert.assertEquals(9719720, toLocation.getLonAs1E6());
Assert.assertEquals(52368950, toLocation.getLatAs1E6());
Assert.assertEquals("home", toLocation.name);
}
@Test
public void oldGoogleNow() throws Exception {
final Location[] results = LocationUriParser.parseLocations(
"http://maps.google.com/maps?daddr=52.52568054199219,13.374129295349121(Work)&dirflg=r&saddr=52.5360876,13.4263088");
Assert.assertEquals(2, results.length);
final Location fromLocation = results[0];
final Location toLocation = results[1];
Assert.assertEquals(LocationType.COORD, fromLocation.type);
Assert.assertEquals(13426309, fromLocation.getLonAs1E6());
Assert.assertEquals(52536088, fromLocation.getLatAs1E6());
Assert.assertNull(fromLocation.name);
Assert.assertEquals(LocationType.ADDRESS, toLocation.type);
Assert.assertEquals(13374129, toLocation.getLonAs1E6());
Assert.assertEquals(52525681, toLocation.getLatAs1E6());
Assert.assertEquals("Work", toLocation.name);
}
@Test
public void artem() throws Exception {
final Location[] results = LocationUriParser.parseLocations(
"http://maps.google.com/maps?saddr=52.5474,13.344510000000014&daddr=52.5057193,13.353883799999949");
Assert.assertEquals(2, results.length);
final Location fromLocation = results[0];
final Location toLocation = results[1];
Assert.assertEquals(LocationType.COORD, fromLocation.type);
Assert.assertEquals(13344510, fromLocation.getLonAs1E6());
Assert.assertEquals(52547400, fromLocation.getLatAs1E6());
Assert.assertNull(fromLocation.name);
Assert.assertEquals(LocationType.COORD, toLocation.type);
Assert.assertEquals(13353884, toLocation.getLonAs1E6());
Assert.assertEquals(52505719, toLocation.getLatAs1E6());
Assert.assertNull(toLocation.name);
}
@Test
public void googleNavigationThrownByGoogleNow() throws Exception {
// "Take me to Alexanderplatz"
@ -222,22 +162,6 @@ public class LocationUriParserTest {
Assert.assertEquals("Prinzenstraße 85, Berlin", location.name);
}
@Test
public void calendar() throws Exception {
final Location[] results = LocationUriParser.parseLocations(
"http://maps.google.com/maps?q=motion*s Tanz- und Bewegungsstudio - Stella Caric GmbH, Prinzenstraße 85, Aufgang B1 - Zugang von der Oranienstraße, 10969 Berlin, Germany&sll=52.50352,13.409187999999972&radius=5");
Assert.assertEquals(1, results.length);
final Location location = results[0];
Assert.assertEquals(LocationType.ADDRESS, location.type);
Assert.assertEquals(52503520, location.getLatAs1E6());
Assert.assertEquals(13409188, location.getLonAs1E6());
Assert.assertEquals(
"motion*s Tanz- und Bewegungsstudio - Stella Caric GmbH, Prinzenstraße 85, Aufgang B1 - Zugang von der Oranienstraße, 10969 Berlin, Germany",
location.name);
}
@Test
public void geoVariant() throws Exception {
final Location[] results = LocationUriParser.parseLocations("geo:52.1333313,11.60000038?z=6");
@ -251,17 +175,6 @@ public class LocationUriParserTest {
Assert.assertNull(location.name);
}
@Test
public void googleCalendarWithAddress() throws Exception {
final Location[] results = LocationUriParser.parseLocations(
"https://maps.google.com/?q=Husemannstra%C3%9Fe,+10435+Berlin,+Germany&ftid=0x47a84e01b6fb4d0b:0x65bf58162bae72fb");
Assert.assertEquals(1, results.length);
final Location location = results[0];
Assert.assertEquals(LocationType.ANY, location.type);
Assert.assertFalse(location.hasCoord());
Assert.assertEquals("Husemannstraße, 10435 Berlin, Germany", location.name);
}
@Test(expected = RuntimeException.class)
public void exceptionBecauseOfScheme() throws Exception {
LocationUriParser.parseLocations("foo:bar");