* 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>
311 lines
12 KiB
Java
311 lines
12 KiB
Java
package androidx.core.widget;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.ActivityInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.ResolveInfo;
|
|
import android.graphics.Paint;
|
|
import android.icu.text.DecimalFormatSymbols;
|
|
import android.os.Build;
|
|
import android.text.Editable;
|
|
import android.text.PrecomputedText;
|
|
import android.text.TextDirectionHeuristic;
|
|
import android.text.TextDirectionHeuristics;
|
|
import android.text.TextPaint;
|
|
import android.text.method.PasswordTransformationMethod;
|
|
import android.util.TypedValue;
|
|
import android.view.ActionMode;
|
|
import android.view.Menu;
|
|
import android.view.MenuItem;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.appcompat.widget.AppCompatTextView;
|
|
import androidx.core.text.PrecomputedTextCompat;
|
|
import androidx.core.util.Preconditions;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class TextViewCompat {
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api23Impl {
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api24Impl {
|
|
public static DecimalFormatSymbols a(Locale locale) {
|
|
return DecimalFormatSymbols.getInstance(locale);
|
|
}
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api26Impl {
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api28Impl {
|
|
public static String[] a(DecimalFormatSymbols decimalFormatSymbols) {
|
|
return decimalFormatSymbols.getDigitStrings();
|
|
}
|
|
|
|
public static PrecomputedText.Params b(AppCompatTextView appCompatTextView) {
|
|
return appCompatTextView.getTextMetricsParams();
|
|
}
|
|
|
|
public static void c(TextView textView, int i) {
|
|
textView.setFirstBaselineToTopHeight(i);
|
|
}
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api34Impl {
|
|
public static void a(TextView textView, int i, float f) {
|
|
textView.setLineHeight(i, f);
|
|
}
|
|
}
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
@RestrictTo
|
|
/* loaded from: classes.dex */
|
|
public @interface AutoSizeTextType {
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class OreoCallback implements ActionMode.Callback {
|
|
|
|
/* renamed from: a, reason: collision with root package name */
|
|
public final ActionMode.Callback f861a;
|
|
public final TextView b;
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public Class f862c;
|
|
public Method d;
|
|
public boolean e;
|
|
public boolean f = false;
|
|
|
|
public OreoCallback(ActionMode.Callback callback, TextView textView) {
|
|
this.f861a = callback;
|
|
this.b = textView;
|
|
}
|
|
|
|
@Override // android.view.ActionMode.Callback
|
|
public final boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
|
|
return this.f861a.onActionItemClicked(actionMode, menuItem);
|
|
}
|
|
|
|
@Override // android.view.ActionMode.Callback
|
|
public final boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
|
|
return this.f861a.onCreateActionMode(actionMode, menu);
|
|
}
|
|
|
|
@Override // android.view.ActionMode.Callback
|
|
public final void onDestroyActionMode(ActionMode actionMode) {
|
|
this.f861a.onDestroyActionMode(actionMode);
|
|
}
|
|
|
|
@Override // android.view.ActionMode.Callback
|
|
public final boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
|
|
Method declaredMethod;
|
|
boolean z;
|
|
TextView textView = this.b;
|
|
Context context = textView.getContext();
|
|
PackageManager packageManager = context.getPackageManager();
|
|
boolean z2 = this.f;
|
|
Class<?> cls = Integer.TYPE;
|
|
if (!z2) {
|
|
this.f = true;
|
|
try {
|
|
Class<?> cls2 = Class.forName("com.android.internal.view.menu.MenuBuilder");
|
|
this.f862c = cls2;
|
|
this.d = cls2.getDeclaredMethod("removeItemAt", cls);
|
|
this.e = true;
|
|
} catch (ClassNotFoundException | NoSuchMethodException unused) {
|
|
this.f862c = null;
|
|
this.d = null;
|
|
this.e = false;
|
|
}
|
|
}
|
|
try {
|
|
if (this.e && this.f862c.isInstance(menu)) {
|
|
declaredMethod = this.d;
|
|
} else {
|
|
declaredMethod = menu.getClass().getDeclaredMethod("removeItemAt", cls);
|
|
}
|
|
for (int size = menu.size() - 1; size >= 0; size--) {
|
|
MenuItem item = menu.getItem(size);
|
|
if (item.getIntent() != null && "android.intent.action.PROCESS_TEXT".equals(item.getIntent().getAction())) {
|
|
declaredMethod.invoke(menu, Integer.valueOf(size));
|
|
}
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
if (context instanceof Activity) {
|
|
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(new Intent().setAction("android.intent.action.PROCESS_TEXT").setType("text/plain"), 0)) {
|
|
if (!context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
|
|
ActivityInfo activityInfo = resolveInfo.activityInfo;
|
|
if (activityInfo.exported) {
|
|
String str = activityInfo.permission;
|
|
if (str != null && context.checkSelfPermission(str) != 0) {
|
|
}
|
|
}
|
|
}
|
|
arrayList.add(resolveInfo);
|
|
}
|
|
}
|
|
for (int i = 0; i < arrayList.size(); i++) {
|
|
ResolveInfo resolveInfo2 = (ResolveInfo) arrayList.get(i);
|
|
MenuItem add = menu.add(0, 0, i + 100, resolveInfo2.loadLabel(packageManager));
|
|
Intent type = new Intent().setAction("android.intent.action.PROCESS_TEXT").setType("text/plain");
|
|
if ((textView instanceof Editable) && textView.onCheckIsTextEditor() && textView.isEnabled()) {
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
Intent putExtra = type.putExtra("android.intent.extra.PROCESS_TEXT_READONLY", !z);
|
|
ActivityInfo activityInfo2 = resolveInfo2.activityInfo;
|
|
add.setIntent(putExtra.setClassName(activityInfo2.packageName, activityInfo2.name)).setShowAsAction(1);
|
|
}
|
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused2) {
|
|
}
|
|
return this.f861a.onPrepareActionMode(actionMode, menu);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r2v0, types: [java.lang.Object, androidx.core.text.PrecomputedTextCompat$Params$Builder] */
|
|
public static PrecomputedTextCompat.Params a(AppCompatTextView appCompatTextView) {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 28) {
|
|
return new PrecomputedTextCompat.Params(Api28Impl.b(appCompatTextView));
|
|
}
|
|
TextPaint textPaint = new TextPaint(appCompatTextView.getPaint());
|
|
?? obj = new Object();
|
|
boolean z = true;
|
|
obj.f749a = 1;
|
|
obj.b = 1;
|
|
TextDirectionHeuristic textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_LTR;
|
|
obj.f749a = appCompatTextView.getBreakStrategy();
|
|
obj.b = appCompatTextView.getHyphenationFrequency();
|
|
if (appCompatTextView.getTransformationMethod() instanceof PasswordTransformationMethod) {
|
|
textDirectionHeuristic = TextDirectionHeuristics.LTR;
|
|
} else if (i >= 28 && (appCompatTextView.getInputType() & 15) == 3) {
|
|
byte directionality = Character.getDirectionality(Api28Impl.a(Api24Impl.a(appCompatTextView.getTextLocale()))[0].codePointAt(0));
|
|
textDirectionHeuristic = (directionality == 1 || directionality == 2) ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR;
|
|
} else {
|
|
if (appCompatTextView.getLayoutDirection() != 1) {
|
|
z = false;
|
|
}
|
|
switch (appCompatTextView.getTextDirection()) {
|
|
case 2:
|
|
textDirectionHeuristic = TextDirectionHeuristics.ANYRTL_LTR;
|
|
break;
|
|
case 3:
|
|
textDirectionHeuristic = TextDirectionHeuristics.LTR;
|
|
break;
|
|
case 4:
|
|
textDirectionHeuristic = TextDirectionHeuristics.RTL;
|
|
break;
|
|
case 5:
|
|
textDirectionHeuristic = TextDirectionHeuristics.LOCALE;
|
|
break;
|
|
case 6:
|
|
break;
|
|
case 7:
|
|
textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_RTL;
|
|
break;
|
|
default:
|
|
if (z) {
|
|
textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_RTL;
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return new PrecomputedTextCompat.Params(textPaint, textDirectionHeuristic, obj.f749a, obj.b);
|
|
}
|
|
|
|
public static void b(TextView textView, int i) {
|
|
int i2;
|
|
Preconditions.b(i);
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
Api28Impl.c(textView, i);
|
|
return;
|
|
}
|
|
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
|
|
if (textView.getIncludeFontPadding()) {
|
|
i2 = fontMetricsInt.top;
|
|
} else {
|
|
i2 = fontMetricsInt.ascent;
|
|
}
|
|
if (i > Math.abs(i2)) {
|
|
textView.setPadding(textView.getPaddingLeft(), i + i2, textView.getPaddingRight(), textView.getPaddingBottom());
|
|
}
|
|
}
|
|
|
|
public static void c(TextView textView, int i) {
|
|
int i2;
|
|
Preconditions.b(i);
|
|
Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
|
|
if (textView.getIncludeFontPadding()) {
|
|
i2 = fontMetricsInt.bottom;
|
|
} else {
|
|
i2 = fontMetricsInt.descent;
|
|
}
|
|
if (i > Math.abs(i2)) {
|
|
textView.setPadding(textView.getPaddingLeft(), textView.getPaddingTop(), textView.getPaddingRight(), i - i2);
|
|
}
|
|
}
|
|
|
|
public static void d(TextView textView, int i) {
|
|
Preconditions.b(i);
|
|
if (i != textView.getPaint().getFontMetricsInt(null)) {
|
|
textView.setLineSpacing(i - r0, 1.0f);
|
|
}
|
|
}
|
|
|
|
public static void e(TextView textView, int i, float f) {
|
|
if (Build.VERSION.SDK_INT >= 34) {
|
|
Api34Impl.a(textView, i, f);
|
|
} else {
|
|
d(textView, Math.round(TypedValue.applyDimension(i, f, textView.getResources().getDisplayMetrics())));
|
|
}
|
|
}
|
|
|
|
public static void f(AppCompatTextView appCompatTextView, PrecomputedTextCompat precomputedTextCompat) {
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
appCompatTextView.setText(precomputedTextCompat.a());
|
|
return;
|
|
}
|
|
PrecomputedTextCompat.Params a2 = a(appCompatTextView);
|
|
precomputedTextCompat.getClass();
|
|
a2.a(null);
|
|
throw null;
|
|
}
|
|
|
|
public static ActionMode.Callback g(ActionMode.Callback callback) {
|
|
if ((callback instanceof OreoCallback) && Build.VERSION.SDK_INT >= 26) {
|
|
return ((OreoCallback) callback).f861a;
|
|
}
|
|
return callback;
|
|
}
|
|
|
|
public static ActionMode.Callback h(ActionMode.Callback callback, TextView textView) {
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 26 && i <= 27 && !(callback instanceof OreoCallback) && callback != null) {
|
|
return new OreoCallback(callback, textView);
|
|
}
|
|
return callback;
|
|
}
|
|
}
|