soul-browser/sources/java/androidx/appcompat/view/menu/MenuItemImpl.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

655 lines
18 KiB
Java

package androidx.appcompat.view.menu;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.RestrictTo;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.internal.view.SupportMenuItem;
import androidx.core.view.ActionProvider;
import java.util.ArrayList;
import kotlin.io.ConstantsKt;
@RestrictTo
/* loaded from: classes.dex */
public final class MenuItemImpl implements SupportMenuItem {
public ActionProvider A;
public MenuItem.OnActionExpandListener B;
/* renamed from: a, reason: collision with root package name */
public final int f179a;
public final int b;
/* renamed from: c, reason: collision with root package name */
public final int f180c;
public final int d;
public CharSequence e;
public CharSequence f;
public Intent g;
public char h;
public char j;
public Drawable l;
public final MenuBuilder n;
public SubMenuBuilder o;
public MenuItem.OnMenuItemClickListener p;
public CharSequence q;
public CharSequence r;
public int y;
public View z;
public int i = ConstantsKt.DEFAULT_BLOCK_SIZE;
public int k = ConstantsKt.DEFAULT_BLOCK_SIZE;
public int m = 0;
public ColorStateList s = null;
public PorterDuff.Mode t = null;
public boolean u = false;
public boolean v = false;
public boolean w = false;
public int x = 16;
public boolean C = false;
/* renamed from: androidx.appcompat.view.menu.MenuItemImpl$1, reason: invalid class name */
/* loaded from: classes.dex */
class AnonymousClass1 implements ActionProvider.VisibilityListener {
public AnonymousClass1() {
}
}
public MenuItemImpl(MenuBuilder menuBuilder, int i, int i2, int i3, int i4, CharSequence charSequence, int i5) {
this.n = menuBuilder;
this.f179a = i2;
this.b = i;
this.f180c = i3;
this.d = i4;
this.e = charSequence;
this.y = i5;
}
public static void c(StringBuilder sb, int i, int i2, String str) {
if ((i & i2) == i2) {
sb.append(str);
}
}
@Override // androidx.core.internal.view.SupportMenuItem
public final SupportMenuItem a(ActionProvider actionProvider) {
ActionProvider actionProvider2 = this.A;
if (actionProvider2 != null) {
actionProvider2.f763c = null;
actionProvider2.b = null;
}
this.z = null;
this.A = actionProvider;
this.n.p(true);
ActionProvider actionProvider3 = this.A;
if (actionProvider3 != null) {
actionProvider3.h(new AnonymousClass1());
}
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem
public final ActionProvider b() {
return this.A;
}
@Override // android.view.MenuItem
public final boolean collapseActionView() {
if ((this.y & 8) == 0) {
return false;
}
if (this.z == null) {
return true;
}
MenuItem.OnActionExpandListener onActionExpandListener = this.B;
if (onActionExpandListener != null && !onActionExpandListener.onMenuItemActionCollapse(this)) {
return false;
}
return this.n.d(this);
}
public final Drawable d(Drawable drawable) {
if (drawable != null && this.w && (this.u || this.v)) {
drawable = drawable.mutate();
if (this.u) {
drawable.setTintList(this.s);
}
if (this.v) {
drawable.setTintMode(this.t);
}
this.w = false;
}
return drawable;
}
public final boolean e() {
ActionProvider actionProvider;
if ((this.y & 8) != 0) {
if (this.z == null && (actionProvider = this.A) != null) {
this.z = actionProvider.d(this);
}
if (this.z != null) {
return true;
}
return false;
}
return false;
}
@Override // android.view.MenuItem
public final boolean expandActionView() {
if (e()) {
MenuItem.OnActionExpandListener onActionExpandListener = this.B;
if (onActionExpandListener != null && !onActionExpandListener.onMenuItemActionExpand(this)) {
return false;
}
return this.n.f(this);
}
return false;
}
public final void f(boolean z) {
if (z) {
this.x |= 32;
} else {
this.x &= -33;
}
}
@Override // android.view.MenuItem
public final android.view.ActionProvider getActionProvider() {
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.getActionProvider()");
}
@Override // android.view.MenuItem
public final View getActionView() {
View view = this.z;
if (view != null) {
return view;
}
ActionProvider actionProvider = this.A;
if (actionProvider != null) {
View d = actionProvider.d(this);
this.z = d;
return d;
}
return null;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final int getAlphabeticModifiers() {
return this.k;
}
@Override // android.view.MenuItem
public final char getAlphabeticShortcut() {
return this.j;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final CharSequence getContentDescription() {
return this.q;
}
@Override // android.view.MenuItem
public final int getGroupId() {
return this.b;
}
@Override // android.view.MenuItem
public final Drawable getIcon() {
Drawable drawable = this.l;
if (drawable != null) {
return d(drawable);
}
int i = this.m;
if (i != 0) {
Drawable a2 = AppCompatResources.a(this.n.f176a, i);
this.m = 0;
this.l = a2;
return d(a2);
}
return null;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final ColorStateList getIconTintList() {
return this.s;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final PorterDuff.Mode getIconTintMode() {
return this.t;
}
@Override // android.view.MenuItem
public final Intent getIntent() {
return this.g;
}
@Override // android.view.MenuItem
public final int getItemId() {
return this.f179a;
}
@Override // android.view.MenuItem
public final ContextMenu.ContextMenuInfo getMenuInfo() {
return null;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final int getNumericModifiers() {
return this.i;
}
@Override // android.view.MenuItem
public final char getNumericShortcut() {
return this.h;
}
@Override // android.view.MenuItem
public final int getOrder() {
return this.f180c;
}
@Override // android.view.MenuItem
public final SubMenu getSubMenu() {
return this.o;
}
@Override // android.view.MenuItem
public final CharSequence getTitle() {
return this.e;
}
@Override // android.view.MenuItem
public final CharSequence getTitleCondensed() {
CharSequence charSequence = this.f;
if (charSequence != null) {
return charSequence;
}
return this.e;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final CharSequence getTooltipText() {
return this.r;
}
@Override // android.view.MenuItem
public final boolean hasSubMenu() {
if (this.o != null) {
return true;
}
return false;
}
@Override // android.view.MenuItem
public final boolean isActionViewExpanded() {
return this.C;
}
@Override // android.view.MenuItem
public final boolean isCheckable() {
if ((this.x & 1) == 1) {
return true;
}
return false;
}
@Override // android.view.MenuItem
public final boolean isChecked() {
if ((this.x & 2) == 2) {
return true;
}
return false;
}
@Override // android.view.MenuItem
public final boolean isEnabled() {
if ((this.x & 16) != 0) {
return true;
}
return false;
}
@Override // android.view.MenuItem
public final boolean isVisible() {
ActionProvider actionProvider = this.A;
if (actionProvider != null && actionProvider.g()) {
if ((this.x & 8) == 0 && this.A.b()) {
return true;
}
return false;
}
if ((this.x & 8) == 0) {
return true;
}
return false;
}
@Override // android.view.MenuItem
public final MenuItem setActionProvider(android.view.ActionProvider actionProvider) {
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.setActionProvider()");
}
@Override // android.view.MenuItem
public final MenuItem setActionView(View view) {
int i;
this.z = view;
this.A = null;
if (view != null && view.getId() == -1 && (i = this.f179a) > 0) {
view.setId(i);
}
MenuBuilder menuBuilder = this.n;
menuBuilder.k = true;
menuBuilder.p(true);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setAlphabeticShortcut(char c2) {
if (this.j == c2) {
return this;
}
this.j = Character.toLowerCase(c2);
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setCheckable(boolean z) {
int i = this.x;
int i2 = (z ? 1 : 0) | (i & (-2));
this.x = i2;
if (i != i2) {
this.n.p(false);
}
return this;
}
@Override // android.view.MenuItem
public final MenuItem setChecked(boolean z) {
boolean z2;
int i;
int i2 = this.x;
int i3 = i2 & 4;
int i4 = 2;
MenuBuilder menuBuilder = this.n;
if (i3 != 0) {
ArrayList arrayList = menuBuilder.f;
int size = arrayList.size();
menuBuilder.w();
for (int i5 = 0; i5 < size; i5++) {
MenuItemImpl menuItemImpl = (MenuItemImpl) arrayList.get(i5);
if (menuItemImpl.b == this.b && (menuItemImpl.x & 4) != 0 && menuItemImpl.isCheckable()) {
if (menuItemImpl == this) {
z2 = true;
} else {
z2 = false;
}
int i6 = menuItemImpl.x;
int i7 = i6 & (-3);
if (z2) {
i = 2;
} else {
i = 0;
}
int i8 = i | i7;
menuItemImpl.x = i8;
if (i6 != i8) {
menuItemImpl.n.p(false);
}
}
}
menuBuilder.v();
return this;
}
int i9 = i2 & (-3);
if (!z) {
i4 = 0;
}
int i10 = i9 | i4;
this.x = i10;
if (i2 != i10) {
menuBuilder.p(false);
}
return this;
}
@Override // android.view.MenuItem
public final /* bridge */ /* synthetic */ MenuItem setContentDescription(CharSequence charSequence) {
setContentDescription(charSequence);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setEnabled(boolean z) {
if (z) {
this.x |= 16;
} else {
this.x &= -17;
}
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setIcon(Drawable drawable) {
this.m = 0;
this.l = drawable;
this.w = true;
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final MenuItem setIconTintList(ColorStateList colorStateList) {
this.s = colorStateList;
this.u = true;
this.w = true;
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final MenuItem setIconTintMode(PorterDuff.Mode mode) {
this.t = mode;
this.v = true;
this.w = true;
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setIntent(Intent intent) {
this.g = intent;
return this;
}
@Override // android.view.MenuItem
public final MenuItem setNumericShortcut(char c2) {
if (this.h == c2) {
return this;
}
this.h = c2;
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
this.B = onActionExpandListener;
return this;
}
@Override // android.view.MenuItem
public final MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
this.p = onMenuItemClickListener;
return this;
}
@Override // android.view.MenuItem
public final MenuItem setShortcut(char c2, char c3) {
this.h = c2;
this.j = Character.toLowerCase(c3);
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final void setShowAsAction(int i) {
int i2 = i & 3;
if (i2 != 0 && i2 != 1 && i2 != 2) {
throw new IllegalArgumentException("SHOW_AS_ACTION_ALWAYS, SHOW_AS_ACTION_IF_ROOM, and SHOW_AS_ACTION_NEVER are mutually exclusive.");
}
this.y = i;
MenuBuilder menuBuilder = this.n;
menuBuilder.k = true;
menuBuilder.p(true);
}
@Override // android.view.MenuItem
public final MenuItem setShowAsActionFlags(int i) {
setShowAsAction(i);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setTitle(CharSequence charSequence) {
this.e = charSequence;
this.n.p(false);
SubMenuBuilder subMenuBuilder = this.o;
if (subMenuBuilder != null) {
subMenuBuilder.setHeaderTitle(charSequence);
}
return this;
}
@Override // android.view.MenuItem
public final MenuItem setTitleCondensed(CharSequence charSequence) {
this.f = charSequence;
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final /* bridge */ /* synthetic */ MenuItem setTooltipText(CharSequence charSequence) {
setTooltipText(charSequence);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setVisible(boolean z) {
int i;
int i2 = this.x;
int i3 = i2 & (-9);
if (z) {
i = 0;
} else {
i = 8;
}
int i4 = i | i3;
this.x = i4;
if (i2 != i4) {
MenuBuilder menuBuilder = this.n;
menuBuilder.h = true;
menuBuilder.p(true);
}
return this;
}
public final String toString() {
CharSequence charSequence = this.e;
if (charSequence != null) {
return charSequence.toString();
}
return null;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final SupportMenuItem setContentDescription(CharSequence charSequence) {
this.q = charSequence;
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final SupportMenuItem setTooltipText(CharSequence charSequence) {
this.r = charSequence;
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final MenuItem setAlphabeticShortcut(char c2, int i) {
if (this.j == c2 && this.k == i) {
return this;
}
this.j = Character.toLowerCase(c2);
this.k = KeyEvent.normalizeMetaState(i);
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final MenuItem setNumericShortcut(char c2, int i) {
if (this.h == c2 && this.i == i) {
return this;
}
this.h = c2;
this.i = KeyEvent.normalizeMetaState(i);
this.n.p(false);
return this;
}
@Override // androidx.core.internal.view.SupportMenuItem, android.view.MenuItem
public final MenuItem setShortcut(char c2, char c3, int i, int i2) {
this.h = c2;
this.i = KeyEvent.normalizeMetaState(i);
this.j = Character.toLowerCase(c3);
this.k = KeyEvent.normalizeMetaState(i2);
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setIcon(int i) {
this.l = null;
this.m = i;
this.w = true;
this.n.p(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setTitle(int i) {
setTitle(this.n.f176a.getString(i));
return this;
}
@Override // android.view.MenuItem
public final MenuItem setActionView(int i) {
int i2;
MenuBuilder menuBuilder = this.n;
Context context = menuBuilder.f176a;
View inflate = LayoutInflater.from(context).inflate(i, (ViewGroup) new LinearLayout(context), false);
this.z = inflate;
this.A = null;
if (inflate != null && inflate.getId() == -1 && (i2 = this.f179a) > 0) {
inflate.setId(i2);
}
menuBuilder.k = true;
menuBuilder.p(true);
return this;
}
}