0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-28 06:03:00 +00:00

Checkin can be used

... but resulting android id is probably unusable as it's not providing features :)
This commit is contained in:
mar-v-in 2015-02-28 20:56:05 +01:00
parent b9cae4df05
commit f88a6d0cde
5 changed files with 70 additions and 14 deletions

View file

@ -84,6 +84,24 @@
<!-- Device Checkin -->
<service android:name="org.microg.gms.checkin.CheckinService" />
<receiver android:name="org.microg.gms.checkin.TriggerReceiver">
<intent-filter>
<action android:name="android.server.checkin.CHECKIN" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="android.server.checkin.CHECKIN" />
</intent-filter>
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data
android:host="2432546"
android:scheme="android_secret_code" />
</intent-filter>
</receiver>
<!-- Cloud Messaging -->
<service
android:name="org.microg.gms.gcm.PushRegisterService"

View file

@ -126,11 +126,9 @@ public class CheckinClient {
.deviceConfiguration(deviceConfig)
.digest(checkinInfo.digest)
.esn(deviceIdent.esn)
.fragment((Integer) TODO)
.fragment(0)
.locale((String) TODO)
.loggingId((Long) TODO)
.macAddress(Arrays.asList(deviceIdent.wifiMac))
.macAddressType(Arrays.asList("wifi"))
.meid(deviceIdent.meid)
.otaCert((List<String>) TODO)
.serial((String) TODO)
@ -138,7 +136,14 @@ public class CheckinClient {
.userName((String) TODO)
.userSerialNumber((Integer) TODO)
.version(3);
if (checkinInfo.securityToken != 0) builder.securityToken(checkinInfo.securityToken);
if (deviceIdent.wifiMac != null) {
builder.macAddress(Arrays.asList(deviceIdent.wifiMac))
.macAddressType(Arrays.asList("wifi"));
}
if (checkinInfo.securityToken != 0) {
builder.securityToken(checkinInfo.securityToken)
.fragment(1);
}
return builder.build();
}

View file

@ -19,6 +19,9 @@ package org.microg.gms.checkin;
import android.content.ContentResolver;
import android.content.Context;
import org.microg.gms.common.DeviceConfiguration;
import org.microg.gms.common.DeviceIdentifier;
import org.microg.gms.common.PhoneInfo;
import org.microg.gms.common.Utils;
import org.microg.gms.gservices.GServices;
@ -30,7 +33,7 @@ public class CheckinManager {
public static synchronized LastCheckinInfo checkin(Context context) throws IOException {
LastCheckinInfo info = LastCheckinInfo.read(context);
if (info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL) return null;
CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), null, null, null, info); // TODO
CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), new DeviceConfiguration(), new DeviceIdentifier(), new PhoneInfo(), info); // TODO
return handleResponse(context, CheckinClient.request(request));
}

View file

@ -24,7 +24,6 @@ import java.io.IOException;
public class CheckinService extends IntentService {
private static final String TAG = "GmsCheckinService";
public static final String CHECKIN_ACTION = "com.google.android.gsf.checkin.CHECKIN";
public CheckinService() {
super(TAG);
@ -32,15 +31,14 @@ public class CheckinService extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
if (CHECKIN_ACTION.equals(intent.getAction())) {
try {
LastCheckinInfo info = CheckinManager.checkin(this);
if (info != null) {
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));
}
} catch (IOException e) {
Log.w(TAG, e);
try {
LastCheckinInfo info = CheckinManager.checkin(this);
if (info != null) {
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));
}
} catch (Exception e) {
Log.w(TAG, e);
}
stopSelf();
}
}

View file

@ -0,0 +1,32 @@
/*
* Copyright 2013-2015 µg Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.microg.gms.checkin;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class TriggerReceiver extends BroadcastReceiver {
private static final String TAG = "GmsCheckinTrigger";
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Trigger checkin: " + intent);
context.startService(new Intent(context, CheckinService.class));
}
}