Move MTP code to the android namespace

Change-Id: I5da48038fd5e4cdeefaeba42cdc74eb588b3448d
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/media/mtp/MtpClient.cpp b/media/mtp/MtpClient.cpp
index 5e4adb4..c0aacac 100644
--- a/media/mtp/MtpClient.cpp
+++ b/media/mtp/MtpClient.cpp
@@ -28,6 +28,8 @@
 #include "MtpDebug.h"
 #include "MtpStringBuffer.h"
 
+namespace android {
+
 MtpClient::MtpClient(struct usb_endpoint *ep_in, struct usb_endpoint *ep_out,
             struct usb_endpoint *ep_intr)
     :   mEndpointIn(ep_in),
@@ -134,3 +136,4 @@
     }
 }
 
+}  // namespace android
diff --git a/media/mtp/MtpClient.h b/media/mtp/MtpClient.h
index fbbd388..8e2d979 100644
--- a/media/mtp/MtpClient.h
+++ b/media/mtp/MtpClient.h
@@ -24,6 +24,8 @@
 
 #include "MtpUtils.h"
 
+namespace android {
+
 class MtpClient {
 private:
     struct usb_endpoint *mEndpointIn;
@@ -56,4 +58,6 @@
 
 };
 
+}; // namespace android
+
 #endif // _MTP_CLIENT_H
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp
index 8e7ea6e..71dcaee 100644
--- a/media/mtp/MtpDataPacket.cpp
+++ b/media/mtp/MtpDataPacket.cpp
@@ -21,6 +21,8 @@
 #include "MtpDataPacket.h"
 #include "MtpStringBuffer.h"
 
+namespace android {
+
 MtpDataPacket::MtpDataPacket()
     :   MtpPacket(512),
         mOffset(MTP_CONTAINER_HEADER_SIZE)
@@ -294,3 +296,5 @@
 }
 
 #endif // MTP_HOST
+
+}  // namespace android
diff --git a/media/mtp/MtpDataPacket.h b/media/mtp/MtpDataPacket.h
index 3b18e4e..825ff45 100644
--- a/media/mtp/MtpDataPacket.h
+++ b/media/mtp/MtpDataPacket.h
@@ -20,6 +20,8 @@
 #include "MtpPacket.h"
 #include "mtp.h"
 
+namespace android {
+
 class MtpDataPacket : public MtpPacket {
 private:
     // current offset for get/put methods
@@ -86,4 +88,6 @@
     inline bool         hasData() const { return mPacketSize > MTP_CONTAINER_HEADER_SIZE; }
 };
 
+}; // namespace android
+
 #endif // _MTP_DATA_PACKET_H
diff --git a/media/mtp/MtpDatabase.cpp b/media/mtp/MtpDatabase.cpp
index bb44ab6..8f6c75d 100644
--- a/media/mtp/MtpDatabase.cpp
+++ b/media/mtp/MtpDatabase.cpp
@@ -22,6 +22,8 @@
 #include <stdio.h>
 #include <sqlite3.h>
 
+namespace android {
+
 #define ID_COLUMN       1
 #define PATH_COLUMN     2
 #define FORMAT_COLUMN   3
@@ -51,7 +53,6 @@
 #define FILE_INSERT     "INSERT INTO files VALUES(?,?,?,?,?,?,?,?);"
 #define FILE_DELETE     "DELETE FROM files WHERE path = ?;"
 
-
 struct PropertyTableEntry {
     MtpObjectProperty   property;
     int                 type;
@@ -384,3 +385,5 @@
     packet.putUInt8(formFlag);
     // form, variable
 */
+
+}  // namespace android
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 66f70bd..2a48155 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -21,6 +21,8 @@
 #include "SqliteDatabase.h"
 #include "mtp.h"
 
+namespace android {
+
 class MtpDataPacket;
 class SqliteStatement;
 
@@ -62,4 +64,6 @@
     bool                    deleteFile(MtpObjectHandle handle);
 };
 
+}; // namespace android
+
 #endif // _MTP_DATABASE_H
diff --git a/media/mtp/MtpDebug.cpp b/media/mtp/MtpDebug.cpp
index 6d0273d..9ded6e2 100644
--- a/media/mtp/MtpDebug.cpp
+++ b/media/mtp/MtpDebug.cpp
@@ -16,6 +16,7 @@
 
 #include "MtpDebug.h"
 
+namespace android {
 
 struct OperationCodeEntry {
     const char* name;
@@ -71,3 +72,5 @@
     }
     return "*** UNKNOWN OPERATION ***";
 }
