Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39c957cd authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

MCS: Fix reconnect

parent 7b3e490d
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@
                <action android:name="com.google.android.location.internal.GoogleLocationManagerService.START" />
            </intent-filter>
        </service>

        <service android:name="org.microg.gms.location.ReportingAndroidService">
            <intent-filter>
                <action android:name="com.google.android.location.reporting.service.START" />
@@ -101,10 +102,12 @@
            android:name="org.microg.gms.gservices.GServicesProvider"
            android:authorities="com.google.android.gsf.gservices"
            android:exported="true" />

        <provider
            android:name="org.microg.gms.settings.GoogleSettingsProvider"
            android:authorities="com.google.settings"
            android:exported="true" />

        <provider
            android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
            android:authorities="subscribedfeeds"
@@ -151,6 +154,7 @@
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </service>

        <service
            android:name="org.microg.gms.gcm.McsService"
            android:exported="true" />
@@ -159,6 +163,18 @@
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
            <intent-filter>
                <action android:name="org.microg.gms.gcm.RECONNECT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REPLACED" />
                <data
                    android:scheme="package"
                    android:path="com.google.android.gms" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE" />

@@ -232,6 +248,7 @@
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name="org.microg.gms.auth.login.LoginActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
@@ -243,6 +260,7 @@
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name="org.microg.gms.auth.AskPermissionActivity"
            android:excludeFromRecents="true"
+5 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;

import com.squareup.wire.Message;
@@ -163,6 +164,7 @@ public class McsService extends IntentService {
            heartbeatThread = null;
        }
        Log.d(TAG, "Connection closed");
        sendBroadcast(new Intent("org.microg.gms.gcm.RECONNECT"), "org.microg.gms.STATUS_BROADCAST");
    }

    private void handleClose(Close close) throws IOException {
@@ -170,7 +172,7 @@ public class McsService extends IntentService {
    }

    private void handleLoginresponse(LoginResponse loginResponse) throws IOException {
        getSharedPreferences().edit().putString(PREF_LAST_PERSISTENT_ID, null);
        getSharedPreferences().edit().putString(PREF_LAST_PERSISTENT_ID, "").apply();
        if (loginResponse.error == null) {
            Log.d(TAG, "Logged in");
        } else {
@@ -189,10 +191,8 @@ public class McsService extends IntentService {

    private void handleMessage(DataMessageStanza message) throws IOException {
        if (message.persistent_id != null) {
            String old = getSharedPreferences().getString(PREF_LAST_PERSISTENT_ID, null);
            if (old == null) {
                old = "";
            } else {
            String old = getSharedPreferences().getString(PREF_LAST_PERSISTENT_ID, "");
            if (!old.isEmpty()) {
                old += "|";
            }
            getSharedPreferences().edit()