VoldNativeService.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C) 2017 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 specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _VOLD_NATIVE_SERVICE_H_
  17. #define _VOLD_NATIVE_SERVICE_H_
  18. #include <android-base/unique_fd.h>
  19. #include <binder/BinderService.h>
  20. #include "android/os/BnVold.h"
  21. namespace android {
  22. namespace vold {
  23. class VoldNativeService : public BinderService<VoldNativeService>, public os::BnVold {
  24. public:
  25. static status_t start();
  26. static char const* getServiceName() { return "vold"; }
  27. virtual status_t dump(int fd, const Vector<String16>& args) override;
  28. binder::Status setListener(const android::sp<android::os::IVoldListener>& listener);
  29. binder::Status monitor();
  30. binder::Status reset();
  31. binder::Status shutdown();
  32. binder::Status onUserAdded(int32_t userId, int32_t userSerial);
  33. binder::Status onUserRemoved(int32_t userId);
  34. binder::Status onUserStarted(int32_t userId);
  35. binder::Status onUserStopped(int32_t userId);
  36. binder::Status addAppIds(const std::vector<std::string>& packageNames,
  37. const std::vector<int32_t>& appIds);
  38. binder::Status addSandboxIds(const std::vector<int32_t>& appIds,
  39. const std::vector<std::string>& sandboxIds);
  40. binder::Status onSecureKeyguardStateChanged(bool isShowing);
  41. binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio);
  42. binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid);
  43. binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId);
  44. binder::Status unmount(const std::string& volId);
  45. binder::Status format(const std::string& volId, const std::string& fsType);
  46. binder::Status benchmark(const std::string& volId,
  47. const android::sp<android::os::IVoldTaskListener>& listener);
  48. binder::Status checkEncryption(const std::string& volId);
  49. binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId,
  50. const android::sp<android::os::IVoldTaskListener>& listener);
  51. binder::Status remountUid(int32_t uid, int32_t remountMode);
  52. binder::Status mkdirs(const std::string& path);
  53. binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey,
  54. int32_t ownerGid, std::string* _aidl_return);
  55. binder::Status destroyObb(const std::string& volId);
  56. binder::Status createStubVolume(const std::string& sourcePath, const std::string& mountPath,
  57. const std::string& fsType, const std::string& fsUuid,
  58. const std::string& fsLabel, std::string* _aidl_return);
  59. binder::Status destroyStubVolume(const std::string& volId);
  60. binder::Status fstrim(int32_t fstrimFlags,
  61. const android::sp<android::os::IVoldTaskListener>& listener);
  62. binder::Status runIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
  63. binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
  64. binder::Status mountAppFuse(int32_t uid, int32_t mountId,
  65. android::base::unique_fd* _aidl_return);
  66. binder::Status unmountAppFuse(int32_t uid, int32_t mountId);
  67. binder::Status openAppFuseFile(int32_t uid, int32_t mountId, int32_t fileId, int32_t flags,
  68. android::base::unique_fd* _aidl_return);
  69. binder::Status fdeCheckPassword(const std::string& password);
  70. binder::Status fdeRestart();
  71. binder::Status fdeComplete(int32_t* _aidl_return);
  72. binder::Status fdeEnable(int32_t passwordType, const std::string& password,
  73. int32_t encryptionFlags);
  74. binder::Status fdeChangePassword(int32_t passwordType, const std::string& password);
  75. binder::Status fdeVerifyPassword(const std::string& password);
  76. binder::Status fdeGetField(const std::string& key, std::string* _aidl_return);
  77. binder::Status fdeSetField(const std::string& key, const std::string& value);
  78. binder::Status fdeGetPasswordType(int32_t* _aidl_return);
  79. binder::Status fdeGetPassword(std::string* _aidl_return);
  80. binder::Status fdeClearPassword();
  81. binder::Status fbeEnable();
  82. binder::Status mountDefaultEncrypted();
  83. binder::Status initUser0();
  84. binder::Status isConvertibleToFbe(bool* _aidl_return);
  85. binder::Status mountFstab(const std::string& blkDevice, const std::string& mountPoint);
  86. binder::Status encryptFstab(const std::string& blkDevice, const std::string& mountPoint);
  87. binder::Status createUserKey(int32_t userId, int32_t userSerial, bool ephemeral);
  88. binder::Status destroyUserKey(int32_t userId);
  89. binder::Status addUserKeyAuth(int32_t userId, int32_t userSerial, const std::string& token,
  90. const std::string& secret);
  91. binder::Status fixateNewestUserKeyAuth(int32_t userId);
  92. binder::Status unlockUserKey(int32_t userId, int32_t userSerial, const std::string& token,
  93. const std::string& secret);
  94. binder::Status lockUserKey(int32_t userId);
  95. binder::Status prepareUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId,
  96. int32_t userSerial, int32_t flags);
  97. binder::Status destroyUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId,
  98. int32_t flags);
  99. binder::Status prepareSandboxForApp(const std::string& packageName, int32_t appId,
  100. const std::string& sandboxId, int32_t userId);
  101. binder::Status destroySandboxForApp(const std::string& packageName,
  102. const std::string& sandboxId, int32_t userId);
  103. binder::Status startCheckpoint(int32_t retry);
  104. binder::Status needsCheckpoint(bool* _aidl_return);
  105. binder::Status needsRollback(bool* _aidl_return);
  106. binder::Status commitChanges();
  107. binder::Status prepareCheckpoint();
  108. binder::Status restoreCheckpoint(const std::string& mountPoint);
  109. binder::Status restoreCheckpointPart(const std::string& mountPoint, int count);
  110. binder::Status markBootAttempt();
  111. binder::Status abortChanges(const std::string& message, bool retry);
  112. binder::Status supportsCheckpoint(bool* _aidl_return);
  113. binder::Status supportsBlockCheckpoint(bool* _aidl_return);
  114. binder::Status supportsFileCheckpoint(bool* _aidl_return);
  115. };
  116. } // namespace vold
  117. } // namespace android
  118. #endif // _VOLD_NATIVE_SERVICE_H_