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 specic language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MEDIAPROVIDER_JNI_UTILS_H_ 18 #define MEDIAPROVIDER_JNI_UTILS_H_ 19 20 #include <string> 21 22 namespace mediaprovider { 23 namespace fuse { 24 static constexpr char STORAGE_PREFIX[] = "/storage"; 25 static constexpr char VOLUME_INTERNAL[] = "internal"; 26 static constexpr char VOLUME_EXTERNAL_PRIMARY[] = "external_primary"; 27 static constexpr char PRIMARY_VOLUME_PREFIX[] = "/storage/emulated"; 28 29 /** 30 * Returns true if the given path (ignoring case) is mounted for any 31 * userid. Mounted paths are: 32 * "/storage/emulated/<userid>/Android" 33 * "/storage/emulated/<userid>/Android/data" 34 * "/storage/emulated/<userid>/Android/obb" * 35 */ 36 bool containsMount(const std::string& path); 37 38 /** 39 * Returns the volume name extracted from a given path. 40 */ 41 std::string getVolumeNameFromPath(const std::string& path); 42 43 } // namespace fuse 44 } // namespace mediaprovider 45 46 #endif // MEDIAPROVIDER_JNI_UTILS_H_ 47