Skip to content

Commit

Permalink
Add dummy service for SEMANTIC_LOCATION(173) (#2174)
Browse files Browse the repository at this point in the history
Co-authored-by: Marvin W <[email protected]>
  • Loading branch information
DaVinci9196 and mar-v-in authored Feb 17, 2024
1 parent e4c1c5a commit 37dd2b5
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.semanticlocation;

parcelable SemanticLocationEventRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.semanticlocation.internal;

import android.app.PendingIntent;
import android.os.IInterface;
import com.google.android.gms.semanticlocation.SemanticLocationEventRequest;
import com.google.android.gms.semanticlocation.internal.SemanticLocationParameters;
import com.google.android.gms.common.api.internal.IStatusCallback;

interface ISemanticLocationService {
void registerSemanticLocationEvents(in SemanticLocationParameters params, IStatusCallback callback, in SemanticLocationEventRequest request, in PendingIntent pendingIntent) = 0;
void unregisterSemanticLocationEvents(in SemanticLocationParameters params, IStatusCallback callback, in PendingIntent pendingIntent) = 1;

void setIncognitoMode(in SemanticLocationParameters params, IStatusCallback callback, boolean mode) = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.semanticlocation.internal;

parcelable SemanticLocationParameters;
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.semanticlocation;


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 SemanticLocationEventRequest extends AbstractSafeParcelable {
@Field(1)
public final float position;

@Constructor
public SemanticLocationEventRequest(@Param(1) float position) {
this.position = position;
}

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

public static final SafeParcelableCreatorAndWriter<SemanticLocationEventRequest> CREATOR = findCreator(SemanticLocationEventRequest.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.semanticlocation.internal;

import android.accounts.Account;
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 SemanticLocationParameters extends AbstractSafeParcelable {
@Field(1)
public final Account account;
@Field(2)
public final String clientIdentifier;
@Field(3)
public final String packageName;

@Constructor
public SemanticLocationParameters(@Param(1) Account account, @Param(2) String clientIdentifier, @Param(3) String packageName) {
this.account = account;
this.clientIdentifier = clientIdentifier;
this.packageName = packageName;
}

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

@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public enum GmsService {
AD_HTTP(166, "com.google.android.gms.ads.service.HTTP"),
LANGUAGE_PROFILE(167, "com.google.android.gms.languageprofile.service.START"),
MDNS(168, "com.google.android.gms.mdns.service.START"),
SEMANTIC_LOCATION(173, "com.google.android.gms.semanticlocation.service.START_ODLH"),
FIDO2_ZEROPARTY(180, "com.google.android.gms.fido.fido2.zeroparty.START"),
G1_RESTORE(181, "com.google.android.gms.backup.G1_RESTORE"),
G1_BACKUP(182, "com.google.android.gms.backup.G1_BACKUP"),
Expand Down
7 changes: 6 additions & 1 deletion play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,12 @@
</intent-filter>
</service>

<service android:name=".semanticlocation.SemanticLocationService" android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.semanticlocation.service.START_ODLH" />
</intent-filter>
</service>

<service android:name="com.google.android.gms.audit.internal.AuditApiService">
<intent-filter>
<action android:name="com.google.android.gms.audit.service.START" />
Expand Down Expand Up @@ -943,7 +949,6 @@
<action android:name="com.google.android.gms.romanesco.MODULE_BACKUP_AGENT" />
<action android:name="com.google.android.gms.romanesco.service.START" />
<action android:name="com.google.android.gms.search.service.SEARCH_AUTH_START" />
<action android:name="com.google.android.gms.semanticlocation.service.START_ODLH" />
<action android:name="com.google.android.gms.sesame.service.BIND" />
<action android:name="com.google.android.gms.telephonyspam.service.START" />
<action android:name="com.google.android.gms.testsupport.service.START" />
Expand Down
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
*/
package com.google.android.gms.semanticlocation

import android.app.PendingIntent
import android.util.Log
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.Feature
import com.google.android.gms.common.api.internal.IStatusCallback
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 com.google.android.gms.semanticlocation.internal.ISemanticLocationService
import com.google.android.gms.semanticlocation.internal.SemanticLocationParameters
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService

private const val TAG = "SemanticLocationService"

private val FEATURES = arrayOf(
Feature("semanticlocation_events", 1L),
)

class SemanticLocationService : BaseService(TAG, GmsService.SEMANTIC_LOCATION) {
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
val connectionInfo = ConnectionInfo().apply {
features = FEATURES
}
callback.onPostInitCompleteWithConnectionInfo(
ConnectionResult.SUCCESS,
SemanticLocationServiceImpl().asBinder(),
connectionInfo
)
}
}

class SemanticLocationServiceImpl : ISemanticLocationService.Stub() {
override fun registerSemanticLocationEvents(
params: SemanticLocationParameters,
callback: IStatusCallback,
request: SemanticLocationEventRequest,
pendingIntent: PendingIntent
) {
Log.d(TAG, "registerSemanticLocationEvents: $params")
}

override fun setIncognitoMode(params: SemanticLocationParameters, callback: IStatusCallback, mode: Boolean) {
Log.d(TAG, "setIncognitoMode: $params")
}

override fun unregisterSemanticLocationEvents(params: SemanticLocationParameters, callback: IStatusCallback, pendingIntent: PendingIntent) {
Log.d(TAG, "unregisterSemanticLocationEvents: $params")
}
}

0 comments on commit 37dd2b5

Please sign in to comment.