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

228 lines
7.4 KiB
Java

package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
import com.google.errorprone.annotations.DoNotMock;
import j$.lang.Iterable;
import j$.util.Collection;
import j$.util.Spliterator;
import j$.util.Spliterators;
import j$.util.stream.Stream;
import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Arrays;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.stream.Stream;
@DoNotMock
@GwtCompatible
/* loaded from: classes3.dex */
public abstract class ImmutableCollection<E> extends AbstractCollection<E> implements Serializable, Collection {
/* renamed from: c, reason: collision with root package name */
public static final Object[] f12287c = new Object[0];
/* loaded from: classes3.dex */
public static abstract class ArrayBasedBuilder<E> extends Builder<E> {
/* renamed from: a, reason: collision with root package name */
public Object[] f12288a;
public int b;
/* renamed from: c, reason: collision with root package name */
public boolean f12289c;
public ArrayBasedBuilder(int i) {
CollectPreconditions.b(i, "initialCapacity");
this.f12288a = new Object[i];
this.b = 0;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
/* renamed from: c, reason: merged with bridge method [inline-methods] */
public ArrayBasedBuilder a(Object obj) {
obj.getClass();
d(1);
Object[] objArr = this.f12288a;
int i = this.b;
this.b = i + 1;
objArr[i] = obj;
return this;
}
public final void d(int i) {
Object[] objArr = this.f12288a;
int b = Builder.b(objArr.length, this.b + i);
if (b <= objArr.length && !this.f12289c) {
return;
}
this.f12288a = Arrays.copyOf(this.f12288a, b);
this.f12289c = false;
}
}
@DoNotMock
/* loaded from: classes3.dex */
public static abstract class Builder<E> {
public static int b(int i, int i2) {
if (i2 >= 0) {
if (i2 <= i) {
return i;
}
int i3 = i + (i >> 1) + 1;
if (i3 < i2) {
i3 = Integer.highestOneBit(i2 - 1) << 1;
}
if (i3 < 0) {
return Integer.MAX_VALUE;
}
return i3;
}
throw new IllegalArgumentException("cannot store more than Integer.MAX_VALUE elements");
}
public abstract Builder a(Object obj);
}
public ImmutableList a() {
if (isEmpty()) {
UnmodifiableListIterator unmodifiableListIterator = ImmutableList.f;
return RegularImmutableList.i;
}
Object[] array = toArray(f12287c);
UnmodifiableListIterator unmodifiableListIterator2 = ImmutableList.f;
return ImmutableList.q(array.length, array);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean add(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean addAll(java.util.Collection collection) {
throw new UnsupportedOperationException();
}
public int c(int i, Object[] objArr) {
UnmodifiableIterator it = iterator();
while (it.hasNext()) {
objArr[i] = it.next();
i++;
}
return i;
}
@Override // java.util.AbstractCollection, java.util.Collection
public final void clear() {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public abstract boolean contains(Object obj);
@Override // java.lang.Iterable, j$.util.Collection, j$.lang.Iterable
public /* synthetic */ void forEach(Consumer consumer) {
Iterable.CC.$default$forEach(this, consumer);
}
public Object[] g() {
return null;
}
public int i() {
throw new UnsupportedOperationException();
}
public int k() {
throw new UnsupportedOperationException();
}
public abstract boolean m();
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
/* renamed from: p, reason: merged with bridge method [inline-methods] */
public abstract UnmodifiableIterator iterator();
@Override // java.util.Collection
public /* synthetic */ Stream parallelStream() {
return Stream.Wrapper.convert(parallelStream());
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean remove(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean removeAll(java.util.Collection collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection, j$.util.Collection
public /* synthetic */ boolean removeIf(Predicate predicate) {
return Collection.CC.$default$removeIf(this, predicate);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean retainAll(java.util.Collection collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection, java.lang.Iterable
public /* synthetic */ Spliterator spliterator() {
return Spliterator.Wrapper.convert(spliterator());
}
@Override // java.util.Collection
public /* synthetic */ java.util.stream.Stream stream() {
return Stream.Wrapper.convert(stream());
}
@Override // java.util.Collection, j$.util.Collection
public /* synthetic */ Object[] toArray(IntFunction intFunction) {
return Collection.CC.$default$toArray(this, intFunction);
}
@Override // java.util.Collection, j$.util.Collection
public /* synthetic */ j$.util.stream.Stream parallelStream() {
return Collection.CC.$default$parallelStream(this);
}
@Override // java.util.Collection, java.lang.Iterable, j$.util.Collection, j$.lang.Iterable
public final j$.util.Spliterator spliterator() {
return Spliterators.spliterator(this, 1296);
}
@Override // java.util.Collection, j$.util.Collection
public /* synthetic */ j$.util.stream.Stream stream() {
return Collection.CC.$default$stream(this);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final Object[] toArray() {
return toArray(f12287c);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final Object[] toArray(Object[] objArr) {
objArr.getClass();
int size = size();
if (objArr.length < size) {
Object[] g = g();
if (g != null) {
return Arrays.copyOfRange(g, k(), i(), objArr.getClass());
}
if (objArr.length != 0) {
objArr = Arrays.copyOf(objArr, 0);
}
objArr = Arrays.copyOf(objArr, size);
} else if (objArr.length > size) {
objArr[size] = null;
}
c(0, objArr);
return objArr;
}
}