keyring fixes
This commit is contained in:
parent
8d4ef01086
commit
0a7ebcb3be
19
Cargo.lock
generated
19
Cargo.lock
generated
@ -1153,6 +1153,15 @@ dependencies = [
|
|||||||
"dirs-sys",
|
"dirs-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "directories"
|
||||||
|
version = "4.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210"
|
||||||
|
dependencies = [
|
||||||
|
"dirs-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs-sys"
|
name = "dirs-sys"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@ -1821,16 +1830,20 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation 0.9.2",
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys 0.8.3",
|
||||||
|
"directories 4.0.1",
|
||||||
"jni",
|
"jni",
|
||||||
"keychain-services",
|
"keychain-services",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"ndk",
|
"ndk",
|
||||||
"ndk-glue",
|
"ndk-glue",
|
||||||
|
"owning_ref",
|
||||||
"rpassword",
|
"rpassword",
|
||||||
"secret-service",
|
"secret-service",
|
||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
|
"serde 1.0.133",
|
||||||
|
"serde_cbor",
|
||||||
"serial_test 0.5.1",
|
"serial_test 0.5.1",
|
||||||
"simplelog",
|
"simplelog",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
@ -3743,7 +3756,7 @@ dependencies = [
|
|||||||
"cursive",
|
"cursive",
|
||||||
"cursive-flexi-logger-view",
|
"cursive-flexi-logger-view",
|
||||||
"cursive_buffered_backend",
|
"cursive_buffered_backend",
|
||||||
"directories",
|
"directories 3.0.2",
|
||||||
"flexi_logger",
|
"flexi_logger",
|
||||||
"futures",
|
"futures",
|
||||||
"log",
|
"log",
|
||||||
@ -3780,7 +3793,7 @@ dependencies = [
|
|||||||
"curve25519-dalek-ng",
|
"curve25519-dalek-ng",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
"digest",
|
"digest",
|
||||||
"directories",
|
"directories 3.0.2",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"generic-array",
|
"generic-array",
|
||||||
@ -3848,7 +3861,7 @@ dependencies = [
|
|||||||
"config 0.11.0",
|
"config 0.11.0",
|
||||||
"ctrlc",
|
"ctrlc",
|
||||||
"daemonize",
|
"daemonize",
|
||||||
"directories",
|
"directories 3.0.2",
|
||||||
"failure",
|
"failure",
|
||||||
"futures",
|
"futures",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
2
external/keyring-rs
vendored
2
external/keyring-rs
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 8b34ace77dfca20c482fc856a4b027bdd297f445
|
Subproject commit dadfe40c70d7679a56e36e22240920c78acd0f06
|
@ -5,38 +5,46 @@ pub fn get_files_dir() -> String {
|
|||||||
let aglock = ANDROID_GLOBALS.lock();
|
let aglock = ANDROID_GLOBALS.lock();
|
||||||
let ag = aglock.as_ref().unwrap();
|
let ag = aglock.as_ref().unwrap();
|
||||||
let env = ag.vm.attach_current_thread().unwrap();
|
let env = ag.vm.attach_current_thread().unwrap();
|
||||||
// context.getFilesDir().getAbsolutePath()
|
|
||||||
let file = env
|
|
||||||
.call_method(ag.ctx.as_obj(), "getFilesDir", "()Ljava/io/File;", &[])
|
|
||||||
.unwrap()
|
|
||||||
.l()
|
|
||||||
.unwrap();
|
|
||||||
let path = env
|
|
||||||
.call_method(file, "getAbsolutePath", "()Ljava/lang/String;", &[])
|
|
||||||
.unwrap()
|
|
||||||
.l()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let jstrval = env.get_string(JString::from(path)).unwrap();
|
with_null_local_frame(env, 64, || {
|
||||||
String::from(jstrval.to_string_lossy())
|
// context.getFilesDir().getAbsolutePath()
|
||||||
|
let file = env
|
||||||
|
.call_method(ag.ctx.as_obj(), "getFilesDir", "()Ljava/io/File;", &[])
|
||||||
|
.unwrap()
|
||||||
|
.l()
|
||||||
|
.unwrap();
|
||||||
|
let path = env
|
||||||
|
.call_method(file, "getAbsolutePath", "()Ljava/lang/String;", &[])
|
||||||
|
.unwrap()
|
||||||
|
.l()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let jstrval = env.get_string(JString::from(path)).unwrap();
|
||||||
|
Ok(String::from(jstrval.to_string_lossy()))
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_cache_dir() -> String {
|
pub fn get_cache_dir() -> String {
|
||||||
let aglock = ANDROID_GLOBALS.lock();
|
let aglock = ANDROID_GLOBALS.lock();
|
||||||
let ag = aglock.as_ref().unwrap();
|
let ag = aglock.as_ref().unwrap();
|
||||||
let env = ag.vm.attach_current_thread().unwrap();
|
let env = ag.vm.attach_current_thread().unwrap();
|
||||||
// context.getCacheDir().getAbsolutePath()
|
|
||||||
let file = env
|
|
||||||
.call_method(ag.ctx.as_obj(), "getCacheDir", "()Ljava/io/File;", &[])
|
|
||||||
.unwrap()
|
|
||||||
.l()
|
|
||||||
.unwrap();
|
|
||||||
let path = env
|
|
||||||
.call_method(file, "getAbsolutePath", "()Ljava/lang/String;", &[])
|
|
||||||
.unwrap()
|
|
||||||
.l()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let jstrval = env.get_string(JString::from(path)).unwrap();
|
with_null_local_frame(env, 64, || {
|
||||||
String::from(jstrval.to_string_lossy())
|
// context.getCacheDir().getAbsolutePath()
|
||||||
|
let file = env
|
||||||
|
.call_method(ag.ctx.as_obj(), "getCacheDir", "()Ljava/io/File;", &[])
|
||||||
|
.unwrap()
|
||||||
|
.l()
|
||||||
|
.unwrap();
|
||||||
|
let path = env
|
||||||
|
.call_method(file, "getAbsolutePath", "()Ljava/lang/String;", &[])
|
||||||
|
.unwrap()
|
||||||
|
.l()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let jstrval = env.get_string(JString::from(path)).unwrap();
|
||||||
|
String::from(jstrval.to_string_lossy())
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ pub use get_directories::*;
|
|||||||
use crate::xx::*;
|
use crate::xx::*;
|
||||||
use android_logger::{Config, FilterBuilder};
|
use android_logger::{Config, FilterBuilder};
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
|
use jni::errors::Result as JniResult;
|
||||||
use jni::{objects::GlobalRef, objects::JObject, objects::JString, JNIEnv, JavaVM};
|
use jni::{objects::GlobalRef, objects::JObject, objects::JString, JNIEnv, JavaVM};
|
||||||
use lazy_static::*;
|
use lazy_static::*;
|
||||||
use log::*;
|
use log::*;
|
||||||
@ -66,3 +67,13 @@ pub fn veilid_core_setup_android<'a>(
|
|||||||
ctx: env.new_global_ref(ctx).unwrap(),
|
ctx: env.new_global_ref(ctx).unwrap(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_null_local_frame<'b, T, F>(env: JNIEnv<'b>, s: i32, f: F) -> JniResult<T>
|
||||||
|
where
|
||||||
|
F: FnOnce() -> JniResult<T>,
|
||||||
|
{
|
||||||
|
env.push_local_frame(s)?;
|
||||||
|
let out = f();
|
||||||
|
env.pop_local_frame(JObject::null())?;
|
||||||
|
out
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user