Skip to content

Commit

Permalink
supplement the num 153 <ACCOUNT_DATA> service
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 committed Feb 7, 2024
1 parent e7db794 commit f81571a
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 1 deletion.
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.auth.firstparty.dataservice;

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

package com.google.android.gms.auth.firstparty.dataservice;

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 DeviceManagementInfoResponse extends AbstractSafeParcelable {
@Field(1)
public int code;
@Field(2)
public String info;
@Field(3)
public boolean status;

public DeviceManagementInfoResponse() {
}

public DeviceManagementInfoResponse(int code, String info, boolean status) {
this.code = code;
this.info = info;
this.status = status;
}

public DeviceManagementInfoResponse(String info, boolean status) {
this(1, info, status);
}

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

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

}
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.auth.account.data;

import com.google.android.gms.auth.account.data.IDeviceManagementInfoCallback;
import android.accounts.Account;
import com.google.android.gms.common.api.internal.IStatusCallback;

interface IAccountDataService {
void requestDeviceManagementInfo(in IDeviceManagementInfoCallback callback, in Account account) = 0;
void requestAccountInfo(in IStatusCallback callback, in Account account, boolean isPrimary) = 1;
void requestProfileInfo(in IStatusCallback callback, String profile) = 2;
}
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.auth.account.data;

import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse;
import com.google.android.gms.common.api.Status;

interface IDeviceManagementInfoCallback {
void onResult(in Status status, in DeviceManagementInfoResponse response);
}
8 changes: 7 additions & 1 deletion play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,13 @@
</intent-filter>
</service>

<!-- AccountData -->
<service android:name="com.google.android.gms.auth.account.data.AccountDataService">
<intent-filter>
<action android:name="com.google.android.gms.auth.account.data.service.START" />
</intent-filter>
</service>

<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
Expand All @@ -866,7 +873,6 @@
<action android:name="com.google.android.gms.auth.account.authenticator.auto.service.START" />
<action android:name="com.google.android.gms.auth.account.authenticator.chromeos.START" />
<action android:name="com.google.android.gms.auth.account.authenticator.tv.service.START" />
<action android:name="com.google.android.gms.auth.account.data.service.START" />
<action android:name="com.google.android.gms.auth.api.identity.service.authorization.START" />
<action android:name="com.google.android.gms.auth.api.identity.service.credentialsaving.START" />
<action android:name="com.google.android.gms.auth.api.phone.service.InternalService.START" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.auth.account.data

import android.accounts.Account
import android.util.Log
import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse
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.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 org.microg.gms.BaseService
import org.microg.gms.common.GmsService

private const val TAG = "AccountDataService"

class AccountDataService : BaseService(TAG, GmsService.ACCOUNT_DATA) {

override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
Log.d(TAG, "handleServiceRequest start ")
val connectionInfo = ConnectionInfo()
connectionInfo.features = arrayOf(
Feature("account_data_service", 6L),
Feature("account_data_service_legacy", 1L),
Feature("account_data_service_token", 7L),
Feature("account_data_service_visibility", 1L),
Feature("gaiaid_primary_email_api", 1L))
callback.onPostInitCompleteWithConnectionInfo(ConnectionResult.SUCCESS,
AccountDataServiceImpl().asBinder(),
connectionInfo)
}

}

class AccountDataServiceImpl : IAccountDataService.Stub() {
override fun requestDeviceManagementInfo(callback: IDeviceManagementInfoCallback, account: Account?) {
Log.d(TAG, "requestDeviceManagementInfo is called ")
callback.onResult(Status.SUCCESS, DeviceManagementInfoResponse(null, false))
}

override fun requestAccountInfo(callback: IStatusCallback, account: Account?, isPrimary: Boolean) {
Log.d(TAG, "requestAccountInfo is called ")
callback.onResult(Status.SUCCESS)
}

override fun requestProfileInfo(callback: IStatusCallback, profile: String?) {
Log.d(TAG, "requestProfileInfo is called ")
callback.onResult(Status.SUCCESS)
}
}

0 comments on commit f81571a

Please sign in to comment.