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

Commit a2709360 authored by Steve Howard's avatar Steve Howard
Browse files

Initial implementation of the download manager public API.

The implementation is in android.net.DownloadManager, which is
obtained through Context.getSystemService().  Right now this class
acts as a simple wrapper on top of the existing DownloadProvider,
exposing a simple interface to a subset of DownloadProvider's
functionality.  There are several TODOs for features that require
changes to the underlying download manager implementation.

Change-Id: I2f26e51b60b6e82af8478ac7ccd895667df095b6
parent 9d8bea11
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import android.location.LocationManager;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
import android.net.DownloadManager;
import android.net.ThrottleManager;
import android.net.IThrottleManager;
import android.net.Uri;
@@ -199,6 +200,7 @@ class ContextImpl extends Context {
    private DropBoxManager mDropBoxManager = null;
    private DevicePolicyManager mDevicePolicyManager = null;
    private UiModeManager mUiModeManager = null;
    private DownloadManager mDownloadManager = null;

    private final Object mSync = new Object();

@@ -973,6 +975,8 @@ class ContextImpl extends Context {
            return getDevicePolicyManager();
        } else if (UI_MODE_SERVICE.equals(name)) {
            return getUiModeManager();
        } else if (DOWNLOAD_SERVICE.equals(name)) {
            return getDownloadManager();
        }

        return null;
@@ -1191,6 +1195,15 @@ class ContextImpl extends Context {
        return mUiModeManager;
    }

    private DownloadManager getDownloadManager() {
        synchronized (mSync) {
            if (mDownloadManager == null) {
                mDownloadManager = new DownloadManager(getContentResolver());
            }
        }
        return mDownloadManager;
    }

    @Override
    public int checkPermission(String permission, int pid, int uid) {
        if (permission == null) {
+9 −0
Original line number Diff line number Diff line
@@ -1534,6 +1534,15 @@ public abstract class Context {
     */
    public static final String UI_MODE_SERVICE = "uimode";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.net.DownloadManager} for requesting HTTP downloads.
     *
     * @see #getSystemService
     * @hide (TODO) for now
     */
    public static final String DOWNLOAD_SERVICE = "download";

    /**
     * Determine whether the given permission is allowed for a particular
     * process and user ID running in the system.
+719 −0

File added.

Preview size limit exceeded, changes collapsed.