soul-browser/sources/java/com/google/android/gms/common/api/Api.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* Decompile and recreate Soul Browser v1.4.85 with APK CI builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix CI build: include bundled google.jks and remove PR trigger

The apktool build failed in CI because app/unknown/.../google.jks was
excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files
and commit the missing resource.

Also remove the redundant pull_request workflow trigger.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Change package ID to com.github.kaki87.soulbrowser

Rename the application ID so the rebuilt APK can be installed
alongside the original Soul Browser from Google Play.

- Update AndroidManifest package, permissions, providers, and actions
- Update R class references in smali (com/github/kaki87/soulbrowser/R)
- Update shortcuts.xml targetPackage
- Rename app label to "Soul Rebuild" for easy identification

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install compatibility: remove split APK metadata and bundle native libs

The rebuilt APK still declared requiredSplitTypes and Play Store split
metadata, causing Android to reject standalone installs as incompatible.

- Remove requiredSplitTypes and split-related manifest meta-data
- Merge native libs from all ABI splits with uncompressed storage
- Page-align before signing for extractNativeLibs=false
- Add .so to apktool doNotCompress list

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install failure: use apksigner v2/v3 and bundle arm64 native libs

Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only
produces v1 signatures, causing Android to reject the install.

- Sign with apksigner (v1+v2+v3) instead of jarsigner
- Add arm64-v8a native libraries from universal Soul Browser 1.4.79
- Set extractNativeLibs=true for reliable sideload installs
- Commit stable debug keystore for consistent signatures across builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add committed debug keystore for consistent APK signatures

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix startup crash: use original classes2.dex desugar libraries

Apktool recompiles smali_classes2 into a broken classes2.dex, causing
ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init.

Inject the original classes2.dex (Java 8+ desugar libs) after apktool
build instead of using the recompiled version.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix missing drawable resources from density split APKs

The base APK is an app bundle module; density-specific drawables like
seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild,
causing Resources$NotFoundException at runtime.

- Merge non-9-patch resources from split APKs before apktool build
- Sync public.xml IDs from R smali only when backing files exist
- Add 713 density-specific resource IDs to public.xml

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-10 16:07:14 +02:00

232 lines
7 KiB
Java

