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

410 lines
16 KiB
Java

package androidx.appcompat.widget;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Editable;
import android.text.method.KeyListener;
import android.text.method.NumberKeyListener;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ActionMode;
import android.view.DragEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.view.textclassifier.TextClassifier;
import android.widget.EditText;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.appcompat.R;
import androidx.appcompat.widget.AppCompatReceiveContentHelper;
import androidx.appcompat.widget.AppCompatTextClassifierHelper;
import androidx.core.view.ContentInfoCompat;
import androidx.core.view.OnReceiveContentViewBehavior;
import androidx.core.view.TintableBackgroundView;
import androidx.core.view.ViewCompat;
import androidx.core.view.inputmethod.EditorInfoCompat;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.widget.TextViewCompat;
import androidx.core.widget.TextViewOnReceiveContentListener;
import androidx.core.widget.TintableCompoundDrawablesView;
/* loaded from: classes.dex */
public class AppCompatEditText extends EditText implements TintableBackgroundView, OnReceiveContentViewBehavior, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
/* renamed from: c, reason: collision with root package name */
public final AppCompatBackgroundHelper f239c;
public final AppCompatTextHelper f;
public final AppCompatTextClassifierHelper g;
public final TextViewOnReceiveContentListener h;
public final AppCompatEmojiEditTextHelper i;
public SuperCaller j;
@RequiresApi
@RestrictTo
/* loaded from: classes.dex */
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
/* renamed from: a, reason: collision with root package name */
public int f240a;
public int b;
/* renamed from: c, reason: collision with root package name */
public int f241c;
public int d;
public final void mapProperties(PropertyMapper propertyMapper) {
this.f240a = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.b = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.f241c = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.d = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
}
public final void readProperties(Object obj, PropertyReader propertyReader) {
AppCompatEditText appCompatEditText = (AppCompatEditText) obj;
propertyReader.readObject(this.f240a, appCompatEditText.getBackgroundTintList());
propertyReader.readObject(this.b, appCompatEditText.getBackgroundTintMode());
propertyReader.readObject(this.f241c, appCompatEditText.getCompoundDrawableTintList());
propertyReader.readObject(this.d, appCompatEditText.getCompoundDrawableTintMode());
}
}
@RequiresApi
/* loaded from: classes.dex */
public class SuperCaller {
public SuperCaller() {
}
}
public AppCompatEditText(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R.attr.editTextStyle);
}
@NonNull
@RequiresApi
@UiThread
private SuperCaller getSuperCaller() {
if (this.j == null) {
this.j = new SuperCaller();
}
return this.j;
}
@Override // androidx.core.view.OnReceiveContentViewBehavior
public final ContentInfoCompat a(ContentInfoCompat contentInfoCompat) {
return this.h.a(this, contentInfoCompat);
}
@Override // android.widget.TextView, android.view.View
public final void drawableStateChanged() {
super.drawableStateChanged();
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.a();
}
AppCompatTextHelper appCompatTextHelper = this.f;
if (appCompatTextHelper != null) {
appCompatTextHelper.b();
}
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.g(super.getCustomSelectionActionModeCallback());
}
@Nullable
@RestrictTo
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.b();
}
return null;
}
@Nullable
@RestrictTo
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.c();
}
return null;
}
@Nullable
@RestrictTo
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.f.d();
}
@Nullable
@RestrictTo
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.f.e();
}
@Override // android.widget.TextView
@NonNull
@RequiresApi
public TextClassifier getTextClassifier() {
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
if (Build.VERSION.SDK_INT < 28 && (appCompatTextClassifierHelper = this.g) != null) {
TextClassifier textClassifier = appCompatTextClassifierHelper.b;
if (textClassifier == null) {
return AppCompatTextClassifierHelper.Api26Impl.a(appCompatTextClassifierHelper.f272a);
}
return textClassifier;
}
return super.getTextClassifier();
}
@Override // android.widget.TextView, android.view.View
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
String[] m;
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
this.f.getClass();
int i = Build.VERSION.SDK_INT;
if (i < 30 && onCreateInputConnection != null) {
EditorInfoCompat.c(editorInfo, getText());
}
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
if (onCreateInputConnection != null && i <= 30 && (m = ViewCompat.m(this)) != null) {
EditorInfoCompat.b(editorInfo, m);
onCreateInputConnection = InputConnectionCompat.a(this, onCreateInputConnection, editorInfo);
}
return this.i.b.b(onCreateInputConnection, editorInfo);
}
@Override // android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
int i = Build.VERSION.SDK_INT;
if (i >= 30 && i < 33) {
((InputMethodManager) getContext().getSystemService("input_method")).isActive(this);
}
}
@Override // android.widget.TextView, android.view.View
public boolean onDragEvent(DragEvent dragEvent) {
Activity activity;
int i = Build.VERSION.SDK_INT;
boolean z = false;
if (i < 31 && i >= 24 && dragEvent.getLocalState() == null && ViewCompat.m(this) != null) {
Context context = getContext();
while (true) {
if (context instanceof ContextWrapper) {
if (context instanceof Activity) {
activity = (Activity) context;
break;
}
context = ((ContextWrapper) context).getBaseContext();
} else {
activity = null;
break;
}
}
if (activity == null) {
Log.i("ReceiveContent", "Can't handle drop: no activity: view=" + this);
} else if (dragEvent.getAction() != 1 && dragEvent.getAction() == 3) {
z = AppCompatReceiveContentHelper.OnDropApi24Impl.a(dragEvent, this, activity);
}
}
if (z) {
return true;
}
return super.onDragEvent(dragEvent);
}
@Override // android.widget.EditText, android.widget.TextView
public final boolean onTextContextMenuItem(int i) {
ClipData primaryClip;
int i2;
if (Build.VERSION.SDK_INT < 31 && ViewCompat.m(this) != null && (i == 16908322 || i == 16908337)) {
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService("clipboard");
if (clipboardManager == null) {
primaryClip = null;
} else {
primaryClip = clipboardManager.getPrimaryClip();
}
if (primaryClip != null && primaryClip.getItemCount() > 0) {
ContentInfoCompat.Builder builder = new ContentInfoCompat.Builder(primaryClip, 1);
if (i == 16908322) {
i2 = 0;
} else {
i2 = 1;
}
builder.c(i2);
ViewCompat.u(this, builder.a());
}
return true;
}
return super.onTextContextMenuItem(i);
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.e();
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.f(i);
}
}
@Override // android.widget.TextView
public final void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.f;
if (appCompatTextHelper != null) {
appCompatTextHelper.b();
}
}
@Override // android.widget.TextView
public final void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.f;
if (appCompatTextHelper != null) {
appCompatTextHelper.b();
}
}
@Override // android.widget.TextView
public void setCustomSelectionActionModeCallback(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.h(callback, this));
}
public void setEmojiCompatEnabled(boolean z) {
this.i.b.c(z);
}
@Override // android.widget.TextView
public void setKeyListener(@Nullable KeyListener keyListener) {
super.setKeyListener(this.i.a(keyListener));
}
@RestrictTo
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.h(colorStateList);
}
}
@RestrictTo
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.f239c;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.i(mode);
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
AppCompatTextHelper appCompatTextHelper = this.f;
appCompatTextHelper.k(colorStateList);
appCompatTextHelper.b();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatTextHelper appCompatTextHelper = this.f;
appCompatTextHelper.l(mode);
appCompatTextHelper.b();
}
@Override // android.widget.TextView
public final void setTextAppearance(Context context, int i) {
super.setTextAppearance(context, i);
AppCompatTextHelper appCompatTextHelper = this.f;
if (appCompatTextHelper != null) {
appCompatTextHelper.g(context, i);
}
}
@Override // android.widget.TextView
@RequiresApi
public void setTextClassifier(@Nullable TextClassifier textClassifier) {
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
if (Build.VERSION.SDK_INT < 28 && (appCompatTextClassifierHelper = this.g) != null) {
appCompatTextClassifierHelper.b = textClassifier;
} else {
super.setTextClassifier(textClassifier);
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Type inference failed for: r4v4, types: [androidx.appcompat.widget.AppCompatTextClassifierHelper, java.lang.Object] */
/* JADX WARN: Type inference failed for: r4v5, types: [androidx.core.widget.TextViewOnReceiveContentListener, java.lang.Object] */
public AppCompatEditText(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
TintContextWrapper.a(context);
ThemeUtils.a(getContext(), this);
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
this.f239c = appCompatBackgroundHelper;
appCompatBackgroundHelper.d(attributeSet, i);
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
this.f = appCompatTextHelper;
appCompatTextHelper.f(attributeSet, i);
appCompatTextHelper.b();
?? obj = new Object();
obj.f272a = this;
this.g = obj;
this.h = new Object();
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
this.i = appCompatEmojiEditTextHelper;
appCompatEmojiEditTextHelper.b(attributeSet, i);
KeyListener keyListener = getKeyListener();
if (keyListener instanceof NumberKeyListener) {
return;
}
boolean isFocusable = super.isFocusable();
boolean isClickable = super.isClickable();
boolean isLongClickable = super.isLongClickable();
int inputType = super.getInputType();
KeyListener a2 = appCompatEmojiEditTextHelper.a(keyListener);
if (a2 == keyListener) {
return;
}
super.setKeyListener(a2);
super.setRawInputType(inputType);
super.setFocusable(isFocusable);
super.setClickable(isClickable);
super.setLongClickable(isLongClickable);
}
@Override // android.widget.EditText, android.widget.TextView
@Nullable
public Editable getText() {
if (Build.VERSION.SDK_INT >= 28) {
return super.getText();
}
return super.getEditableText();
}
}