summaryrefslogtreecommitdiff
path: root/core/java/android/appwidget/AppWidgetManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Combining widget broadcastsSihua Ma2022-10-311-0/+37
| | | | | | | | | | | 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 a security issue in app widget service.Pinyao Ting2022-07-141-1/+3
| | | | | | Bug: 234013191 Test: atest RemoteViewsAdapterTest Change-Id: Icd2eccb7a90124aca18a3dd463c3f79e3a595c20
* Update the documentation of AppWidgetManagerPierre Barbier de Reuille2021-05-271-0/+10
| | | | | | | | | | AppWidgetManager#bindAppWidgetIdIfAllowed sends a broadcast when successful, but this is currently not documented. The behavior was introduced in 2014 by a change in the AppWidgetServiceImpl. Bug: 189334092 Test: N/A (documentation only) Change-Id: Iba83b89fd60c7f658a1fe911a260b666638fb020
* Correct API for new sizes in App Widgets.Pierre Barbier de Reuille2021-03-041-1/+1
| | | | | | | | | | | | This follow recommendations from the API council review. Based on those recommendations: I updated the API and updated the comments to make the function behavior clearer. Bug: 181611658 Test: atest android.widget.cts.RemoteViewsSizeMapTest Test: Local widget to check rendering Change-Id: Ie9fcedbc7b18b83f6d1220f99240f264e53e3649
* Merge "Expose setBindAppWidgetPermission as a testAPI" into sc-devKholoud Mohamed2021-02-241-1/+5
|\
| * Expose setBindAppWidgetPermission as a testAPIkholoud mohamed2021-02-151-1/+5
| | | | | | | | | | | | | | | | | | | | This is needed to replace usage of the adb shell command 'appwidget grantbind' in some cts tests with TestAPIs. Bug: 180328483 Test: N/A Change-Id: Ie74149c2045e19261c77da2ffa757a803cc61d95
* | Framework changes for go/widget-size-specificationPierre Barbier de Reuille2021-02-161-0/+6
|/ | | | | | | | | | | | | Update the framework to: 1 - Allow creating RemoteViews with a mapping from size to layouts 2 - Use the closes sized layout in any given situation 3 - Allow the launher to specify the current size when inflating a remote views Bug: 179025145 Test: atest android.widget.cts.RemoteViewsSizeMapTest Change-Id: Icf98d01bd0cf8b48c47555a1af6acb498b46b1a4
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-2/+3
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-3/+2
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-2/+3
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Move noteAppWidgetTapped call into AppWidgetHostView.Hui Yu2020-04-151-4/+4
| | | | | | | | | | | RemoteViews is public API used out of scope of widget. The correct place to call noteAppWidgetTapped is in AppWidgetHostView. Fix: 153676411 Test: manual test, tap a widget, "adb shell dumpsys usagestats | grep USER_INTERACTION" to oberserve USER_INTERACTION event sent to UsageStas, "adb shell dumpsys appops | grep appWidgetVisible" to observer appWidgetVisible flag. Change-Id: Ic473211b91fd952dbb81b09b1e1568d6f69a0dd8
* Update AppOps & UsageStats when app widget tapped.Hui Yu2020-03-211-0/+14
| | | | | | | | | | | | When the app widget on the launcher is tapped on: 1. Update AppOps. AppOps treats the underlying app as foreground so the app can get while-in-use permission. 2. Report a USER_INTERACTION event to UsageStats so UsageStats can update mLastTimeUsed and mLastTimeVisible of this package. Bug: 149043079 Test: manual test, tapped on a widget. Change-Id: Ic8c91190881cf5dcf89f0f72cfd410b0c2e86bf6
* AppWidgetManager option documentationSamuel Fufa2020-03-101-6/+10
| | | | | | Bug: 151157829 Test: n/a Change-Id: Ia6b86eaf2cbc6543854b88ee112c687590d50c1f
* Fix widget restore flowSamuel Fufa2020-02-241-0/+10
| | | | | | | | | 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
* Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-181-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I8789f8499d4dca08580672e9e45ed9a7026dd686
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-091-0/+8
| | | | | | | | | | | | | | | | For packages: android.appwidget This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Idbddc50320e7df92e0f260c1e309e5390b502d28
* Updating javadoc for updateAppWidgetProviderInfo APISunny Goyal2018-03-201-2/+4
| | | | | | Bug: 74838920 Test: N/A Change-Id: I531676900fbf8d60ef7050c86a570112ff1ad476
* Updating java doc for requestPinAppWidgetSunny Goyal2018-03-171-1/+5
| | | | | | Bug: 74435565 Test: N/A Change-Id: Iae290e411929c817721f481301f8fb057ebe7b2c
* Add RequiresFeature annotation.Jeff Sharkey2018-02-161-0/+3
| | | | | | | | | | Certain APIs require that a device have a specific feature to operate correctly, so start annotating them. Test: builds, boots Bug: 72284763 Change-Id: Ie2f30284bdfdb6acc4067f434eba3b5433837606 Exempt-From-Owner-Approval: simple annotations
* Pass in the user defined by Context.Jeff Sharkey2018-02-031-8/+8
| | | | | | | | | | | | | | | The majority of Manager-style classes already use Context.getUserId() when making calls into the OS, so clean up the remaining callers to unify behind this strategy. This gives @SystemApi developers a nice clean interface to interact across user boundaries, instead of manually adding "AsUser" or "ForUser" method variants, which would quickly become unsustainable. Test: builds, boots Bug: 72863821 Exempt-From-Owner-Approval: trivial changes Change-Id: Ib772ec4438e57a2ad4950821b9432f9842998451
* Adding support for overriding app-awidget properties at runtimeSunny Goyal2018-01-081-0/+28
| | | | | | | | | This would allow apps to customize the behaviour/appearance of a widget based on the app state Test: atest CtsAppWidgetTestCases:UpdateProviderInfoTest Bug: 63931362 Change-Id: I1eef705975c2310af7311b74acc23c089fb6d1ec
* Binding to the RemoteViewsService directly from the hostSunny Goyal2017-10-201-29/+11
| | | | | | | | | | | | | | | The host passes an IServiceConnection to the AppWidgetManager which is used to bind to the RemoteViewsService. This allows the host to recieve the connection callbacks directly instead of proxying it via the AppWidgetManager. The host is also responsible for unbinding to the service. Bug: 26481160 Test: adb shell \ am instrument -w -e class android.widget.RemoteViewsAdapterTest \ com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Change-Id: Iac400095a319c3a43714c82fda7516be1ccc68af
* Annotate @SystemApi with required permissions.Jeff Sharkey2017-06-051-0/+2
| | | | | | | | | | | | | | | | | Most @SystemApi methods should be protected with system (or higher) permissions, so annotate common methods with @RequiresPermission to make automatic verification easier. Verification is really only relevant when calling into system services (where permissions checking can happen on the other side of a Binder call), so annotate managers with the new @SystemService annotation, which is now automatically documented. This is purely a docs change; no logic changes are being made. Test: make -j32 update-api && make -j32 offline-sdk-docs Bug: 62263906 Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
* Address API Review commentsTony Wickham2017-04-241-5/+13
| | | | | | | | | | | | | - throw NullPointerException if the package name is null; there’s already a method with the specified null behavior. - Return value of this method should be @NonNull - return an empty list. Document this. Test: Unit test on AppWidgetServiceImplTest $ runtest --path=services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java Bug: 37544056 Change-Id: I047a8e7c4e519ef7c5deddaca0d1ad931dc91343
* Add AppWidgetManager#getInstalledProvidersForPackage()Tony Wickham2017-04-041-8/+33
| | | | | | | | | | | | | This allows more fine-grained control than getting all installed providers for a user, when you might only want to check for a particular package. For instance, Launcher can use this API to surface widgets per app without having to ask for all the widgets. Test: Unit test on AppWidgetServiceImplTest $ runtest --path=services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java Bug: 34940468 Change-Id: I182bf1c012d31182024422fc4a63f57f151c3ee5
* Create new BroadcastBehavior annotation.Jeff Sharkey2017-03-081-0/+21
| | | | | | | | | | | | | This will be used to help document the expected behavior of various broadcast actions defined by the OS. Also add logic to PackageParser that will then yell at developers whose manifests are making bad assumptions about which broadcasts they'll receive. Test: builds, boots Bug: 35925551 Change-Id: I059c2bf8aa3ce53d9ff18dcc263db7620cd14bd6
* Adding support for passing arbitrary extras when requesting to pin a widget.Sunny Goyal2017-03-011-4/+26
| | | | | | | | | | | | | | | | | Also defining an extra constant for widget preview which can be used by developers to provide a snapshot of the widget with the pin request Bug: 35811129 Test: All exisiting tests passing for f in 1 2 3 4 5 6 7 8 9 10; do \ adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest$f \ -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner; \ done; adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest \ -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner Change-Id: Id854bd28468a5bf0416ff1a1b19c44d850016f32
* Adding AppWidgetManager.isRequestPinAppWidgetSupportedSunny Goyal2017-01-241-0/+13
| | | | | | | | | Launchers can choose to implement support pin shortcut or pin appwidget or both by specifying different actions in the intent filter Test: Automated tests and CTS Bug: 34174006 Change-Id: I4456dbb943cfba11d465556f0732f0ed629ab3ba
* Fixing dimensions for AppWidgetProviderInfo not getting updated properlySunny Goyal2017-01-191-15/+2
| | | | | | | for PinItemRequest Test: Manually tested on device Change-Id: I7bbf7e93e052ef25c2a4a98ff0795ef500f68cc0
* Update the javadoc on requestPinShortcut() about multiple...Makoto Onuki2017-01-101-2/+3
| | | | | | | | | requests in a row form the same app. Bug 34175917 Test: Javadoc change only; presubmit test. Change-Id: Ibf33010dbd9080c557112e15efcadd30d95b121f
* AppWidgetManager: direct add widget support.Sunny Goyal2017-01-031-0/+41
| | | | | | | | | | Test: Manual test and all the unit tests: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests ... to test9 adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest -w com.android.frameworks.servicestests Bug 32404406 Change-Id: Icd6d4cbd25d9cdf4508da725d95d6401cc3a46a7
* When system server goes down, crash apps more.Jeff Sharkey2016-02-271-45/+31
| | | | | | | | | | | | | | Similar to first patch, but now using new "rethrowFromSystemServer()" method which internally translates DeadObjectException into DeadSystemException. New logic over in Log.printlns() now suppresses the DeadSystemException stack traces, since they're misleading and just added pressure to the precious log buffer space. Add some extra RuntimeInit checks to suppress logging-about-logging when the system server is dead. Bug: 27364859 Change-Id: I05316b3e8e42416b30a56a76c09cd3113a018123
* AppWidgetServiceImpl should use ParceledListSlice as return objectHyunyoung Song2015-06-171-3/+4
| | | | | | | | | b/19904873 > Reason: to prevent TransactionTooLargeException from occuring when binder transaction size goes over the limit. Change-Id: I054cb161d235234f3ccdaadd70314163e690b0db
* Exclude bound app widgets from idle app listAmith Yamasani2015-05-011-0/+14
| | | | | | | | Track package names of bound app widgets and use the list when querying for idle apps. Bug: 20066058 Change-Id: If8039397a061ef04bb13aa38d57cd7f0221f5fc7
* Generalizing Recents widget category to Search box. (Bug 17334589)Winson Chung2014-09-041-1/+1
| | | | Change-Id: Id62398255799844cc89affcb4bafc86b6479dad0
* RemoteViews service not unbound.Svet Ganov2014-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | We are checking whether an app can access an app widget based on the calling uid and the package name. The package is mostly to make sure that hosts in different apps do not accidentally interfere whereas the security is enforced by the uid. When remote views adapter binds and unbinds to a remote views serivce it was passing the package of the context we create to load resources for the widget instead the package of the host. Now it is passing the host package and also we are checking if the caller of bind remove serivce API is in uid that has the host package - this makes it consistent with elsewhere. bug:17226052 Change-Id: I2b0b6669e3dc027037b7481c2871cedabd642433
* Polish the new cross-profile app widget APIsSvetoslav2014-08-081-21/+16
| | | | | | bug:14991269 Change-Id: I5996f8c69a3d151ff1ecd8f19403dd606f588150
* Allow adding widgets from user profiles.Svetoslav2014-08-051-116/+297
| | | | | | | | | | | | | The goal of this change is to enable support for appwidget from user profiles to the user main profile. A user profile is a user which is associated as a child of the main user profile. For example, a user may have a personal (parent) and corporate (child) profile. The device policy should be able to control whether adding a widget from a child profile and given packages is allowed. This change assumes that all packages from managed profiles are white listed. Another change will add the device policy changes. Change-Id: I267260b55d74c48b112a29979a9f59eef7a8194e
* Widget restore documentation tweaksChristopher Tate2014-05-281-6/+6
| | | | | | | | | | | - Fix broken Javadoc @see directives - Linkify AppWidgetProvider in the documentation for the new ACTION_APPWIDGET_RESTORED broadcast - Minor content edits Bug 15022842 Change-Id: Ia7d4ad5be476c260492e1be5d83e21f6943a6847
* Exposing the API to support widgets in Recents.Winson Chung2014-05-051-1/+2
| | | | Change-Id: I2d53f226dbc328f0dbda7006eac647c6468c6b36
* App widget backup/restore infrastructureChristopher Tate2014-03-201-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove unused imports from frameworks/base.John Spurlock2013-11-201-1/+0
| | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* Fix awkward wording in AppWidgetManager docs.John Spurlock2013-06-031-6/+6
| | | | Change-Id: I6d1e180be666b3d88e88f357e8d79f6bbc0c9857
* Fix issue #8470131: Process thrash kills batteryDianne Hackborn2013-03-251-4/+16
| | | | | | | | | | | | Protect app widget broadcasts from abuse. In this case the app was sending an APPWIDGET_UPDATE broadcast without specifying a target, which (a) should not be allowed (you should not be able to send updates to other apps), and (b) resulted in every single potential app widget in the system being launched... which was about 75 of them. Change-Id: I9d48733610ce6d5a7c32e69a3e06b9f33bd79a34
* Add explicit userId to AppWidget binder callsJim Miller2013-02-201-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keyguard currently relies on being in the system process to grab the given user's widgets. When we split keyguard into a new process, it will need to have access to user-specific info to instantiate a specific user's widgets. In order to accomplish this, we add an explicit userid to each binder call as well as new permission check to allow keyguard access. This also fixes a potential race condition of having an incorrect user id due to an async call to change the user. Every binder call now has a specific user id. The user id is either the calling process user's id or an explicit one passed by applications like keyguard. It is created once when an AppWidgetManager is instantiated and remains for the lifetime of the object. Fixed bug where widgets sometimes didn't show up for secondary users. Moved permission check in AppWidgetService into getImplForUser() Refactored to use userid from context associated AppWidgetManager instance. Clean up AppWidgetHost to use userId from Context. Remove redundant userId check in checkPermission since it's handled by ActivityManager.handleIncomingUser() Removed redundant userid check. Upload after rebase... Change-Id: Iae3e20f2b342c323bb58768b3d22051510f8268b
* am 70af3cdb: Merge "docs: resolve bugs from external tracker" into jb-mr1-devScott Main2013-01-081-1/+1
|\ | | | | | | | | * commit '70af3cdb90bafc081ffa693a350b95ced48b6cfd': docs: resolve bugs from external tracker
| * docs: resolve bugs from external trackerScott Main2013-01-081-1/+1
| | | | | | | | Change-Id: I680970ec63701197103f6c5ab55c25c736aa0519
* | Fix crosstalk between users for widgets hosted in lockscreenAmith Yamasani2012-11-301-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was initially about the Clock widget crashing repeatedly on some devices with multiple users. Turned out that there were race conditions when switching users that could result in remote views of one user calling back to the RemoteViewsAdapter in keyguard that in turn sent an incorrect widget id to a different user's widget, resulting in a crash. Since KeyguardHostView is instantiated in the same process for different users, it needs to carry a user identity to pass along to AppWidgetService so that remote views services were bound to the correct user and callbacks were attached and detached properly. Added some aidl calls that take the userId to do the binding properly. A more complete fix might be needed in the future so that all calls from Keyguard carry the user id. Also, there was a problem in comparing host uid for secondary users, since Settings for a secondary user has a different uid than keyguard. Not an issue on single-user systems. Changed the host.uid comparison to accomodate for the secondary user. Bug: 7450247 Change-Id: Idbc36e3c60023cac74174f6cb7f2b2130dd3052c
* | Making sure keyguard and homescreen only display eligible widgets (issue ↵Adam Cohen2012-11-281-1/+12
|/ | | | | | 7550090) Change-Id: I25acb7bde2e8e5ac3185a009f5c7151b81f0ae19
* Use new keyguard appwidget pickerMichael Jurka2012-10-311-7/+7
| | | | | | Also, remove ability to filter widgets by feature in appwidget picker in anticipation of api change Change-Id: I325de0b98f03d3a250758d504229ea27794b5330