From 2f78c63eb64764907a4175e017cb3aeb91d49415 Mon Sep 17 00:00:00 2001 From: mar-v-in Date: Mon, 22 Jun 2015 23:26:35 +0200 Subject: [PATCH] Use common BaseService, update AuthService --- extern/GmsApi | 2 +- .../src/main/AndroidManifest.xml | 25 ++++++-- .../android/gms/ads/AdManagerCreatorImpl.java | 2 +- .../microg/gms/AbstractGmsServiceBroker.java | 4 +- .../main/java/org/microg/gms/BaseService.java | 51 +++++++++++++++ .../java/org/microg/gms/DummyService.java | 24 ++----- .../java/org/microg/gms/ads/GService.java | 35 +++++++++++ .../gms/auth/AuthManagerServiceImpl.java | 6 ++ .../java/org/microg/gms/car/CarService.java | 24 +++---- .../gms/droidguard/DroidGuardService.java | 25 +++----- .../microg/gms/feedback/FeedbackService.java | 34 ++++++++++ .../org/microg/gms/icing/IndexService.java | 62 ++++++++----------- .../gms/icing/LightweightIndexService.java | 25 +++----- .../GoogleLocationManagerService.java | 29 +++------ .../gms/location/ReportingAndroidService.java | 26 +++----- .../org/microg/gms/people/PeopleService.java | 30 +++------ .../microg/gms/playlog/PlayLogService.java | 25 +++----- 17 files changed, 237 insertions(+), 192 deletions(-) create mode 100644 play-services-core/src/main/java/org/microg/gms/BaseService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/ads/GService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/feedback/FeedbackService.java diff --git a/extern/GmsApi b/extern/GmsApi index 6743f1d4..37e3b4dc 160000 --- a/extern/GmsApi +++ b/extern/GmsApi @@ -1 +1 @@ -Subproject commit 6743f1d4b1a3cf0202b9d62f2ebc5dfb385b5576 +Subproject commit 37e3b4dc398cb349e9637471d6df09db9c8910c8 diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 3eba3244..b259f4e7 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -15,8 +15,8 @@ --> + android:versionCode="7574001" + android:versionName="7.5.74 (µg v0.01)"> + + + + + + + + + + + + + @@ -359,7 +376,6 @@ - @@ -368,7 +384,6 @@ - @@ -380,13 +395,11 @@ - - diff --git a/play-services-core/src/main/java/com/google/android/gms/ads/AdManagerCreatorImpl.java b/play-services-core/src/main/java/com/google/android/gms/ads/AdManagerCreatorImpl.java index d1f5add6..43d8d2d5 100644 --- a/play-services-core/src/main/java/com/google/android/gms/ads/AdManagerCreatorImpl.java +++ b/play-services-core/src/main/java/com/google/android/gms/ads/AdManagerCreatorImpl.java @@ -16,5 +16,5 @@ package com.google.android.gms.ads; -public class AdManagerCreatorImpl { +public class AdManagerCreatorImpl extends AdManagerCreator.Stub { } diff --git a/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java b/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java index e6449e6c..02813376 100644 --- a/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java +++ b/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java @@ -36,6 +36,8 @@ import java.util.HashSet; import java.util.Set; public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub { + public static final int ID_ACCEPT_ALL = -1; + private static final String TAG = "GmsServiceBroker"; private final Set supportedServiceIds; @@ -265,7 +267,7 @@ public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub { @Override public void getService(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - if (supportedServiceIds.contains(request.serviceId)) { + if (supportedServiceIds.contains(request.serviceId) || supportedServiceIds.contains(ID_ACCEPT_ALL)) { handleServiceRequest(callback, request); } else { Log.d(TAG, "Service not supported: " + request); diff --git a/play-services-core/src/main/java/org/microg/gms/BaseService.java b/play-services-core/src/main/java/org/microg/gms/BaseService.java new file mode 100644 index 00000000..badd41b6 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/BaseService.java @@ -0,0 +1,51 @@ +/* + * 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; + +import android.app.Service; +import android.content.Intent; +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 com.google.android.gms.common.internal.IGmsServiceBroker; + +public abstract class BaseService extends Service { + private final IGmsServiceBroker broker; + protected final String TAG; + + public BaseService(String tag, Integer supportedServiceId, Integer... supportedServiceIds) { + this.TAG = tag; + broker = new AbstractGmsServiceBroker(supportedServiceId, supportedServiceIds) { + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + Log.d(TAG, "bound by: " + request); + BaseService.this.handleServiceRequest(callback, request); + } + }; + } + + @Override + public IBinder onBind(Intent intent) { + Log.d(TAG, "onBind: " + intent); + return broker.asBinder(); + } + + public abstract void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException; +} diff --git a/play-services-core/src/main/java/org/microg/gms/DummyService.java b/play-services-core/src/main/java/org/microg/gms/DummyService.java index dd7f843c..51ea6480 100644 --- a/play-services-core/src/main/java/org/microg/gms/DummyService.java +++ b/play-services-core/src/main/java/org/microg/gms/DummyService.java @@ -16,29 +16,17 @@ package org.microg.gms; -import android.app.Service; -import android.content.Intent; -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 com.google.android.gms.common.internal.IGmsServiceBroker; -public class DummyService extends Service { +public class DummyService extends BaseService { - private static final String TAG = "GmsDummySvc"; - private IGmsServiceBroker broker = new AbstractGmsServiceBroker(-1) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - - } - }; + public DummyService() { + super("GmsDummySvc", AbstractGmsServiceBroker.ID_ACCEPT_ALL); + } @Override - public IBinder onBind(Intent intent) { - Log.d(TAG, "onBind: " + intent); - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { + // Dummy } } diff --git a/play-services-core/src/main/java/org/microg/gms/ads/GService.java b/play-services-core/src/main/java/org/microg/gms/ads/GService.java new file mode 100644 index 00000000..b86bc78c --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/ads/GService.java @@ -0,0 +1,35 @@ +/* + * 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.ads; + +import com.google.android.gms.common.internal.GetServiceRequest; +import com.google.android.gms.common.internal.IGmsCallbacks; + +import org.microg.gms.BaseService; +import org.microg.gms.common.Services; + +public class GService extends BaseService { + + public GService() { + super("GmsAdsGSvc", Services.GSERVICES.SERVICE_ID); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { + // TODO + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java index d5eb07ff..b07ffac7 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/AuthManagerServiceImpl.java @@ -16,6 +16,7 @@ package org.microg.gms.auth; +import android.accounts.Account; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -105,6 +106,11 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub { return new AccountChangeEventsResponse(); } + @Override + public Bundle getTokenWithAccount(Account account, String scope, Bundle extras) throws RemoteException { + return getToken(account.name, scope, extras); + } + @Override public Bundle clearToken(String token, Bundle extras) throws RemoteException { String packageName = extras.getString(KEY_ANDROID_PACKAGE_NAME); diff --git a/play-services-core/src/main/java/org/microg/gms/car/CarService.java b/play-services-core/src/main/java/org/microg/gms/car/CarService.java index f48a6731..44593964 100644 --- a/play-services-core/src/main/java/org/microg/gms/car/CarService.java +++ b/play-services-core/src/main/java/org/microg/gms/car/CarService.java @@ -16,29 +16,19 @@ package org.microg.gms.car; -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; -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.BaseService; import org.microg.gms.common.Services; -public class CarService extends Service { - private static final String TAG = "GmsCarSvc"; - - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.CAR.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { - Log.d(TAG, "getCarService for " + request); - } - }; +public class CarService extends BaseService { + public CarService() { + super("GmsCarSvc", Services.CAR.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { + // TODO } } diff --git a/play-services-core/src/main/java/org/microg/gms/droidguard/DroidGuardService.java b/play-services-core/src/main/java/org/microg/gms/droidguard/DroidGuardService.java index 45191d4e..4bd128da 100644 --- a/play-services-core/src/main/java/org/microg/gms/droidguard/DroidGuardService.java +++ b/play-services-core/src/main/java/org/microg/gms/droidguard/DroidGuardService.java @@ -16,31 +16,20 @@ package org.microg.gms.droidguard; -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.BaseService; import org.microg.gms.common.Services; -public class DroidGuardService extends Service { - private static final String TAG = "GmsDroidGuardSvc"; +public class DroidGuardService extends BaseService { - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.DROIDGUARD.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { - Log.d(TAG, "getDroidGuardService for " + request); - } - }; + public DroidGuardService() { + super("GmsDroidGuardSvc", Services.DROIDGUARD.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { + // TODO } } diff --git a/play-services-core/src/main/java/org/microg/gms/feedback/FeedbackService.java b/play-services-core/src/main/java/org/microg/gms/feedback/FeedbackService.java new file mode 100644 index 00000000..7d6d3160 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/feedback/FeedbackService.java @@ -0,0 +1,34 @@ +/* + * 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.feedback; + +import com.google.android.gms.common.internal.GetServiceRequest; +import com.google.android.gms.common.internal.IGmsCallbacks; + +import org.microg.gms.BaseService; +import org.microg.gms.common.Services; + +public class FeedbackService extends BaseService { + public FeedbackService() { + super("GmsFeedbackSvc", Services.FEEDBACK.SERVICE_ID); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) { + // TODO + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java b/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java index 26c9c59f..4683a35a 100644 --- a/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java +++ b/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java @@ -16,52 +16,42 @@ package org.microg.gms.icing; -import android.app.Service; -import android.content.Intent; -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 com.google.android.gms.common.internal.IGmsServiceBroker; -import org.microg.gms.AbstractGmsServiceBroker; +import org.microg.gms.BaseService; import org.microg.gms.common.Services; -public class IndexService extends Service { - private static final String TAG = "GmsIcingIndexSvc"; - +public class IndexService extends BaseService { private AppDataSearchImpl appDataSearch = new AppDataSearchImpl(); private CorporaSearchImpl corporaSearch = new CorporaSearchImpl(); - private IGmsServiceBroker 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 handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - switch (request.serviceId) { - case Services.INDEX.SERVICE_ID: - callback.onPostInitComplete(0, appDataSearch.asBinder(), null); - break; - case Services.SEARCH_ADMINISTRATION.SERVICE_ID: - break; - case Services.SEARCH_CORPORA.SERVICE_ID: - callback.onPostInitComplete(0, corporaSearch.asBinder(), null); - break; - case Services.SEARCH_GLOBAL.SERVICE_ID: - break; - case Services.SEARCH_IME.SERVICE_ID: - break; - case Services.SEARCH_QUERIES.SERVICE_ID: - break; - } - } - }; + + public IndexService() { + super("GmsIcingIndexSvc", + 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 IBinder onBind(Intent intent) { - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + switch (request.serviceId) { + case Services.INDEX.SERVICE_ID: + callback.onPostInitComplete(0, appDataSearch.asBinder(), null); + break; + case Services.SEARCH_ADMINISTRATION.SERVICE_ID: + break; + case Services.SEARCH_CORPORA.SERVICE_ID: + callback.onPostInitComplete(0, corporaSearch.asBinder(), null); + break; + case Services.SEARCH_GLOBAL.SERVICE_ID: + break; + case Services.SEARCH_IME.SERVICE_ID: + break; + case Services.SEARCH_QUERIES.SERVICE_ID: + break; + } } } diff --git a/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java b/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java index 92f05303..afb3520c 100644 --- a/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java +++ b/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java @@ -16,32 +16,23 @@ package org.microg.gms.icing; -import android.app.Service; -import android.content.Intent; -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.BaseService; import org.microg.gms.common.Services; -public class LightweightIndexService extends Service { - private static final String TAG = "GmsIcingLightIndexSvc"; - +public class LightweightIndexService extends BaseService { private LightweightAppDataSearchImpl appDataSearch = new LightweightAppDataSearchImpl(); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LIGHTWEIGHT_INDEX.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - callback.onPostInitComplete(0, appDataSearch.asBinder(), null); - } - }; + + public LightweightIndexService() { + super("GmsIcingLightIndexSvc", Services.LIGHTWEIGHT_INDEX.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + callback.onPostInitComplete(0, appDataSearch.asBinder(), null); } } diff --git a/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java index eea0bfb3..e2716d54 100644 --- a/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java +++ b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java @@ -16,37 +16,26 @@ package org.microg.gms.location; -import android.app.Service; -import android.content.Intent; -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.BaseService; import org.microg.gms.common.Services; -public class GoogleLocationManagerService extends Service { +public class GoogleLocationManagerService extends BaseService { private static final String TAG = "GmsLocManagerSvc"; private GoogleLocationManagerServiceImpl impl = new GoogleLocationManagerServiceImpl(this); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LOCATION_MANAGER.SERVICE_ID, - Services.GEODATA.SERVICE_ID, Services.PLACE_DETECTION.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - callback.onPostInitComplete(0, impl.asBinder(), null); - } - }; + + public GoogleLocationManagerService() { + super("GmsLocManagerSvc", Services.LOCATION_MANAGER.SERVICE_ID, + Services.GEODATA.SERVICE_ID, Services.PLACE_DETECTION.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - if (Services.LOCATION_MANAGER.ACTION.equals(intent.getAction())) { - return broker.asBinder(); - } else { - return null; - } + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + callback.onPostInitComplete(0, impl.asBinder(), null); } } diff --git a/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java b/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java index 712cd097..1e8bb666 100644 --- a/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java +++ b/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java @@ -16,33 +16,23 @@ package org.microg.gms.location; -import android.app.Service; -import android.content.Intent; -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.BaseService; import org.microg.gms.common.Services; -public class ReportingAndroidService extends Service { - private static final String TAG = "GmsLocReportingSvc"; - +public class ReportingAndroidService extends BaseService { private ReportingServiceImpl reportingService = new ReportingServiceImpl(); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.LOCATION_REPORTING.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - callback.onPostInitComplete(0, reportingService.asBinder(), null); - } - }; + + public ReportingAndroidService() { + super("GmsLocReportingSvc", Services.LOCATION_REPORTING.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - Log.d(TAG, "onBind: " + intent); - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + callback.onPostInitComplete(0, reportingService.asBinder(), null); } } diff --git a/play-services-core/src/main/java/org/microg/gms/people/PeopleService.java b/play-services-core/src/main/java/org/microg/gms/people/PeopleService.java index 60c7a639..efee125d 100644 --- a/play-services-core/src/main/java/org/microg/gms/people/PeopleService.java +++ b/play-services-core/src/main/java/org/microg/gms/people/PeopleService.java @@ -16,37 +16,23 @@ package org.microg.gms.people; -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.BaseService; import org.microg.gms.common.Services; -public class PeopleService extends Service { - private static final String TAG = "GmsPeopleSvc"; - +public class PeopleService extends BaseService { private PeopleServiceImpl impl = new PeopleServiceImpl(this); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.PEOPLE.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - callback.onPostInitComplete(0, impl.asBinder(), null); - } - }; + + public PeopleService() { + super("GmsPeopleSvc", Services.PEOPLE.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - if (Services.PEOPLE.ACTION.equals(intent.getAction())) { - return broker.asBinder(); - } else { - return null; - } + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + callback.onPostInitComplete(0, impl.asBinder(), null); } } diff --git a/play-services-core/src/main/java/org/microg/gms/playlog/PlayLogService.java b/play-services-core/src/main/java/org/microg/gms/playlog/PlayLogService.java index 2548c93e..12335343 100644 --- a/play-services-core/src/main/java/org/microg/gms/playlog/PlayLogService.java +++ b/play-services-core/src/main/java/org/microg/gms/playlog/PlayLogService.java @@ -16,33 +16,24 @@ package org.microg.gms.playlog; -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.BaseService; import org.microg.gms.common.Services; -public class PlayLogService extends Service { - private static final String TAG = "GmsPlayLogSvc"; +public class PlayLogService extends BaseService { private PlayLogServiceImpl playLogService = new PlayLogServiceImpl(); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker(Services.PLAY_LOG.SERVICE_ID) { - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { - Log.d(TAG, "bound by: " + request); - callback.onPostInitComplete(0, playLogService.asBinder(), null); - } - }; + + public PlayLogService() { + super("GmsPlayLogSvc", Services.PLAY_LOG.SERVICE_ID); + } @Override - public IBinder onBind(Intent intent) { - return broker.asBinder(); + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + callback.onPostInitComplete(0, playLogService.asBinder(), null); } }