diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-07-20 16:38:43 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-07-20 17:33:13 -0700 |
commit | 7188e55f54a43c55fd6b96454720c447f1dc454e (patch) | |
tree | ce77a06ad12fc66ce180fdbf882c011393d472d9 /include/media/mediascanner.h | |
parent | 50d42da58a88dcdb082cff079766af71c0871470 (diff) | |
download | frameworks_av-7188e55f54a43c55fd6b96454720c447f1dc454e.zip frameworks_av-7188e55f54a43c55fd6b96454720c447f1dc454e.tar.gz frameworks_av-7188e55f54a43c55fd6b96454720c447f1dc454e.tar.bz2 |
Untangle MediaScanner error handling.
Bug: 5056917
Change-Id: I1a7a73579e3ba4e9709459329fc1901a28b0f4b1
Diffstat (limited to 'include/media/mediascanner.h')
-rw-r--r-- | include/media/mediascanner.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h index 765c039..803bffb 100644 --- a/include/media/mediascanner.h +++ b/include/media/mediascanner.h @@ -23,23 +23,33 @@ #include <utils/Errors.h> #include <pthread.h> +struct dirent; + namespace android { class MediaScannerClient; class StringArray; +enum MediaScanResult { + // This file or directory was scanned successfully. + MEDIA_SCAN_RESULT_OK, + // This file or directory was skipped because it was not found, could + // not be opened, was of an unsupported type, or was malfored in some way. + MEDIA_SCAN_RESULT_SKIPPED, + // The scan should be aborted due to a fatal error such as out of memory + // or an exception. + MEDIA_SCAN_RESULT_ERROR, +}; + struct MediaScanner { MediaScanner(); virtual ~MediaScanner(); - virtual status_t processFile( - const char *path, const char *mimeType, - MediaScannerClient &client) = 0; + virtual MediaScanResult processFile( + const char *path, const char *mimeType, MediaScannerClient &client) = 0; - typedef bool (*ExceptionCheck)(void* env); - virtual status_t processDirectory( - const char *path, MediaScannerClient &client, - ExceptionCheck exceptionCheck, void *exceptionEnv); + virtual MediaScanResult processDirectory( + const char *path, MediaScannerClient &client); void setLocale(const char *locale); @@ -53,9 +63,11 @@ private: // current locale (like "ja_JP"), created/destroyed with strdup()/free() char *mLocale; - status_t doProcessDirectory( - char *path, int pathRemaining, MediaScannerClient &client, - bool noMedia, ExceptionCheck exceptionCheck, void *exceptionEnv); + MediaScanResult doProcessDirectory( + char *path, int pathRemaining, MediaScannerClient &client, bool noMedia); + MediaScanResult doProcessDirectoryEntry( + char *path, int pathRemaining, MediaScannerClient &client, bool noMedia, + struct dirent* entry, char* fileSpot); MediaScanner(const MediaScanner &); MediaScanner &operator=(const MediaScanner &); @@ -68,13 +80,13 @@ public: virtual ~MediaScannerClient(); void setLocale(const char* locale); void beginFile(); - bool addStringTag(const char* name, const char* value); + status_t addStringTag(const char* name, const char* value); void endFile(); - virtual bool scanFile(const char* path, long long lastModified, + virtual status_t scanFile(const char* path, long long lastModified, long long fileSize, bool isDirectory, bool noMedia) = 0; - virtual bool handleStringTag(const char* name, const char* value) = 0; - virtual bool setMimeType(const char* mimeType) = 0; + virtual status_t handleStringTag(const char* name, const char* value) = 0; + virtual status_t setMimeType(const char* mimeType) = 0; protected: void convertValues(uint32_t encoding); |