Implement AppInvite and Firebase Dynamic Links

This commit is contained in:
Alexandru Chircu 2020-01-01 14:50:56 +02:00 committed by Marvin W
parent 94de371cb9
commit 7bc61ab97f
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
7 changed files with 244 additions and 0 deletions

View File

@ -34,6 +34,7 @@ android {
dependencies {
api project(':play-services-basement')
api project(':play-services-appinvite-api')
api project(':play-services-cast-api')
api project(':play-services-cast-framework-api')
api project(':play-services-iid-api')

View File

@ -37,6 +37,7 @@ dependencies {
api "org.slf4j:slf4j-api:1.7.25"
api "uk.uuid.slf4j:slf4j-android:1.7.25-1"
implementation project(':firebase-dynamic-links-api')
implementation project(':play-services-base-core')
implementation project(':play-services-location-core')
implementation project(':play-services-core:microg-ui-tools') // deprecated

View File

@ -622,6 +622,18 @@
</intent-filter>
</service>
<service android:name="org.microg.gms.appinvite.AppInviteService">
<intent-filter>
<action android:name="com.google.android.gms.appinvite.service.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.firebase.dynamiclinks.DynamicLinksService">
<intent-filter>
<action android:name="com.google.firebase.dynamiclinks.service.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.gms.plus.service.START" />

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.appinvite;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.os.RemoteException;
import com.google.android.gms.common.api.CommonStatusCodes;
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.GmsService;
import org.microg.gms.common.PackageUtils;
import org.microg.gms.appinvite.AppInviteServiceImpl;
public class AppInviteService extends BaseService {
private static final String TAG = "GmsAppInviteService";
public AppInviteService() {
super("GmsAppInviteSvc", GmsService.APP_INVITE);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
PackageUtils.getAndCheckCallingPackage(this, request.packageName);
Log.d(TAG, "callb: " + callback + " ; req: " + request + " ; serv: " + service);
callback.onPostInitComplete(0, new AppInviteServiceImpl(this, request.packageName, request.extras), null);
}
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.appinvite;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.appinvite.internal.IAppInviteService;
import com.google.android.gms.appinvite.internal.IAppInviteCallbacks;
public class AppInviteServiceImpl extends IAppInviteService.Stub {
private static final String TAG = "GmsAppInviteServImpl";
public AppInviteServiceImpl(Context context, String packageName, Bundle extras) {
}
@Override
public void updateInvitationOnInstall(IAppInviteCallbacks callback, String invitationId) throws RemoteException {
callback.onStatus(Status.SUCCESS);
}
@Override
public void convertInvitation(IAppInviteCallbacks callback, String invitationId) throws RemoteException {
callback.onStatus(Status.SUCCESS);
}
@Override
public void getInvitation(IAppInviteCallbacks callback) throws RemoteException {
callback.onStatusIntent(new Status(Activity.RESULT_CANCELED), null);
}
@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;
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.firebase.dynamiclinks;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.os.RemoteException;
import com.google.android.gms.common.api.CommonStatusCodes;
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.GmsService;
import org.microg.gms.common.PackageUtils;
import org.microg.gms.firebase.dynamiclinks.DynamicLinksServiceImpl;
public class DynamicLinksService extends BaseService {
private static final String TAG = "GmsDynamicLinksService";
public DynamicLinksService() {
super("GmsDynamicLinksSvc", GmsService.DYNAMIC_LINKS);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
PackageUtils.getAndCheckCallingPackage(this, request.packageName);
Log.d(TAG, "callb: " + callback + " ; req: " + request + " ; serv: " + service);
callback.onPostInitComplete(0, new DynamicLinksServiceImpl(this, request.packageName, request.extras), null);
}
}

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.firebase.dynamiclinks;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.Bundle;
import android.util.Log;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksService;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks;
import com.google.firebase.dynamiclinks.internal.DynamicLinkData;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLink;
public class DynamicLinksServiceImpl extends IDynamicLinksService.Stub {
private static final String TAG = "GmsDynamicLinksServImpl";
public DynamicLinksServiceImpl(Context context, String packageName, Bundle extras) {
}
@Override
public void getInitialLink(IDynamicLinksCallbacks callback, String var2) throws RemoteException {
callback.onStatusDynamicLinkData(Status.SUCCESS, new DynamicLinkData());
}
@Override
public void func2(IDynamicLinksCallbacks callback, Bundle var2) throws RemoteException {
Log.d(TAG, "func2: " + callback + ", " + var2);
callback.onStatusShortDynamicLink(Status.SUCCESS, new ShortDynamicLink());
}
@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;
}
}