summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetManager.cpp
diff options
context:
space:
mode:
authorMÃ¥rten Kongstad <marten.kongstad@sony.com>2018-05-25 15:58:17 +0200
committerTodd Kennedy <toddke@google.com>2018-11-21 06:48:19 -0800
commit67d5c938e98681f20243345232ebd2c77b390419 (patch)
treeb75fc0264473cc2183ecdb05b2d545d0aa7bd716 /libs/androidfw/AssetManager.cpp
parente4205126eeb0bb81babe47b2a4608d8971cab6ed (diff)
idmap: optimize time to create idmap data
Change idmap to iterate over the resources in the overlay package instead of the target package when scanning for resources defined in both packages. This cuts down the runtime cost of creating an idmap considerably since the algorithm now scales with the number of resources in the overlay package (a handful) and not the number of resources in the target package (android: 10k, SystemUI: 8k) at a minor cost to code complexity. Improvements on the runtime of ResTable::createIdmap (systrace on an emulator running aosp_x86_64-eng): - target=android: 12.5 ms -> 3.0 ms - target=SystemUI: 8.6 ms -> 1.0 ms The bulk of the cost of creating an idmap from installd is now the fork and execl to call "idmap --fd ..." which weigh in at 16 ms. Bug: 80150169 Test: make libandroidfw_tests Test: atest OverlayHostTests OverlayDeviceTests Change-Id: I98e18d5958c0cd835a73055b714f5bf0f4f95a09
Diffstat (limited to 'libs/androidfw/AssetManager.cpp')
-rw-r--r--libs/androidfw/AssetManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 1cb0d25d8c08..365be10f597f 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -349,7 +349,7 @@ bool AssetManager::createIdmap(const char* targetApkPath, const char* overlayApk
goto exit;
}
}
- ret = tables[0].createIdmap(tables[1], targetCrc, overlayCrc,
+ ret = tables[1].createIdmap(tables[0], targetCrc, overlayCrc,
targetApkPath, overlayApkPath, (void**)outData, outSize) == NO_ERROR;
}