soul-browser/sources/java/com/google/api/client/googleapis/services/AbstractGoogleClient.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

234 lines
8.2 KiB
Java

package com.google.api.client.googleapis.services;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.api.client.googleapis.batch.BatchRequest;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.util.ObjectParser;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Strings;
import java.util.logging.Logger;
/* loaded from: classes3.dex */
public abstract class AbstractGoogleClient {
private static final Logger logger = Logger.getLogger(AbstractGoogleClient.class.getName());
private final String applicationName;
private final String batchPath;
private final GoogleClientRequestInitializer googleClientRequestInitializer;
private final ObjectParser objectParser;
private final HttpRequestFactory requestFactory;
private final String rootUrl;
private final String servicePath;
private final boolean suppressPatternChecks;
private final boolean suppressRequiredParameterChecks;
/* loaded from: classes3.dex */
public static abstract class Builder {
String applicationName;
String batchPath;
GoogleClientRequestInitializer googleClientRequestInitializer;
HttpRequestInitializer httpRequestInitializer;
final ObjectParser objectParser;
String rootUrl;
String servicePath;
boolean suppressPatternChecks;
boolean suppressRequiredParameterChecks;
final HttpTransport transport;
public Builder(HttpTransport httpTransport, String str, String str2, ObjectParser objectParser, HttpRequestInitializer httpRequestInitializer) {
this.transport = (HttpTransport) Preconditions.checkNotNull(httpTransport);
this.objectParser = objectParser;
setRootUrl(str);
setServicePath(str2);
this.httpRequestInitializer = httpRequestInitializer;
}
public abstract AbstractGoogleClient build();
public final String getApplicationName() {
return this.applicationName;
}
public final GoogleClientRequestInitializer getGoogleClientRequestInitializer() {
return this.googleClientRequestInitializer;
}
public final HttpRequestInitializer getHttpRequestInitializer() {
return this.httpRequestInitializer;
}
public ObjectParser getObjectParser() {
return this.objectParser;
}
public final String getRootUrl() {
return this.rootUrl;
}
public final String getServicePath() {
return this.servicePath;
}
public final boolean getSuppressPatternChecks() {
return this.suppressPatternChecks;
}
public final boolean getSuppressRequiredParameterChecks() {
return this.suppressRequiredParameterChecks;
}
public final HttpTransport getTransport() {
return this.transport;
}
public Builder setApplicationName(String str) {
this.applicationName = str;
return this;
}
public Builder setBatchPath(String str) {
this.batchPath = str;
return this;
}
public Builder setGoogleClientRequestInitializer(GoogleClientRequestInitializer googleClientRequestInitializer) {
this.googleClientRequestInitializer = googleClientRequestInitializer;
return this;
}
public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) {
this.httpRequestInitializer = httpRequestInitializer;
return this;
}
public Builder setRootUrl(String str) {
this.rootUrl = AbstractGoogleClient.normalizeRootUrl(str);
return this;
}
public Builder setServicePath(String str) {
this.servicePath = AbstractGoogleClient.normalizeServicePath(str);
return this;
}
public Builder setSuppressAllChecks(boolean z) {
return setSuppressPatternChecks(true).setSuppressRequiredParameterChecks(true);
}
public Builder setSuppressPatternChecks(boolean z) {
this.suppressPatternChecks = z;
return this;
}
public Builder setSuppressRequiredParameterChecks(boolean z) {
this.suppressRequiredParameterChecks = z;
return this;
}
}
public AbstractGoogleClient(Builder builder) {
HttpRequestFactory createRequestFactory;
this.googleClientRequestInitializer = builder.googleClientRequestInitializer;
this.rootUrl = normalizeRootUrl(builder.rootUrl);
this.servicePath = normalizeServicePath(builder.servicePath);
this.batchPath = builder.batchPath;
if (Strings.isNullOrEmpty(builder.applicationName)) {
logger.warning("Application name is not set. Call Builder#setApplicationName.");
}
this.applicationName = builder.applicationName;
HttpRequestInitializer httpRequestInitializer = builder.httpRequestInitializer;
if (httpRequestInitializer == null) {
createRequestFactory = builder.transport.createRequestFactory();
} else {
createRequestFactory = builder.transport.createRequestFactory(httpRequestInitializer);
}
this.requestFactory = createRequestFactory;
this.objectParser = builder.objectParser;
this.suppressPatternChecks = builder.suppressPatternChecks;
this.suppressRequiredParameterChecks = builder.suppressRequiredParameterChecks;
}
public static String normalizeRootUrl(String str) {
Preconditions.checkNotNull(str, "root URL cannot be null.");
if (!str.endsWith("/")) {
return str.concat("/");
}
return str;
}
public static String normalizeServicePath(String str) {
Preconditions.checkNotNull(str, "service path cannot be null");
if (str.length() == 1) {
Preconditions.checkArgument("/".equals(str), "service path must equal \"/\" if it is of length 1.");
return RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
}
if (str.length() > 0) {
if (!str.endsWith("/")) {
str = str.concat("/");
}
if (str.startsWith("/")) {
return str.substring(1);
}
return str;
}
return str;
}
public final BatchRequest batch() {
return batch(null);
}
public final String getApplicationName() {
return this.applicationName;
}
public final String getBaseUrl() {
return this.rootUrl + this.servicePath;
}
public final GoogleClientRequestInitializer getGoogleClientRequestInitializer() {
return this.googleClientRequestInitializer;
}
public ObjectParser getObjectParser() {
return this.objectParser;
}
public final HttpRequestFactory getRequestFactory() {
return this.requestFactory;
}
public final String getRootUrl() {
return this.rootUrl;
}
public final String getServicePath() {
return this.servicePath;
}
public final boolean getSuppressPatternChecks() {
return this.suppressPatternChecks;
}
public final boolean getSuppressRequiredParameterChecks() {
return this.suppressRequiredParameterChecks;
}
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) {
if (getGoogleClientRequestInitializer() != null) {
getGoogleClientRequestInitializer().initialize(abstractGoogleClientRequest);
}
}
public final BatchRequest batch(HttpRequestInitializer httpRequestInitializer) {
BatchRequest batchRequest = new BatchRequest(getRequestFactory().getTransport(), httpRequestInitializer);
if (Strings.isNullOrEmpty(this.batchPath)) {
batchRequest.setBatchUrl(new GenericUrl(getRootUrl() + "batch"));
return batchRequest;
}
batchRequest.setBatchUrl(new GenericUrl(getRootUrl() + this.batchPath));
return batchRequest;
}
}