From 6700f1feb3da5023c3cbf1057d7bf56aeac10540 Mon Sep 17 00:00:00 2001 From: l30054665 Date: Thu, 14 Nov 2024 17:41:02 +0800 Subject: [PATCH] mtp muntiple Signed-off-by: l30054665 --- interfaces/innerkits/storage_manager/native/istorage_manager.h | 1 + .../storage_manager/native/storage_manager_ipc_interface_code.h | 1 + .../innerkits/storage_manager/native/storage_manager_proxy.h | 1 + interfaces/innerkits/storage_manager/native/volume_core.h | 1 + services/storage_daemon/include/ipc/storage_manager_client.h | 1 + services/storage_daemon/ipc/src/storage_manager_client.cpp | 1 + services/storage_daemon/mtp/src/mtp_device_monitor.cpp | 1 + services/storage_manager/include/ipc/storage_manager.h | 1 + services/storage_manager/include/ipc/storage_manager_stub.h | 1 + .../storage_manager/include/mock/storage_manager_proxy_mock.h | 1 + services/storage_manager/include/volume/notification.h | 2 ++ .../storage_manager/include/volume/volume_manager_service.h | 1 + .../innerkits_impl/src/storage_manager_proxy.cpp | 1 + services/storage_manager/ipc/src/storage_manager.cpp | 1 + services/storage_manager/ipc/src/storage_manager_stub.cpp | 1 + .../storage_manager/ipc/test/storage_manager_proxy_test.cpp | 1 + .../storage_manager/ipc/test/storage_manager_service_mock.h | 1 + services/storage_manager/ipc/test/storage_manager_stub_mock.h | 1 + services/storage_manager/ipc/test/storage_manager_stub_test.cpp | 1 + services/storage_manager/mock/storage_manager_proxy_mock.cpp | 1 + services/storage_manager/volume/src/notification.cpp | 1 + services/storage_manager/volume/src/volume_manager_service.cpp | 1 + .../storagemanagerproxy_fuzzer/storagemanagerproxymock.h | 1 + 23 files changed, 24 insertions(+) diff --git a/interfaces/innerkits/storage_manager/native/istorage_manager.h b/interfaces/innerkits/storage_manager/native/istorage_manager.h index 85f155ae..0d35ab61 100644 --- a/interfaces/innerkits/storage_manager/native/istorage_manager.h +++ b/interfaces/innerkits/storage_manager/native/istorage_manager.h @@ -71,6 +71,7 @@ public: virtual int32_t NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc, const std::string &uuid) = 0; virtual int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path) = 0; + // fscrypt api virtual int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) = 0; diff --git a/interfaces/innerkits/storage_manager/native/storage_manager_ipc_interface_code.h b/interfaces/innerkits/storage_manager/native/storage_manager_ipc_interface_code.h index 1a25e039..3d4abcb9 100644 --- a/interfaces/innerkits/storage_manager/native/storage_manager_ipc_interface_code.h +++ b/interfaces/innerkits/storage_manager/native/storage_manager_ipc_interface_code.h @@ -58,6 +58,7 @@ namespace StorageManager { UMOUNT_DFS_DOCS, GET_ALL_VOLUMES, NOTIFY_DISK_CREATED, + NOTIFY_DISK_DESTROYED, PARTITION, GET_ALL_DISKS, diff --git a/interfaces/innerkits/storage_manager/native/storage_manager_proxy.h b/interfaces/innerkits/storage_manager/native/storage_manager_proxy.h index 70892b8b..e67e7f29 100644 --- a/interfaces/innerkits/storage_manager/native/storage_manager_proxy.h +++ b/interfaces/innerkits/storage_manager/native/storage_manager_proxy.h @@ -63,6 +63,7 @@ public: int32_t NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc, const std::string &uuid) override; int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path) override; + // fscrypt api int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override; diff --git a/interfaces/innerkits/storage_manager/native/volume_core.h b/interfaces/innerkits/storage_manager/native/volume_core.h index 71efbcd6..858fa782 100644 --- a/interfaces/innerkits/storage_manager/native/volume_core.h +++ b/interfaces/innerkits/storage_manager/native/volume_core.h @@ -31,6 +31,7 @@ enum VolumeState { EJECTING, REMOVED, BAD_REMOVAL + }; class VolumeCore : public Parcelable { public: diff --git a/services/storage_daemon/include/ipc/storage_manager_client.h b/services/storage_daemon/include/ipc/storage_manager_client.h index bf92491d..05022d38 100644 --- a/services/storage_daemon/include/ipc/storage_manager_client.h +++ b/services/storage_daemon/include/ipc/storage_manager_client.h @@ -37,6 +37,7 @@ public: int32_t NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc, const std::string &uuid); int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path); + private: DISALLOW_COPY_AND_MOVE(StorageManagerClient); diff --git a/services/storage_daemon/ipc/src/storage_manager_client.cpp b/services/storage_daemon/ipc/src/storage_manager_client.cpp index 4549793a..eccce031 100644 --- a/services/storage_daemon/ipc/src/storage_manager_client.cpp +++ b/services/storage_daemon/ipc/src/storage_manager_client.cpp @@ -153,5 +153,6 @@ int32_t StorageManagerClient::NotifyMtpUnmounted(const std::string &id, const st } return E_OK; } + } // StorageDaemon } // OHOS diff --git a/services/storage_daemon/mtp/src/mtp_device_monitor.cpp b/services/storage_daemon/mtp/src/mtp_device_monitor.cpp index 337f926d..1931feb6 100644 --- a/services/storage_daemon/mtp/src/mtp_device_monitor.cpp +++ b/services/storage_daemon/mtp/src/mtp_device_monitor.cpp @@ -24,6 +24,7 @@ #include #include #include + #include "storage_service_errno.h" #include "storage_service_log.h" #include "utils/file_utils.h" diff --git a/services/storage_manager/include/ipc/storage_manager.h b/services/storage_manager/include/ipc/storage_manager.h index 4eccdec8..c0e8b735 100644 --- a/services/storage_manager/include/ipc/storage_manager.h +++ b/services/storage_manager/include/ipc/storage_manager.h @@ -73,6 +73,7 @@ public: const std::string &uuid) override; int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path) override; + // fscrypt api int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override; int32_t DeleteUserKeys(uint32_t userId) override; diff --git a/services/storage_manager/include/ipc/storage_manager_stub.h b/services/storage_manager/include/ipc/storage_manager_stub.h index 083d5626..30dd319c 100644 --- a/services/storage_manager/include/ipc/storage_manager_stub.h +++ b/services/storage_manager/include/ipc/storage_manager_stub.h @@ -66,6 +66,7 @@ private: int32_t HandleNotifyMtpMount(MessageParcel &data, MessageParcel &reply); int32_t HandleNotifyMtpUnmount(MessageParcel &data, MessageParcel &reply); + // fscrypt api int32_t HandleGenerateUserKeys(MessageParcel &data, MessageParcel &reply); int32_t HandleDeleteUserKeys(MessageParcel &data, MessageParcel &reply); diff --git a/services/storage_manager/include/mock/storage_manager_proxy_mock.h b/services/storage_manager/include/mock/storage_manager_proxy_mock.h index 1f87aa36..f61afeaa 100644 --- a/services/storage_manager/include/mock/storage_manager_proxy_mock.h +++ b/services/storage_manager/include/mock/storage_manager_proxy_mock.h @@ -93,6 +93,7 @@ public: int32_t NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc, const std::string &uuid) override; int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path) override; + // app file share api std::vector CreateShareFile(const std::vector &uriList, diff --git a/services/storage_manager/include/volume/notification.h b/services/storage_manager/include/volume/notification.h index cc56b126..59badcf7 100644 --- a/services/storage_manager/include/volume/notification.h +++ b/services/storage_manager/include/volume/notification.h @@ -20,12 +20,14 @@ #include #include "volume_external.h" + namespace OHOS { namespace StorageManager { class Notification final : public NoCopyable { DECLARE_DELAYED_SINGLETON(Notification); public: void NotifyVolumeChange(VolumeState notifyCode, std::shared_ptr volume); + }; } // StorageManager } // OHOS diff --git a/services/storage_manager/include/volume/volume_manager_service.h b/services/storage_manager/include/volume/volume_manager_service.h index 4740fc3a..5a2f5617 100644 --- a/services/storage_manager/include/volume/volume_manager_service.h +++ b/services/storage_manager/include/volume/volume_manager_service.h @@ -43,6 +43,7 @@ public: const std::string &uuid); void NotifyMtpUnmounted(const std::string &id, const std::string &path); + private: StorageService::StorageRlMap> volumeMap_; void VolumeStateNotify(VolumeState state, std::shared_ptr volume); diff --git a/services/storage_manager/innerkits_impl/src/storage_manager_proxy.cpp b/services/storage_manager/innerkits_impl/src/storage_manager_proxy.cpp index f71a04e1..08b44ebc 100644 --- a/services/storage_manager/innerkits_impl/src/storage_manager_proxy.cpp +++ b/services/storage_manager/innerkits_impl/src/storage_manager_proxy.cpp @@ -1457,6 +1457,7 @@ int32_t StorageManagerProxy::NotifyMtpUnmounted(const std::string &id, const std return reply.ReadInt32(); } + int32_t StorageManagerProxy::SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { diff --git a/services/storage_manager/ipc/src/storage_manager.cpp b/services/storage_manager/ipc/src/storage_manager.cpp index 4acafb49..a9c390a7 100644 --- a/services/storage_manager/ipc/src/storage_manager.cpp +++ b/services/storage_manager/ipc/src/storage_manager.cpp @@ -669,5 +669,6 @@ int32_t StorageManager::NotifyMtpUnmounted(const std::string &id, const std::str #endif return E_OK; } + } } diff --git a/services/storage_manager/ipc/src/storage_manager_stub.cpp b/services/storage_manager/ipc/src/storage_manager_stub.cpp index 50aa2144..31c06883 100644 --- a/services/storage_manager/ipc/src/storage_manager_stub.cpp +++ b/services/storage_manager/ipc/src/storage_manager_stub.cpp @@ -192,6 +192,7 @@ StorageManagerStub::StorageManagerStub() &StorageManagerStub::HandleNotifyMtpUnmount; } + int32_t StorageManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { diff --git a/services/storage_manager/ipc/test/storage_manager_proxy_test.cpp b/services/storage_manager/ipc/test/storage_manager_proxy_test.cpp index 4f653b4e..83fc2769 100644 --- a/services/storage_manager/ipc/test/storage_manager_proxy_test.cpp +++ b/services/storage_manager/ipc/test/storage_manager_proxy_test.cpp @@ -1707,4 +1707,5 @@ HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyMtpUnmounted_0000, EXPECT_EQ(result, E_WRITE_PARCEL_ERR); GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyMtpUnmounted_0000"; } + } // namespace \ No newline at end of file diff --git a/services/storage_manager/ipc/test/storage_manager_service_mock.h b/services/storage_manager/ipc/test/storage_manager_service_mock.h index 7f81800a..83469898 100644 --- a/services/storage_manager/ipc/test/storage_manager_service_mock.h +++ b/services/storage_manager/ipc/test/storage_manager_service_mock.h @@ -318,6 +318,7 @@ public: { return E_OK; } + }; } // namespace StorageManager } // namespace OHOS diff --git a/services/storage_manager/ipc/test/storage_manager_stub_mock.h b/services/storage_manager/ipc/test/storage_manager_stub_mock.h index 5e4117fe..95283050 100644 --- a/services/storage_manager/ipc/test/storage_manager_stub_mock.h +++ b/services/storage_manager/ipc/test/storage_manager_stub_mock.h @@ -85,6 +85,7 @@ public: MOCK_METHOD4(NotifyMtpMounted, int32_t(const std::string &, const std::string &, const std::string &, const std::string &)); MOCK_METHOD2(NotifyMtpUnmounted, int32_t(const std::string &, const std::string &)); + }; } // namespace StorageManager } // namespace OHOS diff --git a/services/storage_manager/ipc/test/storage_manager_stub_test.cpp b/services/storage_manager/ipc/test/storage_manager_stub_test.cpp index 30742cb2..a9026d48 100644 --- a/services/storage_manager/ipc/test/storage_manager_stub_test.cpp +++ b/services/storage_manager/ipc/test/storage_manager_stub_test.cpp @@ -217,6 +217,7 @@ HWTEST_F(StorageManagerStubTest, Storage_Manager_StorageManagerStubTest_OnRemote EXPECT_CALL(mock, SetRecoverKey(testing::_)).WillOnce(testing::Return(E_OK)); EXPECT_CALL(mock, NotifyMtpMounted(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(E_OK)); EXPECT_CALL(mock, NotifyMtpUnmounted(testing::_, testing::_)).WillOnce(testing::Return(E_OK)); + for (auto c : g_code) { MessageParcel data; diff --git a/services/storage_manager/mock/storage_manager_proxy_mock.cpp b/services/storage_manager/mock/storage_manager_proxy_mock.cpp index 2b8b3184..21c78f6a 100644 --- a/services/storage_manager/mock/storage_manager_proxy_mock.cpp +++ b/services/storage_manager/mock/storage_manager_proxy_mock.cpp @@ -316,5 +316,6 @@ int32_t StorageManagerProxy::NotifyMtpUnmounted(const std::string &id, const std { return E_OK; } + } // StorageManager } // OHOS diff --git a/services/storage_manager/volume/src/notification.cpp b/services/storage_manager/volume/src/notification.cpp index d11afd71..efc4d6e8 100644 --- a/services/storage_manager/volume/src/notification.cpp +++ b/services/storage_manager/volume/src/notification.cpp @@ -60,6 +60,7 @@ void Notification::NotifyVolumeChange(VolumeState notifyCode, std::shared_ptr