Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 51027900 authored by Luca Stefani's avatar Luca Stefani Committed by Michael Bestas
Browse files

idmap2: Cache Lineage resources



Co-authored-by: default avatarMichael Bestas <mkbestas@lineageos.org>
Change-Id: I212e029be783657fec738031db44fdf2aa5f3cdd
parent 066b5313
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ using PolicyBitmask = android::ResTable_overlayable_policy_header::PolicyBitmask
namespace {

constexpr std::string_view kFrameworkPath = "/system/framework/framework-res.apk";
constexpr std::string_view kLineagePath = "/system/framework/org.lineageos.platform-res.apk";

Status ok() {
  return Status::ok();
@@ -213,9 +214,10 @@ Status Idmap2Service::createIdmap(const std::string& target_path, const std::str
idmap2::Result<Idmap2Service::TargetResourceContainerPtr> Idmap2Service::GetTargetContainer(
    const std::string& target_path) {
  const bool is_framework = target_path == kFrameworkPath;
  const bool is_lineage_framework = target_path == kLineagePath;
  bool use_cache;
  struct stat st = {};
  if (is_framework || !::stat(target_path.c_str(), &st)) {
  if (is_framework || is_lineage_framework || !::stat(target_path.c_str(), &st)) {
    use_cache = true;
  } else {
    LOG(WARNING) << "failed to stat target path '" << target_path << "' for the cache";