Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3156059 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Rename android.provider.Mtp to android.provider.Ptp



We are only supporting the PTP subset of MTP in host mode and have
no plans for full MTP, so calling it Mtp was misleading.

Also moved ACTION_MTP_SESSION_END Intent name to android.provider.MediaStore
and added it to the public API.

Change-Id: Ie35d15864d5972e65a39b982aa51316ecca3725a
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 57914381
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -157973,6 +157973,17 @@
 visibility="public"
>
</field>
<field name="ACTION_MTP_SESSION_END"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.provider.action.MTP_SESSION_END&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ACTION_VIDEO_CAPTURE"
 type="java.lang.String"
 transient="false"
+7 −0
Original line number Diff line number Diff line
@@ -53,6 +53,13 @@ public final class MediaStore {

    private static final String CONTENT_AUTHORITY_SLASH = "content://" + AUTHORITY + "/";

   /**
     * Broadcast Action:  A broadcast to indicate the end of an MTP session with the host.
     * This broadcast is only sent if MTP activity has modified the media database during the
     * most recent MTP session.
     */
    public static final String ACTION_MTP_SESSION_END = "android.provider.action.MTP_SESSION_END";

    /**
     * Activity Action: Launch a music player.
     * The activity should be able to play, browse, or manipulate music files stored on the device.
+10 −18
Original line number Diff line number Diff line
@@ -22,28 +22,20 @@ import android.util.Log;


/**
 * The MTP provider supports accessing content on MTP and PTP devices.
 * The PTP provider supports accessing content on PTP devices.
 * @hide
 */
public final class Mtp
public final class Ptp
{
    private final static String TAG = "Mtp";
    private final static String TAG = "Ptp";

    public static final String AUTHORITY = "mtp";
    public static final String AUTHORITY = "ptp";

    private static final String CONTENT_AUTHORITY_SLASH = "content://" + AUTHORITY + "/";
    private static final String CONTENT_AUTHORITY_DEVICE_SLASH = "content://" + AUTHORITY + "/device/";


   /**
     * Broadcast Action:  A broadcast to indicate the end of an MTP session with the host.
     * This broadcast is only sent if MTP activity has modified the media database during the
     * most recent MTP session
     */
    public static final String ACTION_MTP_SESSION_END = "android.provider.action.MTP_SESSION_END";

    /**
     * Contains list of all MTP/PTP devices
     * Contains list of all PTP devices
     */
    public static final class Device implements BaseColumns {

@@ -67,7 +59,7 @@ public final class Mtp
    }

    /**
     * Contains list of storage units for an MTP/PTP device
     * Contains list of storage units for an PTP device
     */
    public static final class Storage implements BaseColumns {

@@ -93,7 +85,7 @@ public final class Mtp
    }

    /**
     * Contains list of objects on an MTP/PTP device
     * Contains list of objects on an PTP device
     */
    public static final class Object implements BaseColumns {

@@ -133,7 +125,7 @@ public final class Mtp

        /**
         * The following columns correspond to the fields in the ObjectInfo dataset
         * as described in the MTP specification.
         * as described in the PTP specification.
         */

        /**
@@ -144,7 +136,7 @@ public final class Mtp

        /**
         * The object's format.  Can be one of the FORMAT_* symbols below,
         * or any of the valid MTP object formats as defined in the MTP specification.
         * or any of the valid PTP object formats as defined in the PTP specification.
         * <P>Type: INTEGER</P>
         */
        public static final String FORMAT = "format";
@@ -163,7 +155,7 @@ public final class Mtp

        /**
         * The object's thumbnail format.  Can be one of the FORMAT_* symbols below,
         * or any of the valid MTP object formats as defined in the MTP specification.
         * or any of the valid PTP object formats as defined in the PTP specification.
         * <P>Type: INTEGER</P>
         */
        public static final String THUMB_FORMAT = "thumb_format";
+31 −31
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@ package android.media;

import android.database.AbstractWindowedCursor;
import android.database.CursorWindow;
import android.provider.Mtp;
import android.provider.Ptp;
import android.util.Log;

import java.util.HashMap;

/**
  * Cursor class for MTP content provider
  * Cursor class for PTP content provider
  * @hide
  */
public final class MtpCursor extends AbstractWindowedCursor {
@@ -173,39 +173,39 @@ public final class MtpCursor extends AbstractWindowedCursor {

    static {
        sDeviceProjectionMap = new HashMap<String, Integer>();
        sDeviceProjectionMap.put(Mtp.Device._ID, new Integer(DEVICE_ROW_ID));
        sDeviceProjectionMap.put(Mtp.Device.MANUFACTURER, new Integer(DEVICE_MANUFACTURER));
        sDeviceProjectionMap.put(Mtp.Device.MODEL, new Integer(DEVICE_MODEL));
        sDeviceProjectionMap.put(Ptp.Device._ID, new Integer(DEVICE_ROW_ID));
        sDeviceProjectionMap.put(Ptp.Device.MANUFACTURER, new Integer(DEVICE_MANUFACTURER));
        sDeviceProjectionMap.put(Ptp.Device.MODEL, new Integer(DEVICE_MODEL));

        sStorageProjectionMap = new HashMap<String, Integer>();
        sStorageProjectionMap.put(Mtp.Storage._ID, new Integer(STORAGE_ROW_ID));
        sStorageProjectionMap.put(Mtp.Storage.IDENTIFIER, new Integer(STORAGE_IDENTIFIER));
        sStorageProjectionMap.put(Mtp.Storage.DESCRIPTION, new Integer(STORAGE_DESCRIPTION));
        sStorageProjectionMap.put(Ptp.Storage._ID, new Integer(STORAGE_ROW_ID));
        sStorageProjectionMap.put(Ptp.Storage.IDENTIFIER, new Integer(STORAGE_IDENTIFIER));
        sStorageProjectionMap.put(Ptp.Storage.DESCRIPTION, new Integer(STORAGE_DESCRIPTION));

        sObjectProjectionMap = new HashMap<String, Integer>();
        sObjectProjectionMap.put(Mtp.Object._ID, new Integer(OBJECT_ROW_ID));
        sObjectProjectionMap.put(Mtp.Object.STORAGE_ID, new Integer(OBJECT_STORAGE_ID));
        sObjectProjectionMap.put(Mtp.Object.FORMAT, new Integer(OBJECT_FORMAT));
        sObjectProjectionMap.put(Mtp.Object.PROTECTION_STATUS, new Integer(OBJECT_PROTECTION_STATUS));
        sObjectProjectionMap.put(Mtp.Object.SIZE, new Integer(OBJECT_SIZE));
        sObjectProjectionMap.put(Mtp.Object.THUMB_FORMAT, new Integer(OBJECT_THUMB_FORMAT));
        sObjectProjectionMap.put(Mtp.Object.THUMB_SIZE, new Integer(OBJECT_THUMB_SIZE));
        sObjectProjectionMap.put(Mtp.Object.THUMB_WIDTH, new Integer(OBJECT_THUMB_WIDTH));
        sObjectProjectionMap.put(Mtp.Object.THUMB_HEIGHT, new Integer(OBJECT_THUMB_HEIGHT));
        sObjectProjectionMap.put(Mtp.Object.IMAGE_WIDTH, new Integer(OBJECT_IMAGE_WIDTH));
        sObjectProjectionMap.put(Mtp.Object.IMAGE_HEIGHT, new Integer(OBJECT_IMAGE_HEIGHT));
        sObjectProjectionMap.put(Mtp.Object.IMAGE_DEPTH, new Integer(OBJECT_IMAGE_DEPTH));
        sObjectProjectionMap.put(Mtp.Object.PARENT, new Integer(OBJECT_PARENT));
        sObjectProjectionMap.put(Mtp.Object.ASSOCIATION_TYPE, new Integer(OBJECT_ASSOCIATION_TYPE));
        sObjectProjectionMap.put(Mtp.Object.ASSOCIATION_DESC, new Integer(OBJECT_ASSOCIATION_DESC));
        sObjectProjectionMap.put(Mtp.Object.SEQUENCE_NUMBER, new Integer(OBJECT_SEQUENCE_NUMBER));
        sObjectProjectionMap.put(Mtp.Object.NAME, new Integer(OBJECT_NAME));
        sObjectProjectionMap.put(Mtp.Object.DATE_CREATED, new Integer(OBJECT_DATE_CREATED));
        sObjectProjectionMap.put(Mtp.Object.DATE_MODIFIED, new Integer(OBJECT_DATE_MODIFIED));
        sObjectProjectionMap.put(Mtp.Object.KEYWORDS, new Integer(OBJECT_KEYWORDS));
        sObjectProjectionMap.put(Mtp.Object.THUMB, new Integer(OBJECT_THUMB));

        sObjectProjectionMap.put(Mtp.Object.NAME, new Integer(OBJECT_NAME));
        sObjectProjectionMap.put(Ptp.Object._ID, new Integer(OBJECT_ROW_ID));
        sObjectProjectionMap.put(Ptp.Object.STORAGE_ID, new Integer(OBJECT_STORAGE_ID));
        sObjectProjectionMap.put(Ptp.Object.FORMAT, new Integer(OBJECT_FORMAT));
        sObjectProjectionMap.put(Ptp.Object.PROTECTION_STATUS, new Integer(OBJECT_PROTECTION_STATUS));
        sObjectProjectionMap.put(Ptp.Object.SIZE, new Integer(OBJECT_SIZE));
        sObjectProjectionMap.put(Ptp.Object.THUMB_FORMAT, new Integer(OBJECT_THUMB_FORMAT));
        sObjectProjectionMap.put(Ptp.Object.THUMB_SIZE, new Integer(OBJECT_THUMB_SIZE));
        sObjectProjectionMap.put(Ptp.Object.THUMB_WIDTH, new Integer(OBJECT_THUMB_WIDTH));
        sObjectProjectionMap.put(Ptp.Object.THUMB_HEIGHT, new Integer(OBJECT_THUMB_HEIGHT));
        sObjectProjectionMap.put(Ptp.Object.IMAGE_WIDTH, new Integer(OBJECT_IMAGE_WIDTH));
        sObjectProjectionMap.put(Ptp.Object.IMAGE_HEIGHT, new Integer(OBJECT_IMAGE_HEIGHT));
        sObjectProjectionMap.put(Ptp.Object.IMAGE_DEPTH, new Integer(OBJECT_IMAGE_DEPTH));
        sObjectProjectionMap.put(Ptp.Object.PARENT, new Integer(OBJECT_PARENT));
        sObjectProjectionMap.put(Ptp.Object.ASSOCIATION_TYPE, new Integer(OBJECT_ASSOCIATION_TYPE));
        sObjectProjectionMap.put(Ptp.Object.ASSOCIATION_DESC, new Integer(OBJECT_ASSOCIATION_DESC));
        sObjectProjectionMap.put(Ptp.Object.SEQUENCE_NUMBER, new Integer(OBJECT_SEQUENCE_NUMBER));
        sObjectProjectionMap.put(Ptp.Object.NAME, new Integer(OBJECT_NAME));
        sObjectProjectionMap.put(Ptp.Object.DATE_CREATED, new Integer(OBJECT_DATE_CREATED));
        sObjectProjectionMap.put(Ptp.Object.DATE_MODIFIED, new Integer(OBJECT_DATE_MODIFIED));
        sObjectProjectionMap.put(Ptp.Object.KEYWORDS, new Integer(OBJECT_KEYWORDS));
        sObjectProjectionMap.put(Ptp.Object.THUMB, new Integer(OBJECT_THUMB));

        sObjectProjectionMap.put(Ptp.Object.NAME, new Integer(OBJECT_NAME));
    }

    // used by the JNI code
+2 −2
Original line number Diff line number Diff line
@@ -25,11 +25,11 @@ import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Environment;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio;
import android.provider.MediaStore.Files;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.MediaColumns;
import android.provider.Mtp;
import android.util.Log;

import java.io.File;
@@ -1023,7 +1023,7 @@ public class MtpDatabase {
        Log.d(TAG, "sessionEnded");
        if (mDatabaseModified) {
            Log.d(TAG, "sending ACTION_MTP_SESSION_END");
            mContext.sendBroadcast(new Intent(Mtp.ACTION_MTP_SESSION_END));
            mContext.sendBroadcast(new Intent(MediaStore.ACTION_MTP_SESSION_END));
            mDatabaseModified = false;
        }
    }
Loading