mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-24 04:05:13 +00:00
Migrate to newer API
This commit is contained in:
parent
e4b9198dc7
commit
f6dca1f162
11 changed files with 188 additions and 65 deletions
2
extern/GmsApi
vendored
2
extern/GmsApi
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 704199355e1c6f8b14402e01063fbae7b187b35b
|
||||
Subproject commit a0e9645c796dfd8af38f8cdedf21f5a299c9c5b0
|
|
@ -15,7 +15,7 @@
|
|||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.android.gms"
|
||||
android:versionCode="6772000"
|
||||
android:versionCode="7099448"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
|
|
|
@ -16,161 +16,268 @@
|
|||
|
||||
package org.microg.gms;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.api.Scope;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
import com.google.android.gms.common.internal.IGmsServiceBroker;
|
||||
import com.google.android.gms.common.internal.ValidateAccountRequest;
|
||||
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub {
|
||||
private static final String TAG = "GmsServiceBroker";
|
||||
private final Set<Integer> supportedServiceIds;
|
||||
|
||||
@Override
|
||||
public void getPlusService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
String str2, String[] paramArrayOfString, String str3, Bundle params)
|
||||
throws RemoteException {
|
||||
throw new IllegalArgumentException("Plus service not supported");
|
||||
public AbstractGmsServiceBroker(Integer supportedServiceId, Integer... supportedServiceIds) {
|
||||
this(new HashSet<>(combine(supportedServiceId, supportedServiceIds)));
|
||||
}
|
||||
|
||||
private static Set<Integer> combine(Integer i, Integer... is) {
|
||||
Set<Integer> integers = new HashSet<>(Arrays.asList(is));
|
||||
integers.add(i);
|
||||
return integers;
|
||||
}
|
||||
|
||||
public AbstractGmsServiceBroker(Set<Integer> supportedServiceIds) {
|
||||
this.supportedServiceIds = supportedServiceIds;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getPlusService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
String authPackage, String[] scopes, String accountName, Bundle params)
|
||||
throws RemoteException {
|
||||
Bundle extras = params == null ? new Bundle() : params;
|
||||
extras.putString("auth_package", authPackage);
|
||||
callGetService(Services.PLUS.SERVICE_ID, callback, versionCode, packageName, extras, accountName, scopes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getPanoramaService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Panorama service not supported");
|
||||
callGetService(Services.PANORAMA.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getAppDataSearchService(IGmsCallbacks callback, int versionCode, String packageName)
|
||||
throws RemoteException {
|
||||
throw new IllegalArgumentException("App Data Search service not supported");
|
||||
callGetService(Services.INDEX.SERVICE_ID, callback, versionCode, packageName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getWalletService(IGmsCallbacks callback, int versionCode) throws RemoteException {
|
||||
throw new IllegalArgumentException("Wallet service not supported");
|
||||
getWalletServiceWithPackageName(callback, versionCode, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getPeopleService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("People service not supported");
|
||||
callGetService(Services.PEOPLE.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getReportingService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Reporting service not supported");
|
||||
callGetService(Services.LOCATION_REPORTING.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getLocationService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Location service not supported");
|
||||
callGetService(Services.LOCATION.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Location Manager service not supported");
|
||||
callGetService(Services.LOCATION_MANAGER.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getGamesService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
String str2, String[] args, String str3, IBinder binder, String str4, Bundle params)
|
||||
String accountName, String[] scopes, String gamePackageName,
|
||||
IBinder popupWindowToken, String desiredLocale, Bundle params)
|
||||
throws RemoteException {
|
||||
throw new IllegalArgumentException("Games service not supported");
|
||||
Bundle extras = params == null ? new Bundle() : params;
|
||||
extras.putString("com.google.android.gms.games.key.gamePackageName", gamePackageName);
|
||||
extras.putString("com.google.android.gms.games.key.desiredLocale", desiredLocale);
|
||||
//extras.putParcelable("com.google.android.gms.games.key.popupWindowToken", popupWindowToken);
|
||||
callGetService(Services.GAMES.SERVICE_ID, callback, versionCode, packageName, extras, accountName, scopes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getAppStateService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
String str2, String[] args) throws RemoteException {
|
||||
throw new IllegalArgumentException("App State service not supported");
|
||||
String accountName, String[] scopes) throws RemoteException {
|
||||
callGetService(Services.APPSTATE.SERVICE_ID, callback, versionCode, packageName, null, accountName, scopes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getPlayLogService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Play Log service not supported");
|
||||
callGetService(Services.PLAY_LOG.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getAdMobService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("AdMob service not supported");
|
||||
callGetService(Services.ADREQUEST.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getDroidGuardService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("DroidGuard service not supported");
|
||||
callGetService(Services.DROIDGUARD.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getLockboxService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lockbox service not supported");
|
||||
callGetService(Services.LOCKBOX.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getCastMirroringService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast Mirroring service not supported");
|
||||
callGetService(Services.CAST_MIRRORING.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getNetworkQualityService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Network Quality service not supported");
|
||||
callGetService(Services.NETWORK_QUALITY.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getGoogleIdentityService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Identity service not supported");
|
||||
callGetService(Services.ACCOUNT.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getGoogleFeedbackService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Feedback service not supported");
|
||||
callGetService(Services.FEEDBACK.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getCastService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
IBinder binder, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast service not supported");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getDriveService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
String[] args, String str2, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Drive service not supported");
|
||||
String[] scopes, String accountName, Bundle params) throws RemoteException {
|
||||
callGetService(Services.DRIVE.SERVICE_ID, callback, versionCode, packageName, params, accountName, scopes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getLightweightAppDataSearchService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lightweight App Data Search service not supported");
|
||||
callGetService(Services.LIGHTWEIGHT_INDEX.SERVICE_ID, callback, versionCode, packageName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getSearchAdministrationService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName) throws RemoteException {
|
||||
throw new IllegalArgumentException("Search Administration service not supported");
|
||||
callGetService(Services.SEARCH_ADMINISTRATION.SERVICE_ID, callback, versionCode, packageName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getAutoBackupService(IGmsCallbacks callback, int versionCode, String packageName,
|
||||
Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Auto Backup service not supported");
|
||||
callGetService(Services.PHOTO_AUTO_BACKUP.SERVICE_ID, callback, versionCode, packageName, params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getAddressService(IGmsCallbacks callback, int versionCode, String packageName)
|
||||
throws RemoteException {
|
||||
throw new IllegalArgumentException("Address service not supported");
|
||||
callGetService(Services.ADDRESS.SERVICE_ID, callback, versionCode, packageName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void getWalletServiceWithPackageName(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
|
||||
callGetService(Services.WALLET.SERVICE_ID, callback, versionCode, packageName);
|
||||
}
|
||||
|
||||
private void callGetService(int serviceId, IGmsCallbacks callback, int gmsVersion,
|
||||
String packageName) throws RemoteException {
|
||||
callGetService(serviceId, callback, gmsVersion, packageName, null);
|
||||
}
|
||||
|
||||
private void callGetService(int serviceId, IGmsCallbacks callback, int gmsVersion,
|
||||
String packageName, Bundle extras) throws RemoteException {
|
||||
callGetService(serviceId, callback, gmsVersion, packageName, extras, null, null);
|
||||
}
|
||||
|
||||
private void callGetService(int serviceId, IGmsCallbacks callback, int gmsVersion, String packageName, Bundle extras, String accountName, String[] scopes) throws RemoteException {
|
||||
GetServiceRequest request = new GetServiceRequest(serviceId);
|
||||
request.gmsVersion = gmsVersion;
|
||||
request.packageName = packageName;
|
||||
request.extras = extras;
|
||||
request.account = accountName == null ? null : new Account(accountName, "com.google");
|
||||
request.scopes = scopes == null ? null : scopesFromStringArray(scopes);
|
||||
getService(callback, request);
|
||||
}
|
||||
|
||||
private Scope[] scopesFromStringArray(String[] arr) {
|
||||
Scope[] scopes = new Scope[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
scopes[i] = new Scope(arr[i]);
|
||||
}
|
||||
return scopes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getService(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
if (supportedServiceIds.contains(request.serviceId)) {
|
||||
handleServiceRequest(callback, request);
|
||||
} else {
|
||||
Log.d(TAG, "Service not supported: " + request);
|
||||
throw new IllegalArgumentException("Service not supported: " + request.serviceId);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException;
|
||||
|
||||
@Override
|
||||
public void validateAccount(IGmsCallbacks callback, ValidateAccountRequest request) throws RemoteException {
|
||||
throw new IllegalArgumentException("ValidateAccountRequest not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,17 +23,19 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class DroidGuardService extends Service {
|
||||
private static final String TAG = "GmsDroidGuardSvc";
|
||||
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.DROIDGUARD.SERVICE_ID) {
|
||||
@Override
|
||||
public void getDroidGuardService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "getDroidGuardService for " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) {
|
||||
Log.d(TAG, "getDroidGuardService for " + request);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -22,18 +22,23 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class IndexService extends Service {
|
||||
private static final String TAG = "GmsIcingIndexSvc";
|
||||
|
||||
private AppDataSearchImpl appDataSearch = new AppDataSearchImpl();
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(
|
||||
Services.INDEX.SERVICE_ID, Services.SEARCH_ADMINISTRATION.SERVICE_ID,
|
||||
Services.SEARCH_CORPORA.SERVICE_ID, Services.SEARCH_GLOBAL.SERVICE_ID,
|
||||
Services.SEARCH_IME.SERVICE_ID, Services.SEARCH_QUERIES.SERVICE_ID) {
|
||||
@Override
|
||||
public void getAppDataSearchService(IGmsCallbacks callback, int versionCode, String packageName) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, appDataSearch.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -22,19 +22,20 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class LightweightIndexService extends Service {
|
||||
private static final String TAG = "GmsIcingLightIndexSvc";
|
||||
|
||||
private LightweightAppDataSearchImpl appDataSearch = new LightweightAppDataSearchImpl();
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LIGHTWEIGHT_INDEX.SERVICE_ID) {
|
||||
@Override
|
||||
public void getLightweightAppDataSearchService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, appDataSearch.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,34 +18,32 @@ package org.microg.gms.location;
|
|||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.location.GoogleLocationManagerServiceImpl;
|
||||
|
||||
import static org.microg.gms.common.Constants.ACTION_GMS_LOCATION_MANAGER_SERVICE_START;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class GoogleLocationManagerService extends Service {
|
||||
private static final String TAG = "GmsLocManagerSvc";
|
||||
|
||||
private GoogleLocationManagerServiceImpl impl = new GoogleLocationManagerServiceImpl(this);
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LOCATION_MANAGER.SERVICE_ID,
|
||||
Services.GEODATA.SERVICE_ID, Services.PLACE_DETECTION.SERVICE_ID) {
|
||||
@Override
|
||||
public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode,
|
||||
String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, impl.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (ACTION_GMS_LOCATION_MANAGER_SERVICE_START.equals(intent.getAction())) {
|
||||
if (Services.LOCATION_MANAGER.ACTION.equals(intent.getAction())) {
|
||||
return broker.asBinder();
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -18,24 +18,25 @@ package org.microg.gms.location;
|
|||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class ReportingAndroidService extends Service {
|
||||
private static final String TAG = "GmsLocReportingSvc";
|
||||
|
||||
private ReportingServiceImpl reportingService = new ReportingServiceImpl();
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LOCATION_REPORTING.SERVICE_ID) {
|
||||
@Override
|
||||
public void getReportingService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
callback.onPostInitComplete(0, reportingService, null);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, reportingService.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,27 +23,27 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
|
||||
import static org.microg.gms.common.Constants.ACTION_GMS_PEOPLE_SERVICE_START;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class PeopleService extends Service {
|
||||
private static final String TAG = "GmsPeopleSvc";
|
||||
|
||||
private PeopleServiceImpl impl = new PeopleServiceImpl(this);
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.PEOPLE.SERVICE_ID) {
|
||||
@Override
|
||||
public void getPeopleService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, impl.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (ACTION_GMS_PEOPLE_SERVICE_START.equals(intent.getAction())) {
|
||||
if (Services.PEOPLE.ACTION.equals(intent.getAction())) {
|
||||
return broker.asBinder();
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -23,18 +23,20 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.AbstractGmsServiceBroker;
|
||||
import org.microg.gms.common.Services;
|
||||
|
||||
public class PlayLogService extends Service {
|
||||
private static final String TAG = "GmsPlayLogSvc";
|
||||
|
||||
private PlayLogServiceImpl playLogService = new PlayLogServiceImpl();
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() {
|
||||
private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.PLAY_LOG.SERVICE_ID) {
|
||||
@Override
|
||||
public void getPlayLogService(IGmsCallbacks callback, int versionCode, String packageName, Bundle params) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + packageName);
|
||||
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException {
|
||||
Log.d(TAG, "bound by: " + request);
|
||||
callback.onPostInitComplete(0, playLogService.asBinder(), null);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,10 +21,17 @@ import android.os.RemoteException;
|
|||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.playlog.internal.IPlayLogService;
|
||||
import com.google.android.gms.playlog.internal.LogEvent;
|
||||
import com.google.android.gms.playlog.internal.PlayLoggerContext;
|
||||
|
||||
public class PlayLogServiceImpl extends IPlayLogService.Stub {
|
||||
private static final String TAG = "GmsPlayLogSvcImpl";
|
||||
|
||||
@Override
|
||||
public void event(String packageName, PlayLoggerContext context, LogEvent event) throws RemoteException {
|
||||
Log.d(TAG, packageName + " event:" + event + " context:" + context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
|
||||
if (super.onTransact(code, data, reply, flags)) return true;
|
||||
|
|
Loading…
Reference in a new issue