mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-22 18:47:46 +01:00
Ensure checkin never happens while disabled
This commit is contained in:
parent
d99fa7e86f
commit
32d6040e55
2
extern/UnifiedNlp
vendored
2
extern/UnifiedNlp
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c161d40f1bfe1c185b67d8120e4d51339d31e280
|
Subproject commit 43a18f90c13c1e7198c23295bb9beb5869030a3b
|
@ -20,8 +20,7 @@ import android.accounts.Account;
|
|||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import com.google.android.gms.R;
|
|
||||||
|
|
||||||
import org.microg.gms.auth.AuthConstants;
|
import org.microg.gms.auth.AuthConstants;
|
||||||
import org.microg.gms.auth.AuthRequest;
|
import org.microg.gms.auth.AuthRequest;
|
||||||
@ -34,6 +33,8 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
|
||||||
|
|
||||||
public class CheckinManager {
|
public class CheckinManager {
|
||||||
private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours
|
private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours
|
||||||
|
|
||||||
@ -42,6 +43,8 @@ public class CheckinManager {
|
|||||||
LastCheckinInfo info = LastCheckinInfo.read(context);
|
LastCheckinInfo info = LastCheckinInfo.read(context);
|
||||||
if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL)
|
if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL)
|
||||||
return null;
|
return null;
|
||||||
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, false))
|
||||||
|
return null;
|
||||||
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
|
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
|
||||||
AccountManager accountManager = AccountManager.get(context);
|
AccountManager accountManager = AccountManager.get(context);
|
||||||
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
|
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
|
||||||
|
@ -26,13 +26,14 @@ import android.preference.PreferenceManager;
|
|||||||
import android.support.v4.content.WakefulBroadcastReceiver;
|
import android.support.v4.content.WakefulBroadcastReceiver;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.gms.R;
|
|
||||||
import com.google.android.gms.checkin.internal.ICheckinService;
|
import com.google.android.gms.checkin.internal.ICheckinService;
|
||||||
|
|
||||||
import org.microg.gms.auth.AuthConstants;
|
import org.microg.gms.auth.AuthConstants;
|
||||||
import org.microg.gms.gcm.McsService;
|
import org.microg.gms.gcm.McsService;
|
||||||
import org.microg.gms.people.PeopleManager;
|
import org.microg.gms.people.PeopleManager;
|
||||||
|
|
||||||
|
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
|
||||||
|
|
||||||
public class CheckinService extends IntentService {
|
public class CheckinService extends IntentService {
|
||||||
private static final String TAG = "GmsCheckinSvc";
|
private static final String TAG = "GmsCheckinSvc";
|
||||||
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
|
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
|
||||||
@ -54,7 +55,7 @@ public class CheckinService extends IntentService {
|
|||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(Intent intent) {
|
protected void onHandleIntent(Intent intent) {
|
||||||
try {
|
try {
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(TriggerReceiver.PREF_ENABLE_CHECKIN, false)) {
|
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREF_ENABLE_CHECKIN, false)) {
|
||||||
LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false));
|
LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false));
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));
|
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));
|
||||||
|
@ -150,7 +150,7 @@ This can take a couple of minutes."</string>
|
|||||||
<string name="pref_snet_status_disabled_title">Disabled</string>
|
<string name="pref_snet_status_disabled_title">Disabled</string>
|
||||||
<string name="pref_snet_status_disabled_summary">Completely disable SafetyNet</string>
|
<string name="pref_snet_status_disabled_summary">Completely disable SafetyNet</string>
|
||||||
<string name="pref_snet_status_official_title">Use official server</string>
|
<string name="pref_snet_status_official_title">Use official server</string>
|
||||||
<string name="pref_snet_status_official_summary">Requires an unrooted system, device registration enabled and microG DroidGuard Helper installed</string>
|
<string name="pref_snet_status_official_summary">Requires an unrooted system and microG DroidGuard Helper installed</string>
|
||||||
<string name="pref_snet_status_third_party_title">Use third-party server</string>
|
<string name="pref_snet_status_third_party_title">Use third-party server</string>
|
||||||
<string name="pref_snet_status_third_party_summary">Third-party servers might be able to reply to SafetyNet requests without DroidGuard signature</string>
|
<string name="pref_snet_status_third_party_summary">Third-party servers might be able to reply to SafetyNet requests without DroidGuard signature</string>
|
||||||
<string name="pref_snet_custom_url_title">Custom server URL</string>
|
<string name="pref_snet_custom_url_title">Custom server URL</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user