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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package android.os;
|
|
|
|
|
2019-12-02 19:50:12 +01:00
|
|
|
import android.os.incremental.IncrementalFileSystemControlParcel;
|
2017-09-13 19:49:44 +02:00
|
|
|
import android.os.IVoldListener;
|
2019-11-19 10:16:03 +01:00
|
|
|
import android.os.IVoldMountCallback;
|
2017-09-15 20:57:44 +02:00
|
|
|
import android.os.IVoldTaskListener;
|
2017-09-13 19:49:44 +02:00
|
|
|
|
2017-09-06 21:47:40 +02:00
|
|
|
/** {@hide} */
|
|
|
|
interface IVold {
|
2017-09-13 19:49:44 +02:00
|
|
|
void setListener(IVoldListener listener);
|
|
|
|
|
2020-04-29 07:49:41 +02:00
|
|
|
void abortFuse();
|
2017-09-16 00:50:28 +02:00
|
|
|
void monitor();
|
2017-09-06 21:47:40 +02:00
|
|
|
void reset();
|
2017-09-07 23:27:28 +02:00
|
|
|
void shutdown();
|
|
|
|
|
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
|
|
|
void onUserAdded(int userId, int userSerial, int sharesStorageWithUserId);
|
2017-09-07 23:27:28 +02:00
|
|
|
void onUserRemoved(int userId);
|
2019-04-29 19:46:35 +02:00
|
|
|
void onUserStarted(int userId);
|
2017-09-07 23:27:28 +02:00
|
|
|
void onUserStopped(int userId);
|
2018-07-31 19:07:34 +02:00
|
|
|
|
|
|
|
void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
|
|
|
|
void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2017-12-15 06:15:20 +01:00
|
|
|
void onSecureKeyguardStateChanged(boolean isShowing);
|
|
|
|
|
2017-09-07 23:27:28 +02:00
|
|
|
void partition(@utf8InCpp String diskId, int partitionType, int ratio);
|
2017-10-24 19:08:45 +02:00
|
|
|
void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2019-11-19 10:16:03 +01:00
|
|
|
void mount(@utf8InCpp String volId, int mountFlags, int mountUserId,
|
2019-11-27 19:15:14 +01:00
|
|
|
@nullable IVoldMountCallback callback);
|
2017-09-07 23:27:28 +02:00
|
|
|
void unmount(@utf8InCpp String volId);
|
|
|
|
void format(@utf8InCpp String volId, @utf8InCpp String fsType);
|
2017-09-15 20:57:44 +02:00
|
|
|
void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2017-09-15 20:57:44 +02:00
|
|
|
void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
|
2018-09-19 00:14:18 +02:00
|
|
|
IVoldTaskListener listener);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
|
|
|
void remountUid(int uid, int remountMode);
|
2020-02-28 17:30:47 +01:00
|
|
|
void remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
|
2021-01-15 15:03:23 +01:00
|
|
|
void unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2020-02-12 15:29:02 +01:00
|
|
|
void setupAppDir(@utf8InCpp String path, int appUid);
|
2020-02-18 15:06:37 +01:00
|
|
|
void fixupAppDir(@utf8InCpp String path, int appUid);
|
2020-12-03 16:32:52 +01:00
|
|
|
void ensureAppDirsCreated(in @utf8InCpp String[] paths, int appUid);
|
2017-09-07 23:27:28 +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
|
|
|
@utf8InCpp String createObb(@utf8InCpp String sourcePath, int ownerGid);
|
2017-09-11 18:32:01 +02:00
|
|
|
void destroyObb(@utf8InCpp String volId);
|
|
|
|
|
2017-09-15 20:57:44 +02:00
|
|
|
void fstrim(int fstrimFlags, IVoldTaskListener listener);
|
2022-01-04 20:37:39 +01:00
|
|
|
void runIdleMaint(boolean needGC, IVoldTaskListener listener);
|
2017-10-18 00:41:45 +02:00
|
|
|
void abortIdleMaint(IVoldTaskListener listener);
|
2022-01-04 20:37:39 +01:00
|
|
|
int getStorageLifeTime();
|
|
|
|
void setGCUrgentPace(int neededSegments, int minSegmentThreshold,
|
2022-03-18 20:24:41 +01:00
|
|
|
float dirtyReclaimRate, float reclaimWeight,
|
2022-06-24 23:50:47 +02:00
|
|
|
int gcPeriod, int minGCSleepTime,
|
|
|
|
int targetDirtyRatio);
|
2022-01-04 20:37:39 +01:00
|
|
|
void refreshLatestWrite();
|
|
|
|
int getWriteAmount();
|
2017-09-11 18:32:01 +02:00
|
|
|
|
2018-10-27 04:56:45 +02:00
|
|
|
FileDescriptor mountAppFuse(int uid, int mountId);
|
|
|
|
void unmountAppFuse(int uid, int mountId);
|
2017-09-11 18:32:01 +02:00
|
|
|
|
2017-09-13 00:30:52 +02:00
|
|
|
void fbeEnable();
|
|
|
|
|
|
|
|
void initUser0();
|
2020-12-15 18:02:29 +01:00
|
|
|
void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, @utf8InCpp String zonedDevice);
|
|
|
|
void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType, @utf8InCpp String zonedDevice);
|
2017-09-13 00:30:52 +02:00
|
|
|
|
2021-01-19 18:51:51 +01:00
|
|
|
void setStorageBindingSeed(in byte[] seed);
|
|
|
|
|
2017-09-13 00:30:52 +02:00
|
|
|
void createUserKey(int userId, int userSerial, boolean ephemeral);
|
|
|
|
void destroyUserKey(int userId);
|
|
|
|
|
2022-01-25 20:21:37 +01:00
|
|
|
void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String secret);
|
|
|
|
void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String secret);
|
2017-09-13 00:30:52 +02:00
|
|
|
void fixateNewestUserKeyAuth(int userId);
|
|
|
|
|
2021-04-06 21:02:56 +02:00
|
|
|
int[] getUnlockedUsers();
|
2022-01-25 20:21:37 +01:00
|
|
|
void unlockUserKey(int userId, int userSerial, @utf8InCpp String secret);
|
2017-09-13 00:30:52 +02:00
|
|
|
void lockUserKey(int userId);
|
|
|
|
|
2018-09-19 00:14:18 +02:00
|
|
|
void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
|
|
|
|
int storageFlags);
|
2017-09-13 00:30:52 +02:00
|
|
|
void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
|
|
|
|
|
2018-10-05 01:26:22 +02:00
|
|
|
void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
|
|
|
|
in @utf8InCpp String sandboxId, int userId);
|
2018-10-25 20:06:55 +02:00
|
|
|
void destroySandboxForApp(in @utf8InCpp String packageName,
|
2018-10-05 01:26:22 +02:00
|
|
|
in @utf8InCpp String sandboxId, int userId);
|
2018-08-24 19:20:56 +02:00
|
|
|
|
2018-10-11 03:52:04 +02:00
|
|
|
void startCheckpoint(int retry);
|
2018-08-28 10:58:49 +02:00
|
|
|
boolean needsCheckpoint();
|
2018-10-03 02:40:44 +02:00
|
|
|
boolean needsRollback();
|
2020-06-11 08:51:17 +02:00
|
|
|
boolean isCheckpointing();
|
2019-03-21 01:02:47 +01:00
|
|
|
void abortChanges(in @utf8InCpp String device, boolean retry);
|
2018-10-11 03:52:04 +02:00
|
|
|
void commitChanges();
|
|
|
|
void prepareCheckpoint();
|
|
|
|
void restoreCheckpoint(@utf8InCpp String device);
|
2019-03-07 02:45:17 +01:00
|
|
|
void restoreCheckpointPart(@utf8InCpp String device, int count);
|
2018-10-11 03:52:04 +02:00
|
|
|
void markBootAttempt();
|
2019-01-23 02:27:25 +01:00
|
|
|
boolean supportsCheckpoint();
|
2019-03-18 21:36:40 +01:00
|
|
|
boolean supportsBlockCheckpoint();
|
|
|
|
boolean supportsFileCheckpoint();
|
2019-10-11 17:38:21 +02:00
|
|
|
void resetCheckpoint();
|
2018-08-28 10:58:49 +02:00
|
|
|
|
2020-11-12 10:59:13 +01:00
|
|
|
void earlyBootEnded();
|
2018-10-29 00:52:56 +01:00
|
|
|
@utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
|
|
|
|
@utf8InCpp String mountPath, @utf8InCpp String fsType,
|
2020-02-04 08:07:21 +01:00
|
|
|
@utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags);
|
2018-10-29 00:52:56 +01:00
|
|
|
void destroyStubVolume(@utf8InCpp String volId);
|
|
|
|
|
2018-10-27 04:56:45 +02:00
|
|
|
FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
|
|
|
|
|
2020-01-10 20:54:06 +01:00
|
|
|
boolean incFsEnabled();
|
2021-04-27 21:46:02 +02:00
|
|
|
IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName);
|
2019-12-02 19:50:12 +01:00
|
|
|
void unmountIncFs(@utf8InCpp String dir);
|
2021-05-11 01:19:38 +02:00
|
|
|
void setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName);
|
2019-12-02 19:50:12 +01:00
|
|
|
void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
|
|
|
|
|
2020-10-07 08:20:00 +02:00
|
|
|
void destroyDsuMetadataKey(@utf8InCpp String dsuSlot);
|
|
|
|
|
2017-09-11 18:32:01 +02:00
|
|
|
const int FSTRIM_FLAG_DEEP_TRIM = 1;
|
|
|
|
|
2017-09-07 23:27:28 +02:00
|
|
|
const int MOUNT_FLAG_PRIMARY = 1;
|
2021-11-11 03:23:01 +01:00
|
|
|
const int MOUNT_FLAG_VISIBLE_FOR_READ = 2;
|
|
|
|
const int MOUNT_FLAG_VISIBLE_FOR_WRITE = 4;
|
2017-09-07 23:27:28 +02:00
|
|
|
|
|
|
|
const int PARTITION_TYPE_PUBLIC = 0;
|
|
|
|
const int PARTITION_TYPE_PRIVATE = 1;
|
|
|
|
const int PARTITION_TYPE_MIXED = 2;
|
|
|
|
|
2017-09-13 00:30:52 +02:00
|
|
|
const int STORAGE_FLAG_DE = 1;
|
|
|
|
const int STORAGE_FLAG_CE = 2;
|
|
|
|
|
2017-09-07 23:27:28 +02:00
|
|
|
const int REMOUNT_MODE_NONE = 0;
|
|
|
|
const int REMOUNT_MODE_DEFAULT = 1;
|
2021-02-24 13:33:25 +01:00
|
|
|
const int REMOUNT_MODE_INSTALLER = 2;
|
|
|
|
const int REMOUNT_MODE_PASS_THROUGH = 3;
|
|
|
|
const int REMOUNT_MODE_ANDROID_WRITABLE = 4;
|
2017-09-07 23:27:28 +02:00
|
|
|
|
2017-09-13 19:49:44 +02:00
|
|
|
const int VOLUME_STATE_UNMOUNTED = 0;
|
|
|
|
const int VOLUME_STATE_CHECKING = 1;
|
|
|
|
const int VOLUME_STATE_MOUNTED = 2;
|
|
|
|
const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
|
|
|
|
const int VOLUME_STATE_FORMATTING = 4;
|
|
|
|
const int VOLUME_STATE_EJECTING = 5;
|
|
|
|
const int VOLUME_STATE_UNMOUNTABLE = 6;
|
|
|
|
const int VOLUME_STATE_REMOVED = 7;
|
|
|
|
const int VOLUME_STATE_BAD_REMOVAL = 8;
|
|
|
|
|
|
|
|
const int VOLUME_TYPE_PUBLIC = 0;
|
|
|
|
const int VOLUME_TYPE_PRIVATE = 1;
|
|
|
|
const int VOLUME_TYPE_EMULATED = 2;
|
|
|
|
const int VOLUME_TYPE_ASEC = 3;
|
|
|
|
const int VOLUME_TYPE_OBB = 4;
|
2018-10-29 00:52:56 +01:00
|
|
|
const int VOLUME_TYPE_STUB = 5;
|
2017-09-06 21:47:40 +02:00
|
|
|
}
|