mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-23 07:51:10 +01:00
Checkin can be used
... but resulting android id is probably unusable as it's not providing features :)
This commit is contained in:
parent
b9cae4df05
commit
f88a6d0cde
@ -84,6 +84,24 @@
|
|||||||
|
|
||||||
<!-- Device Checkin -->
|
<!-- 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 -->
|
<!-- Cloud Messaging -->
|
||||||
<service
|
<service
|
||||||
android:name="org.microg.gms.gcm.PushRegisterService"
|
android:name="org.microg.gms.gcm.PushRegisterService"
|
||||||
|
@ -126,11 +126,9 @@ public class CheckinClient {
|
|||||||
.deviceConfiguration(deviceConfig)
|
.deviceConfiguration(deviceConfig)
|
||||||
.digest(checkinInfo.digest)
|
.digest(checkinInfo.digest)
|
||||||
.esn(deviceIdent.esn)
|
.esn(deviceIdent.esn)
|
||||||
.fragment((Integer) TODO)
|
.fragment(0)
|
||||||
.locale((String) TODO)
|
.locale((String) TODO)
|
||||||
.loggingId((Long) TODO)
|
.loggingId((Long) TODO)
|
||||||
.macAddress(Arrays.asList(deviceIdent.wifiMac))
|
|
||||||
.macAddressType(Arrays.asList("wifi"))
|
|
||||||
.meid(deviceIdent.meid)
|
.meid(deviceIdent.meid)
|
||||||
.otaCert((List<String>) TODO)
|
.otaCert((List<String>) TODO)
|
||||||
.serial((String) TODO)
|
.serial((String) TODO)
|
||||||
@ -138,7 +136,14 @@ public class CheckinClient {
|
|||||||
.userName((String) TODO)
|
.userName((String) TODO)
|
||||||
.userSerialNumber((Integer) TODO)
|
.userSerialNumber((Integer) TODO)
|
||||||
.version(3);
|
.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();
|
return builder.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@ package org.microg.gms.checkin;
|
|||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
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.common.Utils;
|
||||||
import org.microg.gms.gservices.GServices;
|
import org.microg.gms.gservices.GServices;
|
||||||
|
|
||||||
@ -30,7 +33,7 @@ public class CheckinManager {
|
|||||||
public static synchronized LastCheckinInfo checkin(Context context) throws IOException {
|
public static synchronized LastCheckinInfo checkin(Context context) throws IOException {
|
||||||
LastCheckinInfo info = LastCheckinInfo.read(context);
|
LastCheckinInfo info = LastCheckinInfo.read(context);
|
||||||
if (info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL) return null;
|
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));
|
return handleResponse(context, CheckinClient.request(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class CheckinService extends IntentService {
|
public class CheckinService extends IntentService {
|
||||||
private static final String TAG = "GmsCheckinService";
|
private static final String TAG = "GmsCheckinService";
|
||||||
public static final String CHECKIN_ACTION = "com.google.android.gsf.checkin.CHECKIN";
|
|
||||||
|
|
||||||
public CheckinService() {
|
public CheckinService() {
|
||||||
super(TAG);
|
super(TAG);
|
||||||
@ -32,15 +31,14 @@ public class CheckinService extends IntentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(Intent intent) {
|
protected void onHandleIntent(Intent intent) {
|
||||||
if (CHECKIN_ACTION.equals(intent.getAction())) {
|
try {
|
||||||
try {
|
LastCheckinInfo info = CheckinManager.checkin(this);
|
||||||
LastCheckinInfo info = CheckinManager.checkin(this);
|
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));
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.w(TAG, e);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
}
|
}
|
||||||
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
src/org/microg/gms/checkin/TriggerReceiver.java
Normal file
32
src/org/microg/gms/checkin/TriggerReceiver.java
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user