soul-browser/sources/java/com/google/api/client/http/HttpRequest.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

483 lines
16 KiB
Java

package com.google.api.client.http;
import android.support.v4.media.a;
import com.google.api.client.util.Beta;
import com.google.api.client.util.ObjectParser;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Sleeper;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.opencensus.trace.AttributeValue;
import io.opencensus.trace.Span;
import io.opencensus.trace.Tracer;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
/* loaded from: classes3.dex */
public final class HttpRequest {
public static final int DEFAULT_NUMBER_OF_RETRIES = 10;
public static final String USER_AGENT_SUFFIX;
public static final String VERSION;
@Beta
@Deprecated
private BackOffPolicy backOffPolicy;
private HttpContent content;
private HttpEncoding encoding;
private HttpExecuteInterceptor executeInterceptor;
@Beta
private HttpIOExceptionHandler ioExceptionHandler;
private ObjectParser objectParser;
private String requestMethod;
private HttpResponseInterceptor responseInterceptor;
private boolean suppressUserAgentSuffix;
private final HttpTransport transport;
private HttpUnsuccessfulResponseHandler unsuccessfulResponseHandler;
private GenericUrl url;
private HttpHeaders headers = new HttpHeaders();
private HttpHeaders responseHeaders = new HttpHeaders();
private int numRetries = 10;
private int contentLoggingLimit = 16384;
private boolean loggingEnabled = true;
private boolean curlLoggingEnabled = true;
private int connectTimeout = 20000;
private int readTimeout = 20000;
private int writeTimeout = 0;
private boolean followRedirects = true;
private boolean useRawRedirectUrls = false;
private boolean throwExceptionOnExecuteError = true;
@Beta
@Deprecated
private boolean retryOnExecuteIOException = false;
private Sleeper sleeper = Sleeper.DEFAULT;
private final Tracer tracer = OpenCensusUtils.getTracer();
private boolean responseReturnRawInputStream = false;
static {
String version = getVersion();
VERSION = version;
USER_AGENT_SUFFIX = a.l("Google-HTTP-Java-Client/", version, " (gzip)");
}
public HttpRequest(HttpTransport httpTransport, String str) {
this.transport = httpTransport;
setRequestMethod(str);
}
private static void addSpanAttribute(Span span, String str, String str2) {
if (str2 != null) {
span.c(str, AttributeValue.a(str2));
}
}
private static String getVersion() {
String str = "unknown-version";
try {
InputStream resourceAsStream = HttpRequest.class.getResourceAsStream("/com/google/api/client/http/google-http-client.properties");
if (resourceAsStream != null) {
try {
Properties properties = new Properties();
properties.load(resourceAsStream);
str = properties.getProperty("google-http-client.version");
} finally {
}
}
if (resourceAsStream != null) {
resourceAsStream.close();
}
} catch (IOException unused) {
}
return str;
}
/* JADX WARN: Can't wrap try/catch for region: R(4:(9:(2:20|(24:22|(1:24)|25|(2:27|(1:29)(1:30))|31|(1:33)|34|(1:177)(1:38)|39|(8:41|(1:43)(1:175)|44|(1:46)(1:174)|47|(5:49|(2:51|(1:53))(1:172)|(2:55|(1:57))|58|(1:60))(1:173)|(1:62)|63)(1:176)|(2:65|(3:67|(1:69)|70))|(1:171)(1:73)|74|75|76|(1:78)|79|80|81|(3:113|114|(7:116|(1:118)(1:138)|(3:120|(1:(3:128|129|(2:131|132)))|122)|135|(1:137)|86|(4:89|(1:91)(1:111)|92|(4:94|(1:96)|97|(1:109)(3:101|102|103))(1:110))(1:88)))|(1:84)(1:112)|85|86|(0)(0)))(1:179)|79|80|81|(0)|(0)(0)|85|86|(0)(0))|75|76|(0)) */
/* JADX WARN: Code restructure failed: missing block: B:152:0x0268, code lost:
r0 = e;
*/
/* JADX WARN: Code restructure failed: missing block: B:154:0x0283, code lost:
if (r24.retryOnExecuteIOException == false) goto L105;
*/
/* JADX WARN: Code restructure failed: missing block: B:161:0x0290, code lost:
r4.e(com.google.api.client.http.OpenCensusUtils.getEndSpanOptions(r16));
*/
/* JADX WARN: Code restructure failed: missing block: B:162:0x0297, code lost:
throw r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:166:0x029a, code lost:
r8.log(java.util.logging.Level.WARNING, "exception thrown while executing request", (java.lang.Throwable) r0);
*/
/* JADX WARN: Code restructure failed: missing block: B:167:0x02a1, code lost:
r3.close();
r3 = r16;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:112:0x02fb */
/* JADX WARN: Removed duplicated region for block: B:113:0x02a8 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:176:0x01fd */
/* JADX WARN: Removed duplicated region for block: B:27:0x00f4 */
/* JADX WARN: Removed duplicated region for block: B:33:0x0128 */
/* JADX WARN: Removed duplicated region for block: B:41:0x013f */
/* JADX WARN: Removed duplicated region for block: B:65:0x0209 */
/* JADX WARN: Removed duplicated region for block: B:78:0x025a A[Catch: all -> 0x0265, IOException -> 0x0268, TRY_LEAVE, TryCatch #0 {IOException -> 0x0268, blocks: (B:76:0x0254, B:78:0x025a, B:146:0x0277, B:148:0x027d, B:149:0x0280), top: B:75:0x0254, outer: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:84:0x02f9 */
/* JADX WARN: Removed duplicated region for block: B:88:0x0341 A[LOOP:0: B:8:0x003c->B:88:0x0341, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:89:0x0301 A[SYNTHETIC] */
/* JADX WARN: Type inference failed for: r14v0, types: [com.google.api.client.http.HttpEncodingStreamingContent] */
/* JADX WARN: Type inference failed for: r16v0 */
/* JADX WARN: Type inference failed for: r16v1, types: [java.lang.Integer] */
/* JADX WARN: Type inference failed for: r16v2 */
/* JADX WARN: Type inference failed for: r5v27, types: [com.google.api.client.util.LoggingStreamingContent] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public com.google.api.client.http.HttpResponse execute() {
/*
Method dump skipped, instructions count: 840
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.api.client.http.HttpRequest.execute():com.google.api.client.http.HttpResponse");
}
@Beta
public Future<HttpResponse> executeAsync(Executor executor) {
FutureTask futureTask = new FutureTask(new Callable<HttpResponse>() { // from class: com.google.api.client.http.HttpRequest.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public HttpResponse call() {
return HttpRequest.this.execute();
}
});
executor.execute(futureTask);
return futureTask;
}
@Beta
@Deprecated
public BackOffPolicy getBackOffPolicy() {
return this.backOffPolicy;
}
public int getConnectTimeout() {
return this.connectTimeout;
}
public HttpContent getContent() {
return this.content;
}
public int getContentLoggingLimit() {
return this.contentLoggingLimit;
}
public HttpEncoding getEncoding() {
return this.encoding;
}
public boolean getFollowRedirects() {
return this.followRedirects;
}
public HttpHeaders getHeaders() {
return this.headers;
}
@Beta
public HttpIOExceptionHandler getIOExceptionHandler() {
return this.ioExceptionHandler;
}
public HttpExecuteInterceptor getInterceptor() {
return this.executeInterceptor;
}
public int getNumberOfRetries() {
return this.numRetries;
}
public final ObjectParser getParser() {
return this.objectParser;
}
public int getReadTimeout() {
return this.readTimeout;
}
public String getRequestMethod() {
return this.requestMethod;
}
public HttpHeaders getResponseHeaders() {
return this.responseHeaders;
}
public HttpResponseInterceptor getResponseInterceptor() {
return this.responseInterceptor;
}
public boolean getResponseReturnRawInputStream() {
return this.responseReturnRawInputStream;
}
@Beta
@Deprecated
public boolean getRetryOnExecuteIOException() {
return this.retryOnExecuteIOException;
}
public Sleeper getSleeper() {
return this.sleeper;
}
public boolean getSuppressUserAgentSuffix() {
return this.suppressUserAgentSuffix;
}
public boolean getThrowExceptionOnExecuteError() {
return this.throwExceptionOnExecuteError;
}
public HttpTransport getTransport() {
return this.transport;
}
public HttpUnsuccessfulResponseHandler getUnsuccessfulResponseHandler() {
return this.unsuccessfulResponseHandler;
}
public GenericUrl getUrl() {
return this.url;
}
public boolean getUseRawRedirectUrls() {
return this.useRawRedirectUrls;
}
public int getWriteTimeout() {
return this.writeTimeout;
}
public boolean handleRedirect(int i, HttpHeaders httpHeaders) {
String location = httpHeaders.getLocation();
if (getFollowRedirects() && HttpStatusCodes.isRedirect(i) && location != null) {
setUrl(new GenericUrl(this.url.toURL(location), this.useRawRedirectUrls));
if (i == 303) {
setRequestMethod(HttpMethods.GET);
setContent(null);
}
this.headers.setAuthorization((String) null);
this.headers.setIfMatch(null);
this.headers.setIfNoneMatch(null);
this.headers.setIfModifiedSince(null);
this.headers.setIfUnmodifiedSince(null);
this.headers.setIfRange(null);
return true;
}
return false;
}
public boolean isCurlLoggingEnabled() {
return this.curlLoggingEnabled;
}
public boolean isLoggingEnabled() {
return this.loggingEnabled;
}
@Beta
@Deprecated
public HttpRequest setBackOffPolicy(BackOffPolicy backOffPolicy) {
this.backOffPolicy = backOffPolicy;
return this;
}
public HttpRequest setConnectTimeout(int i) {
boolean z;
if (i >= 0) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z);
this.connectTimeout = i;
return this;
}
public HttpRequest setContent(HttpContent httpContent) {
this.content = httpContent;
return this;
}
public HttpRequest setContentLoggingLimit(int i) {
boolean z;
if (i >= 0) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z, "The content logging limit must be non-negative.");
this.contentLoggingLimit = i;
return this;
}
public HttpRequest setCurlLoggingEnabled(boolean z) {
this.curlLoggingEnabled = z;
return this;
}
public HttpRequest setEncoding(HttpEncoding httpEncoding) {
this.encoding = httpEncoding;
return this;
}
public HttpRequest setFollowRedirects(boolean z) {
this.followRedirects = z;
return this;
}
public HttpRequest setHeaders(HttpHeaders httpHeaders) {
this.headers = (HttpHeaders) Preconditions.checkNotNull(httpHeaders);
return this;
}
@Beta
public HttpRequest setIOExceptionHandler(HttpIOExceptionHandler httpIOExceptionHandler) {
this.ioExceptionHandler = httpIOExceptionHandler;
return this;
}
public HttpRequest setInterceptor(HttpExecuteInterceptor httpExecuteInterceptor) {
this.executeInterceptor = httpExecuteInterceptor;
return this;
}
public HttpRequest setLoggingEnabled(boolean z) {
this.loggingEnabled = z;
return this;
}
public HttpRequest setNumberOfRetries(int i) {
boolean z;
if (i >= 0) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z);
this.numRetries = i;
return this;
}
public HttpRequest setParser(ObjectParser objectParser) {
this.objectParser = objectParser;
return this;
}
public HttpRequest setReadTimeout(int i) {
boolean z;
if (i >= 0) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z);
this.readTimeout = i;
return this;
}
public HttpRequest setRequestMethod(String str) {
boolean z;
if (str != null && !HttpMediaType.matchesToken(str)) {
z = false;
} else {
z = true;
}
Preconditions.checkArgument(z);
this.requestMethod = str;
return this;
}
public HttpRequest setResponseHeaders(HttpHeaders httpHeaders) {
this.responseHeaders = (HttpHeaders) Preconditions.checkNotNull(httpHeaders);
return this;
}
public HttpRequest setResponseInterceptor(HttpResponseInterceptor httpResponseInterceptor) {
this.responseInterceptor = httpResponseInterceptor;
return this;
}
public HttpRequest setResponseReturnRawInputStream(boolean z) {
this.responseReturnRawInputStream = z;
return this;
}
@Beta
@Deprecated
public HttpRequest setRetryOnExecuteIOException(boolean z) {
this.retryOnExecuteIOException = z;
return this;
}
public HttpRequest setSleeper(Sleeper sleeper) {
this.sleeper = (Sleeper) Preconditions.checkNotNull(sleeper);
return this;
}
public HttpRequest setSuppressUserAgentSuffix(boolean z) {
this.suppressUserAgentSuffix = z;
return this;
}
public HttpRequest setThrowExceptionOnExecuteError(boolean z) {
this.throwExceptionOnExecuteError = z;
return this;
}
public HttpRequest setUnsuccessfulResponseHandler(HttpUnsuccessfulResponseHandler httpUnsuccessfulResponseHandler) {
this.unsuccessfulResponseHandler = httpUnsuccessfulResponseHandler;
return this;
}
public HttpRequest setUrl(GenericUrl genericUrl) {
this.url = (GenericUrl) Preconditions.checkNotNull(genericUrl);
return this;
}
public HttpRequest setUseRawRedirectUrls(boolean z) {
this.useRawRedirectUrls = z;
return this;
}
public HttpRequest setWriteTimeout(int i) {
boolean z;
if (i >= 0) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z);
this.writeTimeout = i;
return this;
}
@Beta
public Future<HttpResponse> executeAsync() {
ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder();
threadFactoryBuilder.b = Boolean.TRUE;
return executeAsync(Executors.newFixedThreadPool(1, threadFactoryBuilder.a()));
}
}