This method is used to parse the custom OpenStreetMap shortlink algorithm
that encodes lat, lon, and zoom. The previous version,
MapUtils.decodeShortLocString(), only parsed lat, lon from the shortlink.
This puts them all into a single <intent-filter> to improve readability and
reduce the number of IntentFilters used. This also adds some new domains:
* maps.yandex.com
* map.baidu.cn
* map.baidu.com
* wb.amap.com
* www.amap.com
It seems this code is quite out of date, because none of the URL formats
listed in the tests seem to work. This commit updates the URL formats in
the tests, then makes all of them parse properly. It also changes the
parsing technique, leveraging java.net.URL's built-in parsing abilities to
assist. Also, I plan on adding a lot more URL formats, so the current code
structure made it very difficult to add to. So each service will be split
out into its own section, starting here.
For the record, I do not think it is a good idea to share location using
HTTP, it should always be HTTPS. There are too many privacy concerns.
@vshcherb says he plans on adding HTTPS to osmand.net, so that will be good
once it happens.
osm.org is the official short URL for OpenStreetMap, with proper HTTPS
coming soon. openstreetmap.org is the temporary short URL since it already
supports HTTPS.
In order to maintain privacy when sharing location, this changes the shared
location link to use HTTPS, thereby hiding the location info from anyone
who might be snooping on the WiFi, ISP, internet, etc.
Unfortunately, http://osm.org does not yet work with HTTPS, but the
standard OSM URLs are short enough to fit into a text message. They are
planning on supporting https://osm.org in the future:
https://github.com/openstreetmap/operations/issues/2
fixes this stacktrace:
StrictMode E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E java.lang.Throwable: Explicit termination method 'end' not called
E at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E at java.util.zip.Inflater.<init>(Inflater.java:82)
E at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:96)
E at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
E at net.osmand.plus.download.DownloadOsmandIndexesHelper.downloadIndexesListFromInternet(DownloadOsmandIndexesHelper.java:112)
E at net.osmand.plus.download.DownloadOsmandIndexesHelper.getIndexesList(DownloadOsmandIndexesHelper.java:38)
E at net.osmand.plus.download.DownloadIndexesThread$1.doInBackground(DownloadIndexesThread.java:377)
E at net.osmand.plus.download.DownloadIndexesThread$1.doInBackground(DownloadIndexesThread.java:373)
E at android.os.AsyncTask$2.call(AsyncTask.java:288)
E at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E at java.lang.Thread.run(Thread.java:841)