summaryrefslogtreecommitdiff
path: root/core/java/android/appwidget/AppWidgetHostView.java
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
* The launcher to always listen to app widgetSihua Ma2022-08-251-3/+10
| | | | | | | | | | | | | | | | 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
* 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
* 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
* 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
* | 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
* 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
* 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-041-49/+43
| | | | | | | | | | | | 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
* 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
* Add checked change APIs to RemoteViewsStevie Kideckel2021-02-171-13/+13
| | | | | | Bug: 179245670 Test: built sample app to use APIs with and without collections, atest Change-Id: I5474bfb7dc15d559867063d1d8516b8ca2ef9755
* Framework changes for go/widget-size-specificationPierre Barbier de Reuille2021-02-161-6/+99
| | | | | | | | | | | | | 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-1/+2
| | | | | | | | | | | | | | | | | | | 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-2/+1
| | | | | | | | | 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-1/+2
| | | | | | | | | | 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
* fix RuntimeException when inflating default layout for AdapterView-based widgetsPinyao Ting2020-05-181-1/+4
| | | | | | Bug: 151901506 Test: manual Change-Id: I71068b7d13783f658c02cc76ec50f40319e68160
* Move noteAppWidgetTapped call into AppWidgetHostView.Hui Yu2020-04-151-3/+14
| | | | | | | | | | | 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
* 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
* Removing SDK check when getting default widget paddingSunny Goyal2019-02-221-24/+12
| | | | | | | | This avoids packageManager call everytime a widget updates and on swipe up Test: Everything compiles Change-Id: I58e8613b7a8c9d27fb9293e623ccb274edab82d3
* Updating the comments as per API feedbackSunny Goyal2019-01-081-3/+3
| | | | | | Bug: 122549181 Test: N/A Change-Id: I46d6f98c7cd644cad79b1aad973621222657b113
* Adding API to specify a dark text specific layout in app-widgetsSunny Goyal2018-12-041-0/+14
| | | | | | Bug: 109954539 Test: atest CtsAppWidgetTestCases Change-Id: I785931469888a09685c45949afcf2e3633233c60
* Starting the default activity when an app widget'sSunny Goyal2018-11-091-0/+16
| | | | | | | | default/fallback view is clicked Bug: 119142325 Test: Verfied on device Change-Id: I5ac39b77cdd0a46f8c66dcec289cec78746e67cf
* Adding shared element transitions support in AppWidgetsSunny Goyal2018-10-291-0/+42
| | | | | | Bug: 113071278 Test: atest frameworks/base/core/tests/coretests/src/android/widget/RemoteViewsTest.java Change-Id: I0d7698faa8d9e61913b55d34de8b7cfbb32863b1
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-091-0/+5
| | | | | | | | | | | | | | | | 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
* Removing some system binder calls in AppWidgetHostViewSunny Goyal2017-10-251-50/+31
| | | | | | | | | | | > Using the AppWidgetProviderInfo for applicationInfo instead of getting it from packageNamager > Sending ProviderInfo update when the package is suspended/unsuspended so that the provider info on client side is always up-to-date Bug: 67865199 Test: Manually tested on device Change-Id: Id44facc30b4c3cc01e155eba9feeb541997fc816
* Using bundle instead of a custom class for SaveInstanceStateSunny Goyal2017-09-211-119/+12
| | | | | | | Also removing the crossfade effect option which has been disabled since the start Test: N/A Change-Id: I0c5dcf0d81d8a0a60f4cf202b63a3b9aafcee98e
* Suppressing spammy logs when widget inflation failsSunny Goyal2017-08-311-2/+3
| | | | | | Test: N/A Bug: 63061304 Change-Id: I6696856efb3999e2ad2a947604411c163f9d11c1
* Renaming setAsyncExecutor to setExecutorSunny Goyal2017-04-201-1/+1
| | | | | | Bug: 37534990 Test: Tests updated Change-Id: I9ea467d05b4ac4d96c23d53750727096a511686d
* getApplicationInfo() should throw NameNotFoundExceptionMakoto Onuki2017-04-141-2/+7
| | | | | | | | | | | | | | | | | | | ... instead of returning null. Bug: 37324177 Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests Change-Id: I7f9f3729ee0eef6b342e4711379e02516559472c
* Adding API to allow async inflaiton of AppWidgetSunny Goyal2017-01-091-3/+3
| | | | | | | | Test: Manual and unit tests adb shell am instrument -e class android.widget.AppWidgetHostViewTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Bug: 22839968 Change-Id: Id9cb56619653f43b9f755c881f5d0936375f9c87
* Adding support for async view loading in RemoteViewsAdapterSunny Goyal2016-09-291-3/+3
| | | | | | | | | | | > When loadingView is no available, the FirstView is always loaded on the background thread > AppWidgetHostView only inflates on the background thread, if the view has any costly operations Test: TBD Change-Id: I701caee7e4e6ba5972d0cf478cb57f8ec950da54
* Set accessibility string for suspended widgets.Kenny Guy2016-05-231-1/+19
| | | | | | | | | | Update the content description to mention the widget is suspended. Mark the remote views as not significant for accessibility. Bug: 28909714 Change-Id: I8804d41e520e2b4af7ade0fa8820ee7b2488bde5
* Using AppWidgetHostView in RemoteViewsAdapter instead of managing the ↵Sunny Goyal2016-02-171-1/+8
| | | | | | | RemoteViews inflation itself Change-Id: If6dd8a778096a07c58b543efe892bbffbe24098f (cherry picked from commit 89699a2811967fc0c3ad9e06f716d408d6949c86)