-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dummy service for SEMANTIC_LOCATION(173) (#2174)
Co-authored-by: Marvin W <[email protected]>
- Loading branch information
1 parent
e4c1c5a
commit 37dd2b5
Showing
8 changed files
with
165 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...i/src/main/aidl/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
18 changes: 18 additions & 0 deletions
18
.../main/aidl/com/google/android/gms/semanticlocation/internal/ISemanticLocationService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
7 changes: 7 additions & 0 deletions
7
...ain/aidl/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
32 changes: 32 additions & 0 deletions
32
...i/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationEventRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
38 changes: 38 additions & 0 deletions
38
...ain/java/com/google/android/gms/semanticlocation/internal/SemanticLocationParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ces-core/src/main/java/com/google/android/gms/semanticlocation/SemanticLocationService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |