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

Commit 73f0a3a6 authored by Debashish Chatterjee's avatar Debashish Chatterjee
Browse files

VoicemailContract API change to add voicemail status table fields.

See design doc:
https://docs.google.com/a/google.com/document/pub?id=1FM2cl7Qqt002m9PahbpxUAJNM8rdH1b08IHePi-qaDA

Change-Id: Ib471f50d32ed77eed45a4e0857e3053be8a6582d
parent cec7ab8e
Loading
Loading
Loading
Loading
+100 −4
Original line number Diff line number Diff line
@@ -52,18 +52,24 @@ public class VoicemailContract {

    /** The authority used by the voicemail provider. */
    public static final String AUTHORITY = "com.android.voicemail";

    /** URI to insert/retrieve all voicemails. */
    public static final Uri CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/voicemail");
    /** URI to insert/retrieve voicemails by a given voicemail source. */
    public static final Uri CONTENT_URI_SOURCE =
            Uri.parse("content://" + AUTHORITY + "/voicemail/source/");
    /** URI to insert/retrieve status of voicemail source. */
    public static final Uri STATUS_CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/status");
    /**
     * Parameter key used in the URI to specify the voicemail source package name.
     * <p> This field must be set in all requests that originate from a voicemail source.
     */
    public static final String PARAM_KEY_SOURCE_PACKAGE = "source_package";

    // TODO: Move ACTION_NEW_VOICEMAIL to the Intent class.
    /** Broadcast intent when a new voicemail record is inserted. */
    public static final String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL";

    /**
     * Extra included in {@value Intent#ACTION_PROVIDER_CHANGED} and
     * {@value #ACTION_NEW_VOICEMAIL} broadcast intents to indicate if the receiving
@@ -72,9 +78,27 @@ public class VoicemailContract {
    public static final String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE";

    /** The mime type for a collection of voicemails. */
    public static final String DIR_TYPE =
            "vnd.android.cursor.dir/voicemails";
    public static final String DIR_TYPE = "vnd.android.cursor.dir/voicemails";

    /**
     * A convenience method to build voicemail URI specific to a source package. Appends URI param
     * {@link #PARAM_KEY_SOURCE_PACKAGE} to the base voicemail content URI.
     */
    public static Uri buildSourceVoicemailUri(String packageName) {
        return CONTENT_URI.buildUpon()
                .appendQueryParameter(PARAM_KEY_SOURCE_PACKAGE, packageName).build();
    }

    /**
     * A convenience method to build status URI specific to a source package. Appends URI param
     * {@link #PARAM_KEY_SOURCE_PACKAGE} to the base status content URI.
     */
    public static Uri buildSourceStatusUri(String packageName) {
        return STATUS_CONTENT_URI.buildUpon()
                .appendQueryParameter(PARAM_KEY_SOURCE_PACKAGE, packageName).build();
    }

    /** Defines fields exposed through the /voicemail path of this content provider. */
    public static final class Voicemails implements BaseColumns {
        /** Not instantiable. */
        private Voicemails() {
@@ -144,4 +168,76 @@ public class VoicemailContract {
         */
        public static final String _DATA = "_data";
    }

    /** Defines fields exposed through the /status path of this content provider. */
    public static final class Status implements BaseColumns {
        /** Not instantiable. */
        private Status() {
        }
        /**
         * The package name of the voicemail source. There can only be a one entry per source.
         * <P>Type: TEXT</P>
         */
        public static final String SOURCE_PACKAGE = "source_package";
        /**
         * The URI to call to invoke source specific voicemail settings screen. On a user request
         * to setup voicemail an intent with action VIEW with this URI will be fired by the system.
         * <P>Type: TEXT</P>
         */
        public static final String SETTINGS_URI = "settings_uri";
        /**
         * The URI to call when the user requests to directly access the voicemail from the remote
         * server. In case of an IVR voicemail system this is typically set to the the voicemail
         * number specified using a tel:/ URI.
         * <P>Type: TEXT</P>
         */
        public static final String VOICEMAIL_ACCESS_URI = "voicemail_access_uri";
        /**
         * The configuration state of the voicemail source.
         * <P> Possible values:
         * {@link #CONFIGURATION_STATE_OK},
         * {@link #CONFIGURATION_STATE_NOT_CONFIGURED},
         * {@link #CONFIGURATION_STATE_CAN_BE_CONFIGURED}
         * <P>Type: INTEGER</P>
         */
        public static final String CONFIGURATION_STATE = "configuration_state";
        public static final int CONFIGURATION_STATE_OK = 0;
        public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1;
        /**
         * This state must be used when the source has verified that the current user can be
         * upgraded to visual voicemail and would like to show a set up invitation message.
         */
        public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2;
        /**
         * The data channel state of the voicemail source. This the channel through which the source
         * pulls voicemail data from a remote server.
         * <P> Possible values:
         * {@link #DATA_CHANNEL_STATE_OK},
         * {@link #DATA_CHANNEL_STATE_NO_CONNECTION}
         * </P>
         * <P>Type: INTEGER</P>
         */
        public static final String DATA_CHANNEL_STATE = "data_channel_state";
        public static final int DATA_CHANNEL_STATE_OK = 0;
        public static final int DATA_CHANNEL_STATE_NO_CONNECTION = 1;
        /**
         * The notification channel state of the voicemail source. This is the channel through which
         * the source gets notified of new voicemails on the remote server.
         * <P> Possible values:
         * {@link #NOTIFICATION_CHANNEL_STATE_OK},
         * {@link #NOTIFICATION_CHANNEL_STATE_NO_CONNECTION},
         * {@link #NOTIFICATION_CHANNEL_STATE_MESSAGE_WAITING}
         * </P>
         * <P>Type: INTEGER</P>
         */
        public static final String NOTIFICATION_CHANNEL_STATE = "notification_channel_state";
        public static final int NOTIFICATION_CHANNEL_STATE_OK = 0;
        public static final int NOTIFICATION_CHANNEL_STATE_NO_CONNECTION = 1;
        /**
         * Use this state when the notification can only tell that there are pending messages on
         * the server but no details of the sender/time etc are known.
         */
        public static final int NOTIFICATION_CHANNEL_STATE_MESSAGE_WAITING = 2;

    }
}