soul-browser/sources/java/androidx/appcompat/widget/ActionBarContainer.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

360 lines
12 KiB
Java

package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import com.google.api.client.googleapis.media.MediaHttpUploader;
import kotlin.jvm.internal.IntCompanionObject;
@RestrictTo
/* loaded from: classes.dex */
public class ActionBarContainer extends FrameLayout {
/* renamed from: c, reason: collision with root package name */
public boolean f195c;
public ScrollingTabContainerView f;
public View g;
public View h;
public Drawable i;
public Drawable j;
public Drawable k;
public final boolean l;
public boolean m;
public final int n;
@RequiresApi
/* loaded from: classes.dex */
public static class Api21Impl {
}
public ActionBarContainer(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
setBackground(new ActionBarBackgroundDrawable(this));
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActionBar);
this.i = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_background);
this.j = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundStacked);
this.n = obtainStyledAttributes.getDimensionPixelSize(R.styleable.ActionBar_height, -1);
boolean z = true;
if (getId() == R.id.split_action_bar) {
this.l = true;
this.k = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundSplit);
}
obtainStyledAttributes.recycle();
if (!this.l ? this.i != null || this.j != null : this.k != null) {
z = false;
}
setWillNotDraw(z);
}
public static int a(View view) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
return view.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
}
@Override // android.view.ViewGroup, android.view.View
public final void drawableStateChanged() {
super.drawableStateChanged();
Drawable drawable = this.i;
if (drawable != null && drawable.isStateful()) {
this.i.setState(getDrawableState());
}
Drawable drawable2 = this.j;
if (drawable2 != null && drawable2.isStateful()) {
this.j.setState(getDrawableState());
}
Drawable drawable3 = this.k;
if (drawable3 != null && drawable3.isStateful()) {
this.k.setState(getDrawableState());
}
}
public View getTabContainer() {
return this.f;
}
@Override // android.view.ViewGroup, android.view.View
public final void jumpDrawablesToCurrentState() {
super.jumpDrawablesToCurrentState();
Drawable drawable = this.i;
if (drawable != null) {
drawable.jumpToCurrentState();
}
Drawable drawable2 = this.j;
if (drawable2 != null) {
drawable2.jumpToCurrentState();
}
Drawable drawable3 = this.k;
if (drawable3 != null) {
drawable3.jumpToCurrentState();
}
}
@Override // android.view.View
public final void onFinishInflate() {
super.onFinishInflate();
this.g = findViewById(R.id.action_bar);
this.h = findViewById(R.id.action_context_bar);
}
@Override // android.view.View
public final boolean onHoverEvent(MotionEvent motionEvent) {
super.onHoverEvent(motionEvent);
return true;
}
@Override // android.view.ViewGroup
public final boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (!this.f195c && !super.onInterceptTouchEvent(motionEvent)) {
return false;
}
return true;
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
boolean z2;
Drawable drawable;
super.onLayout(z, i, i2, i3, i4);
ScrollingTabContainerView scrollingTabContainerView = this.f;
boolean z3 = true;
boolean z4 = false;
if (scrollingTabContainerView != null && scrollingTabContainerView.getVisibility() != 8) {
z2 = true;
} else {
z2 = false;
}
if (scrollingTabContainerView != null && scrollingTabContainerView.getVisibility() != 8) {
int measuredHeight = getMeasuredHeight();
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) scrollingTabContainerView.getLayoutParams();
int measuredHeight2 = measuredHeight - scrollingTabContainerView.getMeasuredHeight();
int i5 = layoutParams.bottomMargin;
scrollingTabContainerView.layout(i, measuredHeight2 - i5, i3, measuredHeight - i5);
}
if (this.l) {
Drawable drawable2 = this.k;
if (drawable2 != null) {
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
z3 = z4;
} else {
if (this.i != null) {
if (this.g.getVisibility() == 0) {
this.i.setBounds(this.g.getLeft(), this.g.getTop(), this.g.getRight(), this.g.getBottom());
} else {
View view = this.h;
if (view != null && view.getVisibility() == 0) {
this.i.setBounds(this.h.getLeft(), this.h.getTop(), this.h.getRight(), this.h.getBottom());
} else {
this.i.setBounds(0, 0, 0, 0);
}
}
z4 = true;
}
this.m = z2;
if (z2 && (drawable = this.j) != null) {
drawable.setBounds(scrollingTabContainerView.getLeft(), scrollingTabContainerView.getTop(), scrollingTabContainerView.getRight(), scrollingTabContainerView.getBottom());
}
z3 = z4;
}
if (z3) {
invalidate();
}
}
@Override // android.widget.FrameLayout, android.view.View
public final void onMeasure(int i, int i2) {
int i3;
int i4;
int i5;
if (this.g == null && View.MeasureSpec.getMode(i2) == Integer.MIN_VALUE && (i5 = this.n) >= 0) {
i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i5, View.MeasureSpec.getSize(i2)), IntCompanionObject.MIN_VALUE);
}
super.onMeasure(i, i2);
if (this.g != null) {
int mode = View.MeasureSpec.getMode(i2);
ScrollingTabContainerView scrollingTabContainerView = this.f;
if (scrollingTabContainerView != null && scrollingTabContainerView.getVisibility() != 8 && mode != 1073741824) {
View view = this.g;
if (view != null && view.getVisibility() != 8 && view.getMeasuredHeight() != 0) {
i3 = a(this.g);
} else {
View view2 = this.h;
if (view2 != null && view2.getVisibility() != 8 && view2.getMeasuredHeight() != 0) {
i3 = a(this.h);
} else {
i3 = 0;
}
}
if (mode == Integer.MIN_VALUE) {
i4 = View.MeasureSpec.getSize(i2);
} else {
i4 = Integer.MAX_VALUE;
}
setMeasuredDimension(getMeasuredWidth(), Math.min(a(this.f) + i3, i4));
}
}
}
@Override // android.view.View
public final boolean onTouchEvent(MotionEvent motionEvent) {
super.onTouchEvent(motionEvent);
return true;
}
public void setPrimaryBackground(Drawable drawable) {
Drawable drawable2 = this.i;
if (drawable2 != null) {
drawable2.setCallback(null);
unscheduleDrawable(this.i);
}
this.i = drawable;
if (drawable != null) {
drawable.setCallback(this);
View view = this.g;
if (view != null) {
this.i.setBounds(view.getLeft(), this.g.getTop(), this.g.getRight(), this.g.getBottom());
}
}
boolean z = false;
if (!this.l ? !(this.i != null || this.j != null) : this.k == null) {
z = true;
}
setWillNotDraw(z);
invalidate();
invalidateOutline();
}
public void setSplitBackground(Drawable drawable) {
Drawable drawable2;
Drawable drawable3 = this.k;
if (drawable3 != null) {
drawable3.setCallback(null);
unscheduleDrawable(this.k);
}
this.k = drawable;
boolean z = this.l;
boolean z2 = false;
if (drawable != null) {
drawable.setCallback(this);
if (z && (drawable2 = this.k) != null) {
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
}
if (!z ? !(this.i != null || this.j != null) : this.k == null) {
z2 = true;
}
setWillNotDraw(z2);
invalidate();
invalidateOutline();
}
public void setStackedBackground(Drawable drawable) {
Drawable drawable2;
Drawable drawable3 = this.j;
if (drawable3 != null) {
drawable3.setCallback(null);
unscheduleDrawable(this.j);
}
this.j = drawable;
if (drawable != null) {
drawable.setCallback(this);
if (this.m && (drawable2 = this.j) != null) {
drawable2.setBounds(this.f.getLeft(), this.f.getTop(), this.f.getRight(), this.f.getBottom());
}
}
boolean z = false;
if (!this.l ? !(this.i != null || this.j != null) : this.k == null) {
z = true;
}
setWillNotDraw(z);
invalidate();
invalidateOutline();
}
public void setTabContainer(ScrollingTabContainerView scrollingTabContainerView) {
ScrollingTabContainerView scrollingTabContainerView2 = this.f;
if (scrollingTabContainerView2 != null) {
removeView(scrollingTabContainerView2);
}
this.f = scrollingTabContainerView;
if (scrollingTabContainerView != null) {
addView(scrollingTabContainerView);
ViewGroup.LayoutParams layoutParams = scrollingTabContainerView.getLayoutParams();
layoutParams.width = -1;
layoutParams.height = -2;
scrollingTabContainerView.setAllowCollapse(false);
}
}
public void setTransitioning(boolean z) {
int i;
this.f195c = z;
if (z) {
i = 393216;
} else {
i = MediaHttpUploader.MINIMUM_CHUNK_SIZE;
}
setDescendantFocusability(i);
}
@Override // android.view.View
public void setVisibility(int i) {
boolean z;
super.setVisibility(i);
if (i == 0) {
z = true;
} else {
z = false;
}
Drawable drawable = this.i;
if (drawable != null) {
drawable.setVisible(z, false);
}
Drawable drawable2 = this.j;
if (drawable2 != null) {
drawable2.setVisible(z, false);
}
Drawable drawable3 = this.k;
if (drawable3 != null) {
drawable3.setVisible(z, false);
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
return null;
}
@Override // android.view.View
public final boolean verifyDrawable(Drawable drawable) {
Drawable drawable2 = this.i;
boolean z = this.l;
if (drawable != drawable2 || z) {
if (drawable != this.j || !this.m) {
if ((drawable == this.k && z) || super.verifyDrawable(drawable)) {
return true;
}
return false;
}
return true;
}
return true;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) {
if (i != 0) {
return super.startActionModeForChild(view, callback, i);
}
return null;
}
}