Update gradle, update dependencies and bump minSdkVersion to 23

New versions of Jetpack libraries require minSdkVersion 23.

There are a couple of changes in the code to fix incorrect usage of
annotations that started breaking the build after this Gradle update.
This commit is contained in:
Alexander Bakker 2025-05-23 13:40:08 +02:00
parent 819865230f
commit 6758ec498b
13 changed files with 378 additions and 296 deletions

View file

@ -26,7 +26,7 @@ android {
defaultConfig {
applicationId "${packageName}"
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 35
versionCode 77
versionName "3.3.4"
@ -96,13 +96,16 @@ android {
packagingOptions {
// R8 doesn't remove these resources, so exclude them manually. This reduces APK size by 4MB.
resources {
excludes += ['/org/bouncycastle/pqc/**/*.properties']
excludes += [
'/org/bouncycastle/pqc/**/*.properties',
'META-INF/versions/9/OSGI-INF/MANIFEST.MF'
]
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_17
coreLibraryDesugaringEnabled true
}
lint {
@ -141,13 +144,13 @@ aboutLibraries {
}
dependencies {
def cameraxVersion = '1.4.0'
def cameraxVersion = '1.4.2'
def glideVersion = '4.16.0'
def guavaVersion = '33.3.1'
def hiltVersion = '2.52'
def guavaVersion = '33.4.8'
def hiltVersion = '2.56.2'
def junitVersion = '4.13.2'
def libsuVersion = '6.0.0'
def roomVersion = "2.6.1"
def roomVersion = '2.7.1'
annotationProcessor 'androidx.annotation:annotation:1.9.1'
annotationProcessor "androidx.room:room-compiler:$roomVersion"
@ -155,18 +158,18 @@ dependencies {
annotationProcessor "com.github.bumptech.glide:compiler:${glideVersion}"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.activity:activity:1.9.3'
implementation 'androidx.activity:activity:1.10.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation "androidx.biometric:biometric:1.1.0"
implementation "androidx.camera:camera-camera2:$cameraxVersion"
implementation "androidx.camera:camera-lifecycle:$cameraxVersion"
implementation "androidx.camera:camera-view:$cameraxVersion"
implementation 'androidx.core:core:1.15.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.lifecycle:lifecycle-process:2.8.7'
implementation 'androidx.core:core:1.16.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'androidx.documentfile:documentfile:1.1.0'
implementation 'androidx.lifecycle:lifecycle-process:2.9.0'
implementation "androidx.preference:preference:1.2.1"
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation "androidx.room:room-runtime:$roomVersion"
implementation 'androidx.viewpager2:viewpager2:1.1.0'
implementation 'com.caverock:androidsvg-aar:1.4'
@ -181,7 +184,7 @@ dependencies {
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"
implementation "com.google.guava:guava:${guavaVersion}-android"
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.protobuf:protobuf-javalite:4.28.3'
implementation 'com.google.protobuf:protobuf-javalite:4.31.0'
implementation 'com.google.zxing:core:3.5.3'
implementation('com.mikepenz:aboutlibraries:11.2.3') {
exclude group: 'com.mikepenz', module: 'aboutlibraries-core'
@ -189,7 +192,7 @@ dependencies {
implementation 'com.mikepenz:aboutlibraries-core-android:11.2.3'
implementation 'com.nulab-inc:zxcvbn:1.9.0'
implementation 'net.lingala.zip4j:zip4j:2.11.5'
implementation 'org.bouncycastle:bcprov-jdk18on:1.79'
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
implementation 'org.simpleflatmapper:sfm-csv:8.2.3'
androidTestAnnotationProcessor "com.google.dagger:hilt-android-compiler:$hiltVersion"
@ -207,8 +210,8 @@ dependencies {
testImplementation 'androidx.test:core:1.6.1'
testImplementation "com.google.guava:guava:${guavaVersion}-jre"
testImplementation "junit:junit:${junitVersion}"
testImplementation 'org.json:json:20240303'
testImplementation 'org.robolectric:robolectric:4.14'
testImplementation 'org.json:json:20250517'
testImplementation 'org.robolectric:robolectric:4.14.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}

View file

@ -17,23 +17,14 @@ import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ProcessLifecycleOwner;
import androidx.room.Room;
import com.beemdevelopment.aegis.database.AppDatabase;
import com.beemdevelopment.aegis.database.AuditLogEntry;
import com.beemdevelopment.aegis.database.AuditLogRepository;
import com.beemdevelopment.aegis.receivers.VaultLockReceiver;
import com.beemdevelopment.aegis.ui.MainActivity;
import com.beemdevelopment.aegis.util.IOUtils;
import com.beemdevelopment.aegis.vault.VaultManager;
import com.topjohnwu.superuser.Shell;
import org.checkerframework.checker.units.qual.A;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import dagger.hilt.InstallIn;
import dagger.hilt.android.EarlyEntryPoint;

View file

@ -1,7 +1,5 @@
package com.beemdevelopment.aegis.crypto;
import android.os.Build;
import com.beemdevelopment.aegis.crypto.bc.SCrypt;
import java.io.ByteArrayOutputStream;
@ -23,7 +21,6 @@ import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class CryptoUtils {
@ -66,13 +63,7 @@ public class CryptoUtils {
// generate the nonce if none is given
// we are not allowed to do this ourselves as "setRandomizedEncryptionRequired" is set to true
if (nonce != null) {
AlgorithmParameterSpec spec;
// apparently kitkat doesn't support GCMParameterSpec
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
spec = new IvParameterSpec(nonce);
} else {
spec = new GCMParameterSpec(CRYPTO_AEAD_TAG_SIZE * 8, nonce);
}
AlgorithmParameterSpec spec = new GCMParameterSpec(CRYPTO_AEAD_TAG_SIZE * 8, nonce);
cipher.init(opmode, key, spec);
} else {
cipher.init(opmode, key);

View file

@ -1,11 +1,8 @@
package com.beemdevelopment.aegis.crypto;
import android.os.Build;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import androidx.annotation.RequiresApi;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -45,10 +42,6 @@ public class KeyStoreHandle {
}
public SecretKey generateKey(String id) throws KeyStoreHandleException {
if (!isSupported()) {
throw new KeyStoreHandleException("Symmetric KeyStore keys are not supported in this version of Android");
}
try {
KeyGenerator generator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, STORE_NAME);
generator.init(new KeyGenParameterSpec.Builder(id,
@ -87,14 +80,13 @@ public class KeyStoreHandle {
throw new KeyStoreHandleException(e);
}
if (isSupported() && isKeyPermanentlyInvalidated(key)) {
if (isKeyPermanentlyInvalidated(key)) {
return null;
}
return key;
}
@RequiresApi(api = Build.VERSION_CODES.M)
private static boolean isKeyPermanentlyInvalidated(SecretKey key) {
// try to initialize a dummy cipher and see if an InvalidKeyException is thrown
try {
@ -127,8 +119,4 @@ public class KeyStoreHandle {
throw new KeyStoreHandleException(e);
}
}
public static boolean isSupported() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}
}

View file

@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import androidx.annotation.Nullable;
@ -29,11 +28,7 @@ public class NotificationService extends Service {
@SuppressLint("LaunchActivityFromNotification")
public void serviceMethod() {
int flags = PendingIntent.FLAG_ONE_SHOT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
flags |= PendingIntent.FLAG_IMMUTABLE;
}
int flags = PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE;
Intent intent = new Intent(this, VaultLockReceiver.class);
intent.setAction(VaultLockReceiver.ACTION_LOCK_VAULT);
intent.setPackage(BuildConfig.APPLICATION_ID);

View file

@ -1,17 +1,14 @@
package com.beemdevelopment.aegis.ui.preferences;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import androidx.annotation.RequiresApi;
import androidx.preference.Preference;
import androidx.preference.SwitchPreferenceCompat;
public class SwitchPreference extends SwitchPreferenceCompat {
private Preference.OnPreferenceChangeListener _listener;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public SwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}

View file

@ -2,14 +2,11 @@ package com.beemdevelopment.aegis.ui.views;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.animation.LinearInterpolator;
import android.widget.ProgressBar;
import androidx.annotation.RequiresApi;
import com.beemdevelopment.aegis.helpers.AnimationsHelper;
import com.beemdevelopment.aegis.otp.TotpInfo;
@ -30,7 +27,6 @@ public class TotpProgressBar extends ProgressBar {
super(context, attrs, defStyleAttr);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public TotpProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}

View file

@ -1,5 +1,8 @@
package com.beemdevelopment.aegis.vault;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.beemdevelopment.aegis.encoding.Base64;
import com.beemdevelopment.aegis.encoding.EncodingException;
import com.beemdevelopment.aegis.encoding.Hex;
@ -7,8 +10,6 @@ import com.beemdevelopment.aegis.icons.IconType;
import com.beemdevelopment.aegis.util.JsonUtils;
import com.google.common.hash.HashCode;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.json.JSONException;
import org.json.JSONObject;
@ -25,21 +26,21 @@ public class VaultEntryIcon implements Serializable {
public static final int MAX_DIMENS = 512;
public VaultEntryIcon(byte @NonNull [] bytes, @NonNull IconType type) {
public VaultEntryIcon(@NonNull byte[] bytes, @NonNull IconType type) {
this(bytes, type, generateHash(bytes, type));
}
VaultEntryIcon(byte @NonNull [] bytes, @NonNull IconType type, byte @NonNull [] hash) {
VaultEntryIcon(@NonNull byte[] bytes, @NonNull IconType type, @NonNull byte[] hash) {
_bytes = bytes;
_hash = hash;
_type = type;
}
public byte @NonNull [] getBytes() {
public @NonNull byte[] getBytes() {
return _bytes;
}
public byte @NonNull [] getHash() {
public @NonNull byte[] getHash() {
return _hash;
}
@ -98,7 +99,7 @@ public class VaultEntryIcon implements Serializable {
}
}
private static byte @NonNull [] generateHash(byte @NonNull [] bytes, @NonNull IconType type) {
private static @NonNull byte[] generateHash(@NonNull byte[] bytes, @NonNull IconType type) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(type.toMimeType().getBytes(StandardCharsets.UTF_8));

File diff suppressed because it is too large Load diff

View file

@ -1,18 +0,0 @@
<resources>
<style name="Theme.Aegis.Light" parent="Base.Theme.Aegis.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="Theme.Aegis.Dark" parent="Base.Theme.Aegis.Dark">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="Theme.Aegis.Amoled" parent="Base.Theme.Aegis.Amoled">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>

View file

@ -187,12 +187,20 @@
</style>
<style name="Theme.Aegis.Light" parent="Base.Theme.Aegis.Light">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="Theme.Aegis.Dark" parent="Base.Theme.Aegis.Dark">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="Theme.Aegis.Amoled" parent="Base.Theme.Aegis.Amoled">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="Widget.Aegis.Dropdown" parent="Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu" />

View file

@ -6,8 +6,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.52'
classpath 'com.android.tools.build:gradle:8.10.0'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.56.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
// NOTE: Do not place your application dependencies here; they belong

View file

@ -1,6 +1,6 @@
#Tue Aug 15 23:01:16 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists