summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/java/android/mtp/MtpDatabase.java19
-rw-r--r--media/java/android/mtp/MtpServer.java9
-rw-r--r--media/jni/android_mtp_MtpDatabase.cpp4
-rw-r--r--media/jni/android_mtp_MtpServer.cpp17
-rw-r--r--media/mtp/MtpServer.cpp30
-rw-r--r--media/mtp/MtpStorage.cpp2
6 files changed, 17 insertions, 64 deletions
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index abc457e..a595562 100644
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -222,7 +222,6 @@ public class MtpDatabase {
private int[] getObjectList(int storageID, int format, int parent) {
// we can ignore storageID until we support multiple storages
- Log.d(TAG, "getObjectList parent: " + parent);
Cursor c = null;
try {
if (format != 0) {
@@ -235,7 +234,6 @@ public class MtpDatabase {
PARENT_WHERE, new String[] { Integer.toString(parent) }, null);
}
if (c == null) {
- Log.d(TAG, "null cursor");
return null;
}
int count = c.getCount();
@@ -245,7 +243,6 @@ public class MtpDatabase {
c.moveToNext();
result[i] = c.getInt(0);
}
- Log.d(TAG, "returning " + result);
return result;
}
} catch (RemoteException e) {
@@ -260,7 +257,6 @@ public class MtpDatabase {
private int getNumObjects(int storageID, int format, int parent) {
// we can ignore storageID until we support multiple storages
- Log.d(TAG, "getObjectList parent: " + parent);
Cursor c = null;
try {
if (format != 0) {
@@ -529,8 +525,8 @@ public class MtpDatabase {
String newPath = path.substring(0, lastSlash + 1) + newName;
File newFile = new File(newPath);
boolean success = oldFile.renameTo(newFile);
- Log.d(TAG, "renaming "+ path + " to " + newPath + (success ? " succeeded" : " failed"));
if (!success) {
+ Log.w(TAG, "renaming "+ path + " to " + newPath + " failed");
return MtpConstants.RESPONSE_GENERAL_ERROR;
}
@@ -557,8 +553,6 @@ public class MtpDatabase {
private int setObjectProperty(int handle, int property,
long intValue, String stringValue) {
- Log.d(TAG, "setObjectProperty: " + property);
-
switch (property) {
case MtpConstants.PROPERTY_OBJECT_FILE_NAME:
return renameFile(handle, stringValue);
@@ -569,8 +563,6 @@ public class MtpDatabase {
}
private int getDeviceProperty(int property, long[] outIntValue, char[] outStringValue) {
- Log.d(TAG, "getDeviceProperty: " + property);
-
switch (property) {
case MtpConstants.DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER:
case MtpConstants.DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME:
@@ -616,8 +608,6 @@ public class MtpDatabase {
}
private int setDeviceProperty(int property, long intValue, String stringValue) {
- Log.d(TAG, "setDeviceProperty: " + property + " : " + stringValue);
-
switch (property) {
case MtpConstants.DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER:
case MtpConstants.DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME:
@@ -638,7 +628,6 @@ public class MtpDatabase {
private boolean getObjectInfo(int handle, int[] outStorageFormatParent,
char[] outName, long[] outSizeModified) {
- Log.d(TAG, "getObjectInfo: " + handle);
Cursor c = null;
try {
c = mMediaProvider.query(mObjectsUri, OBJECT_INFO_PROJECTION,
@@ -674,7 +663,6 @@ public class MtpDatabase {
}
private int getObjectFilePath(int handle, char[] outFilePath, long[] outFileLengthFormat) {
- Log.d(TAG, "getObjectFilePath: " + handle);
if (handle == 0) {
// special case root directory
mMediaStoragePath.getChars(0, mMediaStoragePath.length(), outFilePath, 0);
@@ -708,7 +696,6 @@ public class MtpDatabase {
}
private int deleteFile(int handle) {
- Log.d(TAG, "deleteFile: " + handle);
mDatabaseModified = true;
String path = null;
int format = 0;
@@ -754,7 +741,6 @@ public class MtpDatabase {
}
private int[] getObjectReferences(int handle) {
- Log.d(TAG, "getObjectReferences for: " + handle);
Uri uri = Files.getMtpReferencesUri(mVolumeName, handle);
Cursor c = null;
try {
@@ -802,14 +788,11 @@ public class MtpDatabase {
}
private void sessionStarted() {
- Log.d(TAG, "sessionStarted");
mDatabaseModified = false;
}
private void sessionEnded() {
- Log.d(TAG, "sessionEnded");
if (mDatabaseModified) {
- Log.d(TAG, "sending ACTION_MTP_SESSION_END");
mContext.sendBroadcast(new Intent(MediaStore.ACTION_MTP_SESSION_END));
mDatabaseModified = false;
}
diff --git a/media/java/android/mtp/MtpServer.java b/media/java/android/mtp/MtpServer.java
index af6e8eb..2e69373 100644
--- a/media/java/android/mtp/MtpServer.java
+++ b/media/java/android/mtp/MtpServer.java
@@ -34,15 +34,6 @@ public class MtpServer {
native_setup(database, storagePath, reserveSpace);
}
- @Override
- protected void finalize() throws Throwable {
- try {
- native_finalize();
- } finally {
- super.finalize();
- }
- }
-
public void start() {
native_start();
}
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 9abf6a2..17d39e3 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -1031,7 +1031,6 @@ static void
android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz)
{
#ifdef HAVE_ANDROID_OS
- LOGD("setup\n");
MyMtpDatabase* database = new MyMtpDatabase(env, thiz);
env->SetIntField(thiz, field_context, (int)database);
checkAndClearExceptionFromCallback(env, __FUNCTION__);
@@ -1042,7 +1041,6 @@ static void
android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz)
{
#ifdef HAVE_ANDROID_OS
- LOGD("finalize\n");
MyMtpDatabase* database = (MyMtpDatabase *)env->GetIntField(thiz, field_context);
database->cleanup(env);
delete database;
@@ -1081,8 +1079,6 @@ int register_android_mtp_MtpDatabase(JNIEnv *env)
{
jclass clazz;
- LOGD("register_android_mtp_MtpDatabase\n");
-
clazz = env->FindClass("android/mtp/MtpDatabase");
if (clazz == NULL) {
LOGE("Can't find android/mtp/MtpDatabase");
diff --git a/media/jni/android_mtp_MtpServer.cpp b/media/jni/android_mtp_MtpServer.cpp
index 8908e67..1452d21 100644
--- a/media/jni/android_mtp_MtpServer.cpp
+++ b/media/jni/android_mtp_MtpServer.cpp
@@ -111,7 +111,6 @@ public:
sMutex.unlock();
- LOGD("MtpThread mServer->run");
mServer->run();
sleep(1);
@@ -128,7 +127,6 @@ public:
env->DeleteGlobalRef(mJavaServer);
sMutex.unlock();
- LOGD("threadLoop returning");
return false;
}
@@ -160,8 +158,6 @@ android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase,
jstring storagePath, jlong reserveSpace)
{
#ifdef HAVE_ANDROID_OS
- LOGD("setup\n");
-
MtpDatabase* database = getMtpDatabase(env, javaDatabase);
const char *storagePathStr = env->GetStringUTFChars(storagePath, NULL);
@@ -174,17 +170,9 @@ android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase,
}
static void
-android_mtp_MtpServer_finalize(JNIEnv *env, jobject thiz)
-{
- LOGD("finalize\n");
-}
-
-
-static void
android_mtp_MtpServer_start(JNIEnv *env, jobject thiz)
{
#ifdef HAVE_ANDROID_OS
- LOGD("start\n");
MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
thread->run("MtpThread");
#endif // HAVE_ANDROID_OS
@@ -194,7 +182,6 @@ static void
android_mtp_MtpServer_stop(JNIEnv *env, jobject thiz)
{
#ifdef HAVE_ANDROID_OS
- LOGD("stop\n");
MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
if (thread)
thread->stop();
@@ -225,7 +212,6 @@ static void
android_mtp_MtpServer_set_ptp_mode(JNIEnv *env, jobject thiz, jboolean usePtp)
{
#ifdef HAVE_ANDROID_OS
- LOGD("set_ptp_mode\n");
MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
if (thread)
thread->setPtpMode(usePtp);
@@ -237,7 +223,6 @@ android_mtp_MtpServer_set_ptp_mode(JNIEnv *env, jobject thiz, jboolean usePtp)
static JNINativeMethod gMethods[] = {
{"native_setup", "(Landroid/mtp/MtpDatabase;Ljava/lang/String;J)V",
(void *)android_mtp_MtpServer_setup},
- {"native_finalize", "()V", (void *)android_mtp_MtpServer_finalize},
{"native_start", "()V", (void *)android_mtp_MtpServer_start},
{"native_stop", "()V", (void *)android_mtp_MtpServer_stop},
{"native_send_object_added", "(I)V", (void *)android_mtp_MtpServer_send_object_added},
@@ -251,8 +236,6 @@ int register_android_mtp_MtpServer(JNIEnv *env)
{
jclass clazz;
- LOGD("register_android_mtp_MtpServer\n");
-
clazz = env->FindClass("android/mtp/MtpServer");
if (clazz == NULL) {
LOGE("Can't find android/mtp/MtpServer");
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index b1bd145..be004d2 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -130,7 +130,7 @@ void MtpServer::run() {
while (1) {
int ret = mRequest.read(fd);
if (ret < 0) {
- LOGE("request read returned %d, errno: %d", ret, errno);
+ LOGV("request read returned %d, errno: %d", ret, errno);
if (errno == ECANCELED) {
// return to top of loop and wait for next command
continue;
@@ -204,23 +204,23 @@ void MtpServer::run() {
void MtpServer::sendObjectAdded(MtpObjectHandle handle) {
if (mSessionOpen) {
- LOGD("sendObjectAdded %d\n", handle);
+ LOGV("sendObjectAdded %d\n", handle);
mEvent.setEventCode(MTP_EVENT_OBJECT_ADDED);
mEvent.setTransactionID(mRequest.getTransactionID());
mEvent.setParameter(1, handle);
int ret = mEvent.write(mFD);
- LOGD("mEvent.write returned %d\n", ret);
+ LOGV("mEvent.write returned %d\n", ret);
}
}
void MtpServer::sendObjectRemoved(MtpObjectHandle handle) {
if (mSessionOpen) {
- LOGD("sendObjectRemoved %d\n", handle);
+ LOGV("sendObjectRemoved %d\n", handle);
mEvent.setEventCode(MTP_EVENT_OBJECT_REMOVED);
mEvent.setTransactionID(mRequest.getTransactionID());
mEvent.setParameter(1, handle);
int ret = mEvent.write(mFD);
- LOGD("mEvent.write returned %d\n", ret);
+ LOGV("mEvent.write returned %d\n", ret);
}
}
@@ -496,7 +496,7 @@ MtpResponseCode MtpServer::doSetObjectReferences() {
MtpResponseCode MtpServer::doGetObjectPropValue() {
MtpObjectHandle handle = mRequest.getParameter(1);
MtpObjectProperty property = mRequest.getParameter(2);
- LOGD("GetObjectPropValue %d %s\n", handle,
+ LOGV("GetObjectPropValue %d %s\n", handle,
MtpDebug::getObjectPropCodeName(property));
return mDatabase->getObjectPropertyValue(handle, property, mData);
@@ -505,7 +505,7 @@ MtpResponseCode MtpServer::doGetObjectPropValue() {
MtpResponseCode MtpServer::doSetObjectPropValue() {
MtpObjectHandle handle = mRequest.getParameter(1);
MtpObjectProperty property = mRequest.getParameter(2);
- LOGD("SetObjectPropValue %d %s\n", handle,
+ LOGV("SetObjectPropValue %d %s\n", handle,
MtpDebug::getObjectPropCodeName(property));
return mDatabase->setObjectPropertyValue(handle, property, mData);
@@ -513,7 +513,7 @@ MtpResponseCode MtpServer::doSetObjectPropValue() {
MtpResponseCode MtpServer::doGetDevicePropValue() {
MtpDeviceProperty property = mRequest.getParameter(1);
- LOGD("GetDevicePropValue %s\n",
+ LOGV("GetDevicePropValue %s\n",
MtpDebug::getDevicePropCodeName(property));
return mDatabase->getDevicePropertyValue(property, mData);
@@ -521,7 +521,7 @@ MtpResponseCode MtpServer::doGetDevicePropValue() {
MtpResponseCode MtpServer::doSetDevicePropValue() {
MtpDeviceProperty property = mRequest.getParameter(1);
- LOGD("SetDevicePropValue %s\n",
+ LOGV("SetDevicePropValue %s\n",
MtpDebug::getDevicePropCodeName(property));
return mDatabase->setDevicePropertyValue(property, mData);
@@ -529,7 +529,7 @@ MtpResponseCode MtpServer::doSetDevicePropValue() {
MtpResponseCode MtpServer::doResetDevicePropValue() {
MtpDeviceProperty property = mRequest.getParameter(1);
- LOGD("ResetDevicePropValue %s\n",
+ LOGV("ResetDevicePropValue %s\n",
MtpDebug::getDevicePropCodeName(property));
return mDatabase->resetDeviceProperty(property);
@@ -543,7 +543,7 @@ MtpResponseCode MtpServer::doGetObjectPropList() {
uint32_t property = mRequest.getParameter(3);
int groupCode = mRequest.getParameter(4);
int depth = mRequest.getParameter(5);
- LOGD("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
+ LOGV("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
handle, MtpDebug::getFormatCodeName(format),
MtpDebug::getObjectPropCodeName(property), groupCode, depth);
@@ -674,7 +674,7 @@ MtpResponseCode MtpServer::doSendObjectInfo() {
mData.getString(modified); // date modified
// keywords follow
- LOGD("name: %s format: %04X\n", (const char *)name, format);
+ LOGV("name: %s format: %04X\n", (const char *)name, format);
time_t modifiedTime;
if (!parseDateTime(modified, modifiedTime))
modifiedTime = 0;
@@ -750,7 +750,7 @@ MtpResponseCode MtpServer::doSendObject() {
mfr.offset = 0;
mfr.length = mSendObjectFileSize;
- LOGD("receiving %s\n", (const char *)mSendObjectFilePath);
+ LOGV("receiving %s\n", (const char *)mSendObjectFilePath);
// transfer the file
ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
close(mfr.fd);
@@ -854,7 +854,7 @@ MtpResponseCode MtpServer::doDeleteObject() {
MtpResponseCode MtpServer::doGetObjectPropDesc() {
MtpObjectProperty propCode = mRequest.getParameter(1);
MtpObjectFormat format = mRequest.getParameter(2);
- LOGD("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
+ LOGV("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
MtpDebug::getFormatCodeName(format));
MtpProperty* property = mDatabase->getObjectPropertyDesc(propCode, format);
if (!property)
@@ -866,7 +866,7 @@ MtpResponseCode MtpServer::doGetObjectPropDesc() {
MtpResponseCode MtpServer::doGetDevicePropDesc() {
MtpDeviceProperty propCode = mRequest.getParameter(1);
- LOGD("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
+ LOGV("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
MtpProperty* property = mDatabase->getDevicePropertyDesc(propCode);
if (!property)
return MTP_RESPONSE_DEVICE_PROP_NOT_SUPPORTED;
diff --git a/media/mtp/MtpStorage.cpp b/media/mtp/MtpStorage.cpp
index abc23de..2fbbc51 100644
--- a/media/mtp/MtpStorage.cpp
+++ b/media/mtp/MtpStorage.cpp
@@ -38,7 +38,7 @@ MtpStorage::MtpStorage(MtpStorageID id, const char* filePath, uint64_t reserveSp
mMaxCapacity(0),
mReserveSpace(reserveSpace)
{
- LOGD("MtpStorage id: %d path: %s\n", id, filePath);
+ LOGV("MtpStorage id: %d path: %s\n", id, filePath);
}
MtpStorage::~MtpStorage() {