summaryrefslogtreecommitdiff
path: root/core/java/android/appwidget/AppWidgetProvider.java
Commit message (Collapse)AuthorAgeFilesLines
* Combining widget broadcastsSihua Ma2022-10-311-1/+6
| | | | | | | | | | | Combining broadcasts WIDGET_ENABLED and WIDGET_UPDATE into WIDGET_ENABLE_AND_UPDATE to reduce response time at boot time Test: Manually verified that some app widgets would function properly Fix: 221890505 Change-Id: I6aff0f00464ec8628d2258d0d84dcd3c82258d57 (cherry picked from commit 1ae08fe75ebcfeab57b4fc3044bd69955044899e) Merged-In: I6aff0f00464ec8628d2258d0d84dcd3c82258d57
* Fix widget restore flowSamuel Fufa2020-02-241-0/+3
| | | | | | | | | After restore, the app should set OPTION_APPWIDGET_RESTORE_COMPLETED to true on its widgets followed by calling updateAppWidget to update views. Bug:63667276 Test: Manual Change-Id: Idb6fc63b0f894fca9e0470aaf335240fc124e2e9
* App widget backup/restore infrastructureChristopher Tate2014-03-201-12/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backup/restore now supports app widgets. An application involved with app widgets, either hosting or publishing, now has associated data in its backup dataset related to the state of widget instantiation on the ancestral device. That data is processed by the OS during restore so that the matching widget instances can be "automatically" regenerated. To take advantage of this facility, widget-using apps need to do two things: first, implement a backup agent and store whatever widget state they need to properly deal with them post-restore (e.g. the widget instance size & location, for a host); and second, implement handlers for new AppWidgetManager broadcasts that describe how to translate ancestral-dataset widget id numbers to the post-restore world. Note that a host or provider doesn't technically need to store *any* data on its own via its agent; it just needs to opt in to the backup/restore process by publishing an agent. The OS will then store a small amount of data on behalf of each widget-savvy app within the backup dataset, and act on that data at restore time. The broadcasts are AppWidgetManager.ACTION_APPWIDGET_RESTORED and ACTION_APPWIDGET_HOST_RESTORED, and have three associated extras: EXTRA_APPWIDGET_OLD_IDS EXTRA_APPWIDGET_IDS EXTRA_HOST_ID [for the host-side broadcast] The first two are same-sized arrays of integer widget IDs. The _OLD_IDS values are the widget IDs as known to the ancestral device. The _IDS array holds the corresponding widget IDs in the new post- restore environment. The app should simply update the stored widget IDs in its bookkeeping to the new values, and things are off and running. The HOST_ID extra, as one might expect, is the app-defined host ID value of the particular host instance which has just been restored. The broadcasts are sent following the conclusion of the overall restore pass. This is because the restore might have occurred in a tightly restricted lifecycle environment without content providers or the package's custom Application class. The _RESTORED broadcast, however, is always delivered into a normal application environment, so that the app can use its content provider etc as expected. *All* widget instances that were processed over the course of the system restore are indicated in the _RESTORED broadcast, even if the backing provider or host is not yet installed. The widget participant is responsible for understanding that these are promises that might be fulfilled later rather than necessarily reflecting the immediate presentable widget state. (Remember that following a cloud restore, apps may be installed piecemeal over a lengthy period of time.) Telling the hosts up front about all intended widget instances allows them to show placeholder UI or similarly useful information rather than surprising the user with piecemeal unexpected appearances. The AppWidgetProvider helper class has been updated to add a new callback, onRestored(...), invoked when the _RESTORED broadcast is received. The call to onRestored() is immediately followed by an invocation of onUpdate() for the affected widgets because they will need to have their RemoteViews regenerated under the new ID values. Bug 10622506 Bug 10707117 Change-Id: Ie0007cdf809600b880d91989c00c3c3b8a4f988b
* Correct executable bit for source filesKenny Root2012-11-071-0/+0
| | | | | | | | | Many media files and source code files were marked as executable in Git. Remove those. Also a shell script and python script were not marked as executable. Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
* Changing app widget "extras" to "options" and another small API Review issueAdam Cohen2012-05-021-9/+9
| | | | | | -> (issue 6427146), (issue 6427861) Change-Id: Ib69a9b3717a5b62317ec227936bc3b2fd5954043
* Adding callback for widget size changed, and potentially other extra infoAdam Cohen2012-04-191-2/+31
| | | | Change-Id: I57738c92b6a0ba68ae66b19a533559470c64e6f1
* docs: Add developer guide cross-references, Project ACRE, round 4Joe Fernandez2011-12-221-2/+7
| | | | Change-Id: I1b43414aaec8ea217b39a0d780c80a25409d0991
* Correctly deliver AppWidgetProvider.onDeleted() events.Jeff Sharkey2009-07-101-5/+3
| | | | | | | | When the AppWidgetService sends APPWIDGET_DELETED broadcasts, it only sends a single APPWIDGET_ID extra. This change fixes the Provider to handle this extra correctly. Fixes http://b/issue?id=1800738
* Fix typos.Ken Shirriff2009-05-131-1/+1
|
* AI 147732: fix broken linksScott Main2009-04-241-5/+3
| | | | | | BUG=1810005 Automated import of CL 147732
* auto import from //branches/cupcake/...@137873The Android Open Source Project2009-03-111-0/+154