StorageManager: add disk & notification code

Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
This commit is contained in:
张文迪 2022-02-08 16:11:48 +08:00
parent bb12482710
commit e5d24d1f69
24 changed files with 1160 additions and 75 deletions

View File

@ -44,7 +44,7 @@
"//foundation/filemanagement/storage_service/services/storage_manager/sa_profile:storage_manager_sa_profile",
"//foundation/filemanagement/storage_service/services/storage_manager/sa_profile:storage_manager_cfg",
"//foundation/filemanagement/storage_service/services/storage_manager:storage_manager",
"//foundation/filemanagement/storage_service/interfaces/kits/js/storage_statist:storage_js",
"//foundation/filemanagement/storage_service/interfaces/kits/js/storage_manager:storage_js",
"//third_party/exfat-utils:exfat-utils",
"//third_party/f2fs-tools:f2fs-tools",
"//third_party/fsck_msdos:fsck_msdos",

View File

@ -27,8 +27,11 @@ config("private_config") {
ohos_shared_library("storage_manager_sa_proxy") {
sources = [
"../../../../services/storage_daemon/ipc/src/storage_daemon_proxy.cpp",
"../../../../services/storage_manager/ipc/src/storage_manager_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_daemon/ipc/src/storage_daemon_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/disk.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_core.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_external.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_proxy.cpp",
]
configs = [ ":private_config" ]

View File

@ -1,26 +1,51 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_STORAGE_MANAGER_DISK_H
#define OHOS_STORAGE_MANAGER_DISK_H
namespace OHOS {
namespace StorageManager {
class Disk {
};
} // STORAGE_MANAGER
} // OHOS
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_STORAGE_MANAGER_DISK_H
#define OHOS_STORAGE_MANAGER_DISK_H
#include "parcel.h"
namespace OHOS {
namespace StorageManager {
enum {
SD_FLAG = 1,
USB_FLAG
};
class Disk : public Parcelable {
public:
Disk();
Disk(std::string diskId, int64_t sizeBytes, std::string sysPath, std::string vendor, int32_t flag);
std::string GetDiskId();
int64_t GetSizeBytes();
std::string GetSysPath();
std::string GetVendor();
int32_t GetFlag();
void SetFlag(int32_t flag);
bool Marshalling(Parcel &parcel) const override;
static std::unique_ptr<Disk> Unmarshalling(Parcel &parcel);
private:
std::string diskId_;
int64_t sizeBytes_;
std::string sysPath_;
std::string vendor_;
int32_t flag_;
};
} // STORAGE_MANAGER
} // OHOS
#endif // OHOS_STORAGE_MANAGER_DISK_H

View File

@ -17,6 +17,9 @@
#define OHOS_STORAGE_MANAGER_ISTORAGE_MANAGER_H
#include "iremote_broker.h"
#include "volume_core.h"
#include "volume_external.h"
#include "disk.h"
namespace OHOS {
namespace StorageManager {
@ -29,7 +32,17 @@ public:
virtual int64_t GetFreeSizeOfVolume(std::string volumeUuid) = 0;
virtual int64_t GetTotalSizeOfVolume(std::string volumeUuid) = 0;
virtual std::vector<int64_t> GetBundleStats(std::string uuid, std::string pkgName) = 0;
virtual void NotifyVolumeCreated(VolumeCore vc) = 0;
virtual void NotifyVolumeMounted(std::string volumeId, int fsType, std::string fsUuid,
std::string path, std::string description) = 0;
virtual void NotifyVolumeDestoryed(std::string volumeId) = 0;
virtual int32_t Mount(std::string volumeId) = 0;
virtual int32_t Unmount(std::string volumeId) = 0;
virtual std::vector<VolumeExternal> GetAllVolumes() = 0;
virtual void NotifyDiskCreated(Disk disk) = 0;
virtual void NotifyDiskDestroyed(std::string diskId) = 0;
virtual int32_t Partition(std::string diskId, int32_t type) = 0;
virtual std::vector<Disk> GetAllDisks() = 0;
enum {
PREPARE_ADD_USER = 1,
REMOVE_USER,
@ -37,7 +50,17 @@ public:
STOP_USER,
GET_TOTAL,
GET_FREE,
GET_BUNDLE_STATUS
GET_BUNDLE_STATUS,
NOTIFY_VOLUME_CREATED,
NOTIFY_VOLUME_MOUNTED,
NOTIFY_VOLUME_DESTORYED,
MOUNT,
UNMOUNT,
GET_ALL_VOLUMES,
NOTIFY_DISK_CREATED,
NOTIFY_DISK_DESTROYED,
PARTITION,
GET_ALL_DISKS
};
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.StorageManager.IStorageManager");

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_STORAGE_MANAGER_VOLUME_CORE_H
#define OHOS_STORAGE_MANAGER_VOLUME_CORE_H
#include "parcel.h"
namespace OHOS {
namespace StorageManager {
enum VolumeType {
EMULATED = 1,
EXTERNAL,
};
enum VolumeState {
UNMOUNTED = 0,
CHECKING,
MOUNTED,
EJECTING
};
class VolumeCore : public Parcelable {
public:
VolumeCore();
VolumeCore(std::string id, int32_t type, std::string diskId);
VolumeCore(std::string id, int32_t type, std::string diskId, int32_t state);
std::string GetId();
int32_t GetType();
std::string GetDiskId();
int32_t GetState();
void SetState(int32_t state);
bool Marshalling(Parcel &parcel) const override;
static std::unique_ptr<VolumeCore> Unmarshalling(Parcel &parcel);
private:
std::string id_;
int32_t type_;
std::string diskId_;
int32_t state_ = UNMOUNTED;
bool errorFlag_ = false;
};
} // StorageManager
} // OHOS
#endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H

View File

@ -14,13 +14,34 @@
*/
#ifndef OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H
#define OHOS_STORAGE_MANAGER_VLOUME_EXTERNAL_H
#define OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H
#include "volume_core.h"
namespace OHOS {
namespace StorageManager {
class VolumeExternal : public VolumeCore {
public:
VolumeExternal();
VolumeExternal(VolumeCore vc);
void SetFsType(int32_t fsType);
void SetFsUuid(std::string fsUuid);
void SetPath(std::string path);
void SetDescription(std::string description);
int32_t GetFsType();
std::string GetUuid();
std::string GetPath();
std::string GetDescription();
void Reset();
bool Marshalling(Parcel &parcel) const override;
static std::unique_ptr<VolumeExternal> Unmarshalling(Parcel &parcel);
private:
int32_t fsType_;
std::string fsUuid_;
std::string path_;
std::string description_;
};
} // OHOS
} // StorageManager

View File

@ -23,17 +23,21 @@ config("storage_manager_config") {
"../storage_daemon/include",
"//foundation/filemanagement/storage_service/utils/include",
"//foundation/appexecfwk/standard/services/bundlemgr/include",
"//foundation/aafwk/standard/interfaces/innerkits/base/include/ohos/aafwk/base",
]
}
ohos_shared_library("storage_manager") {
sources = [
"disk/src/disk_manager_service.cpp",
"ipc/src/storage_manager.cpp",
"ipc/src/storage_manager_stub.cpp",
"storage/src/storage_status_service.cpp",
"storage/src/storage_total_status_service.cpp",
"storage_daemon_communication/src/storage_daemon_communication.cpp",
"user/src/multi_user_manager_service.cpp",
"volume/src/notification.cpp",
"volume/src/volume_manager_service.cpp",
]
configs = [ ":storage_manager_config" ]
@ -46,7 +50,10 @@ ohos_shared_library("storage_manager") {
]
external_deps = [
"ability_runtime:base",
"ability_runtime:want",
"bundle_framework:appexecfwk_base",
"ces_standard:cesfwk_innerkits",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"os_account_standard:os_account_innerkits",

View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "disk/disk_manager_service.h"
#include "storage_daemon_communication/storage_daemon_communication.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
namespace OHOS {
namespace StorageManager {
DiskManagerService::DiskManagerService() {}
DiskManagerService::~DiskManagerService() {}
std::shared_ptr<Disk> DiskManagerService::GetDiskById(std::string diskId)
{
if (!diskMap_.Contains(diskId)) {
return nullptr;
}
return diskMap_[diskId];
}
void DiskManagerService::OnDiskCreated(Disk disk)
{
if (diskMap_.Contains(disk.GetDiskId())) {
LOGE("DiskManagerService::OnDiskCreated the disk %{public}s already exists", disk.GetDiskId().c_str());
return;
}
auto diskPtr = std::make_shared<Disk>(disk);
diskMap_.Insert(diskPtr->GetDiskId(), diskPtr);
}
void DiskManagerService::OnDiskDestroyed(std::string diskId)
{
if (!diskMap_.Contains(diskId)) {
LOGE("DiskManagerService::OnDiskDestroyed the disk %{public}s doesn't exist", diskId.c_str());
return;
}
diskMap_.Erase(diskId);
}
int32_t DiskManagerService::Partition(std::string diskId, int32_t type)
{
if (!diskMap_.Contains(diskId)) {
LOGE("DiskManagerService::Partition the disk %{public}s doesn't exist", diskId.c_str());
return E_NON_EXIST;
}
std::shared_ptr<StorageDaemonCommunication> sdCommunication;
sdCommunication = DelayedSingleton<StorageDaemonCommunication>::GetInstance();
int32_t err = sdCommunication->Partition(diskId, type);
return err;
}
std::vector<Disk> DiskManagerService::GetAllDisks()
{
std::vector<Disk> result;
for (auto it = diskMap_.Begin(); it != diskMap_.End(); ++it) {
Disk disk = *(it->second);
result.push_back(disk);
}
return result;
}
}
}

View File

@ -16,9 +16,24 @@
#ifndef OHOS_STORAGE_MANAGER_DISK_MANAGER_SERVICE_H
#define OHOS_STORAGE_MANAGER_DISK_MANAGER_SERVICE_H
#include <unordered_map>
#include <singleton.h>
#include <nocopyable.h>
#include "disk.h"
#include "utils/storage_rl_map.h"
namespace OHOS {
namespace StorageManager {
class DiskManagerService {
class DiskManagerService final : public NoCopyable {
DECLARE_DELAYED_SINGLETON(DiskManagerService);
public:
std::shared_ptr<Disk> GetDiskById(std::string diskId);
int32_t Partition(std::string diskId, int32_t type);
void OnDiskCreated(Disk disk);
void OnDiskDestroyed(std::string diskId);
std::vector<Disk> GetAllDisks();
private:
StorageRlMap<std::string, std::shared_ptr<Disk>> diskMap_;
};
} // StorageManager
} // OHOS

View File

@ -39,6 +39,21 @@ public:
int64_t GetFreeSizeOfVolume(std::string volumeUuid) override;
int64_t GetTotalSizeOfVolume(std::string volumeUuid) override;
std::vector<int64_t> GetBundleStats(std::string uuid, std::string pkgName) override;
void NotifyVolumeCreated(VolumeCore vc) override;
void NotifyVolumeMounted(std::string volumeId, int32_t fsType, std::string fsUuid,
std::string path, std::string description) override;
void NotifyVolumeDestoryed(std::string volumeId) override;
int32_t Mount(std::string volumeId) override;
int32_t Unmount(std::string volumeId) override;
std::vector<VolumeExternal> GetAllVolumes()override;
void NotifyDiskCreated(Disk disk) override;
void NotifyDiskDestroyed(std::string diskId) override;
int32_t Partition(std::string diskId, int32_t type) override;
std::vector<Disk> GetAllDisks() override;
private:
StorageManager();
static sptr<StorageManager> instance_;

View File

@ -34,6 +34,17 @@ public:
int64_t GetFreeSizeOfVolume(std::string volumeUuid) override;
int64_t GetTotalSizeOfVolume(std::string volumeUuid) override;
std::vector<int64_t> GetBundleStats(std::string uuid, std::string pkgName) override;
void NotifyVolumeCreated(VolumeCore vc) override;
void NotifyVolumeMounted(std::string volumeId, int32_t fsType, std::string fsUuid,
std::string path, std::string description) override;
void NotifyVolumeDestoryed(std::string volumeId) override;
int32_t Mount(std::string volumeId) override;
int32_t Unmount(std::string volumeId) override;
std::vector<VolumeExternal> GetAllVolumes() override;
void NotifyDiskCreated(Disk disk) override;
void NotifyDiskDestroyed(std::string diskId) override;
int32_t Partition(std::string diskId, int32_t type) override;
std::vector<Disk> GetAllDisks() override;
private:
static inline BrokerDelegator<StorageManagerProxy> delegator_;
};

View File

@ -33,6 +33,16 @@ private:
int32_t HandleGetTotal(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetFree(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetBundleStatus(MessageParcel &data, MessageParcel &reply);
int32_t HandleNotifyVolumeCreated(MessageParcel &data, MessageParcel &reply);
int32_t HandleNotifyVolumeMounted(MessageParcel &data, MessageParcel &reply);
int32_t HandleNotifyVolumeDestoryed(MessageParcel &data, MessageParcel &reply);
int32_t HandleMount(MessageParcel &data, MessageParcel &reply);
int32_t HandleUnmount(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetAllVolumes(MessageParcel &data, MessageParcel &reply);
int32_t HandleNotifyDiskCreated(MessageParcel &data, MessageParcel &reply);
int32_t HandleNotifyDiskDestroyed(MessageParcel &data, MessageParcel &reply);
int32_t HandlePartition(MessageParcel &data, MessageParcel &reply);
int32_t HandleGetAllDisks(MessageParcel &data, MessageParcel &reply);
};
} // StorageManager
} // OHOS

View File

@ -30,6 +30,7 @@ public:
int64_t GetFreeSizeOfVolume(std::string volumeUuid);
int64_t GetTotalSizeOfVolume(std::string volumeUuid);
private:
std::string GetVolumePath(std::string volumeUuid);
const std::vector<std::string> mountDir = {"/debug_ramdisk", "/patch_hw",
"/metadata", "/", "/cust", "/hw_product", "/odm", "/preas", "/vendor",
"/vendor/modem/modem_driver", "/data"};

View File

@ -38,6 +38,10 @@ public:
int32_t PrepareStartUser(int32_t userId);
int32_t StopUser(int32_t userId);
int32_t Mount(std::string volumeId, int32_t flag);
int32_t Unmount(std::string volumeId);
int32_t Check(std::string volumeId);
int32_t Partition(std::string diskId, int32_t type);
private:
sptr<OHOS::StorageDaemon::IStorageDaemon> storageDaemon_;
};

View File

@ -16,9 +16,23 @@
#ifndef OHOS_STORAGE_MANAGER_NOTIFICATION_H
#define OHOS_STORAGE_MANAGER_NOTIFICATION_H
#include <singleton.h>
#include <nocopyable.h>
namespace OHOS {
namespace StorageManager {
class Notification {
enum {
VOLUME_REMOVED,
VOLUME_UNMOUNTED,
VOLUME_MOUNTED,
VOLUME_BAD_REMOVAL,
VOLUME_EJECT
};
class Notification final : public NoCopyable {
DECLARE_DELAYED_SINGLETON(Notification);
public:
void NotifyVolumeChange(int32_t notifyCode, std::string id, std::string diskId,
std::string fsUuid, std::string path);
};
} // StorageManager
} // OHOS

View File

@ -1,26 +0,0 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_STORAGE_MANAGER_VOLUME_CORE_H
#define OHOS_STORAGE_MANAGER_VOLUME_CORE_H
namespace OHOS {
namespace StorageManager {
class VolumeCore {
};
} // StorageManager
} // OHOS
#endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "disk.h"
namespace OHOS {
namespace StorageManager {
Disk::Disk() {}
Disk::Disk(std::string diskId, int64_t sizeBytes, std::string sysPath, std::string vendor, int32_t flag)
: diskId_(diskId), sizeBytes_(sizeBytes), sysPath_(sysPath), vendor_(vendor), flag_(flag) {}
std::string Disk::GetDiskId()
{
return diskId_;
}
int64_t Disk::GetSizeBytes()
{
return sizeBytes_;
}
std::string Disk::GetSysPath()
{
return sysPath_;
}
std::string Disk::GetVendor()
{
return vendor_;
}
int32_t Disk::GetFlag()
{
return flag_;
}
void Disk::SetFlag(int32_t flag)
{
flag_ = flag;
}
bool Disk::Marshalling(Parcel &parcel) const
{
parcel.WriteString(diskId_);
parcel.WriteInt32(sizeBytes_);
parcel.WriteString(sysPath_);
parcel.WriteString(vendor_);
parcel.WriteInt32(flag_);
return true;
}
std::unique_ptr<Disk> Disk::Unmarshalling(Parcel &parcel)
{
auto obj = std::make_unique<Disk>();
obj->diskId_ = parcel.ReadString();
obj->sizeBytes_ = parcel.ReadInt32();
obj->sysPath_ = parcel.ReadString();
obj->vendor_ = parcel.ReadString();
obj->flag_ = parcel.ReadInt32();
return obj;
}
}
}

View File

@ -0,0 +1,82 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "volume_core.h"
namespace OHOS {
namespace StorageManager {
VolumeCore::VolumeCore() {}
VolumeCore::VolumeCore(std::string id, int type, std::string diskId)
{
id_ = id;
type_ = type;
diskId_ = diskId;
}
VolumeCore::VolumeCore(std::string id, int type, std::string diskId, int32_t state)
{
id_ = id;
type_ = type;
diskId_ = diskId;
state_ = state;
}
void VolumeCore::SetState(int32_t state)
{
state_ = state;
}
std::string VolumeCore::GetId()
{
return id_;
}
int VolumeCore::GetType()
{
return type_;
}
std::string VolumeCore::GetDiskId()
{
return diskId_;
}
int32_t VolumeCore::GetState()
{
return state_;
}
bool VolumeCore::Marshalling(Parcel &parcel) const
{
parcel.WriteString(id_);
parcel.WriteInt32(type_);
parcel.WriteString(diskId_);
parcel.WriteInt32(state_);
parcel.WriteBool(errorFlag_);
return true;
}
std::unique_ptr<VolumeCore> VolumeCore::Unmarshalling(Parcel &parcel)
{
auto obj = std::make_unique<VolumeCore>();
obj->id_ = parcel.ReadString();
obj->type_ = parcel.ReadInt32();
obj->diskId_ = parcel.ReadString();
obj->state_ = parcel.ReadInt32();
obj->errorFlag_ = parcel.ReadBool();
return obj;
}
}
}

View File

@ -0,0 +1,96 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "volume_external.h"
#include "volume/notification.h"
#include "disk.h"
#include "disk/disk_manager_service.h"
namespace OHOS {
namespace StorageManager {
VolumeExternal::VolumeExternal() {}
VolumeExternal::VolumeExternal(VolumeCore vc)
: VolumeExternal::VolumeCore(vc.GetId(), vc.GetType(), vc.GetDiskId(), vc.GetState()) {}
void VolumeExternal::SetFsType(int32_t fsType)
{
fsType_ = fsType;
}
void VolumeExternal::SetFsUuid(std::string fsUuid)
{
fsUuid_ = fsUuid;
}
void VolumeExternal::SetPath(std::string path)
{
path_ = path;
}
void VolumeExternal::SetDescription(std::string description)
{
description_ = description;
}
int32_t VolumeExternal::GetFsType()
{
return fsType_;
}
std::string VolumeExternal::GetUuid()
{
return fsUuid_;
}
std::string VolumeExternal::GetPath()
{
return path_;
}
std::string VolumeExternal::GetDescription()
{
return description_;
}
void VolumeExternal::Reset()
{
fsType_ = 0;
fsUuid_ = "";
path_ = "";
}
bool VolumeExternal::Marshalling(Parcel &parcel) const
{
VolumeCore::Marshalling(parcel);
parcel.WriteInt32(fsType_);
parcel.WriteString(fsUuid_);
parcel.WriteString(path_);
parcel.WriteString(description_);
return true;
}
std::unique_ptr<VolumeExternal> VolumeExternal::Unmarshalling(Parcel &parcel)
{
auto obj = std::make_unique<VolumeExternal>(*VolumeCore::Unmarshalling(parcel));
obj->fsType_ = parcel.ReadInt32();
obj->fsUuid_ = parcel.ReadString();
obj->path_ = parcel.ReadString();
obj->description_ = parcel.ReadString();
return obj;
}
}
}

View File

@ -14,13 +14,16 @@
*/
#include "ipc/storage_manager.h"
#include <storage/storage_status_service.h>
#include <storage/storage_total_status_service.h>
#include <singleton.h>
#include "system_ability_definition.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
#include "user/multi_user_manager_service.h"
#include <storage/storage_status_service.h>
#include <storage/storage_total_status_service.h>
#include "volume/volume_manager_service.h"
#include "disk/disk_manager_service.h"
namespace OHOS {
namespace StorageManager {
@ -90,5 +93,74 @@ std::vector<int64_t> StorageManager::GetBundleStats(std::string uuid, std::strin
std::vector<int64_t> result = DelayedSingleton<StorageStatusService>::GetInstance()->GetBundleStats(uuid, pkgName);
return result;
}
void StorageManager::NotifyVolumeCreated(VolumeCore vc)
{
LOGI("StorageManger::NotifyVolumeCreated start, volumeId: %{public}s", vc.GetId().c_str());
DelayedSingleton<VolumeManagerService>::GetInstance()->OnVolumeCreated(vc);
}
void StorageManager::NotifyVolumeMounted(std::string volumeId, int32_t fsType, std::string fsUuid,
std::string path, std::string description)
{
LOGI("StorageManger::NotifyVolumeMounted start");
DelayedSingleton<VolumeManagerService>::GetInstance()->OnVolumeMounted(volumeId, fsType, fsUuid, path, description);
}
void StorageManager::NotifyVolumeDestoryed(std::string volumeId)
{
LOGI("StorageManger::NotifyVolumeDestoryed start");
DelayedSingleton<VolumeManagerService>::GetInstance()->OnVolumeDestoryed(volumeId);
}
int32_t StorageManager::Mount(std::string volumeId)
{
LOGI("StorageManger::Mount start");
int result = DelayedSingleton<VolumeManagerService>::GetInstance()->Mount(volumeId);
return result;
}
int32_t StorageManager::Unmount(std::string volumeId)
{
LOGI("StorageManger::Unmount start");
int result = DelayedSingleton<VolumeManagerService>::GetInstance()->Unmount(volumeId);
return result;
}
std::vector<VolumeExternal> StorageManager::GetAllVolumes()
{
LOGI("StorageManger::GetAllVolumes start");
std::vector<VolumeExternal> result = DelayedSingleton<VolumeManagerService>::GetInstance()->GetAllVolumes();
return result;
}
void StorageManager::NotifyDiskCreated(Disk disk)
{
LOGI("StorageManager::NotifyDiskCreated start, diskId: %{public}s", disk.GetDiskId().c_str());
std::shared_ptr<DiskManagerService> diskManager = DelayedSingleton<DiskManagerService>::GetInstance();
diskManager->OnDiskCreated(disk);
}
void StorageManager::NotifyDiskDestroyed(std::string diskId)
{
LOGI("StorageManager::NotifyDiskDestroyed start, diskId: %{public}s", diskId.c_str());
std::shared_ptr<DiskManagerService> diskManager = DelayedSingleton<DiskManagerService>::GetInstance();
diskManager->OnDiskDestroyed(diskId);
}
int32_t StorageManager::Partition(std::string diskId, int32_t type)
{
LOGI("StorageManager::Partition start, diskId: %{public}s", diskId.c_str());
std::shared_ptr<DiskManagerService> diskManager = DelayedSingleton<DiskManagerService>::GetInstance();
int32_t err = diskManager->Partition(diskId, type);
return err;
}
std::vector<Disk> StorageManager::GetAllDisks()
{
LOGI("StorageManger::GetAllDisks start");
std::vector<Disk> result = DelayedSingleton<DiskManagerService>::GetInstance()->GetAllDisks();
return result;
}
}
}

View File

@ -173,6 +173,246 @@ std::vector<int64_t> StorageManagerProxy::GetBundleStats(std::string uuid, std::
}
return val;
}
void StorageManagerProxy::NotifyVolumeCreated(VolumeCore vc)
{
LOGI("StorageManagerProxy::NotifyVolumeCreated, volumeUuid:%{public}s", vc.GetId().c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::NotifyVolumeCreated, WriteInterfaceToken failed");
return;
}
vc.Marshalling(data);
int err = Remote()->SendRequest(NOTIFY_VOLUME_CREATED, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::NotifyVolumeCreated, SendRequest failed");
}
}
void StorageManagerProxy::NotifyVolumeMounted(std::string volumeId, int32_t fsType, std::string fsUuid,
std::string path, std::string description)
{
LOGI("StorageManagerProxy::NotifyVolumeMounted, volumeUuid:%{public}s", volumeId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(volumeId)) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
if (!data.WriteInt32(fsType)) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(fsUuid)) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(path)) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(description)) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, WriteInterfaceToken failed");
return;
}
int err = Remote()->SendRequest(NOTIFY_VOLUME_MOUNTED, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::NotifyVolumeMounted, SendRequest failed");
}
}
void StorageManagerProxy::NotifyVolumeDestoryed(std::string volumeId)
{
LOGI("StorageManagerProxy::NotifyVolumeDestoryed, volumeId:%{public}s", volumeId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::NotifyVolumeDestoryed, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(volumeId)) {
LOGE("StorageManagerProxy::NotifyVolumeDestoryed, WriteInterfaceToken failed");
return;
}
int err = Remote()->SendRequest(NOTIFY_VOLUME_DESTORYED, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::NotifyVolumeDestoryed, SendRequest failed");
}
}
int32_t StorageManagerProxy::Mount(std::string volumeId)
{
LOGI("StorageManagerProxy::Mount, volumeId:%{public}s", volumeId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::Mount, WriteInterfaceToken failed");
return E_IPC_ERROR;
}
if (!data.WriteString(volumeId)) {
LOGE("StorageManagerProxy::Mount, WriteInterfaceToken failed");
return E_IPC_ERROR;
}
int err = Remote()->SendRequest(MOUNT, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::Mount, SendRequest failed");
return E_IPC_ERROR;
}
return reply.ReadInt32();
}
int32_t StorageManagerProxy::Unmount(std::string volumeId)
{
LOGI("StorageManagerProxy::Unmount, volumeId:%{public}s", volumeId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::Unmount, WriteInterfaceToken failed");
return E_IPC_ERROR;
}
if (!data.WriteString(volumeId)) {
LOGE("StorageManagerProxy::Unmount, WriteInterfaceToken failed");
return E_IPC_ERROR;
}
int err = Remote()->SendRequest(UNMOUNT, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::Unmount, SendRequest failed");
return E_IPC_ERROR;
}
return reply.ReadInt32();
}
std::vector<VolumeExternal> StorageManagerProxy::GetAllVolumes()
{
std::vector<VolumeExternal> result = {};
LOGI("StorageManagerProxy::GetAllVolumes");
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::GetAllVolumes, WriteInterfaceToken failed");
return result;
}
int err = Remote()->SendRequest(GET_ALL_VOLUMES, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::GetAllVolumes, SendRequest failed");
return result;
}
int size = reply.ReadUint32();
if (size == 0) {
return result;
}
for (int i = 0; i < size; i++) {
std::unique_ptr<VolumeExternal> ve = VolumeExternal::Unmarshalling(reply);
LOGI("StorageManagerProxy::GetAllVolumes push %{public}s", ve->GetId().c_str());
result.push_back(*ve);
}
return result;
}
void StorageManagerProxy::NotifyDiskCreated(Disk disk)
{
LOGI("StorageManagerProxy::NotifyDiskCreate, diskId:%{public}s", disk.GetDiskId().c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::NotifyDiskCreate, WriteInterfaceToken failed");
return;
}
disk.Marshalling(data);
int err = Remote()->SendRequest(NOTIFY_DISK_CREATED, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::NotifyDiskCreate, SendRequest failed");
return;
}
}
void StorageManagerProxy::NotifyDiskDestroyed(std::string diskId)
{
LOGI("StorageManagerProxy::NotifyDiskDestroyed, diskId:%{public}s", diskId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::NotifyDiskDestroyed, WriteInterfaceToken failed");
return;
}
if (!data.WriteString(diskId)) {
LOGE("StorageManagerProxy::NotifyDiskDestroyed, WriteString failed");
return;
}
int err = Remote()->SendRequest(NOTIFY_DISK_DESTROYED, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::NotifyDiskDestroyed, SendRequest failed");
return;
}
}
int32_t StorageManagerProxy::Partition(std::string diskId, int32_t type)
{
LOGI("StorageManagerProxy::Partition, diskId:%{public}s", diskId.c_str());
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::Partition, WriteInterfaceToken failed");
return E_IPC_ERROR;
}
if (!data.WriteString(diskId)) {
LOGE("StorageManagerProxy::Partition, WriteString failed");
return E_IPC_ERROR;
}
if (!data.WriteInt32(type)) {
LOGE("StorageManagerProxy::Partition WriteInt32 failed");
return E_IPC_ERROR;
}
int err = Remote()->SendRequest(PARTITION, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::Partition, SendRequest failed");
return E_IPC_ERROR;
}
return reply.ReadInt32();
}
std::vector<Disk> StorageManagerProxy::GetAllDisks()
{
LOGI("StorageManagerProxy::GetAllDisks");
std::vector<Disk> result = {};
MessageParcel data, reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
LOGE("StorageManagerProxy::GetAllDisks, WriteInterfaceToken failed");
return result;
}
int err = Remote()->SendRequest(GET_ALL_DISKS, data, reply, option);
if (err != E_OK) {
LOGE("StorageManagerProxy::GetAllDisks, SendRequest failed");
return result;
}
int size = reply.ReadUint32();
if (size == 0) {
return result;
}
for (int i = 0; i < size; i++) {
std::unique_ptr<Disk> disk = Disk::Unmarshalling(reply);
LOGI("StorageManagerProxy::GetAllDisks push %{public}s", disk->GetDiskId().c_str());
result.push_back(*disk);
}
return result;
}
} // StorageManager
} // OHOS

