diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl new file mode 100644 index 0000000000..d509f9f1ac --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.semanticlocation; + +parcelable SemanticLocationEventRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl new file mode 100644 index 0000000000..5c50807321 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl @@ -0,0 +1,18 @@ +// ISemanticLocationService.aidl +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; +// Declare any non-default types here with import statements + +interface ISemanticLocationService { + void registerSemanticLocationEventsOperation(in SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, in SemanticLocationEventRequest semanticLocationEventRequest, in PendingIntent pendingIntent); + + void setIncognitoModeOperation(in SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, boolean mode); + + void unregisterSemanticLocationEventsOperation(in SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, in PendingIntent pendingIntent); + +} \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl new file mode 100644 index 0000000000..fe2e356e10 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.semanticlocation.internal; + +parcelable SemanticLocationParameters; diff --git a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java new file mode 100644 index 0000000000..d83191c069 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java @@ -0,0 +1,31 @@ +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 float position; + + public SemanticLocationEventRequest(float position) { + this.position = position; + } + + public SemanticLocationEventRequest() { + + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SemanticLocationEventRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java new file mode 100644 index 0000000000..b173d23f6c --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java @@ -0,0 +1,35 @@ +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 Account account; + @Field(2) + public String clientIdentifier; + @Field(3) + public String packageName; + + public SemanticLocationParameters() {} + + public SemanticLocationParameters(Account account, String clientIdentifier, String packageName) { + this.account = account; + this.clientIdentifier = clientIdentifier; + this.packageName = packageName; + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(SemanticLocationParameters.class); + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } +} diff --git a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java index 00cfbb8a76..1825ccf26b 100644 --- a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java +++ b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java @@ -169,6 +169,7 @@ public enum GmsService { OCR_INTERNAL(281, "com.google.android.gms.ocr.service.internal.START"), MODULE_INSTALL(308, "com.google.android.gms.chimera.container.moduleinstall.ModuleInstallService.START"), IN_APP_REACH(315, "com.google.android.gms.inappreach.service.START"), + SEMANTIC_LOCATION(173, "com.google.android.gms.semanticlocation.service.START_ODLH"), APP_ERRORS(334, "com.google.android.gms.apperrors.service.START_APP_ERROR"), ; diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index b1255e13a5..2f92eb434c 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -835,6 +835,12 @@ + + + + + + @@ -939,7 +945,6 @@ - diff --git a/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientImpl.java b/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientImpl.java new file mode 100644 index 0000000000..cb551ef071 --- /dev/null +++ b/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientImpl.java @@ -0,0 +1,30 @@ +package com.google.android.gms.semanticlocation.service; + +import android.app.PendingIntent; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.common.api.internal.IStatusCallback; +import com.google.android.gms.semanticlocation.SemanticLocationEventRequest; +import com.google.android.gms.semanticlocation.internal.ISemanticLocationService; +import com.google.android.gms.semanticlocation.internal.SemanticLocationParameters; + +public class SemanticLocationClientImpl extends ISemanticLocationService.Stub { + + private static final String TAG = SemanticLocationClientImpl.class.getSimpleName(); + + @Override + public void registerSemanticLocationEventsOperation(SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, SemanticLocationEventRequest semanticLocationEventRequest, PendingIntent pendingIntent) throws RemoteException { + Log.d(TAG, "registerSemanticLocationEventsOperation: " + semanticLocationParameters); + } + + @Override + public void setIncognitoModeOperation(SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, boolean mode) throws RemoteException { + Log.d(TAG, "setIncognitoModeOperation: " + semanticLocationParameters); + } + + @Override + public void unregisterSemanticLocationEventsOperation(SemanticLocationParameters semanticLocationParameters, IStatusCallback callback, PendingIntent pendingIntent) throws RemoteException { + Log.d(TAG, "unregisterSemanticLocationEventsOperation: " + semanticLocationParameters); + } +} diff --git a/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientService.java b/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientService.java new file mode 100644 index 0000000000..93c0ef53c6 --- /dev/null +++ b/play-services-core/src/main/java/com/google/android/gms/semanticlocation/service/SemanticLocationClientService.java @@ -0,0 +1,29 @@ +package com.google.android.gms.semanticlocation.service; + +import android.os.RemoteException; + +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.Feature; +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; + +public class SemanticLocationClientService extends BaseService { + public SemanticLocationClientService() { + super("SemanticLocationClientService", GmsService.SEMANTIC_LOCATION); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.features = new Feature[]{ + new Feature("semanticlocation_events", 1L), + }; + callback.onPostInitCompleteWithConnectionInfo(ConnectionResult.SUCCESS, + new SemanticLocationClientImpl().asBinder(), + connectionInfo); + } +}