0

We have a weather app for Android that also provides a widget. The widget displays the current time and weather for the current user location.

We update the widget clock every minute (via AlarmManager) if the display is active, the weather data at longer intervals. Sometimes the widget "freezes". We were able to track that down to the alarm for the next check not being set but don't have a clue why, yet.

Now we noticed the following warning in the device logs of an affected device:

03-12 10:15:44.803   771  4958 W ActivityManager: Permission Denial: opening provider com.google.android.gsf.gservices.GservicesProvider from ProcessRecord{41a4d028 25012:com.my.app/u0a88} (pid=25012, uid=10088) requires com.google.android.providers.gsf.permission.READ_GSERVICES or com.google.android.providers.gsf.permission.WRITE_GSERVICES

This starts to appear exactly at the time where the clock should have been updated. The message is then repeated several times until the ActivityManager terminates the process.

We use the Google Play Location Services to get the current (or last known) location of the user. I found references to a bug in version 4.2 of the services (here and https://stackoverflow.com/questions/22682538/when-to-use-read-gservices-permission) that could cause this error, but the device has version 6.7.76 installed.

One more thing to consider is that the device is running Cyanogenmod, though the stuck widget problem also happens on devices with "regular" Android.

Any hints what could cause this permission error are very much appreciated. Thanks!

Edit: The widget and app work fine on that and many other devices until the warning appears. Also the Google documentation is not mentioning that you need to get those permissions. In fact the only mention of those is here in this document according to the on site search, but no mention of READ_GSERVICES on the page itself.

Community
  • 1
  • 1
Cornelius
  • 4,214
  • 3
  • 36
  • 55
  • Isn't error message you quoted rather self-explanatory one? – Marcin Orlowski Mar 13 '15 at 15:03
  • Yes, but not why it doesn't appear before, why the Google documentation doesn't mention those permissions and why it is working on millions of other devices. Edit: It is really working most of the time in most cases. It also works on this device for some time. – Cornelius Mar 13 '15 at 15:10

1 Answers1

3

The two permissions it is asking for:

<uses-permission android:name="com.google.android.providers.gsf.permisson.READ_GSERVICES"/>       
<uses-permission android:name="com.google.android.providers.gsf.permission.WRITE_GSERVICES"/>

Something to remember just because this issue was reported in Google Play Location Services in 4.2 does not mean it has been fixed. It may be worth looking through the Google bug reported to see if anyone has any issues. I found a few issues raised running much newer Google Play Services.

Upon doing a quick Google search myself it seems like the major problem phones are the Moto X and the Nexus 5. Which is rather interesting as they are both Android Open Source Project bugs (i.e phones running stock Android with no skin!)

Just a few questions:

  • Can you confirm what phone you have and which version of Android you are running please?
  • Also what is your target SDK?
  • What version of play services are included in your APK?
apmartin1991
  • 3,064
  • 1
  • 23
  • 44
  • Thanks for answering! Strange thing is that the documentation does not mention those permissions. I will get back to you with the required information next week (colleague with the device isn't in anymore). – Cornelius Mar 13 '15 at 16:45
  • Here is the requested info: **Phone**: Sony C5303 with cm-11-20150309-NIGHTLY (CyanogenMod), **Target SDK**: 21, **Play Services**: 6.5.87 – Cornelius Mar 16 '15 at 08:51
  • I see this exception only for amazon devices. is it something for non google play distributed devices? – Emil Jan 09 '18 at 00:51
  • btw, you are typo on the READ_GSERVICES permission. Should be permission instead of permisson. – Kharda Apr 22 '20 at 09:38