-static status_t preProcessImages(Bundle* bundle, const sp<AaptAssets>& assets,
- const sp<ResourceTypeSet>& set)
+class PreProcessImageWorkUnit : public WorkQueue::WorkUnit {
+public:
+ PreProcessImageWorkUnit(const Bundle* bundle, const sp<AaptAssets>& assets,
+ const sp<AaptFile>& file, volatile bool* hasErrors) :
+ mBundle(bundle), mAssets(assets), mFile(file), mHasErrors(hasErrors) {
+ }
+
+ virtual bool run() {
+ status_t status = preProcessImage(mBundle, mAssets, mFile, NULL);
+ if (status) {
+ *mHasErrors = true;
+ }
+ return true; // continue even if there are errors
+ }
+
+private:
+ const Bundle* mBundle;
+ sp<AaptAssets> mAssets;
+ sp<AaptFile> mFile;
+ volatile bool* mHasErrors;
+};
+
+static status_t preProcessImages(const Bundle* bundle, const sp<AaptAssets>& assets,
+ const sp<ResourceTypeSet>& set, const char* type)