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

310 lines
8.4 KiB
Java

package com.google.android.gms.ads.nativead;
import android.content.Context;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.ads.internal.client.zzaz;
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.util.client.zzo;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.internal.ads.zzbgk;
import com.google.android.gms.internal.ads.zzbkc;
/* loaded from: classes.dex */
public final class NativeAdView extends FrameLayout {
/* renamed from: c, reason: collision with root package name */
public final FrameLayout f3206c;
public final zzbkc f;
public NativeAdView(@NonNull Context context) {
super(context);
this.f3206c = c(context);
this.f = d();
}
public final View a(String str) {
zzbkc zzbkcVar = this.f;
if (zzbkcVar != null) {
try {
IObjectWrapper zzc = zzbkcVar.zzc(str);
if (zzc != null) {
return (View) ObjectWrapper.f2(zzc);
}
} catch (RemoteException e) {
zzo.zzg("Unable to call getAssetView on delegate", e);
}
}
return null;
}
@Override // android.view.ViewGroup
public final void addView(@NonNull View view, int i, @NonNull ViewGroup.LayoutParams layoutParams) {
super.addView(view, i, layoutParams);
super.bringChildToFront(this.f3206c);
}
public final void b(View view, String str) {
zzbkc zzbkcVar = this.f;
if (zzbkcVar == null) {
return;
}
try {
zzbkcVar.zzb(str, new ObjectWrapper(view));
} catch (RemoteException e) {
zzo.zzg("Unable to call setAssetView on delegate", e);
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void bringChildToFront(@NonNull View view) {
super.bringChildToFront(view);
FrameLayout frameLayout = this.f3206c;
if (frameLayout != view) {
super.bringChildToFront(frameLayout);
}
}
public final FrameLayout c(Context context) {
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
addView(frameLayout);
return frameLayout;
}
public final zzbkc d() {
if (isInEditMode()) {
return null;
}
zzaz zzb = zzbb.zzb();
FrameLayout frameLayout = this.f3206c;
return zzb.zze(frameLayout.getContext(), this, frameLayout);
}
public void destroy() {
zzbkc zzbkcVar = this.f;
if (zzbkcVar == null) {
return;
}
try {
zzbkcVar.zze();
} catch (RemoteException e) {
zzo.zzg("Unable to destroy native ad view", e);
}
}
@Override // android.view.ViewGroup, android.view.View
public final boolean dispatchTouchEvent(@NonNull MotionEvent motionEvent) {
zzbkc zzbkcVar = this.f;
if (zzbkcVar != null) {
if (((Boolean) zzbd.zzc().a(zzbgk.Sc)).booleanValue()) {
try {
zzbkcVar.zzdC(new ObjectWrapper(motionEvent));
} catch (RemoteException e) {
zzo.zzg("Unable to call handleTouchEvent on delegate", e);
}
}
}
return super.dispatchTouchEvent(motionEvent);
}
@Nullable
public AdChoicesView getAdChoicesView() {
View a2 = a("3011");
if (a2 instanceof AdChoicesView) {
return (AdChoicesView) a2;
}
return null;
}
@Nullable
public final View getAdvertiserView() {
return a("3005");
}
@Nullable
public final View getBodyView() {
return a("3004");
}
@Nullable
public final View getCallToActionView() {
return a("3002");
}
@Nullable
public final View getHeadlineView() {
return a("3001");
}
@Nullable
public final View getIconView() {
return a("3003");
}
@Nullable
public final View getImageView() {
return a("3008");
}
@Nullable
public final MediaView getMediaView() {
View a2 = a("3010");
if (a2 instanceof MediaView) {
return (MediaView) a2;
}
if (a2 != null) {
zzo.zzd("View is not an instance of MediaView");
return null;
}
return null;
}
@Nullable
public final View getPriceView() {
return a("3007");
}
@Nullable
public final View getStarRatingView() {
return a("3009");
}
@Nullable
public final View getStoreView() {
return a("3006");
}
@Override // android.view.View
public final void onVisibilityChanged(@NonNull View view, int i) {
super.onVisibilityChanged(view, i);
zzbkc zzbkcVar = this.f;
if (zzbkcVar == null) {
return;
}
try {
zzbkcVar.zzf(new ObjectWrapper(view), i);
} catch (RemoteException e) {
zzo.zzg("Unable to call onVisibilityChanged on delegate", e);
}
}
@Override // android.view.ViewGroup
public final void removeAllViews() {
super.removeAllViews();
addView(this.f3206c);
}
@Override // android.view.ViewGroup, android.view.ViewManager
public final void removeView(@NonNull View view) {
if (this.f3206c == view) {
return;
}
super.removeView(view);
}
public void setAdChoicesView(@Nullable AdChoicesView adChoicesView) {
b(adChoicesView, "3011");
}
public final void setAdvertiserView(@Nullable View view) {
b(view, "3005");
}
public final void setBodyView(@Nullable View view) {
b(view, "3004");
}
public final void setCallToActionView(@Nullable View view) {
b(view, "3002");
}
public final void setClickConfirmingView(@Nullable View view) {
zzbkc zzbkcVar = this.f;
if (zzbkcVar == null) {
return;
}
try {
zzbkcVar.zzg(new ObjectWrapper(view));
} catch (RemoteException e) {
zzo.zzg("Unable to call setClickConfirmingView on delegate", e);
}
}
public final void setHeadlineView(@Nullable View view) {
b(view, "3001");
}
public final void setIconView(@Nullable View view) {
b(view, "3003");
}
public final void setImageView(@Nullable View view) {
b(view, "3008");
}
public final void setMediaView(@Nullable MediaView mediaView) {
b(mediaView, "3010");
if (mediaView == null) {
return;
}
zzb zzbVar = new zzb(this);
synchronized (mediaView) {
mediaView.g = zzbVar;
if (mediaView.f) {
zzbVar.a(mediaView.f3200c);
}
}
mediaView.a(new zza(this));
}
public void setNativeAd(@NonNull NativeAd nativeAd) {
zzbkc zzbkcVar = this.f;
if (zzbkcVar == null) {
return;
}
try {
zzbkcVar.zzd(nativeAd.a());
} catch (RemoteException e) {
zzo.zzg("Unable to call setNativeAd on delegate", e);
}
}
public final void setPriceView(@Nullable View view) {
b(view, "3007");
}
public final void setStarRatingView(@Nullable View view) {
b(view, "3009");
}
public final void setStoreView(@Nullable View view) {
b(view, "3006");
}
public NativeAdView(@NonNull Context context, @NonNull AttributeSet attributeSet) {
super(context, attributeSet);
this.f3206c = c(context);
this.f = d();
}
public NativeAdView(@NonNull Context context, @NonNull AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.f3206c = c(context);
this.f = d();
}
public NativeAdView(@NonNull Context context, @NonNull AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
this.f3206c = c(context);
this.f = d();
}
}