From c1d882abaab95297e5ea765c344d1e2864aad8ff Mon Sep 17 00:00:00 2001 From: mar-v-in Date: Mon, 2 Mar 2015 03:12:37 +0100 Subject: [PATCH] Fix Reporting service --- GmsApi | 2 +- .../gms/location/ReportingAndroidService.java | 17 ++++++++++- .../gms/location/ReportingServiceImpl.java | 29 +++++++++++++++++++ .../microg/gms/userinfo/ProfileManager.java | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/org/microg/gms/location/ReportingServiceImpl.java diff --git a/GmsApi b/GmsApi index 6020cd81..c29a2cbc 160000 --- a/GmsApi +++ b/GmsApi @@ -1 +1 @@ -Subproject commit 6020cd818a17d1d38a85157b0d44e3505fe791ee +Subproject commit c29a2cbc8937b6e41d125aab34328c988d99e345 diff --git a/src/org/microg/gms/location/ReportingAndroidService.java b/src/org/microg/gms/location/ReportingAndroidService.java index bf92d730..d942c7f7 100644 --- a/src/org/microg/gms/location/ReportingAndroidService.java +++ b/src/org/microg/gms/location/ReportingAndroidService.java @@ -18,15 +18,30 @@ 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.IGmsCallbacks; + +import org.microg.gms.AbstractGmsServiceBroker; + public class ReportingAndroidService extends Service { private static final String TAG = "GmsLocReportingSvc"; + private ReportingServiceImpl reportingService = new ReportingServiceImpl(); + private AbstractGmsServiceBroker broker = new AbstractGmsServiceBroker() { + @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); + } + }; + @Override public IBinder onBind(Intent intent) { Log.d(TAG, "onBind: " + intent); - return null; + return broker.asBinder(); } } diff --git a/src/org/microg/gms/location/ReportingServiceImpl.java b/src/org/microg/gms/location/ReportingServiceImpl.java new file mode 100644 index 00000000..172ff1c5 --- /dev/null +++ b/src/org/microg/gms/location/ReportingServiceImpl.java @@ -0,0 +1,29 @@ +/* + * 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.location; + +import android.accounts.Account; + +import com.google.android.gms.location.reporting.ReportingState; +import com.google.android.gms.location.reporting.internal.IReportingService; + +public class ReportingServiceImpl extends IReportingService.Stub { + public ReportingState unknown3(Account account) { + + return new ReportingState(); + } +} diff --git a/src/org/microg/gms/userinfo/ProfileManager.java b/src/org/microg/gms/userinfo/ProfileManager.java index 22e0047c..14e96d00 100644 --- a/src/org/microg/gms/userinfo/ProfileManager.java +++ b/src/org/microg/gms/userinfo/ProfileManager.java @@ -99,7 +99,7 @@ public class ProfileManager { byte[] bytes = Utils.readStreamToEnd(conn.getInputStream()); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); if (bitmap != null) - preferences.edit().putString("profile_picture", Base64.encodeToString(bytes, Base64.DEFAULT)).commit(); + preferences.edit().putString("profile_picture", Base64.encodeToString(bytes, Base64.DEFAULT)).apply(); return bitmap; } catch (Exception e) { Log.w(TAG, e);