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

244 lines
9.6 KiB
Java

package com.google.android.gms.ads;
import android.content.Context;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission;
import com.google.android.gms.ads.admanager.AdManagerAdRequest;
import com.google.android.gms.ads.formats.AdManagerAdViewOptions;
import com.google.android.gms.ads.formats.OnAdManagerAdViewLoadedListener;
import com.google.android.gms.ads.internal.client.zzbb;
import com.google.android.gms.ads.internal.client.zzbd;
import com.google.android.gms.ads.internal.client.zzbq;
import com.google.android.gms.ads.internal.client.zzbt;
import com.google.android.gms.ads.internal.client.zzek;
import com.google.android.gms.ads.internal.client.zzfi;
import com.google.android.gms.ads.internal.client.zzga;
import com.google.android.gms.ads.internal.client.zzq;
import com.google.android.gms.ads.internal.client.zzr;
import com.google.android.gms.ads.internal.util.client.zzo;
import com.google.android.gms.ads.nativead.NativeAd;
import com.google.android.gms.ads.nativead.NativeAdOptions;
import com.google.android.gms.ads.nativead.NativeCustomFormatAd;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.internal.ads.zzbgk;
import com.google.android.gms.internal.ads.zzbii;
import com.google.android.gms.internal.ads.zzbjn;
import com.google.android.gms.internal.ads.zzbly;
import com.google.android.gms.internal.ads.zzbma;
import com.google.android.gms.internal.ads.zzbmb;
import com.google.android.gms.internal.ads.zzbsv;
import com.google.android.gms.internal.ads.zzbwl;
import com.google.android.gms.internal.ads.zzbwn;
/* loaded from: classes.dex */
public class AdLoader {
/* renamed from: a, reason: collision with root package name */
public final zzq f2932a;
public final Context b;
/* renamed from: c, reason: collision with root package name */
public final zzbq f2933c;
/* loaded from: classes.dex */
public static class Builder {
/* renamed from: a, reason: collision with root package name */
public final Context f2934a;
public final zzbt b;
public Builder(@NonNull Context context, @NonNull String str) {
Context context2 = (Context) Preconditions.checkNotNull(context, "context cannot be null");
zzbt zzc = zzbb.zzb().zzc(context, str, new zzbsv());
this.f2934a = context2;
this.b = zzc;
}
@NonNull
public AdLoader build() {
Context context = this.f2934a;
try {
return new AdLoader(context, this.b.zze(), zzq.zza);
} catch (RemoteException e) {
zzo.zzg("Failed to build AdLoader.", e);
return new AdLoader(context, new zzfi().zzb(), zzq.zza);
}
}
@NonNull
public Builder forAdManagerAdView(@NonNull OnAdManagerAdViewLoadedListener onAdManagerAdViewLoadedListener, @NonNull AdSize... adSizeArr) {
if (adSizeArr != null && adSizeArr.length > 0) {
try {
this.b.zzk(new zzbma(onAdManagerAdViewLoadedListener), new zzr(this.f2934a, adSizeArr));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to add Google Ad Manager banner ad listener", e);
return this;
}
}
throw new IllegalArgumentException("The supported ad sizes must contain at least one valid ad size.");
}
@NonNull
public Builder forCustomFormatAd(@NonNull String str, @NonNull NativeCustomFormatAd.OnCustomFormatAdLoadedListener onCustomFormatAdLoadedListener, @Nullable NativeCustomFormatAd.OnCustomClickListener onCustomClickListener) {
zzbwl zzbwlVar = new zzbwl(onCustomFormatAdLoadedListener, onCustomClickListener);
try {
this.b.zzi(str, zzbwlVar.a(), zzbwlVar.b());
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to add custom format ad listener", e);
return this;
}
}
@NonNull
public Builder forNativeAd(@NonNull NativeAd.OnNativeAdLoadedListener onNativeAdLoadedListener) {
try {
this.b.zzm(new zzbwn(onNativeAdLoadedListener));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to add google native ad listener", e);
return this;
}
}
@NonNull
public Builder withAdListener(@NonNull AdListener adListener) {
try {
this.b.zzf(new com.google.android.gms.ads.internal.client.zzg(adListener));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to set AdListener.", e);
return this;
}
}
@NonNull
public Builder withAdManagerAdViewOptions(@NonNull AdManagerAdViewOptions adManagerAdViewOptions) {
try {
this.b.zzp(adManagerAdViewOptions);
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to specify Ad Manager banner ad options", e);
return this;
}
}
@NonNull
public Builder withNativeAdOptions(@NonNull NativeAdOptions nativeAdOptions) {
zzga zzgaVar;
try {
zzbt zzbtVar = this.b;
boolean shouldReturnUrlsForImageAssets = nativeAdOptions.shouldReturnUrlsForImageAssets();
boolean shouldRequestMultipleImages = nativeAdOptions.shouldRequestMultipleImages();
int adChoicesPlacement = nativeAdOptions.getAdChoicesPlacement();
if (nativeAdOptions.getVideoOptions() != null) {
zzgaVar = new zzga(nativeAdOptions.getVideoOptions());
} else {
zzgaVar = null;
}
zzbtVar.zzj(new zzbjn(4, shouldReturnUrlsForImageAssets, -1, shouldRequestMultipleImages, adChoicesPlacement, zzgaVar, nativeAdOptions.zza(), nativeAdOptions.getMediaAspectRatio(), nativeAdOptions.zzb(), nativeAdOptions.zzc(), nativeAdOptions.zzd() - 1));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to specify native ad options", e);
return this;
}
}
@Deprecated
public final Builder zza(com.google.android.gms.ads.formats.zzg zzgVar) {
try {
this.b.zzm(new zzbmb(zzgVar));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to add google native ad listener", e);
return this;
}
}
@Deprecated
public final Builder zzb(String str, com.google.android.gms.ads.formats.zze zzeVar, @Nullable com.google.android.gms.ads.formats.zzd zzdVar) {
zzbly zzblyVar = new zzbly(zzeVar, zzdVar);
try {
this.b.zzi(str, zzblyVar.a(), zzblyVar.b());
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to add custom template ad listener", e);
return this;
}
}
@NonNull
@Deprecated
public final Builder zzc(@NonNull com.google.android.gms.ads.formats.NativeAdOptions nativeAdOptions) {
try {
this.b.zzj(new zzbjn(nativeAdOptions));
return this;
} catch (RemoteException e) {
zzo.zzj("Failed to specify native ad options", e);
return this;
}
}
}
public AdLoader(Context context, zzbq zzbqVar, zzq zzqVar) {
this.b = context;
this.f2933c = zzbqVar;
this.f2932a = zzqVar;
}
public final void a(final zzek zzekVar) {
Context context = this.b;
zzbgk.a(context);
if (((Boolean) zzbii.f4712c.c()).booleanValue()) {
if (((Boolean) zzbd.zzc().a(zzbgk.Ac)).booleanValue()) {
com.google.android.gms.ads.internal.util.client.zzb.zzb.execute(new Runnable() { // from class: com.google.android.gms.ads.zza
@Override // java.lang.Runnable
public final /* synthetic */ void run() {
AdLoader adLoader = AdLoader.this;
try {
adLoader.f2933c.zze(adLoader.f2932a.zza(adLoader.b, zzekVar));
} catch (RemoteException e) {
zzo.zzg("Failed to load ad.", e);
}
}
});
return;
}
}
try {
this.f2933c.zze(this.f2932a.zza(context, zzekVar));
} catch (RemoteException e) {
zzo.zzg("Failed to load ad.", e);
}
}
public boolean isLoading() {
try {
return this.f2933c.zzg();
} catch (RemoteException e) {
zzo.zzj("Failed to check if ad is loading.", e);
return false;
}
}
@RequiresPermission
public void loadAd(@NonNull AdRequest adRequest) {
a(adRequest.f2935a);
}
@RequiresPermission
public void loadAds(@NonNull AdRequest adRequest, int i) {
try {
this.f2933c.zzi(this.f2932a.zza(this.b, adRequest.f2935a), i);
} catch (RemoteException e) {
zzo.zzg("Failed to load ads.", e);
}
}
public void loadAd(@NonNull AdManagerAdRequest adManagerAdRequest) {
a(adManagerAdRequest.f2935a);
}
}