diff options
author | Mike Lockwood <lockwood@android.com> | 2010-06-29 16:42:13 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-06-30 17:02:07 -0400 |
commit | 98ef64e4a89ced79094d4ff3dc0123c1989f9e10 (patch) | |
tree | 528caaa2fd7b3fa89121de3b1035819bf26ceffa /media/java | |
parent | 071508d9f3d1c004cd9ef8d5329949e7a8a949c8 (diff) | |
download | frameworks_base-98ef64e4a89ced79094d4ff3dc0123c1989f9e10.zip frameworks_base-98ef64e4a89ced79094d4ff3dc0123c1989f9e10.tar.gz frameworks_base-98ef64e4a89ced79094d4ff3dc0123c1989f9e10.tar.bz2 |
MTP: Add MtpServer Java class to wrap MTP device support.
Change-Id: I818c2d3b3f52ad5bb515acc4d3288b2b43e11908
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/MtpClient.java | 2 | ||||
-rw-r--r-- | media/java/android/media/MtpServer.java | 57 |
2 files changed, 58 insertions, 1 deletions
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(); +} |