summaryrefslogtreecommitdiff
path: root/core/java/android/widget/RemoteViewsAdapter.java
Commit message (Collapse)AuthorAgeFilesLines
* Properly handle onNullBinding() in appwidget service.Pinyao Ting2024-12-301-0/+5
| | | | | | | | | Bug: 340239088 Test: manually verified with the PoC app Flag: EXEMPT CVE (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9e1c31ba46178a8cfc68a2dd9984b8223f694c81) Merged-In: I12fccb572e159a73785aa33a4f5204e094ccd1b7 Change-Id: I12fccb572e159a73785aa33a4f5204e094ccd1b7
* Check if APK paths are valid right before creating the context.Pierre Barbier de Reuille2021-10-251-1/+1
| | | | | | | | | | | | 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
* Save/restore view states when reapplying RemoteViews for color changesStevie Kideckel2021-05-041-2/+2
| | | | | | | | | | | 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 checked change APIs to RemoteViewsStevie Kideckel2021-02-171-10/+10
| | | | | | Bug: 179245670 Test: built sample app to use APIs with and without collections, atest Change-Id: I5474bfb7dc15d559867063d1d8516b8ca2ef9755
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-7/+8
| | | | | | | | | | | | | | | | | | | 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-8/+7
| | | | | | | | | 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-7/+8
| | | | | | | | | | 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
* Add @Nullable annotation to the parameter of Object.equals() methods.Roman Kalukiewicz2020-10-151-1/+2
| | | | | | | | | | | | | | | | | | Those annotations could be inferred by some tools (like Kotlin), but the https://checkerframework.org/ doesn't check inherited annotations complaining about all equals() invocations that get nullable argument. The change was generated by running find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /' in the frameworks/base directory and by automatically adding and formatting required imports if needed. No manual edits. Bug: 170883422 Test: Annotation change only. Should have not impact. Exempt-From-Owner-Approval: Mechanical change not specific to any component. Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
* Update language to comply with Android's inclusive language guidanceNader Jawad2020-07-291-2/+2
| | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference BUG=161896447 Test: N/A Change-Id: I2032595a163d9146cfdbaebb1714ad1c53e0157c
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-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: I41e12e425284e74561c6b61663241df364ae54a1
* Resetting widget cache when some configurations changeSunny Goyal2019-06-061-5/+20
| | | | | | | | | | | Sometimes widget providers hardcode colors in their remoteViews by loading them from resources. On UI mode change, this can lead to inconsistent UI if some widgets use a different configuration than others. Test: Verified with calendar widget on device Bug: 133064045 Change-Id: If47a6b1973f55b7590f5d4116813d6a332951697
* Prevent a broken widget from crashing the LauncherSunny Goyal2018-12-061-2/+6
| | | | | | | | | A widget can provide a wrong service intent causing the Launcher to go in a crash loop Bug: 115533593 Test: Verified on device Change-Id: I28666d8559fd23a60fbd3f1539f3b3126a0fa62d
* Adding API to specify a dark text specific layout in app-widgetsSunny Goyal2018-12-041-4/+9
| | | | | | Bug: 109954539 Test: atest CtsAppWidgetTestCases Change-Id: I785931469888a09685c45949afcf2e3633233c60
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-211-0/+8
| | | | | | | | | | | | | | | | For packages: android.widget 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: Ic61019b1df85448a158fc2ba55c326353222c6b9
* Binding to the RemoteViewsService directly from the hostSunny Goyal2017-10-201-367/+280
| | | | | | | | | | | | | | | 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
* Optimizing memory for RemoteViewsAdapter caches.Sunny Goyal2017-10-191-30/+39
| | | | | | | | | The cache holds large number of remoteViews each of which have a separate copy of applicationInfo. Also simplifying some cache objects Test: Manually tested on device Change-Id: I353239354d329d3b0219ade55d39fe3b89e3bb02
* Renaming setAsyncExecutor to setExecutorSunny Goyal2017-04-201-6/+1
| | | | | | Bug: 37534990 Test: Tests updated Change-Id: I9ea467d05b4ac4d96c23d53750727096a511686d
* Merge "Adding support for async view loading in RemoteViewsAdapter"Sunny Goyal2016-10-271-65/+135
|\
| * Adding support for async view loading in RemoteViewsAdapterSunny Goyal2016-09-291-72/+135
| | | | | | | | | | | | | | | | | | | | | | > 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
* | Fix import statements in android.widget package.Aurimas Liutikas2016-10-111-7/+5
|/ | | | | | | Additionally this CL removes spaces at the end of the line. Test: code still compiles. Change-Id: I1ce98b4e70aa3ae614f87966c3bc6181fa4389a4
* Fixing the parent check loop to allow RemoteViewsFrameLayoutSunny Goyal2016-02-251-1/+1
| | | | | Bug: 27328093 Change-Id: I0f6ae8e95f952d40589eafb912ba188d15d7624c
* Using AppWidgetHostView in RemoteViewsAdapter instead of managing the ↵Sunny Goyal2016-02-171-143/+62
| | | | | | | RemoteViews inflation itself Change-Id: If6dd8a778096a07c58b543efe892bbffbe24098f (cherry picked from commit 89699a2811967fc0c3ad9e06f716d408d6949c86)
* Changing hashmaps to sparseArrays and other similar conversionsSunny Goyal2016-02-171-121/+97
| | | | | Change-Id: I1905120a2dc109e8f383b973e599e2c23e005d0e (cherry picked from commit c7ccff4b202d4ff8f6ba1f21629af95954d30398)
* am 6af08c6b: Merge "Fix for infinite loop in RemoteViewsAdapter"Alan Viverette2015-04-281-1/+9
|\ | | | | | | | | * commit '6af08c6b7693b4329184c9cccbc474a0b6a9ea5c': Fix for infinite loop in RemoteViewsAdapter
| * Merge "Fix for infinite loop in RemoteViewsAdapter"Alan Viverette2015-04-281-1/+9
| |\
| | * Fix for infinite loop in RemoteViewsAdapterHenrik Engström2015-03-211-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes an error in RemoteViewsAdapter when there is only one view in the cache, and it is bigger than the cache size threshold. This would cause the cleanup of the cache to get stuck in an infinite loop while holding the mCache lock that is also needed by for example getView which is called on the UI thread, leading to ANRs. This patch breaks the loop when it sees that it can not remove the next view up for removal. Change-Id: I331259bb10eae9fe91e5112102e08f49cc078a1b
* | | Remove problematic early return from notifyDataSetChangedAdam Cohen2015-04-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -> If connection to the service fails for whatever reason, mNotifyDataSetChangedAfterOnServiceConnected can get stuck to true, preventing future connections to the service. Don't let this prevent from connecting to the service. issue 19890339 Change-Id: I376101ae146359109df53add3a3202ba2e1e842d
* | | am 095428d2: am d15958f6: am 64c8a073: Merge "Early return in ↵Elliott Hughes2015-04-021-3/+3
|\| | | | | | | | | | | | | | | | | | | | RemoteViewsAdapter is too late" * commit '095428d262f1cb0cf09d8722fdd9a53661d7513b': Early return in RemoteViewsAdapter is too late
| * | Early return in RemoteViewsAdapter is too lateHenrik Baard2014-11-271-3/+3
| |/ | | | | | | | | | | | | | | | | | | The constuctor RemoteViewsAdapter implements an early return throwing an exception if intent is null. However the intent is used before it is checked. Moving early return before use of the intent. Change-Id: If847245b3b9f21111805f301717080c81474cad7
* / Remove unused imports in frameworks/base.John Spurlock2015-02-281-2/+0
|/ | | | Change-Id: I031443de83f93eb57a98863001826671b18f3b17
* Fix app widget serices not being unbound.Svetoslav2014-08-281-1/+1
| | | | | | bug:17321037 Change-Id: I44578df1104f9bd2e28700a3422a3323844d92c0
* 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
* Allow adding widgets from user profiles.Svetoslav2014-08-051-30/+12
| | | | | | | | | | | | | 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
* Remove unused imports from frameworks/base.John Spurlock2013-11-201-2/+0
| | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* Fix keyguard listview widgets for secondary usersJim Miller2013-03-061-16/+27
| | | | | | | | | | This fixes a bug where secondary user widgets weren't being updated properly because the system was checking for SYSTEM_UID which no longer works with keyguard in a separate process. The symptom was an app with a listview, like Gmail, would always show an empty list for secondary users. Change-Id: I3749a7a0b39f1eb7922966af0fbdcefdd804e41e
* Merge "Making sure to clear state related to views that are being recycled ↵Adam Cohen2012-12-061-1/+23
|\ | | | | | | (issue 7650538)" into jb-mr1.1-dev
| * Making sure to clear state related to views that are being recycled (issue ↵Adam Cohen2012-12-061-1/+23
| | | | | | | | | | | | 7650538) Change-Id: I5161ac261f963789537d2066a472cd3036c218aa
* | Make 3rd party lockscreen widgets work on secondary usersAmith Yamasani2012-12-041-0/+1
|/ | | | | | | | | | | If you install a lockscreen widget app on a secondary user, lockscreen fails to find it. There were several places where the correct context and userId were required under the covers - AppWidgetHost, AppWidgetHostView and RemoteViewsAdapter. Set the user id in the required places and use it to query the package information. Bug: 7662835 Change-Id: Ife482c8ab2a2e601650b7cfe2660e88d3b8f2050
* Fix remote views cache to avoid lockscreen widget crosstalkAmith Yamasani2012-12-031-12/+40
| | | | | | | | | Bug: 7660973 RemoteViewsAdapter will now store the userId as part of the cache key when caching remote views to optimize for orientation changes. Change-Id: I7c4e52b3995d4f56ebfa35aa9516327e182ad892
* Fix crosstalk between users for widgets hosted in lockscreenAmith Yamasani2012-11-301-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixing Keyguard widget click handling (issue 7179972)Adam Cohen2012-09-261-10/+18
| | | | Change-Id: I2b268d08f5aff403a04db53c357fa45a6cb8d490
* No longer parceling FixedSizeRemoteViewsCachesAdam Cohen2012-07-271-129/+34
| | | | | | -> Related to issue 6854767 Change-Id: Ib9a9ef827a739ef9efbe6f11dcc4765004fa0c51
* Fixing cache pruning to avoid pruning those in the visible rangeAdam Cohen2012-07-251-34/+53
| | | | | | | -> Improves flashing on rotation of stack widgets, or other widgets who's items use a lot of memory Change-Id: I762b555ac1827861ed63ac5929972395f3080a0a
* Caching the FixedSizeRemoteViewsCaches across rotationAdam Cohen2012-07-241-5/+200
| | | | | | -> This prevents unnecessary flashing of collection widgets on rotation Change-Id: Id29d4952aa640ca90b31dc3e02e2402cc0fb84d3
* Prevent crash in AppWidgetHost that can be triggered by an AppWidgetAdam Cohen2012-07-201-27/+54
| | | | | | | | | -> When the RemoteViewsFactory violates the getViewTypeCount() contract we detect it, and prevent the AdapterView from crashing -> Also made RemoteViewsCache a static inner class, since we may need that down the road, and there's no reason it shouldn't be Change-Id: I872a255167aac94513e522924179de61286b995a
* Fix ANR which could occur for collection widgets with very large itemsAdam Cohen2012-05-221-1/+1
| | | | | | | | | | -> We cache RemoteViews which populate the AdapterViews, but only up to a total memory amount of 2MB. The remainder of the cache is pruned out. If _every_ item is greater than 2MB, we were failing to prune the last item, leaving the framework in a loop on a bg thread, but holding a lock required by the main thread. Change-Id: I0574a25a59ebec6586ae223fff6605c0fee953c3
* Enabling RemoteViews to have a landscape and portrait layoutAdam Cohen2012-04-261-5/+1
| | | | | | | -> Implmented BitmapCache to ensure no bitmap data is duplicated within a RemoteViews hierarchy. Change-Id: I68f0f5e2882ee2a2a9a110c1642b93c4c7518743
* Only preload items if they are within the valid range (issue 6265338, 6194161)Adam Cohen2012-04-021-3/+18
| | | | Change-Id: Ic2713b41ad545a004df1e06e4be9946d7336c4b3
* Hinting RemoteViewsAdapter as to which views are visibleAdam Cohen2012-01-171-9/+30
| | | | | | | -> This prevents collection widgets from flashing loading views when they are updated with new content Change-Id: I1241ff9a09edfd990ad03f76449d18b9359246b4
* Fixing widget notifyDataSetChanged() not getting called, issue 5092676Adam Cohen2011-07-281-0/+6
| | | | Change-Id: I61a034a77c0c9d07aba71bfabe7a0864ce92c2e9