Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
android:exported="false"
android:process=":persistent">
<intent-filter>
<action android:name="org.microg.gms.gcm.REGISTERED" />
<action android:name="org.microg.gms.gcm.CONNECTED" />
<action android:name="org.microg.gms.gcm.REGISTER_ACCOUNT" />
<action android:name="org.microg.gms.gcm.NOTIFY_COMPLETE" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
import static android.app.AlarmManager.ELAPSED_REALTIME_WAKEUP;
import static android.os.Build.VERSION.SDK_INT;
import static org.microg.gms.common.PackageUtils.warnIfNotPersistentProcess;
import static org.microg.gms.gcm.ExtensionsKt.ACTION_GCM_CONNECTED;
import static org.microg.gms.gcm.GcmConstants.*;
import static org.microg.gms.gcm.ExtensionsKt.ACTION_GCM_REGISTERED;
import static org.microg.gms.gcm.McsConstants.*;

@ForegroundServiceInfo(value = "Cloud messaging", resName = "service_name_mcs", resPackage = "com.google.android.gms")
Expand Down Expand Up @@ -497,15 +497,15 @@ private void handleLoginResponse(LoginResponse loginResponse) {
if (loginResponse.error == null) {
GcmPrefs.clearLastPersistedId(this);
logd(this, "Logged in");
notifyGcmRegistered();
notifyGcmConnected();
wakeLock.release();
} else {
throw new RuntimeException("Could not login: " + loginResponse.error);
}
}

private void notifyGcmRegistered() {
Intent intent = new Intent(ACTION_GCM_REGISTERED);
private void notifyGcmConnected() {
Intent intent = new Intent(ACTION_GCM_CONNECTED);
intent.setPackage(Constants.GMS_PACKAGE_NAME);
sendBroadcast(intent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ class GcmInGmsService : LifecycleService() {
Log.d(TAG, "start handle gcm message")
intent.extras?.let { notifyVerificationInfo(it) }
}
ACTION_GCM_REGISTERED -> {
ACTION_GCM_REGISTER_ALL_ACCOUNTS,
ACTION_GCM_CONNECTED -> {
updateLocalAccountGroups()
}
ACTION_GCM_REGISTER_ACCOUNT -> {
Expand Down Expand Up @@ -370,6 +371,10 @@ class GcmInGmsService : LifecycleService() {
completeRegisterRequest(context, gcmDatabase, request).getString(GcmConstants.EXTRA_REGISTRATION_ID)
}
Log.d(TAG, "GCM IN GMS regId: $regId")
if (regId == null) {
Log.w(TAG, "registerGcmInGms reg id is null")
return
}
val sharedPreferencesEditor = sp?.edit()
sharedPreferencesEditor?.putLong(KEY_GCM_ANDROID_ID, LastCheckinInfo.read(context).androidId)
sharedPreferencesEditor?.putString(KEY_GCM_REG_ID, regId)
Expand Down Expand Up @@ -510,4 +515,4 @@ class GcmRegistrationReceiver : WakefulBroadcastReceiver() {
}
ForegroundServiceContext(context).startService(callIntent)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import okhttp3.OkHttpClient
import okhttp3.Response

const val ACTION_GCM_RECONNECT = "org.microg.gms.gcm.RECONNECT"
const val ACTION_GCM_REGISTERED = "org.microg.gms.gcm.REGISTERED"
const val ACTION_GCM_CONNECTED = "org.microg.gms.gcm.CONNECTED"
const val ACTION_GCM_REGISTER_ACCOUNT = "org.microg.gms.gcm.REGISTER_ACCOUNT"
const val ACTION_GCM_REGISTER_ALL_ACCOUNTS = "org.microg.gms.gcm.REGISTER_ALL_ACCOUNTS"
const val ACTION_GCM_NOTIFY_COMPLETE = "org.microg.gms.gcm.NOTIFY_COMPLETE"
const val KEY_GCM_REGISTER_ACCOUNT_NAME = "register_account_name"
const val EXTRA_NOTIFICATION_ACCOUNT = "notification_account"
Expand Down Expand Up @@ -44,4 +45,4 @@ inline fun <reified S : Service> createGrpcClient(
.minMessageToCompress(minMessageToCompress)
.build()
return grpcClient.create(S::class)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.microg.gms.auth.AuthConstants
import org.microg.gms.common.Constants
import org.microg.gms.gcm.ACTION_GCM_REGISTERED
import org.microg.gms.gcm.ACTION_GCM_CONNECTED
import org.microg.gms.gcm.ACTION_GCM_REGISTER_ALL_ACCOUNTS
import org.microg.gms.people.DatabaseHelper
import org.microg.gms.people.PeopleManager
import org.microg.gms.settings.SettingsContract
Expand Down Expand Up @@ -65,7 +66,7 @@ class AccountsFragment : PreferenceFragmentCompat() {
}).also { it.isCircular = true } else null

private fun registerGcmInGms() {
Intent(ACTION_GCM_REGISTERED).apply {
Intent(ACTION_GCM_REGISTER_ALL_ACCOUNTS).apply {
`package` = Constants.GMS_PACKAGE_NAME
}.let { requireContext().sendBroadcast(it) }
}
Expand Down