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

Unverified Commit 346d0617 authored by Torsten Grote's avatar Torsten Grote Committed by Abhishek Aggarwal
Browse files

Do a check-in if we are not actually checked in, but should be, e.g. cleared app data

Change-Id: If800339fa35644d8783203fbd511128457d6d101
parent edc6e29b
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Log;

import androidx.legacy.content.WakefulBroadcastReceiver;

import org.microg.gms.checkin.CheckinPrefs;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.ForegroundServiceContext;

@@ -67,6 +68,14 @@ public class TriggerReceiver extends WakefulBroadcastReceiver {

            if (LastCheckinInfo.read(context).getAndroidId() == 0) {
                Log.d(TAG, "Ignoring " + intent + ": need to checkin first.");
                if (CheckinPrefs.isEnabled(context)) {
                    // Do a check-in if we are not actually checked in,
                    // but should be, e.g. cleared app data
                    Log.d(TAG, "Requesting check-in...");
                    String action = "android.server.checkin.CHECKIN";
                    Class<?> clazz = org.microg.gms.checkin.TriggerReceiver.class;
                    context.sendBroadcast(new Intent(action, null, context, clazz));
                }
                return;
            }