summaryrefslogtreecommitdiff
path: root/core/java/android/appwidget
Commit message (Collapse)AuthorAgeFilesLines
* RemoteViews - Always load new ApplicationInfo from PackageManager.Zak Cohen2025-07-081-4/+0
| | | | | | | | | | | | | | | | | Always load ApplicationInfo object needed for RemoteViews Contexts directly from PackageManager. The key used is the package name. Previously this object was read from the RemoteViews bundle, which was provided by the Widget providing app, and this object could not be relied on to have accurate data fields. Bug: 376028556 Flag: EXEMPT Security Fix Test: atest CtsWidgetTestCases:RemoteViewsActivityTest#testApplicationInfo (cherry picked from commit 352fb4821076f0209ab2092d53444503dcec8992) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5b29f9ae6e6ecfd004f5ab8ccd3ec8d09722d774) Merged-In: Ie263b51fd2c2bdbf9d622533bb3f77d9f3f7181e Change-Id: Ie263b51fd2c2bdbf9d622533bb3f77d9f3f7181e
* [DO NOT MERGE] Prevent RemoteViews crashing SystemUiValentin Iftime2023-03-141-10/+29
| | | | | | | | | | | | | Catch canvas drawing exceptions caused by unsuported image sizes. Test: 1. Post a custom view notification with a layout containing an ImageView that references a 5k x 5k image 2. Add an App Widget to the home screen with that has the layout mentioned above as preview/initial layout. Bug: 268193777 Change-Id: Ib3bda769c499b4069b49c566b1b227f98f707a8a
* Combining widget broadcastsSihua Ma2022-10-312-1/+43
| | | | | | | | | | | 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
* Add API in AppWidgetServiceImplSihua Ma2022-10-261-0/+6
| | | | | | | | | | | A new function is created to notify the service of inheritance information of the widget provider. Test: N/A Bug: 221890505 Change-Id: I5f43f8d6ecd66b54869bef58898b1d3809b43d9e (cherry picked from commit 0b51675e5639ce86308f4c66cd10b23e0a4e7162) Merged-In: I5f43f8d6ecd66b54869bef58898b1d3809b43d9e
* Merge "Add function to AppWidgetService for updating widget visibility" into ↵Sihua Ma2022-10-211-0/+16
|\ | | | | | | tm-qpr-dev
| * Add function to AppWidgetService for updating widget visibilitySihua Ma2022-10-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | Currently, when the widget host stops listening to the widget updates, the callback will be set to null and the updates to the widget will be stashed on the service side. Additionally, the visibility of the widget will be changed. For an upcoming change to the launcher side, a function that only changes the visibility should be added. Test: N/A Bug: 235358918 Change-Id: I9a0f244ca76b378d9c337e0a364bca5955f5ae96
* | Put widget view updating logic in setListenerSihua Ma2022-09-211-10/+9
|/ | | | | | | | | Changed the name of function addListener to setListener and migrated the view-updating logic from createView to setListener Test: N/A Bug: 235358918 Change-Id: I013973674c305095a082adfa29e8f2802db90c26
* The launcher to always listen to app widgetSihua Ma2022-08-252-39/+98
| | | | | | | | | | | | | | | | Making changes to AppWidgetHost and AppWidgetHostView to make sure 1. We could make further changes the implementation of the listener in launcher 2. There is backward compatibility by making AppWidgetHostView a listener Design doc: https://docs.google.com/document/d/1QpTYeOvbpGlcOLe26BtMmpaN2_rG-EC1vn4eNo89zZs/edit?usp=sharing Test: N/A Bug: 235358918 Change-Id: I8c3cd4eee86d93dfdeb14b0dd6d086a49e1b3b18
* Wrapping various apply parameters into a separate classSunny Goyal2022-08-051-5/+11
| | | | | | | | | | | > This would allow us to easily extect the options > Also passing the executor for async inflation. This will allow containing adapters to also be async if the parent View is using async inflation Bug: 202766048 Test: Presubmit Change-Id: I60a9b5db5f9b5f8d6e56521ee00de4be30decce6
* Fix a security issue in app widget service.Pinyao Ting2022-07-141-1/+3
| | | | | | Bug: 234013191 Test: atest RemoteViewsAdapterTest Change-Id: Icd2eccb7a90124aca18a3dd463c3f79e3a595c20
* Prevent recycling if the color mapping changed.Pierre Barbier de Reuille2021-11-091-9/+7
| | | | | | | | | It was done in a weird way by "forgetting" the layoutId. It's now done explicitly, which should make it more robust in the future. Fix: 205265677 Test: Manually Change-Id: Ie8b88a2b17e8f680f14fa19a485cd91853d90142
* Check if a view can be recycled in async case.Pierre Barbier de Reuille2021-10-281-1/+1
| | | | | | | | | | When implementing the code, it seems this was forgotten :( If the view id of the root of the RemoteViews is changed, currently, the top-level view will be re-used, which is an error. Bug: 181985606 Test: atest android.widget.cts.RemoteViewsRecyclingTest Change-Id: I5a8addb08f597ec574e3ed49d1318771e4c7c767
* Check if APK paths are valid right before creating the context.Pierre Barbier de Reuille2021-10-251-4/+7
| | | | | | | | | | | | The check has to be done in RemoteViews and in AppWidgetHostView right before creating the context used to inflate the app widget. Further, the APK is cached potentially in two places: in the APK with code and the APK without codes, so both places are updated if present. Test: manual, see bug for details Fix: 202369942 Change-Id: I5718f67711a3332a942d3c037eef7f30379549a4
* Restore the creation of the remote context in sync inflation.Pierre Barbier de Reuille2021-10-011-0/+7
| | | | | | | | | | | | | | This was mistakenly removed in Android S (in ag/13732454) and could cause issues if the top-level layout parameters are defined using resources defined in the AppWidget's package. Also add some safeguard to avoid crashing if the AppWidgetProviderInfo doesn't contain a ProviderInfo (which can happen if it's not created by the system). Fix: 201744899 Test: Existing CTS tests Change-Id: Ibb4f2c26a6258ec2c68a7fd1fafe3e5fe3551109
* Correct documentation of AppWidgetProviderInfoPierre Barbier de Reuille2021-09-131-6/+6
| | | | | | | | | All the dimensions are in pixel, not dp. The conversion from complex value to pixel is done in AppWidgetProviderInfo#updateDimensions. Fix: 199524613 Test: N/A Change-Id: Ifdc90e7338ade8494d90e567fc95500b650c4ebb
* Revert "Revert "Apply overlay updates to widget provider info""Ryan Mitchell2021-08-091-0/+14
| | | | | | | | Bug: 15332156 Bug: 195649929 This reverts commit 471720cccf848d896639322644314e16264f8af8. Change-Id: Ifa89ae43613add1137ddeca4cb40543a3a01d6a7
* Merge "Revert "Apply overlay updates to widget provider info"" into sc-devPatrick Baumann2021-08-051-14/+0
|\
| * Revert "Apply overlay updates to widget provider info"Patrick Baumann2021-08-041-14/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit 0bf76b6296e7095ab98ea175452e5697e9afcc66. Bug: 193866093 Fixes: 195267626 Reason for revert: b/195267626 Change-Id: I598a99f761e66d8bedbb0745d488ccc35fff9201
* | Merge "Apply overlay updates to widget provider info" into sc-devRyan Mitchell2021-07-301-0/+14
|\|
| * Apply overlay updates to widget provider infoRyan Mitchell2021-07-291-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Runtime Resource Overlays (RROs) are applied to an application, the ApplicationInfo of the app in package manager is updated to have overlay paths. Widgets create the context used to inflate their remote views using a snapshot of the ApplicationInfo of the widget provider. This snapshot is taken when the widget RemoteView is initially created and sent to system server. This change updates the snapshot of the widget provider ApplicationInfo with the new overlay paths and notifies apps hosting widgets to re-inflate their remote views in order to have RROs apply to widgets correctly. Bug: 193866093 Test: Repeatedly change wallpaper & style color to a "basic" color and go back to launcher to observe overlay correct color is applied Change-Id: I0b9b8c0d32d83a52e9ea5bc8ba1635cf99e4b921
* | Use the current padding instead of the default one during layout.Pierre Barbier de Reuille2021-07-011-4/+3
|/ | | | | | Bug: 191612352 Test: Manually, adding extra logs, checking with/without changed padding. Change-Id: I7bc03602fe5e6e9085f0d187e6d2a11d2f15dcca
* Revert^3 "Deprecate Context#createApplicationContext"Ryan Mitchell2021-06-301-5/+3
| | | | | | | | | | This reverts commit cb5a80ea57b51fcde117dea253c546dbba9f27f1. Reason for revert: Was not the cause of the test failure Fixes: 186622527 Test: atest FrameworksCoreTests:ContextTest Change-Id: I705854f080200f0465d94a7754e710f05a3ec92c
* Revert^2 "Deprecate Context#createApplicationContext"Paul Hobbs2021-06-291-3/+5
| | | | | | | | Bug: 192242649 5a41b45a85286200f029b6ac06d004cb32c88dd0 Change-Id: Idcebd68e0079e7e87de04ae25069b3a9ff72093c
* Revert "Deprecate Context#createApplicationContext"Ryan Mitchell2021-06-221-5/+3
| | | | | | | | This reverts commit c54ebba25be71d77a4c0d92dba2f0b32c03a9792. Bug: 188059515 Test: atest FrameworksCoreTests:ContextTest Change-Id: I986563142dac135281889e811e6e5219d728d5d1
* 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
* Merge "Deprecate Context#createApplicationContext" into sc-devTreeHugger Robot2021-05-191-3/+5
|\
| * Deprecate Context#createApplicationContextRyan Mitchell2021-05-181-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an application caches an ApplicationInfo and uses it to call Context#createApplicationContext, the app will not get the most recent version of the overlays for that application. To make things worse, the LoadedApk stored in ActivityThread#mResourcePackages is updated using the old ApplicationInfo causing further uses of the cached LoadedApk to return outdated information. Deprecate Context#createApplicationContext, convert all internal uses to Context#createPackageContext(String packageName, ...) and log whenever any one calls Context#createApplicationContext with an outdated ApplicationInfo to detect debug issues in using old infos. Bug: 188059515 Test: change wallpaper and observe widgets get reloaded with most recent overlays Change-Id: I2aeefa8c0e66264859109975a54c4f73f76ad710
* | Test color mapping equivalent in O(n)Pierre Barbier de Reuille2021-05-131-1/+2
| | | | | | | | | | | | | | | | Relies on the ordering in SparseIntArray, as it's documented as ordered. Bug: 187852819 Test: Manual Change-Id: I3942a7f3826c173d99544ac0b4f81266b4ca3cc1
* | Check colors actually change for App WidgetPierre Barbier de Reuille2021-05-131-1/+24
|/ | | | | | | | | If new colors are set but do not change, do not re-inflate the App Widget. Bug: 187852819 Test: Added logs and added a widget, moved it to see Change-Id: I672ee7984cab8966f79d839494ac8a7b91679102
* Merge "Print the full exception upon widgets inflation error" into sc-devSteven Ng2021-05-071-2/+2
|\
| * Print the full exception upon widgets inflation errorSteven Ng2021-05-061-2/+2
| | | | | | | | | | | | Test: none Bug: 184750539 Change-Id: If026cc09dc9f96f1443b7b6e73e0e4f219050183
* | Merge "Save/restore view states when reapplying RemoteViews for color ↵Pierre Barbier de Reuille2021-05-061-6/+49
|\ \ | |/ |/| | | changes" into sc-dev
| * Save/restore view states when reapplying RemoteViews for color changesStevie Kideckel2021-05-041-6/+49
| | | | | | | | | | | | | | | | | | | | | | This ensures that adapters have their caches filles and other benefits such as lists maintaining their scroll positions Bug: 183503469 Test: validated with local app that service is not called on drag for colors changing and that flicker is removed Change-Id: I043d1d7a547b012f7a12eb555b35854a9bb7109b
* | Add null check in AppWidgetProvider#loadDescription before callingAlina Zaidi2021-05-041-5/+6
|/ | | | | | | | CharSequence#toString() Bug: 186789881 Test: Not needed for a null check. Change-Id: I015ba5943ca3aa218048fe2d11ebd501b5ddab07
* Add hidden setter for AppWidgetHost's InteractionHandlerCyrus Boadway2021-04-131-0/+9
| | | | | | | | | | This will allow Quickstep launchers, e.g. NexusLauncher, to provide a custom interaction handler. Bug: 169042867 Test: manual testing Change-Id: Id70cb463e2671e32ea9f52f06487ac63fcf57e0d
* Updating AppWidgetProviderInfo APISunny Goyal2021-04-051-1/+1
| | | | | | Bug: 184537397 Test: Presubmit Change-Id: I3e634b5bd761a566d6b08519ac58ffdbee2b1e59
* Merge "Update system palette APIs" into sc-devLucas Dupin2021-03-221-2/+2
|\
| * Update system palette APIsLucas Dupin2021-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | UX landed on a format where we have 2 neutral palettes, and 3 accent palettes. It's the ideal format to play with elevation and hue rotation, in order to have a more vibrant and less muddy UI. Fixes: 181986389 Bug: 173553055 Test: atest SystemPalette Test: atest ThemeOverlayControllerTest Test: atest ThemeOverlayApplierTest Test: atest DeviceDefaultThemeTest Change-Id: I80d3f7d1cc92e97efcb40fe6dc9f09918321d273
* | Correct recycling to take setViewId into account.Pierre Barbier de Reuille2021-03-191-3/+1
|/ | | | | | | | | | | | | | Views shouldn't be recycled if the view id is changed as the identity of the view is then altered. Second pass: this has been further tested by adding/removing AppWidgets on a test phone. Bug: 181985606 Test: atest CtsWidgetTestCases:RemoteViewsTest Test: atest CtsWidgetTestCases:RemoteViewsRecyclingTest Test: atest CtsInputMethodTestCases:android.view.inputmethod.cts.InputConnectionBlockingMethodTest Change-Id: I8924c02f7f0223458f556a07a3dfdc96b4ce612e
* Revert "Correct recycling to take setViewId into account."Greg Kaiser2021-03-181-1/+3
| | | | | | | | | This reverts commit 308a272289cafedbb72bc7f5310ac54d50502ae7. Bug: 183104573 Test: Install from Play Store with the screen off on wembley, and the device doesn't crash when the screen turns back on. Change-Id: I289fcafc6685c4ede295e8d6916a54da9bac1ad5
* Correct recycling to take setViewId into account.Pierre Barbier de Reuille2021-03-171-3/+1
| | | | | | | | | | Views shouldn't be recycled if the view id is changed as the identity of the view is then altered. Bug: 181985606 Test: atest CtsWidgetTestCases:RemoteViewsTest Test: atest CtsWidgetTestCases:RemoteViewsRecyclingTest Change-Id: I68415087297312eb2c1985d272be2ac535507c2a
* Merge "Fix flag value for configuration_optional widget feature." into sc-devYogisha Dixit2021-03-121-1/+1
|\
| * Fix flag value for configuration_optional widget feature.Yogisha Dixit2021-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flag value should be 4 and not 3 so that we can use bitwise operations to determine the existence of a flag. For example, we want to use the following to determine if a widget is reconfigurable: (providerInfo.widgetFeatures & WIDGET_FEATURE_RECONFIGURABLE) != 0 But if the value of WIDGET_FEATURE_CONFIGURATION_OPTIONAL is 3, the above check would fail. Test: atest FrameworksServicesTests:AppWidgetServiceImplTest, atest CtsAppWidgetTestCases Bug: 177977976 Change-Id: I15d4baae5e17acb9a0b936485a53f9b3359d65ca
* | Correct invalidation of layout when new color resources are provided.Pierre Barbier de Reuille2021-03-091-0/+2
| | | | | | | | | | | | | | | | | | The mViewMode variable is only used if there is no RemoteViews object. But we still want to update the colors in that case. Bug: 179783721 Test: atest CtsWidgetTestCases:android.widget.cts.RemoteViewsThemeColorsTest Change-Id: I078d21422a6300e7aaecb0baa2a49b9e14cae9e9
* | Correct API for new sizes in App Widgets.Pierre Barbier de Reuille2021-03-042-50/+44
|/ | | | | | | | | | | | 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 "Framework implementation of go/widgets-dynamic-colors" into sc-devPierre Barbier de Reuille2021-02-241-8/+61
|\
| * Framework implementation of go/widgets-dynamic-colorsPierre Barbier de Reuille2021-02-241-8/+61
| | | | | | | | | | | | Bug: 179783721 Test: atest CtsWidgetTestCases:android.widget.cts.RemoteViewsThemeColorsTest Change-Id: I622e79ed8738dc862790191bf9fcf44b0af35c8e
* | Merge "Adjust AppWidgetProviderInfo#getDescription to return CharSequence." ↵Alina Zaidi2021-02-241-8/+17
|\ \ | |/ |/| | | into sc-dev
| * Adjust AppWidgetProviderInfo#getDescription to return CharSequence.Alina Zaidi2021-02-191-8/+17
| | | | | | | | | | | | | | | | Also add more developer docs. Test: atest AppWidgetServiceImplTest#testLoadDescription passed Bug: b/180015383 Change-Id: Ie6fff9d880ba4721bf6babcd51acaa8fc9bd3cd9
* | Merge "Expose setBindAppWidgetPermission as a testAPI" into sc-devKholoud Mohamed2021-02-241-1/+5
|\ \ | |/ |/|