Skip to content

Commit

Permalink
Add zstd-jni library
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Aug 30, 2024
1 parent 2f41cfc commit a297fe6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ android_app {
"com.google.android.material_material",
"kotlinx-coroutines-android",
"kotlinx-coroutines-core",
"seedvault-lib-zstd-jni",
"libzstd",
// our own gradle module libs
"seedvault-lib-core",
"seedvault-lib-storage",
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ dependencies {
implementation(fileTree("${rootProject.rootDir}/libs/koin-android").include("*.jar"))
implementation(fileTree("${rootProject.rootDir}/libs/koin-android").include("*.aar"))

implementation(fileTree("${rootProject.rootDir}/libs").include("zstd-jni-1.5.6-5.aar"))
implementation(fileTree("${rootProject.rootDir}/libs").include("kotlin-bip39-jvm-1.0.6.jar"))

implementation(fileTree("${rootProject.rootDir}/libs/dav4jvm").include("*.jar"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
package com.stevesoltys.seedvault.settings

import android.os.Bundle
import android.util.Log
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback
import com.github.luben.zstd.ZstdOutputStream
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.ui.RequireProvisioningActivity
import com.stevesoltys.seedvault.ui.RequireProvisioningViewModel
import com.stevesoltys.seedvault.ui.recoverycode.ARG_FOR_NEW_CODE
import com.stevesoltys.seedvault.ui.storage.StorageCheckFragment
import org.koin.androidx.viewmodel.ext.android.viewModel
import java.io.ByteArrayOutputStream
import kotlin.random.Random

internal const val ACTION_APP_STATUS_LIST = "com.stevesoltys.seedvault.APP_STATUS_LIST"
private const val PREF_BACKUP_RECOVERY_CODE = "backup_recovery_code"
Expand Down Expand Up @@ -59,6 +63,15 @@ class SettingsActivity : RequireProvisioningActivity(), OnPreferenceStartFragmen
}
}

override fun onStart() {
super.onStart()
val stream = ByteArrayOutputStream()
ZstdOutputStream(stream).use {
it.write(Random.Default.nextBytes(1337))
}
Log.e("TEST", "1337 -> ${stream.size()}")
}

override fun onPreferenceStartFragment(
caller: PreferenceFragmentCompat,
pref: Preference,
Expand Down
6 changes: 6 additions & 0 deletions libs/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
// SPDX-License-Identifier: Apache-2.0
//

android_library_import {
name: "seedvault-lib-zstd-jni",
aars: ["zstd-jni-1.5.6-5.aar"],
sdk_version: "current",
}

java_import {
name: "seedvault-lib-kotlin-bip39",
jars: ["kotlin-bip39-jvm-1.0.6.jar"],
Expand Down
Binary file added libs/zstd-jni-1.5.6-5.aar
Binary file not shown.

0 comments on commit a297fe6

Please sign in to comment.