View File

@ -29,26 +29,56 @@ int32_t StorageManagerStub::OnRemoteRequest(uint32_t code,
int err = 0;
switch (code) {
case PREPARE_ADD_USER:
HandlePrepareAddUser(data, reply);
case PREPARE_ADD_USER:
HandlePrepareAddUser(data, reply);
break;
case REMOVE_USER:
HandleRemoveUser(data, reply);
case REMOVE_USER:
HandleRemoveUser(data, reply);
break;
case PREPARE_START_USER:
HandlePrepareStartUser(data, reply);
case PREPARE_START_USER:
HandlePrepareStartUser(data, reply);
break;
case STOP_USER:
HandleStopUser(data, reply);
case STOP_USER:
HandleStopUser(data, reply);
break;
case GET_TOTAL:
HandleGetTotal(data, reply);
case GET_TOTAL:
HandleGetTotal(data, reply);
break;
case GET_FREE:
HandleGetFree(data, reply);
case GET_FREE:
HandleGetFree(data, reply);
break;
case GET_BUNDLE_STATUS:
HandleGetBundleStatus(data, reply);
case GET_BUNDLE_STATUS:
HandleGetBundleStatus(data, reply);
break;
case NOTIFY_VOLUME_CREATED:
HandleNotifyVolumeCreated(data, reply);
break;
case NOTIFY_VOLUME_MOUNTED:
HandleNotifyVolumeMounted(data, reply);
break;
case NOTIFY_VOLUME_DESTORYED:
HandleNotifyVolumeDestoryed(data, reply);
break;
case MOUNT:
HandleMount(data, reply);
break;
case UNMOUNT:
HandleUnmount(data, reply);
break;
case GET_ALL_VOLUMES:
HandleGetAllVolumes(data, reply);
break;
case NOTIFY_DISK_CREATED:
HandleNotifyDiskCreated(data, reply);
break;
case NOTIFY_DISK_DESTROYED:
HandleNotifyDiskDestroyed(data, reply);
break;
case PARTITION:
HandlePartition(data, reply);
break;
case GET_ALL_DISKS:
HandleGetAllDisks(data, reply);
break;
default: {
LOGI("use IPCObjectStub default OnRemoteRequest");
@ -140,5 +170,130 @@ int32_t StorageManagerStub::HandleGetBundleStatus(MessageParcel &data, MessagePa
}
return E_OK;
}
int32_t StorageManagerStub::HandleGetAllVolumes(MessageParcel &data, MessageParcel &reply)
{
LOGE("StorageManagerStub::HandleGetAllVolumes Begin.");
std::vector<VolumeExternal> ve = GetAllVolumes();
int size = ve.size();
if (size == 0) {
LOGE("StorageManagerStub::No volume.");
if (!reply.WriteUint32(0)) {
return E_IPC_ERROR;
}
return E_OK;
}
if (!reply.WriteUint32(ve.size())) {
return E_IPC_ERROR;
}
for (int i = 0; i < size; i++) {
if (!ve[i].Marshalling(reply)) {
return E_IPC_ERROR;
}
}
return E_OK;
}
int32_t StorageManagerStub::HandleNotifyVolumeCreated(MessageParcel &data, MessageParcel &reply)
{
std::unique_ptr<VolumeCore> vc = VolumeCore::Unmarshalling(data);
NotifyVolumeCreated(*vc);
LOGI("StorageManagerStub::HandleNotifyVolumeCreated");
return E_OK;
}
int32_t StorageManagerStub::HandleNotifyVolumeMounted(MessageParcel &data, MessageParcel &reply)
{
std::string volumeId = data.ReadString();
int32_t fsType = data.ReadInt32();
std::string fsUuid = data.ReadString();
std::string path = data.ReadString();
std::string description = data.ReadString();
NotifyVolumeMounted(volumeId, fsType, fsUuid, path, description);
LOGI("StorageManagerStub::HandleNotifyVolumeMounted");
return E_OK;
}
int32_t StorageManagerStub::HandleNotifyVolumeDestoryed(MessageParcel &data, MessageParcel &reply)
{
std::string volumeId = data.ReadString();
NotifyVolumeDestoryed(volumeId);
LOGI("StorageManagerStub::HandleNotifyVolumeDestoryed");
return E_OK;
}
int32_t StorageManagerStub::HandleMount(MessageParcel &data, MessageParcel &reply)
{
LOGE("StorageManagerStub::HandleMount Begin.");
std::string volumeId = data.ReadString();
int err = Mount(volumeId);
if (!reply.WriteUint32(err)) {
LOGE("StorageManagerStub::HandleMount call Mount failed");
return E_IPC_ERROR;
}
return E_OK;
}
int32_t StorageManagerStub::HandleUnmount(MessageParcel &data, MessageParcel &reply)
{
LOGE("StorageManagerStub::HandleUnmount Begin.");
std::string volumeId = data.ReadString();
int err = Unmount(volumeId);
if (!reply.WriteUint32(err)) {
LOGE("StorageManagerStub::HandleUnmount call Mount failed");
return E_IPC_ERROR;
}
return E_OK;
}
int32_t StorageManagerStub::HandleNotifyDiskCreated(MessageParcel &data, MessageParcel &reply)
{
auto disk = Disk::Unmarshalling(data);
LOGI("zwd, %{public}s", disk->GetDiskId().c_str());
NotifyDiskCreated(*disk);
return E_OK;
}
int32_t StorageManagerStub::HandleNotifyDiskDestroyed(MessageParcel &data, MessageParcel &reply)
{
std::string diskId = data.ReadString();
NotifyDiskDestroyed(diskId);
return E_OK;
}
int32_t StorageManagerStub::HandlePartition(MessageParcel &data, MessageParcel &reply)
{
std::string diskId = data.ReadString();
int32_t type = data.ReadInt32();
int err = Partition(diskId, type);
if (!reply.WriteUint32(err)) {
LOGE("StorageManagerStub::HandlePartition call Partition failed");
return E_IPC_ERROR;
}
return E_OK;
}
int32_t StorageManagerStub::HandleGetAllDisks(MessageParcel &data, MessageParcel &reply)
{
LOGE("StorageManagerStub::HandleGetAllDisk Begin.");
std::vector<Disk> disks = GetAllDisks();
int size = disks.size();
if (size == 0) {
LOGE("StorageManagerStub::No Disk.");
if (!reply.WriteUint32(0)) {
return E_IPC_ERROR;
}
return E_OK;
}
if (!reply.WriteUint32(disks.size())) {
return E_IPC_ERROR;
}
for (int i = 0; i < size; i++) {
if (!disks[i].Marshalling(reply)) {
return E_IPC_ERROR;
}
}
return E_OK;
}
} // StorageManager
} // OHOS

