xref: /aosp_15_r20/frameworks/av/media/mtp/MtpUtils.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1*ec779b8eSAndroid Build Coastguard Worker /*
2*ec779b8eSAndroid Build Coastguard Worker  * Copyright (C) 2010 The Android Open Source Project
3*ec779b8eSAndroid Build Coastguard Worker  *
4*ec779b8eSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*ec779b8eSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*ec779b8eSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*ec779b8eSAndroid Build Coastguard Worker  *
8*ec779b8eSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*ec779b8eSAndroid Build Coastguard Worker  *
10*ec779b8eSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*ec779b8eSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*ec779b8eSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*ec779b8eSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*ec779b8eSAndroid Build Coastguard Worker  * limitations under the License.
15*ec779b8eSAndroid Build Coastguard Worker  */
16*ec779b8eSAndroid Build Coastguard Worker 
17*ec779b8eSAndroid Build Coastguard Worker #ifndef _MTP_UTILS_H
18*ec779b8eSAndroid Build Coastguard Worker #define _MTP_UTILS_H
19*ec779b8eSAndroid Build Coastguard Worker 
20*ec779b8eSAndroid Build Coastguard Worker #include "private/android_filesystem_config.h"
21*ec779b8eSAndroid Build Coastguard Worker 
22*ec779b8eSAndroid Build Coastguard Worker #include <stdint.h>
23*ec779b8eSAndroid Build Coastguard Worker 
24*ec779b8eSAndroid Build Coastguard Worker namespace android {
25*ec779b8eSAndroid Build Coastguard Worker 
26*ec779b8eSAndroid Build Coastguard Worker constexpr int FILE_GROUP = AID_MEDIA_RW;
27*ec779b8eSAndroid Build Coastguard Worker constexpr int FILE_PERM = 0664;
28*ec779b8eSAndroid Build Coastguard Worker constexpr int DIR_PERM = 0775;
29*ec779b8eSAndroid Build Coastguard Worker 
30*ec779b8eSAndroid Build Coastguard Worker bool parseDateTime(const char* dateTime, time_t& outSeconds);
31*ec779b8eSAndroid Build Coastguard Worker void formatDateTime(time_t seconds, char* buffer, int bufferLength);
32*ec779b8eSAndroid Build Coastguard Worker 
33*ec779b8eSAndroid Build Coastguard Worker int makeFolder(const char *path);
34*ec779b8eSAndroid Build Coastguard Worker int copyRecursive(const char *fromPath, const char *toPath);
35*ec779b8eSAndroid Build Coastguard Worker int copyFile(const char *fromPath, const char *toPath);
36*ec779b8eSAndroid Build Coastguard Worker bool deletePath(const char* path);
37*ec779b8eSAndroid Build Coastguard Worker int renameTo(const char *oldPath, const char *newPath);
38*ec779b8eSAndroid Build Coastguard Worker 
39*ec779b8eSAndroid Build Coastguard Worker void closeObjFd(int fd, const char *path);
40*ec779b8eSAndroid Build Coastguard Worker }; // namespace android
41*ec779b8eSAndroid Build Coastguard Worker 
42*ec779b8eSAndroid Build Coastguard Worker #endif // _MTP_UTILS_H
43