package com.google.android.gms.common.api;
import android.accounts.Account;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.common.Feature;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.api.Api.ApiOptions;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.internal.ConnectionCallbacks;
import com.google.android.gms.common.api.internal.OnConnectionFailedListener;
import com.google.android.gms.common.internal.BaseGmsClient;
import com.google.android.gms.common.internal.ClientSettings;
import com.google.android.gms.common.internal.IAccountAccessor;
import com.google.android.gms.common.internal.Preconditions;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/* loaded from: classes.dex */
public final class Api<O extends ApiOptions> {
private final AbstractClientBuilder zaa;
private final ClientKey zab;
private final String zac;
@KeepForSdk
/* loaded from: classes.dex */
public static abstract class AbstractClientBuilder<T extends Client, O> extends BaseClientBuilder<T, O> {
@NonNull
@KeepForSdk
@Deprecated
public T buildClient(@NonNull Context context, @NonNull Looper looper, @NonNull ClientSettings clientSettings, @NonNull O o, @NonNull GoogleApiClient.ConnectionCallbacks connectionCallbacks, @NonNull GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
return buildClient(context, looper, clientSettings, (ClientSettings) o, (ConnectionCallbacks) connectionCallbacks, (OnConnectionFailedListener) onConnectionFailedListener);
}
@NonNull
@KeepForSdk
public T buildClient(@NonNull Context context, @NonNull Looper looper, @NonNull ClientSettings clientSettings, @NonNull O o, @NonNull ConnectionCallbacks connectionCallbacks, @NonNull OnConnectionFailedListener onConnectionFailedListener) {
throw new UnsupportedOperationException("buildClient must be implemented");
}
}
@KeepForSdk
/* loaded from: classes.dex */
public interface AnyClient {
}
@KeepForSdk
/* loaded from: classes.dex */
public static class AnyClientKey<C extends AnyClient> {
}
/* loaded from: classes.dex */
public interface ApiOptions {
@NonNull
public static final NoOptions NO_OPTIONS = new NoOptions(null);
/* loaded from: classes.dex */
public interface HasAccountOptions extends HasOptions, NotRequiredOptions {
@NonNull
Account getAccount();
}
/* loaded from: classes.dex */
public interface HasGoogleSignInAccountOptions extends HasOptions {
@Nullable
GoogleSignInAccount getGoogleSignInAccount();
}
/* loaded from: classes.dex */
public interface HasOptions extends ApiOptions {
}
/* loaded from: classes.dex */
public static final class NoOptions implements NotRequiredOptions {
private NoOptions() {
throw null;
}
public /* synthetic */ NoOptions(byte[] bArr) {
}
}
/* loaded from: classes.dex */
public interface NotRequiredOptions extends ApiOptions {
}
/* loaded from: classes.dex */
public interface Optional extends HasOptions, NotRequiredOptions {
}
}
@VisibleForTesting
@KeepForSdk
/* loaded from: classes.dex */
public static abstract class BaseClientBuilder<T extends AnyClient, O> {
@KeepForSdk
public static final int API_PRIORITY_GAMES = 1;
@KeepForSdk
public static final int API_PRIORITY_OTHER = Integer.MAX_VALUE;
@KeepForSdk
public static final int API_PRIORITY_PLUS = 2;
@NonNull
@KeepForSdk
public List<Scope> getImpliedScopes(@Nullable O o) {
return Collections.EMPTY_LIST;
}
@KeepForSdk
public int getPriority() {
return Integer.MAX_VALUE;
}
}
@KeepForSdk
/* loaded from: classes.dex */
public interface Client extends AnyClient {
@KeepForSdk
void connect(@NonNull BaseGmsClient.ConnectionProgressReportCallbacks connectionProgressReportCallbacks);
@KeepForSdk
void disconnect();
@KeepForSdk
void disconnect(@NonNull String str);
@KeepForSdk
void dump(@NonNull String str, @Nullable FileDescriptor fileDescriptor, @NonNull PrintWriter printWriter, @Nullable String[] strArr);
@NonNull
@KeepForSdk
Feature[] getAvailableFeatures();
@NonNull
@KeepForSdk
String getEndpointPackageName();
@Nullable
@KeepForSdk
String getLastDisconnectMessage();
@KeepForSdk
int getMinApkVersion();
@KeepForSdk
void getRemoteService(@Nullable IAccountAccessor iAccountAccessor, @Nullable Set<Scope> set);
@NonNull
@KeepForSdk
Feature[] getRequiredFeatures();
@NonNull
@KeepForSdk
Set<Scope> getScopesForConnectionlessNonSignIn();
@Nullable
@KeepForSdk
IBinder getServiceBrokerBinder();
@NonNull
@KeepForSdk
Intent getSignInIntent();
@KeepForSdk
boolean isConnected();
@KeepForSdk
boolean isConnecting();
@KeepForSdk
void onUserSignOut(@NonNull BaseGmsClient.SignOutCallbacks signOutCallbacks);
@KeepForSdk
boolean providesSignIn();
@KeepForSdk
boolean requiresAccount();
@KeepForSdk
boolean requiresGooglePlayServices();
@KeepForSdk
boolean requiresSignIn();
}
@KeepForSdk
/* loaded from: classes.dex */
public static final class ClientKey<C extends Client> extends AnyClientKey<C> {
}
@KeepForSdk
public <C extends Client> Api(@NonNull String str, @NonNull AbstractClientBuilder<C, O> abstractClientBuilder, @NonNull ClientKey<C> clientKey) {
Preconditions.checkNotNull(abstractClientBuilder, "Cannot construct an Api with a null ClientBuilder");
Preconditions.checkNotNull(clientKey, "Cannot construct an Api with a null ClientKey");
this.zac = str;
this.zaa = abstractClientBuilder;
this.zab = clientKey;
}
@NonNull
public final BaseClientBuilder zaa() {
return this.zaa;
}
@NonNull
public final AbstractClientBuilder zab() {
return this.zaa;
}
@NonNull
public final AnyClientKey zac() {
return this.zab;
}
@NonNull
public final String zad() {
return this.zac;
}
}