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

Commit c90fcbd6 authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Second pass of eMBMS api."

parents 7781a6d4 4dded7a1
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -433,6 +433,12 @@ LOCAL_SRC_FILES += \
	telecomm/java/com/android/internal/telecom/IInCallService.aidl \
	telecomm/java/com/android/internal/telecom/ITelecomService.aidl \
	telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \
        telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl \
	telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl \
	telephony/java/android/telephony/mbms/IDownloadListener.aidl \
        telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl \
	telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \
	telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \
	telephony/java/com/android/ims/internal/IImsCallSession.aidl \
	telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl \
	telephony/java/com/android/ims/internal/IImsConfig.aidl \
@@ -541,6 +547,13 @@ framework_built := $(call java-lib-deps,framework)
include $(CLEAR_VARS)

aidl_files := \
        frameworks/base/telephony/java/android/telephony/mbms/DownloadRequest.aidl \
        frameworks/base/telephony/java/android/telephony/mbms/DownloadStatus.aidl \
        frameworks/base/telephony/java/android/telephony/mbms/FileInfo.aidl \
        frameworks/base/telephony/java/android/telephony/mbms/FileServiceInfo.aidl \
        frameworks/base/telephony/java/android/telephony/mbms/ServiceInfo.aidl \
	frameworks/base/telephony/java/android/telephony/mbms/StreamingService.aidl \
        frameworks/base/telephony/java/android/telephony/mbms/StreamingServiceInfo.aidl \
	frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
	frameworks/base/telephony/java/android/telephony/SubscriptionInfo.aidl \
	frameworks/base/telephony/java/android/telephony/CellInfo.aidl \
+149 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.telephony;

import android.app.PendingIntent;
import android.content.Context;
import android.net.Uri;
import android.telephony.mbms.DownloadListener;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.DownloadStatus;
import android.telephony.mbms.FileServiceInfo;
import android.telephony.mbms.IMbmsDownloadManagerListener;

import java.util.List;

import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;

/** @hide */
public class MbmsDownloadManager {
    private final Context mContext;
    private int mSubId = INVALID_SUBSCRIPTION_ID;

    /**
     * should use createManager to create/initialize a copy
     * @hide
     */
    public MbmsDownloadManager(Context context) {
        mContext = context;
    }

    public static MbmsDownloadManager createManager(Context context,
            IMbmsDownloadManagerListener listener, String downloadAppName) {
//        MbmsDownloadManager mdm = context.getSystemService(Context.MBMS_DOWNLOAD_SERVICE);
//        if (mdm == null) return mdm;
//        mdm.initialize(listener, downloadAppName,
//                SubscriptionManager.getDefaultSubscriptionId());
//        return mdm;
        return null;
    }

    public static MbmsDownloadManager createManager(Context context,
            IMbmsDownloadManagerListener listener, String downloadAppName, int subId) {
//        MbmsDownloadManager mdm = context.getSystemService(Context.MBMS_DOWNLOAD_SERVICE);
//        if (mdm == null) return mdm;
//        mdm.initialize(listener, downloadAppName, subId);
//        return mdm;
        return null;
    }

    private void initialize(IMbmsDownloadManagerListener listener, String downloadAppName,
            int subId) {
        // assert all empty and set
    }

    /**
     * Gets the list of files published for download.
     * They may occur at times far in the future.
     * servicesClasses lets the app filter on types of files and is opaque data between
     *     the app and the carrier
     */
    public int getFileServices(List<String> serviceClasses) {
        return 0;
    }


    public static final String EXTRA_REQUEST         = "extraRequest";

    public static final int RESULT_SUCCESSFUL = 1;
    public static final int RESULT_CANCELLED  = 2;
    public static final int RESULT_EXPIRED    = 3;
    // TODO - more results!

    public static final String EXTRA_RESULT          = "extraResult";
    public static final String EXTRA_URI             = "extraDownloadedUri";

    /**
     * Requests a future download.
     * returns a token which may be used to cancel a download.
     * fileServiceInfo indicates what FileService to download from
     * source indicates which file to download from the given FileService.  This is
     *     an optional field - it may be null or empty to indicate download everything from
     *     the FileService.
     * destination is a file URI for where in the apps accessible storage locations to write
     *     the content.  This URI may be used to store temporary data and should not be
     *     accessed until the PendingIntent is called indicating success.
     * resultIntent is sent when each file is completed and when the request is concluded
     *     either via TTL expiration, cancel or error.
     *     This intent is sent with three extras: a {@link DownloadRequest} typed extra called
     *     {@link #EXTRA_REQUEST}, an Integer called {@link #EXTRA_RESULT} for the result code
     *     and a {@link Uri} called {@link #EXTRA_URI} to the resulting file (if successful).
     * downloadListener is an optional callback object which can be used to get progress reports
     *     of a currently occuring download.  Note this can only run while the calling app
     *     is running, so future downloads will simply result in resultIntents being sent
     *     for completed or errored-out downloads.  A NULL indicates no callbacks are needed.
     */
    public DownloadRequest download(DownloadRequest downloadRequest, DownloadListener listener) {
        return null;
    }

