summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-11-11 18:18:20 -0800
committerDianne Hackborn <hackbod@google.com>2015-11-12 17:07:19 -0800
commitfcc85302498085fa37475d4ffc687a60e9429b4d (patch)
tree77f86619ae6c27c43157ac7503db0a5db2271ca6 /src/com/android/providers/downloads
parent58d73d78a43e4e8c4a419412b80dbc0155cddc5d (diff)
downloadandroid_packages_providers_DownloadProvider-fcc85302498085fa37475d4ffc687a60e9429b4d.tar.gz
android_packages_providers_DownloadProvider-fcc85302498085fa37475d4ffc687a60e9429b4d.tar.bz2
android_packages_providers_DownloadProvider-fcc85302498085fa37475d4ffc687a60e9429b4d.zip
Report to DeviceIdleController when downloads are active.
Change-Id: Ie0373c1f2a6be16cd1cfc197a8350582c00c6871
Diffstat (limited to 'src/com/android/providers/downloads')
-rw-r--r--src/com/android/providers/downloads/DownloadService.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index b0b73297..7845ce0e 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -33,11 +33,15 @@ import android.content.res.Resources;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Binder;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
+import android.os.IDeviceIdleController;
import android.os.Message;
import android.os.Process;
+import android.os.RemoteException;
+import android.os.ServiceManager;
import android.provider.Downloads;
import android.text.TextUtils;
import android.util.Log;
@@ -84,6 +88,7 @@ public class DownloadService extends Service {
SystemFacade mSystemFacade;
private AlarmManager mAlarmManager;
+ private IDeviceIdleController mDeviceIdleController;
/** Observer to get notified when the content observer's data changes */
private DownloadManagerContentObserver mObserver;
@@ -192,6 +197,12 @@ public class DownloadService extends Service {
}
mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
+ mDeviceIdleController = IDeviceIdleController.Stub.asInterface(
+ ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER));
+ try {
+ mDeviceIdleController.downloadServiceActive(new Binder());
+ } catch (RemoteException e) {
+ }
mUpdateThread = new HandlerThread(TAG + "-UpdateThread");
mUpdateThread.start();
@@ -330,6 +341,10 @@ public class DownloadService extends Service {
if (DEBUG_LIFECYCLE) Log.v(TAG, "Nothing left; stopped");
getContentResolver().unregisterContentObserver(mObserver);
mScanner.shutdown();
+ try {
+ mDeviceIdleController.downloadServiceInactive();
+ } catch (RemoteException e) {
+ }
mUpdateThread.quit();
}
}