soul-browser/sources/java/androidx/fragment/app/FragmentContainerView.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

362 lines
16 KiB
Java

package androidx.fragment.app;
import android.animation.LayoutTransition;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import androidx.annotation.RequiresApi;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.R;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.common.internal.ServiceSpecificExtraArgs;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.jvm.JvmName;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.Typography;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u0001:\u0001\u0013J\u0019\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016¢\u0006\u0004\b\u0005\u0010\u0006J\u0017\u0010\t\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u0007H\u0016¢\u0006\u0004\b\t\u0010\nJ\u0017\u0010\r\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000bH\u0001¢\u0006\u0004\b\r\u0010\u000eJ\u0019\u0010\u0011\u001a\u00028\u0000\"\n\b\u0000\u0010\u0010*\u0004\u0018\u00010\u000f¢\u0006\u0004\b\u0011\u0010\u0012¨\u0006\u0014"}, d2 = {"Landroidx/fragment/app/FragmentContainerView;", "Landroid/widget/FrameLayout;", "Landroid/animation/LayoutTransition;", "transition", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "setLayoutTransition", "(Landroid/animation/LayoutTransition;)V", "Landroid/view/View$OnApplyWindowInsetsListener;", ServiceSpecificExtraArgs.CastExtraArgs.LISTENER, "setOnApplyWindowInsetsListener", "(Landroid/view/View$OnApplyWindowInsetsListener;)V", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "drawDisappearingViewsFirst", "setDrawDisappearingViewsLast", "(Z)V", "Landroidx/fragment/app/Fragment;", "F", "getFragment", "()Landroidx/fragment/app/Fragment;", "Api20Impl", "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nFragmentContainerView.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FragmentContainerView.kt\nandroidx/fragment/app/FragmentContainerView\n+ 2 Context.kt\nandroidx/core/content/ContextKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,348:1\n55#2,6:349\n55#2,6:355\n1855#3,2:361\n*S KotlinDebug\n*F\n+ 1 FragmentContainerView.kt\nandroidx/fragment/app/FragmentContainerView\n*L\n113#1:349,6\n135#1:355,6\n221#1:361,2\n*E\n"})
/* loaded from: classes.dex */
public final class FragmentContainerView extends FrameLayout {
/* renamed from: c, reason: collision with root package name */
public final ArrayList f1098c;
public final ArrayList f;
public View.OnApplyWindowInsetsListener g;
public boolean h;
@RequiresApi
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Landroidx/fragment/app/FragmentContainerView$Api20Impl;", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "fragment_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public static final class Api20Impl {
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
@JvmOverloads
public FragmentContainerView(@NotNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet, 0);
String str;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(context, "context");
this.f1098c = new ArrayList();
this.f = new ArrayList();
this.h = true;
if (attributeSet != null) {
String classAttribute = attributeSet.getClassAttribute();
int[] FragmentContainerView = R.styleable.FragmentContainerView;
Intrinsics.checkNotNullExpressionValue(FragmentContainerView, "FragmentContainerView");
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, FragmentContainerView, 0, 0);
if (classAttribute == null) {
classAttribute = obtainStyledAttributes.getString(R.styleable.FragmentContainerView_android_name);
str = "android:name";
} else {
str = "class";
}
obtainStyledAttributes.recycle();
if (classAttribute == null || isInEditMode()) {
return;
}
throw new UnsupportedOperationException("FragmentContainerView must be within a FragmentActivity to use " + str + "=\"" + classAttribute + Typography.quote);
}
}
public final void a(View view) {
if (this.f.contains(view)) {
this.f1098c.add(view);
}
}
@Override // android.view.ViewGroup
public final void addView(View child, int i, ViewGroup.LayoutParams layoutParams) {
Fragment fragment;
Intrinsics.checkNotNullParameter(child, "child");
Object tag = child.getTag(R.id.fragment_container_view_tag);
if (tag instanceof Fragment) {
fragment = (Fragment) tag;
} else {
fragment = null;
}
if (fragment != null) {
super.addView(child, i, layoutParams);
return;
}
throw new IllegalStateException(("Views added to a FragmentContainerView must be associated with a Fragment. View " + child + " is not associated with a Fragment.").toString());
}
@Override // android.view.ViewGroup, android.view.View
public final WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
WindowInsetsCompat t;
Intrinsics.checkNotNullParameter(insets, "insets");
WindowInsetsCompat o = WindowInsetsCompat.o(null, insets);
Intrinsics.checkNotNullExpressionValue(o, "toWindowInsetsCompat(insets)");
View.OnApplyWindowInsetsListener onApplyWindowInsetsListener = this.g;
if (onApplyWindowInsetsListener != null) {
Intrinsics.checkNotNull(onApplyWindowInsetsListener);
Intrinsics.checkNotNullParameter(onApplyWindowInsetsListener, "onApplyWindowInsetsListener");
Intrinsics.checkNotNullParameter(this, "v");
Intrinsics.checkNotNullParameter(insets, "insets");
WindowInsets onApplyWindowInsets = onApplyWindowInsetsListener.onApplyWindowInsets(this, insets);
Intrinsics.checkNotNullExpressionValue(onApplyWindowInsets, "onApplyWindowInsetsListe…lyWindowInsets(v, insets)");
t = WindowInsetsCompat.o(null, onApplyWindowInsets);
} else {
t = ViewCompat.t(this, o);
}
Intrinsics.checkNotNullExpressionValue(t, "if (applyWindowInsetsLis…, insetsCompat)\n }");
if (!t.l()) {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
ViewCompat.c(getChildAt(i), t);
}
}
return insets;
}
@Override // android.view.ViewGroup, android.view.View
public final void dispatchDraw(Canvas canvas) {
Intrinsics.checkNotNullParameter(canvas, "canvas");
if (this.h) {
ArrayList arrayList = this.f1098c;
int size = arrayList.size();
int i = 0;
while (i < size) {
Object obj = arrayList.get(i);
i++;
super.drawChild(canvas, (View) obj, getDrawingTime());
}
}
super.dispatchDraw(canvas);
}
@Override // android.view.ViewGroup
public final boolean drawChild(Canvas canvas, View child, long j) {
Intrinsics.checkNotNullParameter(canvas, "canvas");
Intrinsics.checkNotNullParameter(child, "child");
if (this.h) {
ArrayList arrayList = this.f1098c;
if (!arrayList.isEmpty() && arrayList.contains(child)) {
return false;
}
}
return super.drawChild(canvas, child, j);
}
@Override // android.view.ViewGroup
public final void endViewTransition(View view) {
Intrinsics.checkNotNullParameter(view, "view");
this.f.remove(view);
if (this.f1098c.remove(view)) {
this.h = true;
}
super.endViewTransition(view);
}
public final <F extends Fragment> F getFragment() {
FragmentActivity fragmentActivity;
Fragment fragment;
FragmentManager T;
View view = this;
while (true) {
fragmentActivity = null;
if (view != null) {
Object tag = view.getTag(R.id.fragment_container_view_tag);
if (tag instanceof Fragment) {
fragment = (Fragment) tag;
} else {
fragment = null;
}
if (fragment != null) {
break;
}
Object parent = view.getParent();
if (parent instanceof View) {
view = (View) parent;
} else {
view = null;
}
} else {
fragment = null;
break;
}
}
if (fragment != null) {
if (fragment.isAdded()) {
T = fragment.getChildFragmentManager();
} else {
throw new IllegalStateException("The Fragment " + fragment + " that owns View " + this + " has already been destroyed. Nested fragments should always use the child FragmentManager.");
}
} else {
Context context = getContext();
while (true) {
if (!(context instanceof ContextWrapper)) {
break;
}
if (context instanceof FragmentActivity) {
fragmentActivity = (FragmentActivity) context;
break;
}
context = ((ContextWrapper) context).getBaseContext();
}
if (fragmentActivity != null) {
T = fragmentActivity.T();
} else {
throw new IllegalStateException("View " + this + " is not within a subclass of FragmentActivity.");
}
}
return (F) T.B(getId());
}
@Override // android.view.View
public final WindowInsets onApplyWindowInsets(WindowInsets insets) {
Intrinsics.checkNotNullParameter(insets, "insets");
return insets;
}
@Override // android.view.ViewGroup
public final void removeAllViewsInLayout() {
int childCount = getChildCount();
while (true) {
childCount--;
if (-1 < childCount) {
View view = getChildAt(childCount);
Intrinsics.checkNotNullExpressionValue(view, "view");
a(view);
} else {
super.removeAllViewsInLayout();
return;
}
}
}
@Override // android.view.ViewGroup, android.view.ViewManager
public final void removeView(View view) {
Intrinsics.checkNotNullParameter(view, "view");
a(view);
super.removeView(view);
}
@Override // android.view.ViewGroup
public final void removeViewAt(int i) {
View view = getChildAt(i);
Intrinsics.checkNotNullExpressionValue(view, "view");
a(view);
super.removeViewAt(i);
}
@Override // android.view.ViewGroup
public final void removeViewInLayout(View view) {
Intrinsics.checkNotNullParameter(view, "view");
a(view);
super.removeViewInLayout(view);
}
@Override // android.view.ViewGroup
public final void removeViews(int i, int i2) {
int i3 = i + i2;
for (int i4 = i; i4 < i3; i4++) {
View view = getChildAt(i4);
Intrinsics.checkNotNullExpressionValue(view, "view");
a(view);
}
super.removeViews(i, i2);
}
@Override // android.view.ViewGroup
public final void removeViewsInLayout(int i, int i2) {
int i3 = i + i2;
for (int i4 = i; i4 < i3; i4++) {
View view = getChildAt(i4);
Intrinsics.checkNotNullExpressionValue(view, "view");
a(view);
}
super.removeViewsInLayout(i, i2);
}
@JvmName(name = "setDrawDisappearingViewsLast")
public final void setDrawDisappearingViewsLast(boolean drawDisappearingViewsFirst) {
this.h = drawDisappearingViewsFirst;
}
@Override // android.view.ViewGroup
public void setLayoutTransition(@Nullable LayoutTransition transition) {
throw new UnsupportedOperationException("FragmentContainerView does not support Layout Transitions or animateLayoutChanges=\"true\".");
}
@Override // android.view.View
public void setOnApplyWindowInsetsListener(@NotNull View.OnApplyWindowInsetsListener listener) {
Intrinsics.checkNotNullParameter(listener, "listener");
this.g = listener;
}
@Override // android.view.ViewGroup
public final void startViewTransition(View view) {
Intrinsics.checkNotNullParameter(view, "view");
if (view.getParent() == this) {
this.f.add(view);
}
super.startViewTransition(view);
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FragmentContainerView(Context context, AttributeSet attrs, FragmentManager fm) {
super(context, attrs);
View view;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(attrs, "attrs");
Intrinsics.checkNotNullParameter(fm, "fm");
this.f1098c = new ArrayList();
this.f = new ArrayList();
this.h = true;
String classAttribute = attrs.getClassAttribute();
int[] FragmentContainerView = R.styleable.FragmentContainerView;
Intrinsics.checkNotNullExpressionValue(FragmentContainerView, "FragmentContainerView");
int i = 0;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, FragmentContainerView, 0, 0);
classAttribute = classAttribute == null ? obtainStyledAttributes.getString(R.styleable.FragmentContainerView_android_name) : classAttribute;
String string = obtainStyledAttributes.getString(R.styleable.FragmentContainerView_android_tag);
obtainStyledAttributes.recycle();
int id = getId();
Fragment B = fm.B(id);
if (classAttribute != null && B == null) {
if (id == -1) {
throw new IllegalStateException(android.support.v4.media.a.l("FragmentContainerView must have an android:id to add Fragment ", classAttribute, string != null ? " with tag ".concat(string) : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED));
}
Fragment a2 = fm.F().a(context.getClassLoader(), classAttribute);
Intrinsics.checkNotNullExpressionValue(a2, "fm.fragmentFactory.insta…ontext.classLoader, name)");
a2.onInflate(context, attrs, (Bundle) null);
BackStackRecord backStackRecord = new BackStackRecord(fm);
backStackRecord.o = true;
a2.mContainer = this;
backStackRecord.f(getId(), a2, string, 1);
if (!backStackRecord.g) {
backStackRecord.p.z(backStackRecord, true);
} else {
throw new IllegalStateException("This transaction is already being added to the back stack");
}
}
ArrayList d = fm.f1106c.d();
int size = d.size();
while (i < size) {
Object obj = d.get(i);
i++;
FragmentStateManager fragmentStateManager = (FragmentStateManager) obj;
Fragment fragment = fragmentStateManager.f1119c;
if (fragment.mContainerId == getId() && (view = fragment.mView) != null && view.getParent() == null) {
fragment.mContainer = this;
fragmentStateManager.b();
}
}
}
}