From 98ef64e4a89ced79094d4ff3dc0123c1989f9e10 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Tue, 29 Jun 2010 16:42:13 -0400 Subject: MTP: Add MtpServer Java class to wrap MTP device support. Change-Id: I818c2d3b3f52ad5bb515acc4d3288b2b43e11908 Signed-off-by: Mike Lockwood --- media/java/android/media/MtpClient.java | 2 +- media/java/android/media/MtpServer.java | 57 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 media/java/android/media/MtpServer.java (limited to 'media/java') diff --git a/media/java/android/media/MtpClient.java b/media/java/android/media/MtpClient.java index 95182bd..ad6640f 100644 --- a/media/java/android/media/MtpClient.java +++ b/media/java/android/media/MtpClient.java @@ -110,4 +110,4 @@ public class MtpClient { private native boolean native_delete_object(int deviceID, int objectID); private native int native_get_parent(int deviceID, int objectID); private native int native_get_storage_id(int deviceID, int objectID); -} \ No newline at end of file +} diff --git a/media/java/android/media/MtpServer.java b/media/java/android/media/MtpServer.java new file mode 100644 index 0000000..a9a54e7 --- /dev/null +++ b/media/java/android/media/MtpServer.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.media; + +import android.util.Log; + +/** + * Java wrapper for MTP/PTP support as USB responder. + * {@hide} + */ +public class MtpServer { + + private static final String TAG = "MtpServer"; + + static { + System.loadLibrary("media_jni"); + } + + public MtpServer(String storagePath, String databasePath) { + native_setup(storagePath, databasePath); + } + + @Override + protected void finalize() { + native_finalize(); + } + + public void start() { + native_start(); + } + + public void stop() { + native_stop(); + } + + // used by the JNI code + private int mNativeContext; + + private native final void native_setup(String storagePath, String databasePath); + private native final void native_finalize(); + private native final void native_start(); + private native final void native_stop(); +} -- cgit v1.1