Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement some functions of Game #2508

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions play-services-auth-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ dependencies {
api project(':play-services-basement')
api project(':play-services-base')
api project(':play-services-tasks')

annotationProcessor project(':safe-parcel-processor')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.auth;

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

package com.google.android.gms.auth;

import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;

import com.google.android.auth.IAuthManagerService;

import java.util.Objects;

public class AccessAccountDataBinder implements DataBinder<Boolean> {

private final String clientPackageName;

public AccessAccountDataBinder(String clientPackageName) {
this.clientPackageName = clientPackageName;
}

@Override
public Boolean getBinderData(IBinder iBinder) throws Exception {
IAuthManagerService service;
if (iBinder == null) {
service = null;
} else {
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.auth.IAuthManagerService");
if (queryLocalInterface instanceof IAuthManagerService) {
service = (IAuthManagerService) queryLocalInterface;
} else {
service = IAuthManagerService.Stub.asInterface(iBinder);
}
}
if (service == null) {
return null;
}
Bundle bundle = service.requestGoogleAccountsAccess(clientPackageName);
if (bundle == null) {
return false;
}
return Objects.equals(bundle.getString("Error"), "OK");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public Account getAccount() {
return null;
}

@Constructor
public AccountChangeEventsRequest(@Param(value = 1) int versionCode, @Param(value = 2) int since, @Param(value = 3) String accountName, @Param(value = 4) Account account) {
this.versionCode = versionCode;
this.since = since;
this.accountName = accountName;
this.account = account;
}

public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<AccountChangeEventsRequest>(AccountChangeEventsRequest.class);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public class AccountChangeEventsResponse extends AutoSafeParcelable {
@SafeParceled(value = 2, subClass = AccountChangeEvent.class)
private List<AccountChangeEvent> events;

public List<AccountChangeEvent> getEvents() {
return events;
}

public AccountChangeEventsResponse() {
events = new ArrayList<AccountChangeEvent>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.auth;

import android.accounts.Account;
import android.os.IBinder;
import android.os.IInterface;

import com.google.android.auth.IAuthManagerService;

import java.util.List;

public class ChangeEventDataBinder implements DataBinder<List<AccountChangeEvent>> {

private final String accountName;
private final int since;

public ChangeEventDataBinder(String accountName, int since) {
this.accountName = accountName;
this.since = since;
}

@Override
public List<AccountChangeEvent> getBinderData(IBinder iBinder) throws Exception {
IAuthManagerService service;
if (iBinder == null) {
service = null;
} else {
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.auth.IAuthManagerService");
if (queryLocalInterface instanceof IAuthManagerService) {
service = (IAuthManagerService) queryLocalInterface;
} else {
service = IAuthManagerService.Stub.asInterface(iBinder);
}
}
if (service == null) {
return null;
}
AccountChangeEventsRequest request = new AccountChangeEventsRequest(1, since, accountName, new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE));
AccountChangeEventsResponse changeEvents = service.getChangeEvents(request);
return changeEvents.getEvents();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.auth;

import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;

import com.google.android.auth.IAuthManagerService;

public class ClearTokenDataBinder implements DataBinder<Void> {

private final String token;
private final Bundle extras;

public ClearTokenDataBinder(String token, Bundle extras) {
this.token = token;
this.extras = extras;
}

@Override
public Void getBinderData(IBinder iBinder) throws Exception {
IAuthManagerService service;
if (iBinder == null) {
service = null;
} else {
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.auth.IAuthManagerService");
if (queryLocalInterface instanceof IAuthManagerService) {
service = (IAuthManagerService) queryLocalInterface;
} else {
service = IAuthManagerService.Stub.asInterface(iBinder);
}
}
if (service == null) {
return null;
}
service.clearToken(token, extras);
return Void.TYPE.newInstance();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.auth;

import android.os.IBinder;

public interface DataBinder<T> {
T getBinderData(IBinder iBinder) throws Exception;
}
Loading