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

248 lines
9.1 KiB
Java

package com.google.android.gms.common;
import android.app.Activity;
import android.app.PendingIntent;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.work.impl.workers.a;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.internal.Objects;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.internal.ShowFirstParty;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
@SafeParcelable.Class(creator = "ConnectionResultCreator")
/* loaded from: classes.dex */
public final class ConnectionResult extends AbstractSafeParcelable {
public static final int API_DISABLED = 23;
public static final int API_DISABLED_FOR_CONNECTION = 24;
public static final int API_UNAVAILABLE = 16;
public static final int CANCELED = 13;
public static final int DEVELOPER_ERROR = 10;
@Deprecated
public static final int DRIVE_EXTERNAL_STORAGE_REQUIRED = 1500;
public static final int INTERNAL_ERROR = 8;
public static final int INTERRUPTED = 15;
public static final int INVALID_ACCOUNT = 5;
public static final int LICENSE_CHECK_FAILED = 11;
public static final int NETWORK_ERROR = 7;
public static final int RESOLUTION_ACTIVITY_NOT_FOUND = 22;
public static final int RESOLUTION_REQUIRED = 6;
public static final int RESTRICTED_PROFILE = 20;
public static final int SERVICE_DISABLED = 3;
public static final int SERVICE_INVALID = 9;
public static final int SERVICE_MISSING = 1;
public static final int SERVICE_MISSING_PERMISSION = 19;
public static final int SERVICE_UPDATING = 18;
public static final int SERVICE_VERSION_UPDATE_REQUIRED = 2;
public static final int SIGN_IN_FAILED = 17;
public static final int SIGN_IN_REQUIRED = 4;
public static final int SUCCESS = 0;
public static final int TIMEOUT = 14;
@KeepForSdk
public static final int UNKNOWN = -1;
@SafeParcelable.VersionField(id = 1)
final int zza;
@SafeParcelable.Field(getter = "getErrorCode", id = 2)
private final int zzb;
@Nullable
@SafeParcelable.Field(getter = "getResolution", id = 3)
private final PendingIntent zzc;
@Nullable
@SafeParcelable.Field(getter = "getErrorMessage", id = 4)
private final String zzd;
@Nullable
@SafeParcelable.Field(getter = "getClientMethodKey", id = 5)
private final Integer zze;
@NonNull
@ShowFirstParty
@KeepForSdk
public static final ConnectionResult RESULT_SUCCESS = new ConnectionResult(0);
@NonNull
public static final Parcelable.Creator<ConnectionResult> CREATOR = new zza();
@SafeParcelable.Constructor
public ConnectionResult(@SafeParcelable.Param(id = 1) int i, @SafeParcelable.Param(id = 2) int i2, @Nullable @SafeParcelable.Param(id = 3) PendingIntent pendingIntent, @Nullable @SafeParcelable.Param(id = 4) String str, @Nullable @SafeParcelable.Param(id = 5) Integer num) {
this.zza = i;
this.zzb = i2;
this.zzc = pendingIntent;
this.zzd = str;
this.zze = num;
}
@NonNull
public static String zza(int i) {
if (i != 99) {
if (i != 1500) {
switch (i) {
case -1:
return "UNKNOWN";
case 0:
return "SUCCESS";
case 1:
return "SERVICE_MISSING";
case 2:
return "SERVICE_VERSION_UPDATE_REQUIRED";
case 3:
return "SERVICE_DISABLED";
case 4:
return "SIGN_IN_REQUIRED";
case 5:
return "INVALID_ACCOUNT";
case 6:
return "RESOLUTION_REQUIRED";
case 7:
return "NETWORK_ERROR";
case 8:
return "INTERNAL_ERROR";
case 9:
return "SERVICE_INVALID";
case 10:
return "DEVELOPER_ERROR";
case 11:
return "LICENSE_CHECK_FAILED";
default:
switch (i) {
case 13:
return "CANCELED";
case 14:
return "TIMEOUT";
case 15:
return "INTERRUPTED";
case 16:
return "API_UNAVAILABLE";
case 17:
return "SIGN_IN_FAILED";
case 18:
return "SERVICE_UPDATING";
case 19:
return "SERVICE_MISSING_PERMISSION";
case 20:
return "RESTRICTED_PROFILE";
case 21:
return "API_VERSION_UPDATE_REQUIRED";
case 22:
return "RESOLUTION_ACTIVITY_NOT_FOUND";
case API_DISABLED /* 23 */:
return "API_DISABLED";
case API_DISABLED_FOR_CONNECTION /* 24 */:
return "API_DISABLED_FOR_CONNECTION";
case 25:
return "API_INSTALL_REQUIRED";
default:
return a.t(new StringBuilder(String.valueOf(i).length() + 20), "UNKNOWN_ERROR_CODE(", i, ")");
}
}
}
return "DRIVE_EXTERNAL_STORAGE_REQUIRED";
}
return "UNFINISHED";
}
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ConnectionResult)) {
return false;
}
ConnectionResult connectionResult = (ConnectionResult) obj;
if (this.zzb == connectionResult.zzb && Objects.equal(this.zzc, connectionResult.zzc) && Objects.equal(this.zzd, connectionResult.zzd) && Objects.equal(this.zze, connectionResult.zze)) {
return true;
}
return false;
}
@Nullable
@KeepForSdk
public Integer getClientMethodKey() {
return this.zze;
}
public int getErrorCode() {
return this.zzb;
}
@Nullable
public String getErrorMessage() {
return this.zzd;
}
@Nullable
public PendingIntent getResolution() {
return this.zzc;
}
public boolean hasResolution() {
return (this.zzb == 0 || this.zzc == null) ? false : true;
}
public int hashCode() {
return Objects.hashCode(Integer.valueOf(this.zzb), this.zzc, this.zzd, this.zze);
}
public boolean isSuccess() {
return this.zzb == 0;
}
public void startResolutionForResult(@NonNull Activity activity, int i) {
if (!hasResolution()) {
return;
}
PendingIntent pendingIntent = this.zzc;
Preconditions.checkNotNull(pendingIntent);
activity.startIntentSenderForResult(pendingIntent.getIntentSender(), i, null, 0, 0, 0);
}
@NonNull
public String toString() {
Objects.ToStringHelper stringHelper = Objects.toStringHelper(this);
stringHelper.add("statusCode", zza(this.zzb));
stringHelper.add("resolution", this.zzc);
stringHelper.add("message", this.zzd);
stringHelper.add("clientMethodKey", this.zze);
return stringHelper.toString();
}
@Override // android.os.Parcelable
public void writeToParcel(@NonNull Parcel parcel, int i) {
int i2 = this.zza;
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
SafeParcelWriter.writeInt(parcel, 1, i2);
SafeParcelWriter.writeInt(parcel, 2, getErrorCode());
SafeParcelWriter.writeParcelable(parcel, 3, getResolution(), i, false);
SafeParcelWriter.writeString(parcel, 4, getErrorMessage(), false);
SafeParcelWriter.writeIntegerObject(parcel, 5, getClientMethodKey(), false);
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
}
public ConnectionResult(int i) {
this(i, null, null);
}
public ConnectionResult(int i, @Nullable PendingIntent pendingIntent) {
this(i, pendingIntent, null);
}
public ConnectionResult(int i, @Nullable PendingIntent pendingIntent, @Nullable String str) {
this(1, i, pendingIntent, str, null);
}
@KeepForSdk
public ConnectionResult(int i, @Nullable PendingIntent pendingIntent, @Nullable String str, @Nullable Integer num) {
this(1, i, pendingIntent, str, num);
}
}