Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps open-source-attribution is incredibly large and blocks the main thread

Update 6 May 2017: Google has removed the attribution requirements from the Google Maps API. This can be seen here: https://issuetracker.google.com/issues/35827189

According to Google's introduction to the Google Maps Android API,

If you use the Google Maps Android API in your application, you must include the Google Play Services attribution text as part of a "Legal Notices" section in your application. Including legal notices as an independent menu item, or as part of an "About" menu item, is recommended.

The attribution text is available by making a call to GoogleApiAvailability.getOpenSourceSoftwareLicenseInfo.

The thing is that the text is really long (542,653 characters!) and trying to set that into a textView blocks the main thread for a long time. Has anyone else run into this issue? Is there a URL that we could link to instead?

I did some research and found that others have had this issue and Google has acknowledged it as a defect. However, until this is updated I can't properly attribute Google without creating a fatal performance flaw in my app.

Q: Has anyone found a way to quickly render Google's open-source-attribution text without blocking the main thread? Or does anyone know of something I could link to until the issue is resolved?

like image 655
Kris Avatar asked Aug 16 '16 19:08

Kris


1 Answers

that the text is really long

It is! Converted to a text file, it is around half a megabyte of text. The reason is that it contains:

  • 27 copies of the Apache 2.0 license (replacing them with a URL brings the file to about half the size) → https://www.apache.org/licenses/LICENSE-2.0
  • 19 copies of the BSD 3-clause license (luckily, this one is shorter) → https://opensource.org/licenses/BSD-3-Clause
  • at least 10 references to the Apache 2.0 license in short form
  • 6 copies of the MIT license → https://opensource.org/licenses/MIT
  • 2 copies of the BSD 2-clause license → https://opensource.org/licenses/BSD-2-Clause
  • 2 copies of the Android SDK license agreement (15 KB itself) → https://developer.android.com/studio/terms.html
  • 1 copy of the LGPL 2.1 → https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
  • 1 copy of the ICU license → https://ssl.icu-project.org/repos/icu/icu/trunk/LICENSE
  • 1 copy of the Unicode terms of use → http://www.unicode.org/copyright.html
  • 1 copy of the STLport license → http://stlport.sourceforge.net/License.shtml
  • 1 copy of the zlib license → http://www.zlib.net/zlib_license.html
  • 1 copy of this weird license → http://www-archive.mozilla.org/MPL/boilerplate-1.1/mpl-tri-license-txt
  • 1 copy of the Mozilla Public License 2.0 for "Eigen" (and more, see below) → https://www.mozilla.org/en-US/MPL/2.0/
  • a huge piece of license information related to "Eigen" → https://bitbucket.org/eigen/eigen/src/

There are also some other licenses that are not easy to find on "reliable" sites so it's better not to link to them. After replacing the text with links, the file goes down to less than 22 KB.

Still quite long!

  • original file
  • stripped version

I know... license information should not rely on external URLs. However, 514 KB of text is insane and any app either has to lag really bad to include the license, or not include any license at all. I think this compromise is the best solution.

Or does anyone know of something I could link to until the issue is resolved?

The text can be stored in a text file and retrieved when needed.

like image 106
Andrea Lazzarotto Avatar answered Oct 14 '22 03:10

Andrea Lazzarotto