From 124ec3ac1c87bb3a8781563a84309f0848a095b3 Mon Sep 17 00:00:00 2001 From: mar-v-in Date: Sat, 11 Apr 2015 13:48:21 +0200 Subject: [PATCH] Update icing service, add DummyService for debugging, update sublib --- extern/GmsApi | 2 +- .../src/main/AndroidManifest.xml | 47 +++++++++++++++++++ .../java/org/microg/gms/DummyService.java | 44 +++++++++++++++++ .../gms/gservices/GServicesProvider.java | 1 + .../microg/gms/icing/AppDataSearchImpl.java | 21 ++++++++- .../microg/gms/icing/CorporaSearchImpl.java | 34 ++++++++++++++ .../org/microg/gms/icing/IndexService.java | 21 ++++++++- 7 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 play-services-core/src/main/java/org/microg/gms/DummyService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/CorporaSearchImpl.java diff --git a/extern/GmsApi b/extern/GmsApi index 562e2317..89280531 160000 --- a/extern/GmsApi +++ b/extern/GmsApi @@ -1 +1 @@ -Subproject commit 562e23177598d94c47318394d0224d6118fcb05f +Subproject commit 8928053170b6a819befa297f264e5ba7e2f9342b diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 567fbb2b..6dcda048 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -332,6 +332,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..dd7f843c --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/DummyService.java @@ -0,0 +1,44 @@ +/* + * 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 class DummyService extends Service { + + private static final String TAG = "GmsDummySvc"; + private IGmsServiceBroker broker = new AbstractGmsServiceBroker(-1) { + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + + } + }; + + @Override + public IBinder onBind(Intent intent) { + Log.d(TAG, "onBind: " + intent); + return broker.asBinder(); + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java b/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java index 4f2ba2f2..9dcc7d80 100644 --- a/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java +++ b/play-services-core/src/main/java/org/microg/gms/gservices/GServicesProvider.java @@ -96,6 +96,7 @@ public class GServicesProvider extends ContentProvider { } } } + if (cursor.getCount() == 0) return null; return cursor; } diff --git a/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java index 6477ec57..d0e2be7b 100644 --- a/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java @@ -21,12 +21,14 @@ import android.os.RemoteException; import android.util.Log; import com.google.android.gms.appdatasearch.CorpusStatus; +import com.google.android.gms.appdatasearch.PIMEUpdateResponse; +import com.google.android.gms.appdatasearch.RequestIndexingSpecification; import com.google.android.gms.appdatasearch.SuggestSpecification; import com.google.android.gms.appdatasearch.SuggestionResults; import com.google.android.gms.appdatasearch.internal.IAppDataSearch; public class AppDataSearchImpl extends IAppDataSearch.Stub { - private static final String TAG = "GmsIcingSearchImpl"; + private static final String TAG = "GmsIcingAppDataImpl"; @Override public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { @@ -40,8 +42,23 @@ public class AppDataSearchImpl extends IAppDataSearch.Stub { return new SuggestionResults("Unknown error"); } + @Override + public boolean requestIndexing(String packageName, String accountName, long l, RequestIndexingSpecification specs) throws RemoteException { + Log.d(TAG, "requestIndexing: " + accountName + " @ " + packageName + ", " + l); + return true; + } + @Override public CorpusStatus getStatus(String packageName, String accountName) throws RemoteException { - return new CorpusStatus(); + Log.d(TAG, "getStatus: " + accountName + " @ " + packageName); + CorpusStatus status = new CorpusStatus(); + status.found = true; + return status; + } + + @Override + public PIMEUpdateResponse requestPIMEUpdate(String s1, String s2, int i, byte[] bs) throws RemoteException { + Log.d(TAG, "requestPIMEUpdate: " + s1 + ", " + s2 + ", " + i + ", " + (bs == null ? "null" : new String(bs))); + return new PIMEUpdateResponse(); } } diff --git a/play-services-core/src/main/java/org/microg/gms/icing/CorporaSearchImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/CorporaSearchImpl.java new file mode 100644 index 00000000..01d4dc05 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/CorporaSearchImpl.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.icing; + +import android.os.Parcel; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.search.corpora.internal.ISearchCorporaService; + +public class CorporaSearchImpl extends ISearchCorporaService.Stub { + private static final String TAG = "GmsIcingCorporaImpl"; + + @Override + public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { + if (super.onTransact(code, data, reply, flags)) return true; + Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); + return false; + } +} 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 816007b6..26c9c59f 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 @@ -24,6 +24,7 @@ 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.common.Services; @@ -32,14 +33,30 @@ public class IndexService extends Service { private static final String TAG = "GmsIcingIndexSvc"; private AppDataSearchImpl appDataSearch = new AppDataSearchImpl(); - private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker( + 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); - callback.onPostInitComplete(0, appDataSearch.asBinder(), null); + 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; + } } };