    public List<DownloadRequest> listPendingDownloads() {
        return null;
    }

    public int cancelDownload(DownloadRequest downloadRequest) {
        return 0;
    }

    /**
     * Gets information about current and known upcoming downloads.
     *
     * Current is a straightforward count of the files being downloaded "now"
     * for some definition of now (may be racey).
     * Future downloads include counts of files with pending repair operations, counts of
     * files with future downloads and indication of scheduled download times with unknown
     * file details.
     */
    public DownloadStatus getDownloadStatus(DownloadRequest downloadRequest) {
        return null;
    }

    /**
     * Resets middleware knowldge regarding this download request.
     *
     * This state consists of knowledge of what files have already been downloaded.
     * Normally the middleware won't download files who's hash matches previously downloaded
     * content, even if that content has since been deleted.  If this function is called
     * repeated content will be downloaded again when available.  This does not interrupt
     * in-progress downloads.
     */
    public void resetDownloadKnowledge(DownloadRequest downloadRequest) {
    }

    public void dispose() {
    }
}
+111 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.telephony;

import android.content.Context;
import android.telephony.mbms.IMbmsStreamingManagerListener;
import android.telephony.mbms.IStreamingServiceListener;
import android.telephony.mbms.StreamingService;
import android.telephony.mbms.StreamingServiceInfo;
import android.util.Log;

import java.util.List;

import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;

/** @hide */
public class MbmsStreamingManager {
    private static final String LOG_TAG = "MbmsStreamingManager";
    private static final boolean DEBUG = true;

    private final Context mContext;
    private int mSubId = INVALID_SUBSCRIPTION_ID;

    /**
     * Create a new MbmsStreamingManager using the system default data subscription ID.
     *
     * Note that this call will bind a remote service and that may take a bit.  This
     * may throw an IllegalArgumentException.
     */
    public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
            String streamingAppName) {
        mContext = context;
    }

    /**
     * Create a new MbmsStreamingManager using the give subscription ID.
     *
     * Note that this call will bind a remote service and that may take a bit.  This
     * may throw an IllegalArgumentException.
     */
    public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
                    String streamingAppName, int subId) {
        mContext = context;
    }

    /**
     * Terminates this instance, ending calls to the registered listener.  Also terminates
     * any streaming services spawned from this instance.
     */
    public void dispose() {
        // service.dispose(streamingAppName);
    }

    /**
     * An inspection API to retrieve the list of streaming media currently be advertised.
     * The results are returned asynchronously through the previously registered callback.
     * serviceClasses lets the app filter on types of programming and is opaque data between
     * the app and the carrier.
     *
     * Multiple calls replace the list of serviceClasses of interest.
     * The return value is a success/error-code with the following possible values:
     * <li>SUCCESS</li>
     * <li>NO_MIDDLEWARE</li>
     * <li>QUEUE_LIMIT</li>
     */
    public int getStreamingServices(List<String> classList) {
        return 0;
    }

    /**
     * Starts streaming a requested service, reporting status to the indicated listener.
     * Returns an object used to control that stream.
     *
     */
    public StreamingService startStreaming(StreamingServiceInfo serviceInfo,
            IStreamingServiceListener listener) {
        return null;
    }

    /**
     * Lists all the services currently being streamed to the device by this application
     * on this given subId.  Results are returned asynchronously through the previously
     * registered callback.
     *
     * The return value is a success/error-code with the following possible values:
     * <li>SUCCESS</li>
     * <li>NO_MIDDLEWARE</li>
     * <li>QUEU_LIMIT</li>
     */
    public int getActiveStreamingServices() {
        return 0;
    }

    private void logd(String str) {
        Log.d(LOG_TAG, str);
    }
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.telephony.mbms;

/**
 * A optional listener class used by download clients to track progress.
 * @hide
 */
public class DownloadListener extends IDownloadListener.Stub {
    /**
     * Gives process callbacks for a given DownloadRequest.
     * request indicates which download is being referenced.
     * fileInfo gives information about the file being downloaded.  Note that
     *   the request may result in many files being downloaded and the client
     *   may not have been able to get a list of them in advance.
     * downloadSize is the final amount to be downloaded.  This may be different
     *   from the decoded final size, but is useful in gauging download progress.
     * currentSize is the amount currently downloaded.
     * decodedPercent is the percent from 0 to 100 of the file decoded.  After the
     *   download completes the contents needs to be processed.  It is perhaps
     *   uncompressed, transcoded and/or decrypted.  Generally the download completes
     *   before the decode is started, but that's not required.
     */
    public void progress(DownloadRequest request, FileInfo fileInfo,
            int downloadSize, int currentSize, int decodedPercent) {
    }
}
+19 −0
Original line number Diff line number Diff line
/*
** Copyright 2017, 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.telephony.mbms;

parcelable DownloadRequest;
Loading