View File

@ -99,5 +99,46 @@ int32_t StorageDaemonCommunication::StopUser(int32_t userId)
}
return storageDaemon_->StopUser(userId);
}
int32_t StorageDaemonCommunication::Mount(std::string volumeId, int32_t flag)
{
LOGI("StorageDaemonCommunication::mount start");
if (Connect() != E_OK) {
LOGE("StorageDaemonCommunication::mount connect failed");
return E_IPC_ERROR;
}
return storageDaemon_->Mount(volumeId, flag);
}
int32_t StorageDaemonCommunication::Unmount(std::string volumeId)
{
LOGI("StorageDaemonCommunication::unmount start");
if (Connect() != E_OK) {
LOGE("StorageDaemonCommunication::unmount connect failed");
return E_IPC_ERROR;
}
return storageDaemon_->UMount(volumeId);
}
int32_t StorageDaemonCommunication::Check(std::string volumeId)
{
LOGI("StorageDaemonCommunication::check start");
if (Connect() != E_OK) {
LOGE("StorageDaemonCommunication::check connect failed");
return E_IPC_ERROR;
}
return storageDaemon_->Check(volumeId);
return E_OK;
}
int32_t StorageDaemonCommunication::Partition(std::string diskId, int32_t type)
{
LOGI("StorageDaemonCommunication::Partition start");
if (Connect() != E_OK) {
LOGE("StorageDaemonCommunication::Partition connect failed");
return E_IPC_ERROR;
}
return E_OK;
}
} // StorageManager
} // OHOS

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "volume/notification.h"
#include "want.h"
#include "want_params.h"
#include "common_event_data.h"
#include "common_event_manager.h"
#include "common_event_support.h"
#include "string_wrapper.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageManager {
Notification::Notification() {}
Notification::~Notification() {}
void Notification::NotifyVolumeChange(int32_t notifyCode, std::string id, std::string diskId,
std::string fsUuid, std::string path)
{
AAFwk::Want want;
AAFwk::WantParams wantParams;
wantParams.SetParam("id", AAFwk::String::Box(id));
wantParams.SetParam("diskId", AAFwk::String::Box(diskId));
switch (notifyCode) {
case VOLUME_REMOVED:
LOGI("notifycode: VOLUME_REMOVED");
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_DISK_REMOVED);
break;
case VOLUME_UNMOUNTED:
LOGI("notifycode: VOLUME_UNMOUNTED");
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_DISK_UNMOUNTED);
break;
case VOLUME_MOUNTED:
LOGI("notifycode: VOLUME_MOUNTED");
wantParams.SetParam("fsUuid", AAFwk::String::Box(fsUuid));
wantParams.SetParam("path", AAFwk::String::Box(path));
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_DISK_MOUNTED);
break;
case VOLUME_BAD_REMOVAL:
LOGI("notifycode: VOLUME_BAD_REMOVAL");
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_DISK_BAD_REMOVAL);
break;
case VOLUME_EJECT:
LOGI("notifycode: VOLUME_EJECT");
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_DISK_EJECT);
break;
default: {
break;
}
}
want.SetParams(wantParams);
EventFwk::CommonEventData commonData { want };
EventFwk::CommonEventManager::PublishCommonEvent(commonData);
}
}
} // namespace OHOS