Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "incremental_manager-jni" |
| 18 | |
| 19 | #include "core_jni_helpers.h" |
| 20 | #include "incfs_ndk.h" |
| 21 | #include "jni.h" |
| 22 | #include "nativehelper/JNIHelp.h" |
| 23 | |
| 24 | #include <iterator> |
| 25 | #include <memory> |
| 26 | |
| 27 | namespace android { |
| 28 | |
| 29 | static jboolean nativeIsIncrementalPath(JNIEnv* env, |
| 30 | jobject clazz, |
| 31 | jstring javaPath) { |
| 32 | ScopedUtfChars path(env, javaPath); |
| 33 | return (jboolean)IncFs_IsIncFsPath(path.c_str()); |
| 34 | } |
| 35 | |
| 36 | static const JNINativeMethod method_table[] = { |
| 37 | {"nativeIsIncrementalPath", "(Ljava/lang/String;)Z", |
| 38 | (void*)nativeIsIncrementalPath}, |
| 39 | }; |
| 40 | |
| 41 | int register_android_os_incremental_IncrementalManager(JNIEnv* env) { |
| 42 | return jniRegisterNativeMethods(env, "android/os/incremental/IncrementalManager", |
| 43 | method_table, std::size(method_table)); |
| 44 | } |
| 45 | |
| 46 | } // namespace android |