vold: add getUnlockedUsers() method to Binder interface
This is needed so that system_server can remind itself about which users
have their storage unlocked, if system_server is restarted due to a
userspace reboot (soft restart).
Bug: 146206679
Test: see I482ed8017f7bbc8f7d4fd5a2c0f58629317ce4ed
Change-Id: I02f0494d827094bd41bcfe5f63c24e204b728595
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index cfa74e0..04def5c 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -730,6 +730,14 @@
return true;
}
+std::vector<int> fscrypt_get_unlocked_users() {
+ std::vector<int> user_ids;
+ for (const auto& it : s_ce_policies) {
+ user_ids.push_back(it.first);
+ }
+ return user_ids;
+}
+
// TODO: rename to 'install' for consistency, and take flags to know which keys to install
bool fscrypt_unlock_user_key(userid_t user_id, int serial, const std::string& secret_hex) {
LOG(DEBUG) << "fscrypt_unlock_user_key " << user_id << " serial=" << serial;