Loading .travis.yml +1 −0 Original line number Diff line number Diff line language: android sudo: false git: submodules: false before_install: Loading play-services-core/src/main/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,9 @@ <intent-filter> <action android:name="android.server.checkin.CHECKIN"/> </intent-filter> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> </intent-filter> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE"/> Loading play-services-core/src/main/java/org/microg/gms/checkin/CheckinService.java +10 −5 Original line number Diff line number Diff line Loading @@ -22,11 +22,13 @@ import android.app.IntentService; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; 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.gcm.McsService; import org.microg.gms.people.PeopleManager; public class CheckinService extends IntentService { Loading @@ -50,16 +52,19 @@ public class CheckinService extends IntentService { LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra("force", false)); if (info != null) { Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId)); } String accountType = getString(R.string.google_account_type); for (Account account : AccountManager.get(this).getAccountsByType(accountType)) { PeopleManager.loadUserInfo(this, account); } McsService.scheduleReconnect(this); } } catch (Exception e) { Log.w(TAG, e); } } finally { WakefulBroadcastReceiver.completeWakefulIntent(intent); stopSelf(); } } @Override public IBinder onBind(Intent intent) { Loading play-services-core/src/main/java/org/microg/gms/checkin/LastCheckinInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,6 @@ public class LastCheckinInfo { .putLong(PREF_SECURITY_TOKEN, securityToken) .putString(PREF_VERSION_INFO, versionInfo) .putString(PREF_DEVICE_DATA_VERSION_INFO, deviceDataVersionInfo) .apply(); .commit(); } } play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java +23 −7 Original line number Diff line number Diff line Loading @@ -16,22 +16,38 @@ package org.microg.gms.checkin; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.preference.PreferenceManager; import android.support.v4.content.WakefulBroadcastReceiver; import android.util.Log; public class TriggerReceiver extends BroadcastReceiver { public class TriggerReceiver extends WakefulBroadcastReceiver { private static final String TAG = "GmsCheckinTrigger"; private static final String PREF_ENABLE_CHECKIN = "checkin_enable_service"; private static final long REGULAR_CHECKIN_INTERVAL = 12 * 60 * 60 * 1000; // 12 hours @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Trigger checkin: " + intent); boolean force = "android.provider.Telephony.SECRET_CODE".equals(intent.getAction()); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, false) || force) { if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction()) && LastCheckinInfo.read(context).lastCheckin > System.currentTimeMillis() - REGULAR_CHECKIN_INTERVAL) { return; } NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected() || force) { Intent subIntent = new Intent(context, CheckinService.class); if ("android.provider.Telephony.SECRET_CODE".equals(intent.getAction())) { subIntent.putExtra("force", true); subIntent.putExtra("force", force); startWakefulService(context, subIntent); } } else { Log.d(TAG, "Ignoring " + intent + ": checkin is disabled"); } context.startService(subIntent); } } Loading
.travis.yml +1 −0 Original line number Diff line number Diff line language: android sudo: false git: submodules: false before_install: Loading
play-services-core/src/main/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,9 @@ <intent-filter> <action android:name="android.server.checkin.CHECKIN"/> </intent-filter> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> </intent-filter> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE"/> Loading
play-services-core/src/main/java/org/microg/gms/checkin/CheckinService.java +10 −5 Original line number Diff line number Diff line Loading @@ -22,11 +22,13 @@ import android.app.IntentService; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; 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.gcm.McsService; import org.microg.gms.people.PeopleManager; public class CheckinService extends IntentService { Loading @@ -50,16 +52,19 @@ public class CheckinService extends IntentService { LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra("force", false)); if (info != null) { Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId)); } String accountType = getString(R.string.google_account_type); for (Account account : AccountManager.get(this).getAccountsByType(accountType)) { PeopleManager.loadUserInfo(this, account); } McsService.scheduleReconnect(this); } } catch (Exception e) { Log.w(TAG, e); } } finally { WakefulBroadcastReceiver.completeWakefulIntent(intent); stopSelf(); } } @Override public IBinder onBind(Intent intent) { Loading
play-services-core/src/main/java/org/microg/gms/checkin/LastCheckinInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,6 @@ public class LastCheckinInfo { .putLong(PREF_SECURITY_TOKEN, securityToken) .putString(PREF_VERSION_INFO, versionInfo) .putString(PREF_DEVICE_DATA_VERSION_INFO, deviceDataVersionInfo) .apply(); .commit(); } }
play-services-core/src/main/java/org/microg/gms/checkin/TriggerReceiver.java +23 −7 Original line number Diff line number Diff line Loading @@ -16,22 +16,38 @@ package org.microg.gms.checkin; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.preference.PreferenceManager; import android.support.v4.content.WakefulBroadcastReceiver; import android.util.Log; public class TriggerReceiver extends BroadcastReceiver { public class TriggerReceiver extends WakefulBroadcastReceiver { private static final String TAG = "GmsCheckinTrigger"; private static final String PREF_ENABLE_CHECKIN = "checkin_enable_service"; private static final long REGULAR_CHECKIN_INTERVAL = 12 * 60 * 60 * 1000; // 12 hours @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Trigger checkin: " + intent); boolean force = "android.provider.Telephony.SECRET_CODE".equals(intent.getAction()); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, false) || force) { if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction()) && LastCheckinInfo.read(context).lastCheckin > System.currentTimeMillis() - REGULAR_CHECKIN_INTERVAL) { return; } NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected() || force) { Intent subIntent = new Intent(context, CheckinService.class); if ("android.provider.Telephony.SECRET_CODE".equals(intent.getAction())) { subIntent.putExtra("force", true); subIntent.putExtra("force", force); startWakefulService(context, subIntent); } } else { Log.d(TAG, "Ignoring " + intent + ": checkin is disabled"); } context.startService(subIntent); } }