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

393 lines
14 KiB
Java

package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
import androidx.appcompat.R;
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
import androidx.core.widget.ListViewAutoScrollHelper;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class DropDownListView extends ListView {
/* renamed from: c, reason: collision with root package name */
public final Rect f294c;
public int f;
public int g;
public int h;
public int i;
public int j;
public GateKeeperDrawable k;
public boolean l;
public final boolean m;
public boolean n;
public ListViewAutoScrollHelper o;
public ResolveHoverRunnable p;
@RequiresApi
/* loaded from: classes.dex */
public static class Api21Impl {
@DoNotInline
public static void a(View view, float f, float f2) {
view.drawableHotspotChanged(f, f2);
}
}
@RequiresApi
/* loaded from: classes.dex */
public static class Api30Impl {
/* renamed from: a, reason: collision with root package name */
public static final Method f295a;
public static final Method b;
/* renamed from: c, reason: collision with root package name */
public static final Method f296c;
public static final boolean d;
static {
try {
Class cls = Integer.TYPE;
Class cls2 = Float.TYPE;
Method declaredMethod = AbsListView.class.getDeclaredMethod("positionSelector", cls, View.class, Boolean.TYPE, cls2, cls2);
f295a = declaredMethod;
declaredMethod.setAccessible(true);
Method declaredMethod2 = AdapterView.class.getDeclaredMethod("setSelectedPositionInt", cls);
b = declaredMethod2;
declaredMethod2.setAccessible(true);
Method declaredMethod3 = AdapterView.class.getDeclaredMethod("setNextSelectedPositionInt", cls);
f296c = declaredMethod3;
declaredMethod3.setAccessible(true);
d = true;
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
}
@RequiresApi
/* loaded from: classes.dex */
public static class Api33Impl {
@DoNotInline
public static boolean a(AbsListView absListView) {
return absListView.isSelectedChildViewEnabled();
}
@DoNotInline
public static void b(AbsListView absListView, boolean z) {
absListView.setSelectedChildViewEnabled(z);
}
}
/* loaded from: classes.dex */
public static class GateKeeperDrawable extends DrawableWrapperCompat {
public boolean f;
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
public final void draw(Canvas canvas) {
if (this.f) {
super.draw(canvas);
}
}
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
public final void setHotspot(float f, float f2) {
if (this.f) {
super.setHotspot(f, f2);
}
}
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
public final void setHotspotBounds(int i, int i2, int i3, int i4) {
if (this.f) {
super.setHotspotBounds(i, i2, i3, i4);
}
}
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
public final boolean setState(int[] iArr) {
if (this.f) {
return this.f140c.setState(iArr);
}
return false;
}
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
public final boolean setVisible(boolean z, boolean z2) {
if (this.f) {
return super.setVisible(z, z2);
}
return false;
}
}
/* loaded from: classes.dex */
public static class PreApi33Impl {
/* renamed from: a, reason: collision with root package name */
public static final Field f297a;
static {
Field field = null;
try {
field = AbsListView.class.getDeclaredField("mIsChildViewEnabled");
field.setAccessible(true);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
f297a = field;
}
}
/* loaded from: classes.dex */
public class ResolveHoverRunnable implements Runnable {
public ResolveHoverRunnable() {
}
@Override // java.lang.Runnable
public final void run() {
DropDownListView dropDownListView = DropDownListView.this;
dropDownListView.p = null;
dropDownListView.drawableStateChanged();
}
}
public DropDownListView(Context context, boolean z) {
super(context, null, R.attr.dropDownListViewStyle);
this.f294c = new Rect();
this.f = 0;
this.g = 0;
this.h = 0;
this.i = 0;
this.m = z;
setCacheColorHint(0);
}
public int a(int i, int i2) {
int makeMeasureSpec;
int listPaddingTop = getListPaddingTop();
int listPaddingBottom = getListPaddingBottom();
int dividerHeight = getDividerHeight();
Drawable divider = getDivider();
ListAdapter adapter = getAdapter();
if (adapter == null) {
return listPaddingTop + listPaddingBottom;
}
int i3 = listPaddingTop + listPaddingBottom;
if (dividerHeight <= 0 || divider == null) {
dividerHeight = 0;
}
int count = adapter.getCount();
int i4 = 0;
View view = null;
for (int i5 = 0; i5 < count; i5++) {
int itemViewType = adapter.getItemViewType(i5);
if (itemViewType != i4) {
view = null;
i4 = itemViewType;
}
view = adapter.getView(i5, view, this);
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams == null) {
layoutParams = generateDefaultLayoutParams();
view.setLayoutParams(layoutParams);
}
int i6 = layoutParams.height;
if (i6 > 0) {
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i6, 1073741824);
} else {
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
}
view.measure(i, makeMeasureSpec);
view.forceLayout();
if (i5 > 0) {
i3 += dividerHeight;
}
i3 += view.getMeasuredHeight();
if (i3 >= i2) {
return i2;
}
}
return i3;
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0167 */
/* JADX WARN: Removed duplicated region for block: B:17:0x017d */
/* JADX WARN: Removed duplicated region for block: B:25:0x0162 */
/* JADX WARN: Removed duplicated region for block: B:9:0x014a A[ADDED_TO_REGION] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean b(android.view.MotionEvent r18, int r19) {
/*
Method dump skipped, instructions count: 396
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DropDownListView.b(android.view.MotionEvent, int):boolean");
}
@Override // android.widget.ListView, android.widget.AbsListView, android.view.ViewGroup, android.view.View
public final void dispatchDraw(Canvas canvas) {
Drawable selector;
Rect rect = this.f294c;
if (!rect.isEmpty() && (selector = getSelector()) != null) {
selector.setBounds(rect);
selector.draw(canvas);
}
super.dispatchDraw(canvas);
}
@Override // android.widget.AbsListView, android.view.ViewGroup, android.view.View
public final void drawableStateChanged() {
if (this.p == null) {
super.drawableStateChanged();
GateKeeperDrawable gateKeeperDrawable = this.k;
if (gateKeeperDrawable != null) {
gateKeeperDrawable.f = true;
}
Drawable selector = getSelector();
if (selector != null && this.n && isPressed()) {
selector.setState(getDrawableState());
}
}
}
@Override // android.view.ViewGroup, android.view.View
public boolean hasFocus() {
if (!this.m && !super.hasFocus()) {
return false;
}
return true;
}
@Override // android.view.View
public boolean hasWindowFocus() {
if (!this.m && !super.hasWindowFocus()) {
return false;
}
return true;
}
@Override // android.view.View
public boolean isFocused() {
if (!this.m && !super.isFocused()) {
return false;
}
return true;
}
@Override // android.view.View
public boolean isInTouchMode() {
if ((this.m && this.l) || super.isInTouchMode()) {
return true;
}
return false;
}
@Override // android.widget.ListView, android.widget.AbsListView, android.widget.AdapterView, android.view.ViewGroup, android.view.View
public final void onDetachedFromWindow() {
this.p = null;
super.onDetachedFromWindow();
}
@Override // android.view.View
public boolean onHoverEvent(MotionEvent motionEvent) {
int i = Build.VERSION.SDK_INT;
if (i < 26) {
return super.onHoverEvent(motionEvent);
}
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 10 && this.p == null) {
ResolveHoverRunnable resolveHoverRunnable = new ResolveHoverRunnable();
this.p = resolveHoverRunnable;
post(resolveHoverRunnable);
}
boolean onHoverEvent = super.onHoverEvent(motionEvent);
if (actionMasked != 9 && actionMasked != 7) {
setSelection(-1);
return onHoverEvent;
}
int pointToPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
if (pointToPosition != -1 && pointToPosition != getSelectedItemPosition()) {
View childAt = getChildAt(pointToPosition - getFirstVisiblePosition());
if (childAt.isEnabled()) {
requestFocus();
if (i >= 30 && Api30Impl.d) {
try {
Api30Impl.f295a.invoke(this, Integer.valueOf(pointToPosition), childAt, Boolean.FALSE, -1, -1);
Api30Impl.b.invoke(this, Integer.valueOf(pointToPosition));
Api30Impl.f296c.invoke(this, Integer.valueOf(pointToPosition));
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e2) {
e2.printStackTrace();
}
} else {
setSelectionFromTop(pointToPosition, childAt.getTop() - getTop());
}
}
Drawable selector = getSelector();
if (selector != null && this.n && isPressed()) {
selector.setState(getDrawableState());
}
}
return onHoverEvent;
}
@Override // android.widget.AbsListView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
if (motionEvent.getAction() == 0) {
this.j = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
}
ResolveHoverRunnable resolveHoverRunnable = this.p;
if (resolveHoverRunnable != null) {
DropDownListView dropDownListView = DropDownListView.this;
dropDownListView.p = null;
dropDownListView.removeCallbacks(resolveHoverRunnable);
}
return super.onTouchEvent(motionEvent);
}
public void setListSelectionHidden(boolean z) {
this.l = z;
}
/* JADX WARN: Type inference failed for: r0v3, types: [androidx.appcompat.widget.DropDownListView$GateKeeperDrawable, androidx.appcompat.graphics.drawable.DrawableWrapperCompat] */
@Override // android.widget.AbsListView
public void setSelector(Drawable drawable) {
GateKeeperDrawable gateKeeperDrawable;
if (drawable != null) {
?? drawableWrapperCompat = new DrawableWrapperCompat(drawable);
drawableWrapperCompat.f = true;
gateKeeperDrawable = drawableWrapperCompat;
} else {
gateKeeperDrawable = null;
}
this.k = gateKeeperDrawable;
super.setSelector(gateKeeperDrawable);
Rect rect = new Rect();
if (drawable != null) {
drawable.getPadding(rect);
}
this.f = rect.left;
this.g = rect.top;
this.h = rect.right;
this.i = rect.bottom;
}
}