soul-browser/sources/java/com/google/android/gms/common/api/GoogleApiClient.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

451 lines
18 KiB
Java

package com.google.android.gms.common.api;
import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.media.a;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.SimpleArrayMap;
import androidx.fragment.app.FragmentActivity;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.internal.BaseImplementation;
import com.google.android.gms.common.api.internal.LifecycleActivity;
import com.google.android.gms.common.api.internal.ListenerHolder;
import com.google.android.gms.common.api.internal.SignInConnectionListener;
import com.google.android.gms.common.api.internal.zaaz;
import com.google.android.gms.common.api.internal.zacs;
import com.google.android.gms.common.api.internal.zak;
import com.google.android.gms.common.api.internal.zas;
import com.google.android.gms.common.internal.ClientSettings;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.signin.SignInOptions;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
@Deprecated
/* loaded from: classes.dex */
public abstract class GoogleApiClient {
@NonNull
@KeepForSdk
public static final String DEFAULT_ACCOUNT = "<<default account>>";
public static final int SIGN_IN_MODE_OPTIONAL = 2;
public static final int SIGN_IN_MODE_REQUIRED = 1;
private static final Set zaa = Collections.newSetFromMap(new WeakHashMap());
@Deprecated
/* loaded from: classes.dex */
public interface ConnectionCallbacks extends com.google.android.gms.common.api.internal.ConnectionCallbacks {
public static final int CAUSE_NETWORK_LOST = 2;
public static final int CAUSE_SERVICE_DISCONNECTED = 1;
}
@Deprecated
/* loaded from: classes.dex */
public interface OnConnectionFailedListener extends com.google.android.gms.common.api.internal.OnConnectionFailedListener {
}
public static void dumpAll(@NonNull String str, @NonNull FileDescriptor fileDescriptor, @NonNull PrintWriter printWriter, @NonNull String[] strArr) {
Set<GoogleApiClient> set = zaa;
synchronized (set) {
try {
StringBuilder sb = new StringBuilder(String.valueOf(str).length() + 2);
sb.append(str);
sb.append(" ");
String sb2 = sb.toString();
int i = 0;
for (GoogleApiClient googleApiClient : set) {
printWriter.append((CharSequence) str).append("GoogleApiClient#").println(i);
googleApiClient.dump(sb2, fileDescriptor, printWriter, strArr);
i++;
}
} catch (Throwable th) {
throw th;
}
}
}
@NonNull
@KeepForSdk
public static Set<GoogleApiClient> getAllClients() {
Set<GoogleApiClient> set = zaa;
synchronized (set) {
}
return set;
}
@NonNull
public abstract ConnectionResult blockingConnect();
@NonNull
public abstract ConnectionResult blockingConnect(long j, @NonNull TimeUnit timeUnit);
@NonNull
public abstract PendingResult<Status> clearDefaultAccountAndReconnect();
public abstract void connect();
public void connect(int i) {
throw new UnsupportedOperationException();
}
public abstract void disconnect();
public abstract void dump(@NonNull String str, @Nullable FileDescriptor fileDescriptor, @NonNull PrintWriter printWriter, @Nullable String[] strArr);
@NonNull
@KeepForSdk
public <A extends Api.AnyClient, R extends Result, T extends BaseImplementation.ApiMethodImpl<R, A>> T enqueue(@NonNull T t) {
throw new UnsupportedOperationException();
}
@NonNull
@KeepForSdk
public <A extends Api.AnyClient, T extends BaseImplementation.ApiMethodImpl<? extends Result, A>> T execute(@NonNull T t) {
throw new UnsupportedOperationException();
}
@NonNull
@KeepForSdk
public <C extends Api.Client> C getClient(@NonNull Api.AnyClientKey<C> anyClientKey) {
throw new UnsupportedOperationException();
}
@NonNull
public abstract ConnectionResult getConnectionResult(@NonNull Api<?> api);
@NonNull
@KeepForSdk
public Context getContext() {
throw new UnsupportedOperationException();
}
@NonNull
@KeepForSdk
public Looper getLooper() {
throw new UnsupportedOperationException();
}
@KeepForSdk
public boolean hasApi(@NonNull Api<?> api) {
throw new UnsupportedOperationException();
}
public abstract boolean hasConnectedApi(@NonNull Api<?> api);
public abstract boolean isConnected();
public abstract boolean isConnecting();
public abstract boolean isConnectionCallbacksRegistered(@NonNull ConnectionCallbacks connectionCallbacks);
public abstract boolean isConnectionFailedListenerRegistered(@NonNull OnConnectionFailedListener onConnectionFailedListener);
@KeepForSdk
public boolean maybeSignIn(@NonNull SignInConnectionListener signInConnectionListener) {
throw new UnsupportedOperationException();
}
@KeepForSdk
public void maybeSignOut() {
throw new UnsupportedOperationException();
}
public abstract void reconnect();
public abstract void registerConnectionCallbacks(@NonNull ConnectionCallbacks connectionCallbacks);
public abstract void registerConnectionFailedListener(@NonNull OnConnectionFailedListener onConnectionFailedListener);
@NonNull
@KeepForSdk
public <L> ListenerHolder<L> registerListener(@NonNull L l) {
throw new UnsupportedOperationException();
}
public abstract void stopAutoManage(@NonNull FragmentActivity fragmentActivity);
public abstract void unregisterConnectionCallbacks(@NonNull ConnectionCallbacks connectionCallbacks);
public abstract void unregisterConnectionFailedListener(@NonNull OnConnectionFailedListener onConnectionFailedListener);
public void zao(zacs zacsVar) {
throw new UnsupportedOperationException();
}
public void zap(zacs zacsVar) {
throw new UnsupportedOperationException();
}
@Deprecated
/* loaded from: classes.dex */
public static final class Builder {
@Nullable
private Account zaa;
private final Set zab;
private final Set zac;
private int zad;
private View zae;
private String zaf;
private String zag;
private final Map zah;
private final Context zai;
private final Map zaj;
private LifecycleActivity zak;
private int zal;
@Nullable
private OnConnectionFailedListener zam;
private Looper zan;
private GoogleApiAvailability zao;
private Api.AbstractClientBuilder zap;
private final ArrayList zaq;
private final ArrayList zar;
/* JADX WARN: Type inference failed for: r0v2, types: [java.util.Map, androidx.collection.SimpleArrayMap] */
/* JADX WARN: Type inference failed for: r0v3, types: [java.util.Map, androidx.collection.SimpleArrayMap] */
public Builder(@NonNull Context context) {
this.zab = new HashSet();
this.zac = new HashSet();
this.zah = new SimpleArrayMap(0);
this.zaj = new SimpleArrayMap(0);
this.zal = -1;
this.zao = GoogleApiAvailability.getInstance();
this.zap = com.google.android.gms.signin.zad.f11602a;
this.zaq = new ArrayList();
this.zar = new ArrayList();
this.zai = context;
this.zan = context.getMainLooper();
this.zaf = context.getPackageName();
this.zag = context.getClass().getName();
}
private final void zab(Api api, @Nullable Api.ApiOptions apiOptions, Scope... scopeArr) {
HashSet hashSet = new HashSet(((Api.BaseClientBuilder) Preconditions.checkNotNull(api.zaa(), "Base client builder must not be null")).getImpliedScopes(apiOptions));
for (Scope scope : scopeArr) {
hashSet.add(scope);
}
this.zah.put(api, new com.google.android.gms.common.internal.zab(hashSet));
}
@NonNull
public Builder addApi(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions> api) {
Preconditions.checkNotNull(api, "Api must not be null");
this.zaj.put(api, null);
List<Scope> impliedScopes = ((Api.BaseClientBuilder) Preconditions.checkNotNull(api.zaa(), "Base client builder must not be null")).getImpliedScopes(null);
this.zac.addAll(impliedScopes);
this.zab.addAll(impliedScopes);
return this;
}
@NonNull
public <O extends Api.ApiOptions.HasOptions> Builder addApiIfAvailable(@NonNull Api<O> api, @NonNull O o, @NonNull Scope... scopeArr) {
Preconditions.checkNotNull(api, "Api must not be null");
Preconditions.checkNotNull(o, "Null options are not permitted for this Api");
this.zaj.put(api, o);
zab(api, o, scopeArr);
return this;
}
@NonNull
public Builder addConnectionCallbacks(@NonNull ConnectionCallbacks connectionCallbacks) {
Preconditions.checkNotNull(connectionCallbacks, "Listener must not be null");
this.zaq.add(connectionCallbacks);
return this;
}
@NonNull
public Builder addOnConnectionFailedListener(@NonNull OnConnectionFailedListener onConnectionFailedListener) {
Preconditions.checkNotNull(onConnectionFailedListener, "Listener must not be null");
this.zar.add(onConnectionFailedListener);
return this;
}
@NonNull
public Builder addScope(@NonNull Scope scope) {
Preconditions.checkNotNull(scope, "Scope must not be null");
this.zab.add(scope);
return this;
}
/* JADX WARN: Type inference failed for: r12v0, types: [java.util.Map, androidx.collection.SimpleArrayMap] */
/* JADX WARN: Type inference failed for: r15v0, types: [java.util.Map, androidx.collection.SimpleArrayMap, androidx.collection.ArrayMap] */
@NonNull
public GoogleApiClient build() {
boolean z;
boolean z2;
Map map = this.zaj;
Preconditions.checkArgument(!map.isEmpty(), "must call addApi() to add at least one API");
ClientSettings zaa = zaa();
Map zaa2 = zaa.zaa();
?? simpleArrayMap = new SimpleArrayMap(0);
?? simpleArrayMap2 = new SimpleArrayMap(0);
ArrayList arrayList = new ArrayList();
boolean z3 = false;
Api api = null;
for (Api api2 : map.keySet()) {
Object obj = map.get(api2);
if (zaa2.get(api2) != null) {
z2 = true;
} else {
z2 = false;
}
simpleArrayMap.put(api2, Boolean.valueOf(z2));
zas zasVar = new zas(api2, z2);
arrayList.add(zasVar);
Api.AbstractClientBuilder abstractClientBuilder = (Api.AbstractClientBuilder) Preconditions.checkNotNull(api2.zab());
Api.Client buildClient = abstractClientBuilder.buildClient(this.zai, this.zan, zaa, (ClientSettings) obj, (ConnectionCallbacks) zasVar, (OnConnectionFailedListener) zasVar);
simpleArrayMap2.put(api2.zac(), buildClient);
if (abstractClientBuilder.getPriority() == 1) {
if (obj != null) {
z3 = true;
} else {
z3 = false;
}
}
if (buildClient.providesSignIn()) {
if (api == null) {
api = api2;
} else {
String zad = api2.zad();
String zad2 = api.zad();
throw new IllegalStateException(a.q(new StringBuilder(String.valueOf(zad).length() + 21 + String.valueOf(zad2).length()), zad, " cannot be used with ", zad2));
}
}
}
if (api != null) {
if (!z3) {
if (this.zaa == null) {
z = true;
} else {
z = false;
}
Preconditions.checkState(z, "Must not set an account in GoogleApiClient.Builder when using %s. Set account in GoogleSignInOptions.Builder instead", api.zad());
Preconditions.checkState(this.zab.equals(this.zac), "Must not set scopes in GoogleApiClient.Builder when using %s. Set account in GoogleSignInOptions.Builder instead.", api.zad());
} else {
String zad3 = api.zad();
throw new IllegalStateException(a.q(new StringBuilder(String.valueOf(zad3).length() + 82), "With using ", zad3, ", GamesOptions can only be specified within GoogleSignInOptions.Builder"));
}
}
zaaz zaazVar = new zaaz(this.zai, new ReentrantLock(), this.zan, zaa, this.zao, this.zap, simpleArrayMap, this.zaq, this.zar, simpleArrayMap2, this.zal, zaaz.zaf(simpleArrayMap2.values(), true), arrayList);
synchronized (GoogleApiClient.zaa) {
GoogleApiClient.zaa.add(zaazVar);
}
if (this.zal >= 0) {
zak.zaa(this.zak).zab(this.zal, zaazVar, this.zam);
}
return zaazVar;
}
@NonNull
public Builder enableAutoManage(@NonNull FragmentActivity fragmentActivity, int i, @Nullable OnConnectionFailedListener onConnectionFailedListener) {
LifecycleActivity lifecycleActivity = new LifecycleActivity((Activity) fragmentActivity);
Preconditions.checkArgument(i >= 0, "clientId must be non-negative");
this.zal = i;
this.zam = onConnectionFailedListener;
this.zak = lifecycleActivity;
return this;
}
@NonNull
public Builder setAccountName(@NonNull String str) {
Account account;
if (str == null) {
account = null;
} else {
account = new Account(str, "com.google");
}
this.zaa = account;
return this;
}
@NonNull
public Builder setGravityForPopups(int i) {
this.zad = i;
return this;
}
@NonNull
public Builder setHandler(@NonNull Handler handler) {
Preconditions.checkNotNull(handler, "Handler must not be null");
this.zan = handler.getLooper();
return this;
}
@NonNull
public Builder setViewForPopups(@NonNull View view) {
Preconditions.checkNotNull(view, "View must not be null");
this.zae = view;
return this;
}
@NonNull
public Builder useDefaultAccount() {
setAccountName("<<default account>>");
return this;
}
@NonNull
public final ClientSettings zaa() {
SignInOptions signInOptions;
Map map = this.zaj;
Api api = com.google.android.gms.signin.zad.b;
if (map.containsKey(api)) {
signInOptions = (SignInOptions) map.get(api);
} else {
signInOptions = SignInOptions.f11596c;
}
return new ClientSettings(this.zaa, this.zab, this.zah, this.zad, this.zae, this.zaf, this.zag, signInOptions, false);
}
@NonNull
public Builder enableAutoManage(@NonNull FragmentActivity fragmentActivity, @Nullable OnConnectionFailedListener onConnectionFailedListener) {
enableAutoManage(fragmentActivity, 0, onConnectionFailedListener);
return this;
}
@NonNull
public <T extends Api.ApiOptions.NotRequiredOptions> Builder addApiIfAvailable(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions> api, @NonNull Scope... scopeArr) {
Preconditions.checkNotNull(api, "Api must not be null");
this.zaj.put(api, null);
zab(api, null, scopeArr);
return this;
}
@NonNull
public <O extends Api.ApiOptions.HasOptions> Builder addApi(@NonNull Api<O> api, @NonNull O o) {
Preconditions.checkNotNull(api, "Api must not be null");
Preconditions.checkNotNull(o, "Null options are not permitted for this Api");
this.zaj.put(api, o);
List<Scope> impliedScopes = ((Api.BaseClientBuilder) Preconditions.checkNotNull(api.zaa(), "Base client builder must not be null")).getImpliedScopes(o);
this.zac.addAll(impliedScopes);
this.zab.addAll(impliedScopes);
return this;
}
public Builder(@NonNull Context context, @NonNull ConnectionCallbacks connectionCallbacks, @NonNull OnConnectionFailedListener onConnectionFailedListener) {
this(context);
Preconditions.checkNotNull(connectionCallbacks, "Must provide a connected listener");
this.zaq.add(connectionCallbacks);
Preconditions.checkNotNull(onConnectionFailedListener, "Must provide a connection failed listener");
this.zar.add(onConnectionFailedListener);
}
}
}