2017-09-06 21:47:40 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* 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 _VOLD_NATIVE_SERVICE_H_
|
|
|
|
#define _VOLD_NATIVE_SERVICE_H_
|
|
|
|
|
2017-09-11 18:32:01 +02:00
|
|
|
#include <android-base/unique_fd.h>
|
2017-09-06 21:47:40 +02:00
|
|
|
#include <binder/BinderService.h>
|
|
|
|
|
|
|
|
#include "android/os/BnVold.h"
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
namespace vold {
|
|
|
|
|
|
|
|
class VoldNativeService : public BinderService<VoldNativeService>, public os::BnVold {
|
2018-09-19 00:14:18 +02:00
|
|
|
public:
|
2017-09-06 21:47:40 +02:00
|
|
|
static status_t start();
|
|
|
|
static char const* getServiceName() { return "vold"; }
|
2018-09-19 00:14:18 +02:00
|
|
|
virtual status_t dump(int fd, const Vector<String16>& args) override;
|
2017-09-06 21:47:40 +02:00
|
|
|
|
2017-09-13 19:49:44 +02:00
|
|
|
binder::Status setListener(const android::sp<android::os::IVoldListener>& listener);
|
|
|
|
|
2017-09-16 00:50:28 +02:00
|
|
|
binder::Status monitor();
|
2017-09-06 21:47:40 +02:00
|
|
|
binder::Status reset();
|
2017-09-07 23:27:28 +02:00
|
|
|
binder::Status shutdown();
|
2020-04-29 07:49:41 +02:00
|
|
|
binder::Status abortFuse();
|
2017-09-07 23:27:28 +02:00
|
|
|
|
Support bind mounting volumes into other volume's mountpoint.
With the way the FUSE mount point are currently setup for emulated
volumes, there can be multiple paths that serve the same files on the
lower filesystem; eg
* /mnt/user/0/emulated/0/Android
* /mnt/user/10/emulated/0/Android
both refer to the same file on the lower filesystem:
* /data/media/0/Android
this is normally not a problem, because cross-user file access is not
allowed, and so the FUSE daemon won't serve files for other users.
With clone profiles this is no longer true however, as their volumes
are accessible by each other.
So, it can happen that an app running in clone profile 10 accesses
"/mnt/user/10/emulated/0/Android", which would be served by the FUSE
daemon for the user 10 filesystem.
At the same time, an app running in the owner profile 0 accesses
"mnt/user/0/emulated/0/Android", which would be served by the FUSE
daemon for the user 0 filesystem.
This can cause page cache inconsistencies, because multiple FUSE daemons
can be running on top of the same entries in the lower filesystem.
To prevent this, use bind mounts to make sure that cross-profile
accesses actually end up in the FUSE daemon to which the volume
belongs: "/mnt/user/10/emulated/0" is bind-mounted to
"/mnt/user/0/emulated/0", and vice-versa.
Bug: 228271997
Test: manual
Change-Id: Iefcbc813670628b329a1a5d408b6126b84991e09
2022-07-12 10:11:02 +02:00
|
|
|
binder::Status onUserAdded(int32_t userId, int32_t userSerial, int32_t sharesStorageWithUserId);
|
2017-09-07 23:27:28 +02:00
|
|
|
binder::Status onUserRemoved(int32_t userId);
|
2019-04-29 19:46:35 +02:00
|
|
|
binder::Status onUserStarted(int32_t userId);
|
2017-09-07 23:27:28 +02:00
|
|
|
binder::Status onUserStopped(int32_t userId);
|
|
|
|
|
2018-07-31 19:07:34 +02:00
|
|
|
binder::Status addAppIds(const std::vector<std::string>& packageNames,
|
2018-09-19 00:14:18 +02:00
|
|
|
const std::vector<int32_t>& appIds);
|
2018-07-31 19:07:34 +02:00
|
|
|
binder::Status addSandboxIds(const std::vector<int32_t>& appIds,
|
2018-09-19 00:14:18 +02:00
|
|
|
const std::vector<std::string>& sandboxIds);
|
2018-07-31 19:07:34 +02:00
|
|
|
|
2017-12-15 06:15:20 +01:00
|
|
|
binder::Status onSecureKeyguardStateChanged(bool isShowing);
|
|
|
|
|
2017-09-07 23:27:28 +02:00
|
|
|
binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio);
|
2017-10-24 19:08:45 +02:00
|
|
|
binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2019-07-19 17:46:53 +02:00
|
|
|
binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId,
|
2019-11-19 10:16:03 +01:00
|
|
|
const android::sp<android::os::IVoldMountCallback>& callback);
|
2017-09-07 23:27:28 +02:00
|
|
|
binder::Status unmount(const std::string& volId);
|
|
|
|
binder::Status format(const std::string& volId, const std::string& fsType);
|
2017-09-15 20:57:44 +02:00
|
|
|
binder::Status benchmark(const std::string& volId,
|
2018-09-19 00:14:18 +02:00
|
|
|
const android::sp<android::os::IVoldTaskListener>& listener);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2017-09-15 20:57:44 +02:00
|
|
|
binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId,
|
2018-09-19 00:14:18 +02:00
|
|
|
const android::sp<android::os::IVoldTaskListener>& listener);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
|
|
|
binder::Status remountUid(int32_t uid, int32_t remountMode);
|
2020-02-28 17:30:47 +01:00
|
|
|
binder::Status remountAppStorageDirs(int uid, int pid,
|
|
|
|
const std::vector<std::string>& packageNames);
|
2021-01-15 15:03:23 +01:00
|
|
|
binder::Status unmountAppStorageDirs(int uid, int pid,
|
|
|
|
const std::vector<std::string>& packageNames);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2020-12-03 16:32:52 +01:00
|
|
|
binder::Status ensureAppDirsCreated(const std::vector<std::string>& paths, int32_t appUid);
|
2020-02-12 15:29:02 +01:00
|
|
|
binder::Status setupAppDir(const std::string& path, int32_t appUid);
|
2020-02-18 15:06:37 +01:00
|
|
|
binder::Status fixupAppDir(const std::string& path, int32_t appUid);
|
2017-09-11 18:32:01 +02:00
|
|
|
|
Remove broken code for mounting encrypted OBB files
Mounting encrypted OBB files has never worked reliably across devices,
partly due to its reliance on Twofish encryption support in the kernel.
This is because Twofish support (CONFIG_CRYPTO_TWOFISH) has never been
required or even recommended for Android. It has never been enabled in
GKI, but even before GKI it wasn't required or recommended. Moreover,
this is now the only Android feature that still uses dm-crypt
(CONFIG_DM_CRYPT), and some devices don't have that enabled either.
Therefore, it appears that this feature is unused. That's perhaps not
surprising, considering that the documentation for OBBs
(https://developer.android.com/google/play/expansion-files) says that
they are deprecated, and also it explains OBBs as being app files that
are opaque to the platform; the ability of the platform to mount OBBs
that happen to be in a particular format is never mentioned. That means
that OBB mounting is probably rarely used even with unencrypted OBBs.
Finally, the usefulness of OBBs having their own encryption layer (in
addition to what the platform already provides via FBE) is not clear
either, especially with such an unusual choice of cipher.
To avoid the confusion that is being caused by having the broken code
for mounting encrypted OBBs still sitting around, let's remove it.
Test: atest StorageManagerTest # on Cuttlefish
Test: atest StorageManagerIntegrationTest # on Cuttlefish
Bug: 216475849
Change-Id: Iaef32cce90f95ea745ba2b143f89e66f533f3479
2022-03-01 22:19:18 +01:00
|
|
|
binder::Status createObb(const std::string& sourcePath, int32_t ownerGid,
|
|
|
|
std::string* _aidl_return);
|
2017-09-11 18:32:01 +02:00
|
|
|
binder::Status destroyObb(const std::string& volId);
|
|
|
|
|
2018-10-29 00:52:56 +01:00
|
|
|
binder::Status createStubVolume(const std::string& sourcePath, const std::string& mountPath,
|
|
|
|
const std::string& fsType, const std::string& fsUuid,
|
2020-02-04 08:07:21 +01:00
|
|
|
const std::string& fsLabel, int32_t flags,
|
|
|
|
std::string* _aidl_return);
|
2018-10-29 00:52:56 +01:00
|
|
|
binder::Status destroyStubVolume(const std::string& volId);
|
|
|
|
|
2017-09-15 20:57:44 +02:00
|
|
|
binder::Status fstrim(int32_t fstrimFlags,
|
2018-09-19 00:14:18 +02:00
|
|
|
const android::sp<android::os::IVoldTaskListener>& listener);
|
2022-01-04 20:37:39 +01:00
|
|
|
binder::Status runIdleMaint(bool needGC,
|
|
|
|
const android::sp<android::os::IVoldTaskListener>& listener);
|
2018-09-19 00:14:18 +02:00
|
|
|
binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
|
2022-01-04 20:37:39 +01:00
|
|
|
binder::Status getStorageLifeTime(int32_t* _aidl_return);
|
2024-01-31 19:54:33 +01:00
|
|
|
binder::Status getStorageRemainingLifetime(int32_t* _aidl_return);
|
2022-01-04 20:37:39 +01:00
|
|
|
binder::Status setGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold,
|
2022-06-24 01:19:58 +02:00
|
|
|
float dirtyReclaimRate, float reclaimWeight, int32_t gcPeriod,
|
2022-06-24 23:50:47 +02:00
|
|
|
int32_t minGCSleepTime, int32_t targetDirtyRatio);
|
2022-01-04 20:37:39 +01:00
|
|
|
binder::Status refreshLatestWrite();
|
|
|
|
binder::Status getWriteAmount(int32_t* _aidl_return);
|
2017-09-11 18:32:01 +02:00
|
|
|
|
2018-10-27 04:56:45 +02:00
|
|
|
binder::Status mountAppFuse(int32_t uid, int32_t mountId,
|
2018-09-19 00:14:18 +02:00
|
|
|
android::base::unique_fd* _aidl_return);
|
2018-10-27 04:56:45 +02:00
|
|
|
binder::Status unmountAppFuse(int32_t uid, int32_t mountId);
|
|
|
|
binder::Status openAppFuseFile(int32_t uid, int32_t mountId, int32_t fileId, int32_t flags,
|
|
|
|
android::base::unique_fd* _aidl_return);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
|
|
|
binder::Status fbeEnable();
|
|
|
|
|
|
|
|
binder::Status initUser0();
|
2020-12-15 18:02:29 +01:00
|
|
|
binder::Status mountFstab(const std::string& blkDevice, const std::string& mountPoint,
|
2024-04-24 04:01:26 +02:00
|
|
|
bool isZoned, const std::vector<std::string>& userDevices);
|
2020-12-15 18:00:49 +01:00
|
|
|
binder::Status encryptFstab(const std::string& blkDevice, const std::string& mountPoint,
|
2024-04-24 04:01:26 +02:00
|
|
|
bool shouldFormat, const std::string& fsType, bool isZoned,
|
|
|
|
const std::vector<std::string>& userDevices);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
2021-01-19 18:51:51 +01:00
|
|
|
binder::Status setStorageBindingSeed(const std::vector<uint8_t>& seed);
|
|
|
|
|
2023-12-13 00:53:55 +01:00
|
|
|
binder::Status createUserStorageKeys(int32_t userId, bool ephemeral);
|
2023-10-19 21:47:20 +02:00
|
|
|
binder::Status destroyUserStorageKeys(int32_t userId);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
2024-04-03 23:18:01 +02:00
|
|
|
binder::Status setCeStorageProtection(int32_t userId, const std::vector<uint8_t>& secret);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
2021-04-06 21:02:56 +02:00
|
|
|
binder::Status getUnlockedUsers(std::vector<int>* _aidl_return);
|
2024-04-03 23:18:01 +02:00
|
|
|
binder::Status unlockCeStorage(int32_t userId, const std::vector<uint8_t>& secret);
|
2023-10-19 21:47:20 +02:00
|
|
|
binder::Status lockCeStorage(int32_t userId);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
2020-01-23 05:23:26 +01:00
|
|
|
binder::Status prepareUserStorage(const std::optional<std::string>& uuid, int32_t userId,
|
2023-12-13 00:53:55 +01:00
|
|
|
int32_t flags);
|
2020-01-23 05:23:26 +01:00
|
|
|
binder::Status destroyUserStorage(const std::optional<std::string>& uuid, int32_t userId,
|
2018-09-19 00:14:18 +02:00
|
|
|
int32_t flags);
|
2018-08-24 19:20:56 +02:00
|
|
|
|
2018-10-05 01:26:22 +02:00
|
|
|
binder::Status prepareSandboxForApp(const std::string& packageName, int32_t appId,
|
|
|
|
const std::string& sandboxId, int32_t userId);
|
2018-10-25 20:06:55 +02:00
|
|
|
binder::Status destroySandboxForApp(const std::string& packageName,
|
2018-10-05 01:26:22 +02:00
|
|
|
const std::string& sandboxId, int32_t userId);
|
2018-08-28 10:58:49 +02:00
|
|
|
|
2018-10-11 03:52:04 +02:00
|
|
|
binder::Status startCheckpoint(int32_t retry);
|
2018-08-28 10:58:49 +02:00
|
|
|
binder::Status needsCheckpoint(bool* _aidl_return);
|
2018-10-03 02:40:44 +02:00
|
|
|
binder::Status needsRollback(bool* _aidl_return);
|
2020-06-11 08:51:17 +02:00
|
|
|
binder::Status isCheckpointing(bool* _aidl_return);
|
2018-10-11 03:52:04 +02:00
|
|
|
binder::Status commitChanges();
|
|
|
|
binder::Status prepareCheckpoint();
|
|
|
|
binder::Status restoreCheckpoint(const std::string& mountPoint);
|
2019-03-07 02:45:17 +01:00
|
|
|
binder::Status restoreCheckpointPart(const std::string& mountPoint, int count);
|
2018-10-11 03:52:04 +02:00
|
|
|
binder::Status markBootAttempt();
|
2019-03-21 01:02:47 +01:00
|
|
|
binder::Status abortChanges(const std::string& message, bool retry);
|
2019-01-23 02:27:25 +01:00
|
|
|
binder::Status supportsCheckpoint(bool* _aidl_return);
|
2019-03-18 21:36:40 +01:00
|
|
|
binder::Status supportsBlockCheckpoint(bool* _aidl_return);
|
|
|
|
binder::Status supportsFileCheckpoint(bool* _aidl_return);
|
2019-10-11 17:38:21 +02:00
|
|
|
binder::Status resetCheckpoint();
|
2019-12-02 19:50:12 +01:00
|
|
|
|
2020-11-12 10:59:13 +01:00
|
|
|
binder::Status earlyBootEnded();
|
|
|
|
|
2020-01-10 20:54:06 +01:00
|
|
|
binder::Status incFsEnabled(bool* _aidl_return) override;
|
2019-12-02 19:50:12 +01:00
|
|
|
binder::Status mountIncFs(
|
2020-01-10 20:54:06 +01:00
|
|
|
const std::string& backingPath, const std::string& targetDir, int32_t flags,
|
2021-04-27 21:46:02 +02:00
|
|
|
const std::string& sysfsName,
|
2019-12-02 19:50:12 +01:00
|
|
|
::android::os::incremental::IncrementalFileSystemControlParcel* _aidl_return) override;
|
|
|
|
binder::Status unmountIncFs(const std::string& dir) override;
|
2020-03-31 23:46:25 +02:00
|
|
|
binder::Status setIncFsMountOptions(
|
|
|
|
const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
|
2021-05-11 01:19:38 +02:00
|
|
|
bool enableReadLogs, bool enableReadTimeouts, const std::string& sysfsName) override;
|
2019-12-02 19:50:12 +01:00
|
|
|
binder::Status bindMount(const std::string& sourceDir, const std::string& targetDir) override;
|
2020-10-07 08:20:00 +02:00
|
|
|
|
|
|
|
binder::Status destroyDsuMetadataKey(const std::string& dsuSlot) override;
|
2023-08-11 19:27:24 +02:00
|
|
|
|
|
|
|
binder::Status getStorageSize(int64_t* storageSize) override;
|
2017-09-06 21:47:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace vold
|
|
|
|
} // namespace android
|
|
|
|
|
|
|
|
#endif // _VOLD_NATIVE_SERVICE_H_
|