+
+}  // namespace android
diff --git a/media/mtp/MtpDebug.h b/media/mtp/MtpDebug.h
index bab79e9..289f5c7 100644
--- a/media/mtp/MtpDebug.h
+++ b/media/mtp/MtpDebug.h
@@ -19,9 +19,13 @@
 
 #include "mtp.h"
 
+namespace android {
+
 class MtpDebug {
 public:
     static const char* getOperationCodeName(MtpOperationCode code);
 };
 
+}; // namespace android
+
 #endif // _MTP_DEBUG_H
diff --git a/media/mtp/MtpPacket.cpp b/media/mtp/MtpPacket.cpp
index 26a9460..5b3e2af 100644
--- a/media/mtp/MtpPacket.cpp
+++ b/media/mtp/MtpPacket.cpp
@@ -22,6 +22,8 @@
 
 #include "MtpPacket.h"
 
+namespace android {
+
 MtpPacket::MtpPacket(int bufferSize)
     :   mBuffer(NULL),
         mBufferSize(bufferSize),
@@ -134,3 +136,5 @@
     return usb_endpoint_wait(usb_endpoint_get_device(ep), &ep_num);
 }
 #endif
+
+}  // namespace android
diff --git a/media/mtp/MtpPacket.h b/media/mtp/MtpPacket.h
index 26a3c24..6632c6e 100644
--- a/media/mtp/MtpPacket.h
+++ b/media/mtp/MtpPacket.h
@@ -17,13 +17,17 @@
 #ifndef _MTP_PACKET_H
 #define _MTP_PACKET_H
 
-class MtpStringBuffer;
-
 #include "mtp.h"
 #include "MtpUtils.h"
 
 #include <stdint.h>
 
+struct usb_endpoint;
+
+namespace android {
+
+class MtpStringBuffer;
+
 class MtpPacket {
 
 protected:
@@ -65,4 +69,6 @@
     void                putUInt32(int offset, uint32_t value);
 };
 
+}; // namespace android
+
 #endif // _MTP_PACKET_H
diff --git a/media/mtp/MtpRequestPacket.cpp b/media/mtp/MtpRequestPacket.cpp
index ed4cc9d..e3a720c 100644
--- a/media/mtp/MtpRequestPacket.cpp
+++ b/media/mtp/MtpRequestPacket.cpp
@@ -20,6 +20,8 @@
 
 #include "MtpRequestPacket.h"
 
+namespace android {
+
 MtpRequestPacket::MtpRequestPacket()
     :   MtpPacket(512)
 {
@@ -48,3 +50,5 @@
     return transfer(ep, mBuffer, mPacketSize);
 }
 #endif
+
+}  // namespace android
diff --git a/media/mtp/MtpRequestPacket.h b/media/mtp/MtpRequestPacket.h
index d44d1dc..df518f2 100644
--- a/media/mtp/MtpRequestPacket.h
+++ b/media/mtp/MtpRequestPacket.h
@@ -20,6 +20,8 @@
 #include "MtpPacket.h"
 #include "mtp.h"
 
+namespace android {
+
 class MtpRequestPacket : public MtpPacket {
 
 public:
@@ -41,4 +43,6 @@
                                                     { return setContainerCode(code); }
 };
 
+}; // namespace android
+
 #endif // _MTP_REQUEST_PACKET_H
diff --git a/media/mtp/MtpResponsePacket.cpp b/media/mtp/MtpResponsePacket.cpp
index 6ebac9e..a1979d7 100644
--- a/media/mtp/MtpResponsePacket.cpp
+++ b/media/mtp/MtpResponsePacket.cpp
@@ -20,6 +20,8 @@
 
 #include "MtpResponsePacket.h"
 
+namespace android {
+
 MtpResponsePacket::MtpResponsePacket()
     :   MtpPacket(512)
 {
@@ -49,4 +51,5 @@
 }
 #endif
 
+}  // namespace android
 
diff --git a/media/mtp/MtpResponsePacket.h b/media/mtp/MtpResponsePacket.h
index 84c3024..373f8f9 100644
--- a/media/mtp/MtpResponsePacket.h
+++ b/media/mtp/MtpResponsePacket.h
@@ -20,6 +20,8 @@
 #include "MtpPacket.h"
 #include "mtp.h"
 
