Skip to content

Commit

Permalink
Add dummy services for PSEUDONYMOUS_ID(52), GASS(116), ACCOUNT_DATA(1…
Browse files Browse the repository at this point in the history
…53) and APP_SET(300) (#2175)

Co-authored-by: Marvin W <[email protected]>
  • Loading branch information
DaVinci9196 and mar-v-in committed Feb 17, 2024
1 parent 37dd2b5 commit 9ee35e3
Show file tree
Hide file tree
Showing 35 changed files with 846 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.gass.internal;

parcelable GassRequestParcel;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.gass.internal;

parcelable GassResponseParcel;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.gass.internal;

import android.os.Bundle;
import android.os.IInterface;
import com.google.android.gms.gass.internal.GassRequestParcel;
import com.google.android.gms.gass.internal.GassResponseParcel;

interface IGassService {
GassResponseParcel getGassResponse(in GassRequestParcel gassRequestParcel) = 0;
Bundle getGassBundle(in Bundle bundle, int code) = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.pseudonymous;

parcelable PseudonymousIdToken;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.pseudonymous.internal;

import com.google.android.gms.common.api.Status;
import com.google.android.gms.pseudonymous.PseudonymousIdToken;

interface IPseudonymousIdCallbacks {
void onGetTokenResponse(in Status status, in PseudonymousIdToken token) = 0;
void onSetTokenResponse(in Status status) = 1;
void onGetLastResetWallTimeMsResponse(in Status status, long time) = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.pseudonymous.internal;

import com.google.android.gms.pseudonymous.internal.IPseudonymousIdCallbacks;
import com.google.android.gms.pseudonymous.PseudonymousIdToken;

interface IPseudonymousIdService {
void getToken(IPseudonymousIdCallbacks call) = 0;
void setToken(IPseudonymousIdCallbacks call, in PseudonymousIdToken token) = 1;
void getLastResetWallTimeMs(IPseudonymousIdCallbacks callbacks) = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.gass.internal;

import android.os.Parcel;

import androidx.annotation.NonNull;

import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class GassRequestParcel extends AbstractSafeParcelable {

@Field(1)
public int versionCode;
@Field(2)
public String packageName;
@Field(3)
public String appVersionCode;

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<GassRequestParcel> CREATOR = findCreator(GassRequestParcel.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.gass.internal;

import android.os.Parcel;

import androidx.annotation.NonNull;

import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
import com.google.android.gms.feedback.ErrorReport;

@SafeParcelable.Class
public class GassResponseParcel extends AbstractSafeParcelable {

@Field(1)
public int versionCode;

@Field(2)
public byte[] data;

public ErrorReport report;

public GassResponseParcel() {
}

public GassResponseParcel(int i, byte[] bArr) {
this.versionCode = i;
this.report = null;
this.data = bArr;
}

public GassResponseParcel(ErrorReport report) {
this.versionCode = 1;
this.report = report;
this.data = null;
}

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<GassResponseParcel> CREATOR = findCreator(GassResponseParcel.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.pseudonymous;

import android.os.Parcel;

import androidx.annotation.NonNull;

import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class PseudonymousIdToken extends AbstractSafeParcelable {

@Field(2)
public String name;

@Constructor
public PseudonymousIdToken(@Param(2) String name) {
this.name = name;
}

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}

public static final SafeParcelableCreatorAndWriter<PseudonymousIdToken> CREATOR = findCreator(PseudonymousIdToken.class);

}
37 changes: 37 additions & 0 deletions play-services-appset/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

apply plugin: 'com.android.library'

android {
namespace "com.google.android.gms.appset"

compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"

buildFeatures {
aidl = true
}

defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

description = 'microG implementation of play-services-appset'

dependencies {
api project(':play-services-base')
api project(':play-services-basement')

annotationProcessor project(':safe-parcel-processor')
}
56 changes: 56 additions & 0 deletions play-services-appset/core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
apply plugin: 'signing'

dependencies {
api project(':play-services-appset')

implementation project(':play-services-base-core')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
}

android {
namespace "org.microg.gms.appset.core"

compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"

defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}

sourceSets {
main {
java.srcDirs = ['src/main/kotlin']
}
}

lintOptions {
disable 'MissingTranslation'
}

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

kotlinOptions {
jvmTarget = 1.8
}
}

// Nothing to publish yet
//apply from: '../gradle/publish-android.gradle'

description = 'microG service implementation for play-services-appset'
16 changes: 16 additions & 0 deletions play-services-appset/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2024 microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>

<service android:name="org.microg.gms.appset.AppSetService">
<intent-filter>
<action android:name="com.google.android.gms.appset.service.START" />
</intent-filter>
</service>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package org.microg.gms.appset

import android.util.Log
import com.google.android.gms.appset.AppSetIdRequestParams
import com.google.android.gms.appset.internal.IAppSetIdCallback
import com.google.android.gms.appset.internal.IAppSetService
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.Feature
import com.google.android.gms.common.api.Status
import com.google.android.gms.common.internal.ConnectionInfo
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

private const val TAG = "AppSetService"
private val FEATURES = arrayOf(Feature("app_set_id", 1L))

class AppSetService : BaseService(TAG, GmsService.APP_SET) {

override fun handleServiceRequest(callback: IGmsCallbacks?, request: GetServiceRequest?, service: GmsService?) {
callback?.onPostInitCompleteWithConnectionInfo(
ConnectionResult.SUCCESS,
AppSetServiceImpl().asBinder(),
ConnectionInfo().apply { features = FEATURES }
)
}
}

class AppSetServiceImpl : IAppSetService.Stub() {
override fun getAppSetIdInfo(params: AppSetIdRequestParams?, callback: IAppSetIdCallback?) {
Log.d(TAG, "AppSetServiceImp getAppSetIdInfo is called -> ${params?.toString()} ")
callback?.onAppSetInfo(Status.SUCCESS, null)
}
}
4 changes: 4 additions & 0 deletions play-services-appset/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.appset;

parcelable AppSetIdRequestParams;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.appset;

parcelable AppSetInfoParcel;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.appset.internal;

import com.google.android.gms.appset.AppSetInfoParcel;
import com.google.android.gms.common.api.Status;

interface IAppSetIdCallback {
void onAppSetInfo(in Status status, in AppSetInfoParcel info) = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.appset.internal;

import com.google.android.gms.appset.AppSetIdRequestParams;
import com.google.android.gms.appset.internal.IAppSetIdCallback;

interface IAppSetService {
void getAppSetIdInfo(in AppSetIdRequestParams params, in IAppSetIdCallback callback) = 0;
}
Loading

0 comments on commit 9ee35e3

Please sign in to comment.