Skip to content

Commit

Permalink
SemanticLocation service completion
Browse files Browse the repository at this point in the history
Fix the crash problem of google maps version 11_114_0103
  • Loading branch information
DaVinci9196 authored and ale5000-git committed Feb 8, 2024
1 parent 7c90b5b commit c57974b
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.semanticlocation;

parcelable SemanticLocationEventRequest;
Original file line number Diff line number Diff line change
@@ -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);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.semanticlocation.internal;

parcelable SemanticLocationParameters;
Original file line number Diff line number Diff line change
@@ -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<SemanticLocationEventRequest> CREATOR = findCreator(SemanticLocationEventRequest.class);
}
Original file line number Diff line number Diff line change
@@ -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<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 @@ -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"),
;

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 @@ -888,6 +888,12 @@
</intent-filter>
</service>

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

<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
Expand Down Expand Up @@ -991,7 +997,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,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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit c57974b

Please sign in to comment.