Add some Logging APIs, fix services list

This commit is contained in:
mar-v-in 2015-04-08 02:48:25 +02:00
parent a0e9645c79
commit a181a0f3b9
10 changed files with 216 additions and 12 deletions

View File

@ -7,16 +7,16 @@ import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.ValidateAccountRequest; import com.google.android.gms.common.internal.ValidateAccountRequest;
interface IGmsServiceBroker { interface IGmsServiceBroker {
void getPlusService(IGmsCallbacks callback, int code, String str1, String str2, in String[] paramArrayOfString, String str3, in Bundle params) = 0; void getPlusService(IGmsCallbacks callback, int code, String packageName, String authPackage, in String[] scopes, String accountName, in Bundle params) = 0;
void getPanoramaService(IGmsCallbacks callback, int code, String str, in Bundle params) = 1; void getPanoramaService(IGmsCallbacks callback, int code, String packageName, in Bundle params) = 1;
void getAppDataSearchService(IGmsCallbacks callback, int code, String str) = 2; void getAppDataSearchService(IGmsCallbacks callback, int code, String packageName) = 2;
void getWalletService(IGmsCallbacks callback, int code) = 3; void getWalletService(IGmsCallbacks callback, int code) = 3;
void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params) = 4; void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params) = 4;
void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params) = 5; void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params) = 5;
void getLocationService(IGmsCallbacks callback, int code, String str, in Bundle params) = 6; void getLocationService(IGmsCallbacks callback, int code, String str, in Bundle params) = 6;
void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params) = 7; void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params) = 7;
void getGamesService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args, String str3, IBinder binder, String str4, in Bundle params) = 8; void getGamesService(IGmsCallbacks callback, int code, String packageName, String accountName, in String[] scopes, String gamePackageName, IBinder popupWindowToken, String desiredLocale, in Bundle params) = 8;
void getAppStateService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args) = 9; void getAppStateService(IGmsCallbacks callback, int code, String packageName, String accountName, in String[] scopes) = 9;
void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params) = 10; void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params) = 10;
void getAdMobService(IGmsCallbacks callback, int code, String str, in Bundle params) = 11; void getAdMobService(IGmsCallbacks callback, int code, String str, in Bundle params) = 11;
void getDroidGuardService(IGmsCallbacks callback, int code, String str, in Bundle params) = 12; void getDroidGuardService(IGmsCallbacks callback, int code, String str, in Bundle params) = 12;
@ -32,6 +32,8 @@ interface IGmsServiceBroker {
void getAutoBackupService(IGmsCallbacks callback, int code, String str, in Bundle params) = 22; void getAutoBackupService(IGmsCallbacks callback, int code, String str, in Bundle params) = 22;
void getAddressService(IGmsCallbacks callback, int code, String str) = 23; void getAddressService(IGmsCallbacks callback, int code, String str) = 23;
void getWalletServiceWithPackageName(IGmsCallbacks callback, int code, String packageName) = 41;
void getService(IGmsCallbacks callback, in GetServiceRequest request) = 45; void getService(IGmsCallbacks callback, in GetServiceRequest request) = 45;
void validateAccount(IGmsCallbacks callback, in ValidateAccountRequest request) = 46; void validateAccount(IGmsCallbacks callback, in ValidateAccountRequest request) = 46;
} }

View File

@ -1,4 +1,8 @@
package com.google.android.gms.playlog.internal; package com.google.android.gms.playlog.internal;
import com.google.android.gms.playlog.internal.LogEvent;
import com.google.android.gms.playlog.internal.PlayLoggerContext;
interface IPlayLogService { interface IPlayLogService {
void event(String packageName, in PlayLoggerContext context, in LogEvent event) = 1;
} }

View File

@ -0,0 +1,3 @@
package com.google.android.gms.playlog.internal;
parcelable LogEvent;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.playlog.internal;
parcelable PlayLoggerContext;

View File

@ -23,18 +23,21 @@ import android.os.IBinder;
import com.google.android.gms.common.api.Scope; import com.google.android.gms.common.api.Scope;
import org.microg.gms.common.Constants; import org.microg.gms.common.Constants;
import org.microg.gms.common.Services;
import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled; import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
public class GetServiceRequest extends AutoSafeParcelable { public class GetServiceRequest extends AutoSafeParcelable {
@SafeParceled(1) @SafeParceled(1)
private final int versionCode = 2; private final int versionCode;
@SafeParceled(2) @SafeParceled(2)
public final int serviceId; public final int serviceId;
@SafeParceled(3) @SafeParceled(3)
public int gmsVersion = Constants.MAX_REFERENCE_VERSION; public int gmsVersion;
@SafeParceled(4) @SafeParceled(4)
public String packageName; public String packageName;
@ -52,11 +55,27 @@ public class GetServiceRequest extends AutoSafeParcelable {
public Account account; public Account account;
private GetServiceRequest() { private GetServiceRequest() {
versionCode = 2;
serviceId = -1; serviceId = -1;
gmsVersion = Constants.MAX_REFERENCE_VERSION;
} }
public GetServiceRequest(int serviceId) { public GetServiceRequest(int serviceId) {
this.versionCode = 2;
this.serviceId = serviceId; this.serviceId = serviceId;
this.gmsVersion = Constants.MAX_REFERENCE_VERSION;
}
@Override
public String toString() {
return "GetServiceRequest{" +
"serviceId=" + Services.nameFromServiceId(serviceId) +
", gmsVersion=" + gmsVersion +
", packageName='" + packageName + '\'' +
(scopes == null || scopes.length == 0 ? "" : (", scopes=" + Arrays.toString(scopes))) +
(extras == null ? "" : (", extras=" + extras)) +
(account == null ? "" : (", account=" + account)) +
'}';
} }
public static Creator<GetServiceRequest> CREATOR = new AutoCreator<>(GetServiceRequest.class); public static Creator<GetServiceRequest> CREATOR = new AutoCreator<>(GetServiceRequest.class);

View File

@ -31,7 +31,7 @@ import org.microg.safeparcel.SafeParceled;
public class TileOverlayOptions extends AutoSafeParcelable { public class TileOverlayOptions extends AutoSafeParcelable {
@SafeParceled(1) @SafeParceled(1)
private final int versionCode = 1; private final int versionCode;
/** /**
* This is a IBinder to the {@link #tileProvider}, built using {@link ITileProviderDelegate}. * This is a IBinder to the {@link #tileProvider}, built using {@link ITileProviderDelegate}.
*/ */
@ -49,6 +49,7 @@ public class TileOverlayOptions extends AutoSafeParcelable {
* Creates a new set of tile overlay options. * Creates a new set of tile overlay options.
*/ */
public TileOverlayOptions() { public TileOverlayOptions() {
versionCode = 1;
} }
/** /**

View File

@ -0,0 +1,55 @@
/*
* 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 com.google.android.gms.playlog.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Date;
public class LogEvent extends AutoSafeParcelable {
@SafeParceled(1)
public final int versionCode;
@SafeParceled(2)
public final long eventTime;
@SafeParceled(3)
public final String tag;
@SafeParceled(4)
public final byte[] data;
private LogEvent() {
versionCode = 1;
eventTime = -1;
tag = null;
data = null;
}
@Override
public String toString() {
return "LogEvent{" +
"eventTime=" + new Date(eventTime) +
", tag='" + tag + '\'' +
", data='" + new String(data) + '\'' +
'}';
}
public static Creator<LogEvent> CREATOR = new AutoCreator<>(LogEvent.class);
}

View File

@ -0,0 +1,75 @@
/*
* 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 com.google.android.gms.playlog.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class PlayLoggerContext extends AutoSafeParcelable {
@SafeParceled(1)
public final int versionCode;
@SafeParceled(2)
public final String packageName;
@SafeParceled(4)
public final int logSource;
@SafeParceled(5)
public final String uploadAccount;
@SafeParceled(6)
public final int loggingId;
@SafeParceled(7)
public final boolean logAndroidId;
@SafeParceled(8)
public final String logSourceName;
private PlayLoggerContext() {
this.versionCode = 1;
packageName = uploadAccount = logSourceName = null;
logSource = loggingId = -1;
logAndroidId = false;
}
public PlayLoggerContext(String packageName, int logSource, String uploadAccount, int loggingId, String logSourceName) {
this.versionCode = 1;
this.packageName = packageName;
this.logSource = logSource;
this.uploadAccount = uploadAccount;
this.loggingId = loggingId;
this.logSourceName = logSourceName;
this.logAndroidId = true;
}
@Override
public String toString() {
return "PlayLoggerContext{" +
"packageName='" + packageName + '\'' +
", logSource=" + logSource +
", uploadAccount='" + uploadAccount + '\'' +
", loggingId=" + loggingId +
", logAndroidId=" + logAndroidId +
", logSourceName='" + logSourceName + '\'' +
'}';
}
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<>(PlayLoggerContext.class);
}

View File

@ -5,7 +5,7 @@ public class Constants {
* This is the highest version that was looked at during development. * This is the highest version that was looked at during development.
* Does not necessarily mean anything. * Does not necessarily mean anything.
*/ */
public static final int MAX_REFERENCE_VERSION = 6599436; public static final int MAX_REFERENCE_VERSION = 7099448;
public static final String KEY_MOCK_LOCATION = "mockLocation"; public static final String KEY_MOCK_LOCATION = "mockLocation";
public static final String DEFAULT_ACCOUNT = "<<default account>>"; public static final String DEFAULT_ACCOUNT = "<<default account>>";
public static final String GMS_PACKAGE_NAME = "com.google.android.gms"; public static final String GMS_PACKAGE_NAME = "com.google.android.gms";

View File

@ -16,6 +16,8 @@
package org.microg.gms.common; package org.microg.gms.common;
import java.lang.reflect.Field;
public final class Services { public final class Services {
public static final class GAMES { public static final class GAMES {
public static final int SERVICE_ID = 1; public static final int SERVICE_ID = 1;
@ -43,9 +45,8 @@ public final class Services {
public static final String ACTION = "com.google.android.gms.people.service.START"; public static final String ACTION = "com.google.android.gms.people.service.START";
} }
@Deprecated
public static final class LOCATION { public static final class LOCATION {
public static final int SERVICE_ID = 5; public static final int SERVICE_ID = 6;
} }
public static final class APPSTATE { public static final class APPSTATE {
@ -128,6 +129,10 @@ public final class Services {
public static final String ACTION = "com.google.android.location.internal.GoogleLocationManagerService.START"; public static final String ACTION = "com.google.android.location.internal.GoogleLocationManagerService.START";
} }
public static final class PLAY_LOG {
public static final int SERVICE_ID = 24;
}
public static final class DROIDGUARD { public static final class DROIDGUARD {
public static final int SERVICE_ID = 25; public static final int SERVICE_ID = 25;
public static final String ACTION = "com.google.android.gms.droidguard.service.START"; public static final String ACTION = "com.google.android.gms.droidguard.service.START";
@ -143,7 +148,6 @@ public final class Services {
public static final String ACTION = "com.google.android.gms.cast_mirroring.service.START"; public static final String ACTION = "com.google.android.gms.cast_mirroring.service.START";
} }
@Deprecated
public static final class NETWORK_QUALITY { public static final class NETWORK_QUALITY {
public static final int SERVICE_ID = 28; public static final int SERVICE_ID = 28;
public static final String ACTION = "com.google.android.gms.mdm.services.START"; public static final String ACTION = "com.google.android.gms.mdm.services.START";
@ -154,16 +158,32 @@ public final class Services {
public static final String ACTION = "com.google.android.gms.feedback.internal.IFeedbackService"; public static final String ACTION = "com.google.android.gms.feedback.internal.IFeedbackService";
} }
public static final class SEARCH_ADMINISTRATION {
public static final int SERVICE_ID = 30;
}
public static final class PHOTO_AUTO_BACKUP { public static final class PHOTO_AUTO_BACKUP {
public static final int SERVICE_ID = 31; public static final int SERVICE_ID = 31;
public static final String ACTION = "com.google.android.gms.photos.autobackup.service.START"; public static final String ACTION = "com.google.android.gms.photos.autobackup.service.START";
} }
public static final class SEARCH_QUERIES {
public static final int SERVICE_ID = 32;
}
public static final class SEARCH_GLOBAL {
public static final int SERVICE_ID = 33;
}
public static final class UDC { public static final class UDC {
public static final int SERVICE_ID = 35; public static final int SERVICE_ID = 35;
public static final String ACTION = "com.google.android.gms.udc.service.START"; public static final String ACTION = "com.google.android.gms.udc.service.START";
} }
public static final class SEARCH_CORPORA {
public static final int SERVICE_ID = 36;
}
public static final class DEVICE_MANAGER { public static final class DEVICE_MANAGER {
public static final int SERVICE_ID = 37; public static final int SERVICE_ID = 37;
public static final String ACTION = "com.google.android.gms.mdm.services.DeviceManagerApiService.START"; public static final String ACTION = "com.google.android.gms.mdm.services.DeviceManagerApiService.START";
@ -302,9 +322,31 @@ public final class Services {
public static final String ACTION = "com.google.android.gms.config.START"; public static final String ACTION = "com.google.android.gms.config.START";
} }
public static final class GEODATA {
public static final int SERVICE_ID = 65;
}
public static final class SEARCH_IME {
public static final int SERVICE_ID = 66;
}
public static final class PLACE_DETECTION {
public static final int SERVICE_ID = 67;
}
public static final class CREDENTIALS { public static final class CREDENTIALS {
public static final int SERVICE_ID = 68; public static final int SERVICE_ID = 68;
public static final String ACTION = "com.google.android.gms.auth.api.credentials.service.START"; public static final String ACTION = "com.google.android.gms.auth.api.credentials.service.START";
} }
public static String nameFromServiceId(int serviceId) {
for (Class cls : Services.class.getDeclaredClasses()) {
try {
Field serviceIdField = cls.getDeclaredField("SERVICE_ID");
if ((Integer) serviceIdField.get(null) == serviceId) return cls.getSimpleName();
} catch (Exception e) {
}
}
return "UNKNOWN(" + serviceId + ")";
}
} }