+namespace android {
+
 class MtpResponsePacket : public MtpPacket {
 
 public:
@@ -41,4 +43,6 @@
                                                      { return setContainerCode(code); }
 };
 
+}; // namespace android
+
 #endif // _MTP_RESPONSE_PACKET_H
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 57b84ac..d868926 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -30,6 +30,8 @@
 
 #include "f_mtp.h"
 
+namespace android {
+
 static const MtpOperationCode kSupportedOperationCodes[] = {
     MTP_OPERATION_GET_DEVICE_INFO,
     MTP_OPERATION_OPEN_SESSION,
@@ -514,3 +516,5 @@
 
     return -1;
 }
+
+}  // namespace android
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h
index 81b1c81..ca570f0 100644
--- a/media/mtp/MtpServer.h
+++ b/media/mtp/MtpServer.h
@@ -24,6 +24,8 @@
 
 #include "MtpUtils.h"
 
+namespace android {
+
 class MtpStorage;
 class MtpDatabase;
 
@@ -83,4 +85,6 @@
     MtpResponseCode     doGetObjectPropDesc();
 };
 
+}; // namespace android
+
 #endif // _MTP_SERVER_H
diff --git a/media/mtp/MtpStorage.cpp b/media/mtp/MtpStorage.cpp
index bbdef51..d4de819 100644
--- a/media/mtp/MtpStorage.cpp
+++ b/media/mtp/MtpStorage.cpp
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <limits.h>
 
+namespace android {
 
 MtpStorage::MtpStorage(MtpStorageID id, const char* filePath, MtpDatabase* db)
     :   mStorageID(id),
@@ -133,3 +134,5 @@
     closedir(dir);
     return 0;
 }
+
+}  // namespace android
diff --git a/media/mtp/MtpStorage.h b/media/mtp/MtpStorage.h
index 011cb81..b1d4408 100644
--- a/media/mtp/MtpStorage.h
+++ b/media/mtp/MtpStorage.h
@@ -19,6 +19,8 @@
 
 #include "mtp.h"
 
+namespace android {
+
 class MtpDatabase;
 class SqliteStatement;
 
@@ -49,4 +51,6 @@
     int                     scanDirectory(const char* path, MtpObjectHandle parent);
 };
 
+}; // namespace android
+
 #endif // _MTP_STORAGE_H
diff --git a/media/mtp/MtpStringBuffer.cpp b/media/mtp/MtpStringBuffer.cpp
index 6b55c44..8694575 100644
--- a/media/mtp/MtpStringBuffer.cpp
+++ b/media/mtp/MtpStringBuffer.cpp
@@ -19,6 +19,7 @@
 #include "MtpDataPacket.h"
 #include "MtpStringBuffer.h"
 
+namespace android {
 
 MtpStringBuffer::MtpStringBuffer()
     :   mCharCount(0),
@@ -131,3 +132,5 @@
         packet->putUInt16(ch);
     }
 }
+
+}  // namespace android
diff --git a/media/mtp/MtpStringBuffer.h b/media/mtp/MtpStringBuffer.h
index 46138d2..4641c3f 100644
--- a/media/mtp/MtpStringBuffer.h
+++ b/media/mtp/MtpStringBuffer.h
@@ -19,6 +19,8 @@
 
 #include <stdint.h>
 
+namespace android {
+
 class MtpDataPacket;
 
 // Represents a utf8 string, with a maximum of 255 characters
@@ -47,4 +49,6 @@
 	inline operator const char*() const { return (const char *)mBuffer; }
 };
 
+}; // namespace android
+
 #endif // _MTP_STRING_BUFFER_H
diff --git a/media/mtp/MtpUtils.cpp b/media/mtp/MtpUtils.cpp
index a472781..77692cd 100644
--- a/media/mtp/MtpUtils.cpp
+++ b/media/mtp/MtpUtils.cpp
@@ -19,6 +19,8 @@
 #include <cutils/tztime.h>
 #include "MtpUtils.h"
 
