signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.16k stars 6.06k forks source link

Signup Failure - prompt to update while Play Services are actually disabled #6381

Closed le-bug closed 7 years ago

le-bug commented 7 years ago

I have:


Bug description

I was eager to try out the new non gcm functionality, got an android phone and promptly disabled the Google Play Apps (precise lising below). Trying to sign up for Signal resulted in a failure, as the App requires me for some reason to update the Play Services before continuing. This locks me out.

[I dont think this is wanted behavior. Looking into src/org/thoughtcrime/securesms/RegistrationActivity.java, it looks like ConnectionResult.SERVICE_DISABLED is supposed to be treated as MISSING but that doesn't seem to work.]

Steps to reproduce

Actual result: A pop up appears: Update Google Play Services Signal won't run unless you update Google Play Services. This is impossible as they are intentionally disabled and unwanted as we want to use Websocket push.

Expected result:

The registration happens and Signal sets up so that gcmdisabled true is set. Signal can be used. (Treat this as if the Google Play service components were just MISSING)

Device info

Android version: 6.0.1 Signal version: 3.31.4 Stock Rom. Newly of the shelf bought phone. disabled apps: com.google.android.gms com.android.vending com.google.android.gsf

Debug log not available as signup is impossible.

A fix would be greatly appreaciated, as it would allow to quickly setup an android burner phone for Signal without much technical sophistication.

johanw666 commented 7 years ago

One might as well treat "gcm too old" the same as "gcm missing". That might enable Signal in the future to run on devices for which no newer gcm becomes available.

le-bug commented 7 years ago

My hypothesis is that the googely bit that checks for the status of the Play Services returns "Update needed" when they are both outdated and disabled. So we either need a way to distinguish between outdated and outdated+disabled, or give the user the choice of what to do when the Play Services are detected as being outdated.

(A quick dirty tip on how to circumvent this locally on my device would be nice, in case this won't ne implemented soon.)

moxie0 commented 7 years ago

I think you'll have to file this bug with Google

egesgehrth commented 7 years ago

Android 6.0, Google Play Services disabled. Whatsapp detect Google Play Services disabled and all working, why not Signal?

le-bug commented 7 years ago

@moxie0 I was just speculating that the issue was in google parts. And even if that is actually the case, wouldn't it be quite low effort to add a line in the Registration activity that works around this? (Or would you have issues with an implementation that asks the user what she wants, when automatic distinction between disabled+outdated and outdated fails?)

le-bug commented 7 years ago

Because no matter who's fault this is, this bug prevents usage of Signal under the described circumstances. That's a pity.

le-bug commented 7 years ago

Another point to consider: Google changing the behavior of the Play Services (following a bug report) will probably not fix this. Firstly, users who have disabled the Play services won't recieve updates for them (so the bugfix on google's side will never help them). Also when an app is disabled it that includes uninstalling all updates for it, so even if you were to update the Play Services before disabling them, this would all be undone again. And third, it is very common for Android devices to not get updates from the manufacturer (as with the device i do these tests on), so the Play Services that get shipped with their Operating System will just always be outdated.

As far as I can see, if we want this to be fixed, we need to make a change to Signal itself (multiple options are mentioned in the comments above). So @moxie0 , would you be so kind to consider a change here. What way of handling this would you prefer? Or, where are you sceptic about this?

[Sorry for my the many words, I greatly appreciate the work everybody is doing here.]

moxie0 commented 7 years ago

The bug would be in the stub that's linked into Signal, not the GMS service on the device.

le-bug commented 7 years ago

So I did some research but failed to find the correct place for reporting bugs against the Google Play Services "Client Library" (thats what the stub is called). Could anybody point me in the right direction (or, even better, report the bug themselves if they already have an account and access there)?

[Following @johanw666 's suggestion I created a branch where outdated Services would result in a promptForNoPlayServices. 20c20cbfa52f7a16d4eb25d00d0e669bd1ed5446 The reasoning being, that the first thing the Play Services do is always to update themselves, so there should be virtually no splash damage against people who actually want to use gcm push, as this should happen before a download from the Play Store. Would such a tweak be acceptible for Signal (maybe just for as long as this issue exists)?]

moxie0 commented 7 years ago

It is fairly common that people need to update Play Services, much less so that people have decided to use an Android device without Play Services for ideological or safety reasons, but only marked it disabled rather than removing it. Using Play Services provides a better experience and is more secure, so we would not want to enable defaults that reflect otherwise.

However, I would accept a PR that explicitly checks if Play Services has been disabled if the client library reports missing.

johanw666 commented 7 years ago

@le-bug : AFAIK Play Services only upgrade themselves if there is an active Google account on the device. I'm running stock Android with gcm but I have no Google account activated on my device. I have to download updates for the Play Services from apkmirror.

le-bug commented 7 years ago

@moxie0 that's fair.

So it looks like other people (http://stackoverflow.com/questions/32220798/how-to-check-google-play-services-is-enabled-disabled-from-code-in-android) have found that disabled+outdated Play Services are considered as outdated. I would still like for that to be reported as a bug.

For explicitly checking if Play Services have been disabled I found two ways. They use the android PackageManager.

1st Something like

ApplicationInfo ai = getActivity().getPackageManager().getApplicationInfo("com.google.android.gms",0);

boolean appStatus = ai.enabled;

should return false for the appStatus if GMS is disabled.

Documentation: https://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationInfo%28java.lang.String,%20int%29 https://developer.android.com/reference/android/content/pm/ApplicationInfo.html#enabled

2nd.

getApplicationEnabledSetting does something similar. https://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationEnabledSetting(java.lang.String)

So I think one could check this way first and then call the Play Client Library call afterwards, or do this check when the Client Library says NEEDS_UPDATE but before the getErrorDialog part.

(I am sorry that I am talking so much about what could be done, but not doing much of the doing. I am not actually a programmer and not sure if me hacking roughly on this would lead to a result that is appropriate for such a security critical application.)

PlutoniumHeart commented 7 years ago

How about instead of an error window asking the user to update play service, pop a dialog asking the user whether they want to update the play service or use signal without it.

So instead of one button "update" it is now 2 buttons "update" and "continue without".

Just my 2 cents.

le-bug commented 7 years ago

So, one walk in the sun and a few explanations from friends later, and I have learned enough java syntax to implement what @moxie0 said he would merge.

You can see the results here: https://github.com/le-bug/Signal-Android/commit/645d6facc976fd6487bd8a6c6e6b49a4cabab1db

I would be very happy to have more eyes on this, so I encourage everyone interested to proofread and test.

One thing I am not sure of: Do I need to do some import at the beginning to use the PackageManager this way?

dietyyli commented 7 years ago

You can see the results here: https://github.com/le-bug/Signal-Android/commit/645d6facc976fd6487bd8a6c6e6b49a4cabab1db

That link is 404. @le-bug Are you still trying to solve this?

dietyyli commented 7 years ago

I tried working around this by updating Play Services from apkmirror. Well I got little further, received the sms message but Signal could not reach server. Network error. This happened with wifi and just mobile data. Maybe I'm missing something...

le-bug commented 7 years ago

Thank you @moxie0 so much for the fix. Now I can compare your implementation with my attempt and learn from that. Cheers!

[It looks like the release at https://signal.org/android/apk/ lags behind the Google Play one in the version number.]