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

345 lines
12 KiB
Java

package androidx.constraintlayout.widget;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.HelperWidget;
import androidx.constraintlayout.widget.ConstraintLayout;
import java.util.Arrays;
import java.util.HashMap;
/* loaded from: classes.dex */
public abstract class ConstraintHelper extends View {
/* renamed from: c, reason: collision with root package name */
public int[] f576c;
public int f;
public Context g;
public HelperWidget h;
public String i;
public String j;
public View[] k;
public HashMap l;
/* JADX WARN: Removed duplicated region for block: B:30:0x0075 */
/* JADX WARN: Removed duplicated region for block: B:32:0x0085 */
/* JADX WARN: Removed duplicated region for block: B:35:0x0092 */
/* JADX WARN: Removed duplicated region for block: B:37:0x0069 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void a(java.lang.String r6) {
/*
r5 = this;
android.content.Context r0 = r5.g
if (r6 == 0) goto Laa
int r1 = r6.length()
if (r1 != 0) goto Lc
goto Laa
Lc:
if (r0 != 0) goto L10
goto Laa
L10:
java.lang.String r6 = r6.trim()
android.view.ViewParent r1 = r5.getParent()
boolean r1 = r1 instanceof androidx.constraintlayout.widget.ConstraintLayout
if (r1 == 0) goto L22
android.view.ViewParent r1 = r5.getParent()
androidx.constraintlayout.widget.ConstraintLayout r1 = (androidx.constraintlayout.widget.ConstraintLayout) r1
L22:
android.view.ViewParent r1 = r5.getParent()
boolean r1 = r1 instanceof androidx.constraintlayout.widget.ConstraintLayout
r2 = 0
if (r1 == 0) goto L32
android.view.ViewParent r1 = r5.getParent()
androidx.constraintlayout.widget.ConstraintLayout r1 = (androidx.constraintlayout.widget.ConstraintLayout) r1
goto L33
L32:
r1 = r2
L33:
boolean r3 = r5.isInEditMode()
if (r3 == 0) goto L5e
if (r1 == 0) goto L5e
boolean r3 = android.support.v4.media.a.A(r6)
if (r3 == 0) goto L52
java.util.HashMap r3 = r1.q
if (r3 == 0) goto L52
boolean r3 = r3.containsKey(r6)
if (r3 == 0) goto L52
java.util.HashMap r3 = r1.q
java.lang.Object r3 = r3.get(r6)
goto L53
L52:
r3 = r2
L53:
boolean r4 = r3 instanceof java.lang.Integer
if (r4 == 0) goto L5e
java.lang.Integer r3 = (java.lang.Integer) r3
int r3 = r3.intValue()
goto L5f
L5e:
r3 = 0
L5f:
if (r3 != 0) goto L67
if (r1 == 0) goto L67
int r3 = r5.g(r1, r6)
L67:
if (r3 != 0) goto L73
java.lang.Class<androidx.constraintlayout.widget.R$id> r1 = androidx.constraintlayout.widget.R.id.class
java.lang.reflect.Field r1 = r1.getField(r6) // Catch: java.lang.Exception -> L73
int r3 = r1.getInt(r2) // Catch: java.lang.Exception -> L73
L73:
if (r3 != 0) goto L83
android.content.res.Resources r1 = r0.getResources()
java.lang.String r2 = "id"
java.lang.String r0 = r0.getPackageName()
int r3 = r1.getIdentifier(r6, r2, r0)
L83:
if (r3 == 0) goto L92
java.util.HashMap r0 = r5.l
java.lang.Integer r1 = java.lang.Integer.valueOf(r3)
r0.put(r1, r6)
r5.b(r3)
return
L92:
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "Could not find id of \""
r0.<init>(r1)
r0.append(r6)
java.lang.String r6 = "\""
r0.append(r6)
java.lang.String r6 = r0.toString()
java.lang.String r0 = "ConstraintHelper"
android.util.Log.w(r0, r6)
Laa:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintHelper.a(java.lang.String):void");
}
public final void b(int i) {
if (i == getId()) {
return;
}
int i2 = this.f + 1;
int[] iArr = this.f576c;
if (i2 > iArr.length) {
this.f576c = Arrays.copyOf(iArr, iArr.length * 2);
}
int[] iArr2 = this.f576c;
int i3 = this.f;
iArr2[i3] = i;
this.f = i3 + 1;
}
public final void c(String str) {
ConstraintLayout constraintLayout;
if (str != null && str.length() != 0 && this.g != null) {
String trim = str.trim();
if (getParent() instanceof ConstraintLayout) {
constraintLayout = (ConstraintLayout) getParent();
} else {
constraintLayout = null;
}
if (constraintLayout == null) {
Log.w("ConstraintHelper", "Parent not a ConstraintLayout");
return;
}
int childCount = constraintLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = constraintLayout.getChildAt(i);
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
if ((layoutParams instanceof ConstraintLayout.LayoutParams) && trim.equals(((ConstraintLayout.LayoutParams) layoutParams).X)) {
if (childAt.getId() == -1) {
Log.w("ConstraintHelper", "to use ConstraintTag view " + childAt.getClass().getSimpleName() + " must have an ID");
} else {
b(childAt.getId());
}
}
}
}
}
public final void d() {
ViewParent parent = getParent();
if (parent != null && (parent instanceof ConstraintLayout)) {
e((ConstraintLayout) parent);
}
}
public final void e(ConstraintLayout constraintLayout) {
int visibility = getVisibility();
float elevation = getElevation();
for (int i = 0; i < this.f; i++) {
View b = constraintLayout.b(this.f576c[i]);
if (b != null) {
b.setVisibility(visibility);
if (elevation > 0.0f) {
b.setTranslationZ(b.getTranslationZ() + elevation);
}
}
}
}
public void f(ConstraintLayout constraintLayout) {
}
public final int g(ConstraintLayout constraintLayout, String str) {
Resources resources;
String str2;
if (str != null && (resources = this.g.getResources()) != null) {
int childCount = constraintLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = constraintLayout.getChildAt(i);
if (childAt.getId() != -1) {
try {
str2 = resources.getResourceEntryName(childAt.getId());
} catch (Resources.NotFoundException unused) {
str2 = null;
}
if (str.equals(str2)) {
return childAt.getId();
}
}
}
}
return 0;
}
public int[] getReferencedIds() {
return Arrays.copyOf(this.f576c, this.f);
}
public final View[] h(ConstraintLayout constraintLayout) {
View[] viewArr = this.k;
if (viewArr == null || viewArr.length != this.f) {
this.k = new View[this.f];
}
for (int i = 0; i < this.f; i++) {
this.k[i] = constraintLayout.b(this.f576c[i]);
}
return this.k;
}
public void i(AttributeSet attributeSet) {
if (attributeSet != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R.styleable.ConstraintLayout_Layout);
int indexCount = obtainStyledAttributes.getIndexCount();
for (int i = 0; i < indexCount; i++) {
int index = obtainStyledAttributes.getIndex(i);
if (index == R.styleable.ConstraintLayout_Layout_constraint_referenced_ids) {
String string = obtainStyledAttributes.getString(index);
this.i = string;
setIds(string);
} else if (index == R.styleable.ConstraintLayout_Layout_constraint_referenced_tags) {
String string2 = obtainStyledAttributes.getString(index);
this.j = string2;
setReferenceTags(string2);
}
}
obtainStyledAttributes.recycle();
}
}
public void j(ConstraintWidget constraintWidget, boolean z) {
}
public void l(ConstraintLayout constraintLayout) {
}
public final void m() {
if (this.h != null) {
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof ConstraintLayout.LayoutParams) {
((ConstraintLayout.LayoutParams) layoutParams).p0 = this.h;
}
}
}
@Override // android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
String str = this.i;
if (str != null) {
setIds(str);
}
String str2 = this.j;
if (str2 != null) {
setReferenceTags(str2);
}
}
@Override // android.view.View
public final void onDraw(Canvas canvas) {
}
@Override // android.view.View
public void onMeasure(int i, int i2) {
setMeasuredDimension(0, 0);
}
public void setIds(String str) {
this.i = str;
if (str == null) {
return;
}
int i = 0;
this.f = 0;
while (true) {
int indexOf = str.indexOf(44, i);
if (indexOf == -1) {
a(str.substring(i));
return;
} else {
a(str.substring(i, indexOf));
i = indexOf + 1;
}
}
}
public void setReferenceTags(String str) {
this.j = str;
if (str == null) {
return;
}
int i = 0;
this.f = 0;
while (true) {
int indexOf = str.indexOf(44, i);
if (indexOf == -1) {
c(str.substring(i));
return;
} else {
c(str.substring(i, indexOf));
i = indexOf + 1;
}
}
}
public void setReferencedIds(int[] iArr) {
this.i = null;
this.f = 0;
for (int i : iArr) {
b(i);
}
}
@Override // android.view.View
public final void setTag(int i, Object obj) {
super.setTag(i, obj);
if (obj == null && this.i == null) {
b(i);
}
}
public void k() {
}
}