+namespace android {
+
 /*
 DateTime strings follow a compatible subset of the definition found in ISO 8601, and
 take the form of a Unicode string formatted as: "YYYYMMDDThhmmss.s". In this
@@ -70,4 +72,4 @@
         tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 }
 
-
+}  // namespace android
diff --git a/media/mtp/MtpUtils.h b/media/mtp/MtpUtils.h
index 2e80762..edd78cb 100644
--- a/media/mtp/MtpUtils.h
+++ b/media/mtp/MtpUtils.h
@@ -20,6 +20,8 @@
 #include "utils/String8.h"
 #include "utils/Vector.h"
 
+namespace android {
+
 class MtpStorage;
 
 typedef android::Vector<MtpStorage *> MtpStorageList;
@@ -31,4 +33,6 @@
 bool parseDateTime(const char* dateTime, time_t& outSeconds);
 void formatDateTime(time_t seconds, char* buffer, int bufferLength);
 
+}; // namespace android
+
 #endif // _MTP_UTILS_H
diff --git a/media/mtp/SqliteDatabase.cpp b/media/mtp/SqliteDatabase.cpp
index 5a70dfe..e115630 100644
--- a/media/mtp/SqliteDatabase.cpp
+++ b/media/mtp/SqliteDatabase.cpp
@@ -20,6 +20,8 @@
 #include <stdio.h>
 #include <sqlite3.h>
 
+namespace android {
+
 SqliteDatabase::SqliteDatabase()
     :   mDatabaseHandle(NULL)
 {
@@ -79,3 +81,5 @@
     snprintf(buffer, sizeof(buffer), "PRAGMA user_version = %d", version);
     exec(buffer);
 }
+
+}  // namespace android
diff --git a/media/mtp/SqliteDatabase.h b/media/mtp/SqliteDatabase.h
index 841b2b7..56dd9dd 100644
--- a/media/mtp/SqliteDatabase.h
+++ b/media/mtp/SqliteDatabase.h
@@ -19,6 +19,8 @@
 
 typedef struct sqlite3 sqlite3;
 
+namespace android {
+
 class SqliteDatabase {
 private:
     sqlite3*        mDatabaseHandle;
@@ -41,7 +43,8 @@
     void            setVersion(int version);
 
     inline sqlite3* getDatabaseHandle() const { return mDatabaseHandle; }
-
 };
 
+}; // namespace android
+
 #endif // _SQLITE_DATABASE_H
diff --git a/media/mtp/SqliteStatement.cpp b/media/mtp/SqliteStatement.cpp
index e568928..e1300b6 100644
--- a/media/mtp/SqliteStatement.cpp
+++ b/media/mtp/SqliteStatement.cpp
@@ -20,6 +20,8 @@
 #include <stdio.h>
 #include <sqlite3.h>
 
+namespace android {
+
 SqliteStatement::SqliteStatement(SqliteDatabase* db)
     :   mDatabaseHandle(db->getDatabaseHandle()),
         mStatement(NULL),
@@ -75,3 +77,5 @@
 const char* SqliteStatement::getColumnString(int column) {
     return (const char *)sqlite3_column_text(mStatement, column);
 }
+
+}  // namespace android
diff --git a/media/mtp/SqliteStatement.h b/media/mtp/SqliteStatement.h
index 0fd8a1e..c0ebfff 100644
--- a/media/mtp/SqliteStatement.h
+++ b/media/mtp/SqliteStatement.h
@@ -17,11 +17,14 @@
 #ifndef _SQLITE_STATEMENT_H
 #define _SQLITE_STATEMENT_H
 
+#include <stdint.h>
+
 typedef struct sqlite3 sqlite3;
 typedef struct sqlite3_stmt sqlite3_stmt;
-class SqliteDatabase;
 
-#include <stdint.h>
+namespace android {
+
+class SqliteDatabase;
 
 class SqliteStatement {
 private:
@@ -48,4 +51,6 @@
     inline bool     isDone() const { return mDone; }
 };
 
+}; // namespace android
+
 #endif // _SQLITE_STATEMENT_H
diff --git a/media/mtp/mtptest.cpp b/media/mtp/mtptest.cpp
index 8996458..89aa622 100644
--- a/media/mtp/mtptest.cpp
+++ b/media/mtp/mtptest.cpp
@@ -25,6 +25,7 @@
 #include "MtpServer.h"
 #include "MtpStorage.h"
 
+using namespace android;
 
 static void enable_usb_function(const char* name, bool enable) {
     char    path[PATH_MAX];
diff --git a/media/mtp/ptptest.cpp b/media/mtp/ptptest.cpp
index 1218fa6e6..3922b61 100644
--- a/media/mtp/ptptest.cpp
+++ b/media/mtp/ptptest.cpp
@@ -23,6 +23,8 @@
 
 #include "MtpClient.h"
 
+using namespace android;
+
 static struct usb_device *sCameraDevice = NULL;
 static int sCameraInterface = 0;
 static MtpClient *sClient = NULL;
@@ -131,4 +133,4 @@
     }
 
     return 0;
-}
\ No newline at end of file
+}