1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "app_gallery_dispose_proxy_mock.h"
17
18 #include <string>
19
20 namespace OHOS::FileManagement::Backup {
21 using namespace std;
22
23 mutex AppGalleryDisposeProxy::instanceLock_;
24 sptr<AppGalleryDisposeProxy> AppGalleryDisposeProxy::appGalleryDisposeProxyInstance_;
25
AppGalleryDisposeProxy()26 AppGalleryDisposeProxy::AppGalleryDisposeProxy() {}
27
~AppGalleryDisposeProxy()28 AppGalleryDisposeProxy::~AppGalleryDisposeProxy()
29 {
30 appGalleryDisposeProxyInstance_ = nullptr;
31 }
32
GetInstance()33 sptr<AppGalleryDisposeProxy> AppGalleryDisposeProxy::GetInstance()
34 {
35 if (appGalleryDisposeProxyInstance_ == nullptr) {
36 lock_guard<mutex> autoLock(instanceLock_);
37 if (appGalleryDisposeProxyInstance_ == nullptr) {
38 appGalleryDisposeProxyInstance_ = sptr(new AppGalleryDisposeProxy);
39 }
40 }
41
42 return appGalleryDisposeProxyInstance_;
43 }
44
StartBackup(const string & bundleName,int32_t userId)45 DisposeErr AppGalleryDisposeProxy::StartBackup(const string &bundleName, int32_t userId)
46 {
47 return BAppGalleryDisposeProxy::proxy->StartBackup(bundleName, userId);
48 }
49
EndBackup(const string & bundleName,int32_t userId)50 DisposeErr AppGalleryDisposeProxy::EndBackup(const string &bundleName, int32_t userId)
51 {
52 return BAppGalleryDisposeProxy::proxy->EndBackup(bundleName, userId);
53 }
54
StartRestore(const string & bundleName,int32_t userId)55 DisposeErr AppGalleryDisposeProxy::StartRestore(const string &bundleName, int32_t userId)
56 {
57 return BAppGalleryDisposeProxy::proxy->StartRestore(bundleName, userId);
58 }
59
EndRestore(const string & bundleName,int32_t userId)60 DisposeErr AppGalleryDisposeProxy::EndRestore(const string &bundleName, int32_t userId)
61 {
62 return BAppGalleryDisposeProxy::proxy->EndRestore(bundleName, userId);
63 }
64 } // namespace OHOS::FileManagement::Backup
65