summaryrefslogtreecommitdiffstats
path: root/tests/IdleServiceTest/Android.mk
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2013-08-19 16:14:25 -0700
committerChristopher Tate <ctate@google.com>2014-01-31 15:41:40 -0800
commitd417d625d244356bc770e2692fd59e754a72f59f (patch)
tree2f45745021f70830046d62fc844e1f6c248235d7 /tests/IdleServiceTest/Android.mk
parentd0856259762eddd873a068c2e9cd3d4e45009a68 (diff)
downloadframeworks_base-d417d625d244356bc770e2692fd59e754a72f59f.zip
frameworks_base-d417d625d244356bc770e2692fd59e754a72f59f.tar.gz
frameworks_base-d417d625d244356bc770e2692fd59e754a72f59f.tar.bz2
Introduce "IdleService" API to expose idle-time maintenance to apps
When an application wishes to do low-priority background work when the device is otherwise idle (e.g. in a desk dock overnight), it declares a service in its manifest that requires this permission: android:permission="android.permission.BIND_IDLE_SERVICE to launch, and which publishes this intent filter: <intent-filter> <action android:name="android.service.idle.IdleService" /> </intent-filter> This string is declared in the API as IdleService.SERVICE_INTERFACE. The service must be implemented by extending the new "IdleService" class, which provides the API through which the system will communicate with the app. IdleService declares three methods, two of which are lifecycle callbacks to the service, and the third of which is for the service itself to invoke when appropriate. The lifecycle callbacks are public abstract boolean onIdleStart(); public abstract void onIdleStop(); The first of these is a notification to the service that an idle maintenance interval has begun. The service can then spin off whatever non-UI work it wishes. When the interval is over, or if the OS determines that idle services should be shut down immediately, the onIdleStop() method will be invoked. The service must shut down any background processing immediately when this method is called. Both of these methods must return immediately. However, the OS holds a wakelock on the application's behalf for the entire period between the onIdleStart() and onIdleStop() callbacks. This means that for system-arbitrated idle-time operation, the application does not need to do any of its own wakelock management, and does not need to hold any wakelock permissions. The third method in IdleService is public final void finishIdle(); Calling this method notifies the OS that the application has finished whatever idle-time operation it needed to perform, and the OS is thus free to release the wakelock and return to normal operation (or to allow other apps to run their own idle services). Currently the idle window granted to each idle service is ten minutes. The OS is rather conservative about when these services are run; low battery or any user activity will suppress them, and the OS will not choose to run them particularly often. Idle services are granted their execution windows in round-robin fashion. Bug 9680213 Change-Id: Idd6f35940c938c31b94aa4269a67870abf7125b6
Diffstat (limited to 'tests/IdleServiceTest/Android.mk')
-rw-r--r--tests/IdleServiceTest/Android.mk13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/IdleServiceTest/Android.mk b/tests/IdleServiceTest/Android.mk
new file mode 100644
index 0000000..a7879c5
--- /dev/null
+++ b/tests/IdleServiceTest/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := IdleServiceTest
+LOCAL_CERTIFICATE := platform
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+include $(BUILD_PACKAGE)