Permalink
Browse files

Support for using Signal without Play Services

This is now possible with beta calling, so non-GCM users are a
part of beta calling by default.

// FREEBIE
  • Loading branch information...
moxie0 committed Feb 20, 2017
1 parent 4112f23 commit 1669731329bcc32c84e33035a67a2fc22444c24b
View
@@ -84,6 +84,7 @@
<uses-permission android:name="android.permission.READ_CALL_STATE"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<permission android:name="org.thoughtcrime.securesms.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
@@ -533,6 +534,12 @@
</intent-filter>
</receiver>
<receiver android:name=".service.PersistentConnectionBootListener">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name=".notifications.MessageNotifier$ReminderReceiver">
<intent-filter>
<action android:name="org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION"/>
View
@@ -57,7 +57,7 @@ dependencies {
compile 'org.whispersystems:jobmanager:1.0.2'
compile 'org.whispersystems:libpastelog:1.0.7'
compile 'org.whispersystems:signal-service-android:2.5.0'
compile 'org.whispersystems:signal-service-android:2.5.1'
compile 'org.whispersystems:webrtc-android:M56-S1'
compile "me.leolin:ShortcutBadger:1.10-WS1"
@@ -127,7 +127,7 @@ dependencyVerification {
'com.google.android.gms:play-services-places:abf3a4a3b146ec7e6e753be62775e512868cf37d6f88ffe2d81167b33b57132b',
'org.whispersystems:jobmanager:506f679fc2fcf7bb6d10f00f41d6f6ea0abf75c70dc95b913398661ad538a181',
'org.whispersystems:libpastelog:bb331d9a98240fc139101128ba836c1edec3c40e000597cdbb29ebf4cbf34d88',
'org.whispersystems:signal-service-android:f207fcf8f17b5a1f04053151cad518f9520f8fbfb2e5563a19828f6b2c2b7b6d',
'org.whispersystems:signal-service-android:b0329b155cc9ad5e7fc08e4660538df1827c6d9485b05cab41946f36ad7ee0ab',
'org.whispersystems:webrtc-android:776a2769348f62aec28b9be6e97dcfea9c07b472ddbe24ac1ca1c46567cf8a8e',
'me.leolin:ShortcutBadger:e8e39df8a59d8211a30f40b1eeab21b3fa57b3f3e0f03abb995f82d66588778c',
'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb',
@@ -162,22 +162,22 @@ dependencyVerification {
'com.google.android.gms:play-services-base:0ca636a8fc9a5af45e607cdcd61783bf5d561cbbb0f862021ce69606eee5ad49',
'com.google.android.gms:play-services-basement:95dd882c5ffba15b9a99de3fefb05d3a01946623af67454ca00055d222f85a8d',
'com.google.android.gms:play-services-iid:54e919f9957b8b7820da7ee9b83471d00d0cac1cf08ddea8b5b41aea80bb1a70',
'org.whispersystems:signal-service-java:e0b9c41fcf614d58a71afcbb290d1864275b65364ca8fafeb5fbcbdc2d59a57a',
'org.whispersystems:signal-protocol-android:1b4b9d557c8eaf861797ff683990d482d4aa8e9f23d9b17ff0cc67a02f38cb19',
'org.whispersystems:signal-service-java:910ed96e928355d118454e1dff6c11b9f95daa801f3b4022e5c8999bff47a888',
'com.nineoldandroids:library:68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a',
'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'com.madgag.spongycastle:core:8d6240b974b0aca4d3da9c7dd44d42339d8a374358aca5fc98e50a995764511f',
'com.google.android.gms:play-services-tasks:69ec265168e601d0203d04cd42e34bb019b2f029aa1e16fabd38a5153eea2086',
'org.whispersystems:curve25519-android:bf6c34223d45d2f2813a8efcab9923caf99115115c760c9acea680bcb42d23c0',
'org.whispersystems:signal-protocol-java:a835cd0609cf116a74651bd0aa748db9392bba48c2d2af787757b8a1b50d131c',
'com.googlecode.libphonenumber:libphonenumber:7214dc6dfc6243e34fb1a3e02ad15331bfff6ab902d679e3ba337695265c21ca',
'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74',
'com.googlecode.libphonenumber:libphonenumber:141ebcafba7070a13d879c44e7648ddbe10beab665cb64d7b0c1bea93afb8dc2',
'com.fasterxml.jackson.core:jackson-databind:835097bcdd11f5bc8a08378c70d4c8054dfa4b911691cc2752063c75534d198d',
'com.squareup.okhttp3:okhttp:eecd834b09d12c3cd568b811522b97012619f7f00378c3c719a1957fac6458ef',
'org.whispersystems:curve25519-java:00f1d4919f759055f41f7853a3d475dc7c8decf0dbf045ae93414f8f23b066cc',
'com.squareup.okhttp3:okhttp:a992938d7203ca557cd7a116f002e8c427ec9cdae7ea852441abb8aec891f948',
'org.whispersystems:curve25519-android:bf6c34223d45d2f2813a8efcab9923caf99115115c760c9acea680bcb42d23c0',
'org.whispersystems:signal-protocol-java:a835cd0609cf116a74651bd0aa748db9392bba48c2d2af787757b8a1b50d131c',
'com.fasterxml.jackson.core:jackson-annotations:0ca408c24202a7626ec8b861e99d85eca5e38b73311dd6dd12e3e9deecc3fe94',
'com.fasterxml.jackson.core:jackson-core:cbf4604784b4de226262845447a1ad3bb38a6728cebe86562e2c5afada8be2c0',
'com.squareup.okio:okio:8c5436cadfab36bbd97db5f5c43b7bfdb5bf2f5f894ec8709b1929f14bdd010c',
'org.whispersystems:curve25519-java:00f1d4919f759055f41f7853a3d475dc7c8decf0dbf045ae93414f8f23b066cc',
'com.android.support:support-media-compat:8d6a1a5ba3d9eb1a25cb8f21bb312ac6280202e3d2900cb0b447d065d0d8a125',
'com.android.support:support-core-utils:a7649e18c04143dde40c218c5ce9a030e7ae674089cd7b18c6cf8ed2a22cf01a',
'com.android.support:support-fragment:1294500b357f52cf3779e2521c79f54ae7844f3b9a5f6727495dbbda7f231377',
View
@@ -370,6 +370,10 @@
<string name="MessageDetailsRecipient_failed_to_send">Failed to send</string>
<string name="MessageDetailsRecipient_new_safety_number">New safety number</string>
<!-- MessageRetrievalService -->
<string name="MessageRetrievalService_signal">Signal</string>
<string name="MessageRetrievalService_background_connection_enabled">Background connection enabled</string>
<!-- MmsDownloader -->
<string name="MmsDownloader_error_storing_mms">Error storing MMS!</string>
<string name="MmsDownloader_error_connecting_to_mms_provider">Error connecting to MMS provider</string>
@@ -501,17 +505,16 @@
<string name="RegistrationActivity_the_number_you_specified_s_is_invalid">The number you
specified (%s) is invalid.
</string>
<string name="RegistrationActivity_unsupported">Unsupported</string>
<string name="RegistrationActivity_sorry_this_device_is_not_supported_for_data_messaging">Sorry,
this device is not supported for data messaging. Devices running versions of Android older
than 4.0 must have a registered Google Account. Devices running Android 4.0 or newer do not
require a Google account, but must have the Play Store app installed.
</string>
<string name="RegistrationActivity_we_will_now_verify_that_the_following_number_is_associated_with_your_device_s">
Double-check that this is your number! We\'re about to verify it with an SMS.
</string>
<string name="RegistrationActivity_continue">Continue</string>
<string name="RegistrationActivity_edit">Edit</string>
<string name="RegistrationActivity_missing_google_play_services">Missing Google Play Services</string>
<string name="RegistrationActivity_this_device_is_missing_google_play_services">This device is missing Google Play Services. You can still use Signal, but this configuration may result in reduced reliability or performance.\n\nIf you are not an advanced user, are not running an aftermarket Android ROM, or believe that you are seeing this in error, please contact support@whispersystems.org for help trouble shooting.</string>
<string name="RegistrationActivity_i_understand">I understand</string>
<string name="RegistrationActivity_play_services_error">Play Services Error</string>
<string name="RegistrationActivity_google_play_services_is_updating_or_unavailable">Google Play Services is updating or temporarily unavailable. Please try again.</string>
<!-- RegistrationProblemsActivity -->
<string name="RegistrationProblemsActivity_possible_problems">Possible problems</string>
@@ -54,6 +54,7 @@
import org.thoughtcrime.securesms.ConversationListAdapter.ItemClickListener;
import org.thoughtcrime.securesms.components.recyclerview.DeleteItemAnimator;
import org.thoughtcrime.securesms.components.reminder.DefaultSmsReminder;
import org.thoughtcrime.securesms.components.reminder.DozeReminder;
import org.thoughtcrime.securesms.components.reminder.ExpiredBuildReminder;
import org.thoughtcrime.securesms.components.reminder.OutdatedBuildReminder;
import org.thoughtcrime.securesms.components.reminder.PushRegistrationReminder;
@@ -184,6 +185,8 @@ private void updateReminders() {
return Optional.of((new PushRegistrationReminder(context, masterSecret)));
} else if (ShareReminder.isEligible(context)) {
return Optional.of(new ShareReminder(context));
} else if (DozeReminder.isEligible(context)) {
return Optional.of(new DozeReminder(context));
} else {
return Optional.absent();
}
@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
@@ -20,6 +21,7 @@
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.i18n.phonenumbers.AsYouTypeFormatter;
import com.google.i18n.phonenumbers.NumberParseException;
@@ -44,6 +46,13 @@
private static final int PICK_COUNTRY = 1;
private static final String TAG = RegistrationActivity.class.getSimpleName();
private enum PlayServicesStatus {
SUCCESS,
MISSING,
NEEDS_UPDATE,
TRANSIENT_ERROR
}
private AsYouTypeFormatter countryFormatter;
private ArrayAdapter<String> countrySpinnerAdapter;
private Spinner countrySpinner;
@@ -211,35 +220,81 @@ public void onClick(View v) {
return;
}
int gcmStatus = GooglePlayServicesUtil.isGooglePlayServicesAvailable(self);
PlayServicesStatus gcmStatus = checkPlayServices(self);
if (gcmStatus != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(gcmStatus)) {
GooglePlayServicesUtil.getErrorDialog(gcmStatus, self, 9000).show();
} else {
Dialogs.showAlertDialog(self, getString(R.string.RegistrationActivity_unsupported),
getString(R.string.RegistrationActivity_sorry_this_device_is_not_supported_for_data_messaging));
}
return;
if (gcmStatus == PlayServicesStatus.SUCCESS) {
promptForRegistrationStart(self, e164number, true);
} else if (gcmStatus == PlayServicesStatus.MISSING) {
promptForNoPlayServices(self, e164number);
} else if (gcmStatus == PlayServicesStatus.NEEDS_UPDATE) {
GoogleApiAvailability.getInstance().getErrorDialog(self, ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0);
} else {
Dialogs.showAlertDialog(self, getString(R.string.RegistrationActivity_play_services_error),
getString(R.string.RegistrationActivity_google_play_services_is_updating_or_unavailable));
}
}
AlertDialog.Builder dialog = new AlertDialog.Builder(self);
private void promptForRegistrationStart(final Context context, final String e164number, final boolean gcmSupported) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(PhoneNumberFormatter.getInternationalFormatFromE164(e164number));
dialog.setMessage(R.string.RegistrationActivity_we_will_now_verify_that_the_following_number_is_associated_with_your_device_s);
dialog.setPositiveButton(getString(R.string.RegistrationActivity_continue),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(self, RegistrationProgressActivity.class);
intent.putExtra("e164number", e164number);
intent.putExtra("master_secret", masterSecret);
Intent intent = new Intent(context, RegistrationProgressActivity.class);
intent.putExtra(RegistrationProgressActivity.NUMBER_EXTRA, e164number);
intent.putExtra(RegistrationProgressActivity.MASTER_SECRET_EXTRA, masterSecret);
intent.putExtra(RegistrationProgressActivity.GCM_SUPPORTED_EXTRA, gcmSupported);
startActivity(intent);
finish();
}
});
dialog.setNegativeButton(getString(R.string.RegistrationActivity_edit), null);
dialog.show();
}
private void promptForNoPlayServices(final Context context, final String e164number) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(R.string.RegistrationActivity_missing_google_play_services);
dialog.setMessage(R.string.RegistrationActivity_this_device_is_missing_google_play_services);
dialog.setPositiveButton(R.string.RegistrationActivity_i_understand, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
promptForRegistrationStart(context, e164number, false);
}
});
dialog.setNegativeButton(android.R.string.cancel, null);
dialog.show();
}
private PlayServicesStatus checkPlayServices(Context context) {
int gcmStatus = 0;
try {
gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
} catch (Throwable t) {
Log.w(TAG, t);
return PlayServicesStatus.MISSING;
}
Log.w(TAG, "Play Services: " + gcmStatus);
switch (gcmStatus) {
case ConnectionResult.SUCCESS:
return PlayServicesStatus.SUCCESS;
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
return PlayServicesStatus.NEEDS_UPDATE;
case ConnectionResult.SERVICE_DISABLED:
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_INVALID:
case ConnectionResult.API_UNAVAILABLE:
case ConnectionResult.SERVICE_MISSING_PERMISSION:
return PlayServicesStatus.MISSING;
default:
return PlayServicesStatus.TRANSIENT_ERROR;
}
}
}
private class CountryCodeChangedListener implements TextWatcher {
Oops, something went wrong.

19 comments on commit 1669731

@nrizzio

This comment has been minimized.

Show comment
Hide comment
@nrizzio

nrizzio Feb 20, 2017

Contributor

This commit fixes issue #1000.

Contributor

nrizzio replied Feb 20, 2017

This commit fixes issue #1000.

@Stanzi97

This comment has been minimized.

Show comment
Hide comment
@Stanzi97

Stanzi97 Feb 20, 2017

And issue #127 and issue #560 and issue #2530!! 👍

And issue #127 and issue #560 and issue #2530!! 👍

@nrizzio

This comment has been minimized.

Show comment
Hide comment
@nrizzio

nrizzio Feb 20, 2017

Contributor

@Stanzi97 This commit doesn't really address #127

Contributor

nrizzio replied Feb 20, 2017

@Stanzi97 This commit doesn't really address #127

@johanw666

This comment has been minimized.

Show comment
Hide comment
@johanw666

johanw666 Feb 20, 2017

Just being curious: what happens when a user with a too old (< 9.6.1) version of GPS starts this version of Signal?

Just being curious: what happens when a user with a too old (< 9.6.1) version of GPS starts this version of Signal?

@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Feb 21, 2017

thanks so much for this!!! i am really glad to see this move forward. i have documented what i think are the remaining issues blocking signal from being released completely outside the google app store in xmikos/fdroiddata#29 (comment), for those who are interested.

thanks so much for this!!! i am really glad to see this move forward. i have documented what i think are the remaining issues blocking signal from being released completely outside the google app store in xmikos/fdroiddata#29 (comment), for those who are interested.

@moxie0

This comment has been minimized.

Show comment
Hide comment
@moxie0

moxie0 Feb 21, 2017

Member

@anarcat What I'd like is:

