| 404 | } |
| 405 | |
| 406 | MMKV_JNI jlong getDefaultMMKV(JNIEnv *env, jobject obj, jint mode, jstring cryptKey, jlong expectedCapacity, |
| 407 | jboolean aes256, jint enableKeyExpire, jint expiredInSeconds, |
| 408 | jboolean enableCompareBeforeSet, jint recover, jint itemSizeLimit) { |
| 409 | MMKV *kv = nullptr; |
| 410 | |
| 411 | auto config = MMKVConfig(); |
| 412 | config.mode = (MMKVMode) mode; |
| 413 | config.aes256 = aes256; |
| 414 | config.expectedCapacity = expectedCapacity; |
| 415 | if (enableKeyExpire >= 0) { |
| 416 | config.enableKeyExpire = (enableKeyExpire != 0); |
| 417 | } |
| 418 | config.expiredInSeconds = expiredInSeconds; |
| 419 | config.enableCompareBeforeSet = enableCompareBeforeSet; |
| 420 | if (recover >= 0) { |
| 421 | config.recover = static_cast<MMKVRecoverStrategic>(recover); |
| 422 | } |
| 423 | config.itemSizeLimit = itemSizeLimit; |
| 424 | |
| 425 | if (cryptKey) { |
| 426 | string crypt = jstring2string(env, cryptKey); |
| 427 | if (crypt.length() > 0) { |
| 428 | config.cryptKey = &crypt; |
| 429 | kv = MMKV::defaultMMKV(config); |
| 430 | } |
| 431 | } |
| 432 | if (!kv) { |
| 433 | kv = MMKV::defaultMMKV(config); |
| 434 | } |
| 435 | |
| 436 | return (jlong) kv; |
| 437 | } |
| 438 | |
| 439 | MMKV_JNI jlong getMMKVWithAshmemFD(JNIEnv *env, jobject obj, jstring mmapID, jint fd, jint metaFD, jstring cryptKey, |
| 440 | jboolean aes256) { |
nothing calls this directly
no test coverage detected