soul-browser/sources/java/com/google/common/base/Splitter.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

212 lines
6.8 KiB
Java

package com.google.common.base;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.AbstractIterator;
import com.google.common.base.CharMatcher;
import com.google.common.base.JdkPattern;
import j$.util.DesugarCollections;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
@GwtCompatible
/* loaded from: classes3.dex */
public final class Splitter {
/* renamed from: a, reason: collision with root package name */
public final CharMatcher f12183a;
public final boolean b;
/* renamed from: c, reason: collision with root package name */
public final Strategy f12184c;
public final int d;
/* renamed from: com.google.common.base.Splitter$3, reason: invalid class name */
/* loaded from: classes3.dex */
class AnonymousClass3 extends SplittingIterator {
@Override // com.google.common.base.Splitter.SplittingIterator
public final int b(int i) {
throw null;
}
@Override // com.google.common.base.Splitter.SplittingIterator
public final int c(int i) {
throw null;
}
}
/* renamed from: com.google.common.base.Splitter$4, reason: invalid class name */
/* loaded from: classes3.dex */
class AnonymousClass4 extends SplittingIterator {
@Override // com.google.common.base.Splitter.SplittingIterator
public final int b(int i) {
return i;
}
@Override // com.google.common.base.Splitter.SplittingIterator
public final int c(int i) {
if (i < this.g.length()) {
return i;
}
return -1;
}
}
/* loaded from: classes3.dex */
public static final class MapSplitter {
}
/* loaded from: classes3.dex */
public static abstract class SplittingIterator extends AbstractIterator<String> {
public final CharSequence g;
public final CharMatcher h;
public final boolean i;
public int j;
public int k;
public SplittingIterator(Splitter splitter, CharSequence charSequence) {
this.f12149c = AbstractIterator.State.f;
this.j = 0;
this.h = splitter.f12183a;
this.i = splitter.b;
this.k = splitter.d;
this.g = charSequence;
}
@Override // com.google.common.base.AbstractIterator
public final Object a() {
int c2;
CharSequence charSequence;
CharMatcher charMatcher;
int i = this.j;
while (true) {
int i2 = this.j;
if (i2 != -1) {
c2 = c(i2);
charSequence = this.g;
if (c2 == -1) {
c2 = charSequence.length();
this.j = -1;
} else {
this.j = b(c2);
}
int i3 = this.j;
if (i3 == i) {
int i4 = i3 + 1;
this.j = i4;
if (i4 > charSequence.length()) {
this.j = -1;
}
} else {
while (true) {
charMatcher = this.h;
if (i >= c2 || !charMatcher.m(charSequence.charAt(i))) {
break;
}
i++;
}
while (c2 > i && charMatcher.m(charSequence.charAt(c2 - 1))) {
c2--;
}
if (!this.i || i != c2) {
break;
}
i = this.j;
}
} else {
this.f12149c = AbstractIterator.State.g;
return null;
}
}
int i5 = this.k;
if (i5 == 1) {
c2 = charSequence.length();
this.j = -1;
while (c2 > i && charMatcher.m(charSequence.charAt(c2 - 1))) {
c2--;
}
} else {
this.k = i5 - 1;
}
return charSequence.subSequence(i, c2).toString();
}
public abstract int b(int i);
public abstract int c(int i);
}
/* loaded from: classes3.dex */
public interface Strategy {
Iterator a(Splitter splitter, CharSequence charSequence);
}
public Splitter(Strategy strategy, boolean z, CharMatcher charMatcher, int i) {
this.f12184c = strategy;
this.b = z;
this.f12183a = charMatcher;
this.d = i;
}
public static Splitter a(char c2) {
return new Splitter(new a(1, new CharMatcher.Is(c2)));
}
public static void b() {
Preconditions.c("The pattern may not match the empty string: %s", new JdkPattern(Pattern.compile("\r\n|\n|\r")), !new JdkPattern.JdkMatcher(r0.f12167c.matcher(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED)).f12168a.matches());
}
public final Iterable c(final String str) {
str.getClass();
return new Iterable<String>(this) { // from class: com.google.common.base.Splitter.5
public final /* synthetic */ Splitter f;
{
this.f = this;
}
@Override // java.lang.Iterable
public final Iterator<String> iterator() {
CharSequence charSequence = str;
Splitter splitter = this.f;
return splitter.f12184c.a(splitter, charSequence);
}
public final String toString() {
Joiner joiner = new Joiner(", ");
StringBuilder sb = new StringBuilder();
sb.append('[');
try {
joiner.a(sb, iterator());
sb.append(']');
return sb.toString();
} catch (IOException e) {
throw new AssertionError(e);
}
}
};
}
public final List d(String str) {
str.getClass();
Iterator a2 = this.f12184c.a(this, str);
ArrayList arrayList = new ArrayList();
while (a2.hasNext()) {
arrayList.add((String) a2.next());
}
return DesugarCollections.unmodifiableList(arrayList);
}
public final Splitter e() {
CharMatcher charMatcher = CharMatcher.Whitespace.g;
charMatcher.getClass();
return new Splitter(this.f12184c, this.b, charMatcher, this.d);
}
public Splitter(Strategy strategy) {
this(strategy, false, CharMatcher.None.f, Integer.MAX_VALUE);
}
}