  1. A small well-written library that we can link into Signal which does crash reporting, checking for updates (and posting notifications for the user), and reporting basic stats.
  2. A simple web-app that looks like the Play Store console, which allows us to publish new APKs, display crash reports, and display basic stats.

Then we could link to the signed APK from our website, get crash reports and stats, and make sure users are keeping up to date.

FYI the server side is here (released/licensed): https://github.com/whispersystems/signal-server

Member

moxie0 replied Feb 21, 2017

@anarcat What I'd like is:

  1. A small well-written library that we can link into Signal which does crash reporting, checking for updates (and posting notifications for the user), and reporting basic stats.
  2. A simple web-app that looks like the Play Store console, which allows us to publish new APKs, display crash reports, and display basic stats.

Then we could link to the signed APK from our website, get crash reports and stats, and make sure users are keeping up to date.

FYI the server side is here (released/licensed): https://github.com/whispersystems/signal-server

@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Feb 21, 2017

@moxie0 did you see the ACRA library that f-droid mentions in release 0.98? I haven't reviewed it at all, but it could be interesting.

thanks for the response, and really happy to see the server side public now!

PS: people over the fdroid side are wondering where it would be best to discuss this - should there be an issue in the Signal-Android repo? or do we continue in xmikos/fdroiddata#29 (comment)...

@moxie0 did you see the ACRA library that f-droid mentions in release 0.98? I haven't reviewed it at all, but it could be interesting.

thanks for the response, and really happy to see the server side public now!

PS: people over the fdroid side are wondering where it would be best to discuss this - should there be an issue in the Signal-Android repo? or do we continue in xmikos/fdroiddata#29 (comment)...

@nrizzio

This comment has been minimized.

Show comment
Hide comment
@nrizzio

nrizzio Feb 21, 2017

Contributor

@anarcat Discussion should go in this thread in the community forum, as OWS prefers using places other than GitHub for discussion.

Contributor

nrizzio replied Feb 21, 2017

@anarcat Discussion should go in this thread in the community forum, as OWS prefers using places other than GitHub for discussion.

@anarcat

This comment has been minimized.

Show comment
Hide comment
@anarcat

anarcat Feb 21, 2017

@nrizzio thanks. i ended posting a new thread before i saw your edit, sorry about that... but i cross-linked it with the non-GCM thread you linked to and peppered it on other related threads as well.

cheers, and thanks again folks!

@nrizzio thanks. i ended posting a new thread before i saw your edit, sorry about that... but i cross-linked it with the non-GCM thread you linked to and peppered it on other related threads as well.

cheers, and thanks again folks!

@Be-ing

This comment has been minimized.

Show comment
Hide comment
@Be-ing

Be-ing Feb 23, 2017

I've been using this the last two days and the battery usage is reasonable. Big thanks!

I've been using this the last two days and the battery usage is reasonable. Big thanks!

@breznak

This comment has been minimized.

Show comment
Hide comment

And issue #6154

@andersbateva

This comment has been minimized.

Show comment
Hide comment
@andersbateva

andersbateva Feb 25, 2017

I saw this article saying Signal will not need Google services in general soon: http://blog.desdelinux.net/signal-fin-sin-las-cadenas-google/

But here on GitHub I see it's part of the beta video calls only. So, Signal would still rely on Google services in general, right?

I saw this article saying Signal will not need Google services in general soon: http://blog.desdelinux.net/signal-fin-sin-las-cadenas-google/

But here on GitHub I see it's part of the beta video calls only. So, Signal would still rely on Google services in general, right?

@Be-ing

This comment has been minimized.

Show comment
Hide comment
@Be-ing

Be-ing Feb 26, 2017

No, text messaging works fine. If you want to make calls (audio or video), until WebRTC audio/video calls are turned on by default, whoever you call needs to have the beta video support turned on in their preferences.

No, text messaging works fine. If you want to make calls (audio or video), until WebRTC audio/video calls are turned on by default, whoever you call needs to have the beta video support turned on in their preferences.

@6w9wy7

This comment has been minimized.

Show comment
Hide comment
@6w9wy7

6w9wy7 Mar 12, 2017

I had to update google play services in order to run it. #6371 Doesnt this mean it needs it?
I didnt bother to check the code.

6w9wy7 replied Mar 12, 2017

I had to update google play services in order to run it. #6371 Doesnt this mean it needs it?
I didnt bother to check the code.

@jospoortvliet

This comment has been minimized.

Show comment
Hide comment
@jospoortvliet

jospoortvliet Mar 29, 2017

@6w9wy7 you HAVE Gplay services so it uses it. If you don't have it, things still work as there's a fallback, your phone will just suck more battery than a Gplay services version would need...

@6w9wy7 you HAVE Gplay services so it uses it. If you don't have it, things still work as there's a fallback, your phone will just suck more battery than a Gplay services version would need...

@StyXman

This comment has been minimized.

Show comment
Hide comment
@StyXman

StyXman Nov 29, 2017

Has this been released? I have Signal 4.12.3 from https://signal.org/android/apk/ and it still needs Google Play Services to run; when I disable and stop it, Signal complains. Does it continue to work for text messaging?

StyXman replied Nov 29, 2017

Has this been released? I have Signal 4.12.3 from https://signal.org/android/apk/ and it still needs Google Play Services to run; when I disable and stop it, Signal complains. Does it continue to work for text messaging?

@michael-thayer

This comment has been minimized.

Show comment
Hide comment
@michael-thayer

michael-thayer Jan 8, 2018

Is there a way to force Signal to use WebSockets instead of GCM even if the second is available, without changing the code? I see the GCM_DISABLED_PREF in the source, but I am new to Android and not sure how to configure it. Of course, I could change the source and rebuild if there is no other way.

Is there a way to force Signal to use WebSockets instead of GCM even if the second is available, without changing the code? I see the GCM_DISABLED_PREF in the source, but I am new to Android and not sure how to configure it. Of course, I could change the source and rebuild if there is no other way.

@haffenloher

This comment has been minimized.

Show comment
Hide comment
@haffenloher

haffenloher Jan 8, 2018

Contributor

To keep the amount of email notifications at a manageable level, OWS uses Github only for tracking issues and reviewing pull requests. For discussion please head to the community forums.

Contributor

haffenloher replied Jan 8, 2018

To keep the amount of email notifications at a manageable level, OWS uses Github only for tracking issues and reviewing pull requests. For discussion please head to the community forums.

@poetapabon

This comment has been minimized.

Show comment
Hide comment
@poetapabon

poetapabon Mar 3, 2018

que buena inf

que buena inf

Please sign in to comment.