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

210 lines
5.6 KiB
Java

package com.google.android.gms.common.internal;
import android.accounts.Account;
import android.content.Context;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.collection.ArraySet;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.signin.SignInOptions;
import j$.util.DesugarCollections;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
@KeepForSdk
/* loaded from: classes.dex */
public final class ClientSettings {
@Nullable
private final Account zaa;
private final Set zab;
private final Set zac;
private final Map zad;
private final int zae;
@Nullable
private final View zaf;
private final String zag;
private final String zah;
private final SignInOptions zai;
private Integer zaj;
@KeepForSdk
/* loaded from: classes.dex */
public static final class Builder {
@Nullable
private Account zaa;
private ArraySet zab;
private String zac;
private String zad;
private final SignInOptions zae = SignInOptions.f11596c;
@NonNull
@KeepForSdk
public ClientSettings build() {
return new ClientSettings(this.zaa, this.zab, null, 0, null, this.zac, this.zad, this.zae, false);
}
@NonNull
@KeepForSdk
public Builder setRealClientPackageName(@NonNull String str) {
this.zac = str;
return this;
}
@NonNull
public final Builder zaa(@Nullable Account account) {
this.zaa = account;
return this;
}
@NonNull
public final Builder zab(@NonNull Collection collection) {
if (this.zab == null) {
this.zab = new ArraySet(0);
}
this.zab.addAll(collection);
return this;
}
@NonNull
public final Builder zac(@NonNull String str) {
this.zad = str;
return this;
}
}
@KeepForSdk
public ClientSettings(@NonNull Account account, @NonNull Set<Scope> set, @NonNull Map<Api<?>, zab> map, int i, @Nullable View view, @NonNull String str, @NonNull String str2, @Nullable SignInOptions signInOptions) {
this(account, set, map, i, view, str, str2, signInOptions, false);
}
@NonNull
@KeepForSdk
public static ClientSettings createDefault(@NonNull Context context) {
return new GoogleApiClient.Builder(context).zaa();
}
@androidx.annotation.Nullable
@KeepForSdk
public Account getAccount() {
return this.zaa;
}
@androidx.annotation.Nullable
@KeepForSdk
@Deprecated
public String getAccountName() {
Account account = this.zaa;
if (account != null) {
return account.name;
}
return null;
}
@NonNull
@KeepForSdk
public Account getAccountOrDefault() {
Account account = this.zaa;
if (account != null) {
return account;
}
return new Account("<<default account>>", "com.google");
}
@NonNull
@KeepForSdk
public Set<Scope> getAllRequestedScopes() {
return this.zac;
}
@NonNull
@KeepForSdk
public Set<Scope> getApplicableScopes(@NonNull Api<?> api) {
zab zabVar = (zab) this.zad.get(api);
if (zabVar != null) {
Set set = zabVar.zaa;
if (!set.isEmpty()) {
HashSet hashSet = new HashSet(this.zab);
hashSet.addAll(set);
return hashSet;
}
}
return this.zab;
}
@KeepForSdk
public int getGravityForPopups() {
return this.zae;
}
@NonNull
@KeepForSdk
public String getRealClientPackageName() {
return this.zag;
}
@NonNull
@KeepForSdk
public Set<Scope> getRequiredScopes() {
return this.zab;
}
@androidx.annotation.Nullable
@KeepForSdk
public View getViewForPopups() {
return this.zaf;
}
@NonNull
public final Map zaa() {
return this.zad;
}
@androidx.annotation.Nullable
public final String zab() {
return this.zah;
}
@NonNull
public final SignInOptions zac() {
return this.zai;
}
@androidx.annotation.Nullable
public final Integer zad() {
return this.zaj;
}
public final void zae(@NonNull Integer num) {
this.zaj = num;
}
public ClientSettings(@Nullable Account account, @NonNull Set set, @NonNull Map map, int i, @Nullable View view, @NonNull String str, @NonNull String str2, @Nullable SignInOptions signInOptions, boolean z) {
this.zaa = account;
Set unmodifiableSet = set == null ? Collections.EMPTY_SET : DesugarCollections.unmodifiableSet(set);
this.zab = unmodifiableSet;
map = map == null ? Collections.EMPTY_MAP : map;
this.zad = map;
this.zaf = view;
this.zae = i;
this.zag = str;
this.zah = str2;
this.zai = signInOptions == null ? SignInOptions.f11596c : signInOptions;
HashSet hashSet = new HashSet(unmodifiableSet);
Iterator it = map.values().iterator();
while (it.hasNext()) {
hashSet.addAll(((zab) it.next()).zaa);
}
this.zac = DesugarCollections.unmodifiableSet(hashSet);
}
}