Ensure checkin never happens while disabled

This commit is contained in:
Marvin W 2017-02-08 21:33:44 +01:00
parent d99fa7e86f
commit 32d6040e55
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
4 changed files with 10 additions and 6 deletions

2
extern/UnifiedNlp vendored

@ -1 +1 @@
Subproject commit c161d40f1bfe1c185b67d8120e4d51339d31e280
Subproject commit 43a18f90c13c1e7198c23295bb9beb5869030a3b

View File

@ -20,8 +20,7 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.ContentResolver;
import android.content.Context;
import com.google.android.gms.R;
import android.preference.PreferenceManager;
import org.microg.gms.auth.AuthConstants;
import org.microg.gms.auth.AuthRequest;
@ -34,6 +33,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinManager {
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);
if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL)
return null;
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, false))
return null;
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
AccountManager accountManager = AccountManager.get(context);
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;

View File

@ -26,13 +26,14 @@ import android.preference.PreferenceManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import com.google.android.gms.R;
import com.google.android.gms.checkin.internal.ICheckinService;
import org.microg.gms.auth.AuthConstants;
import org.microg.gms.gcm.McsService;
import org.microg.gms.people.PeopleManager;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinService extends IntentService {
private static final String TAG = "GmsCheckinSvc";
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
@ -54,7 +55,7 @@ public class CheckinService extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
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));
if (info != null) {
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));

View File

@ -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_summary">Completely disable SafetyNet</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_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>