summaryrefslogtreecommitdiff
path: root/core/java/android/os/PersistableBundle.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix security vulnerability that creates user with no restrictions when ↵Tetiana Meronyk2024-04-091-0/+37
| | | | | | | | | | accountOptions are too long. Bug: 293602970 Test: atest UserManagerTest#testAddUserAccountData_validStringValuesAreSaved_validBundleIsSaved && atest UserManagerTest#testAddUserAccountData_invalidStringValuesAreTruncated_invalidBundleIsDropped (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8dc6feaee7c0a5cea093b5280acaad862921cf3e) Merged-In: I23c971f671546ac085060add89485cfac6691ca3 Change-Id: I23c971f671546ac085060add89485cfac6691ca3
* RESTRICT AUTOMERGE: Drop invalid data.Kweku Adams2023-12-141-8/+34
| | | | | | | | | | | | | | | Drop invalid data when writing or reading from XML. PersistableBundle does lazy unparcelling, so checking the values during unparcelling would remove the benefit of the lazy unparcelling. Checking the validity when writing to or reading from XML seems like the best alternative. Bug: 246542285 Bug: 247513680 Test: install test app with invalid job config, start app to schedule job, then check logcat and jobscheduler persisted file (cherry picked from commit 666e8ac60a31e2cc52b335b41004263f28a8db06) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3c5aa21b4df54c0c0fcbcf00d1b62fa771022146) Merged-In: Ie817aa0993e9046cb313a750d2323cadc8c1ef15 Change-Id: Ie817aa0993e9046cb313a750d2323cadc8c1ef15
* Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()Bernardo Rufino2021-11-021-6/+9
| | | | | | | | | | | | | | | | | | After aosp/1878338, I realized Bundle.hasFileDescriptors() was accessing mParcelledData and mMap without a lock. So, to avoid locking there, I made mParcelledData volatile (since after mParcelledData is null, it can never be non-null again and mMap is guaranteed to be non-null). So, moved assignments to mParcelledData to be last wrt mMap and mParcelledByNative to ensure visibility of those fields. While refactoring copyInternal(), realized that method was always used after constructing an uninitialized Bundle, so to avoid mistakes with objects not properly initialized, I created a constructor in Bundle, PersistableBundle & BaseBundle that does that copyInternal() did. Bug: 195622897 Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest Change-Id: I5c9337496da7ecf87f10370726099dcb247a6789
* Merge "Merge Android 12"Xin Li2021-10-071-6/+20
|\
| * Merge "Avoid full unparcelling where possible in Bundle" am: 3ad4ecc296Treehugger Robot2021-10-061-1/+6
| |\ | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1842226 Change-Id: I0aef93d99d83f20b22753e8e1d41cfb5c4b5cdce
| * \ Merge "PersistableBundle.restoreFromXml should return a mutable bundle." am: ↵Meng Wang2021-05-201-1/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ffb1899ba2 am: c13f8d0fe7 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1679293 Change-Id: I96b86027bb82fbff281d129f06f159df4dc2904e
| * | | Add javadoc for (Persistable)Bundle.EMPTYAdrian Roos2021-01-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 152525509 Test: n/a Change-Id: I5518433816f11a7c719531c60ffbcf4f4857aa87
| * | | Mechanical refactoring to new XML resolvers.Jeff Sharkey2020-11-161-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related changes are introducing new TypedXmlSerializer and TypedXmlPullParser interfaces which offer efficient access to primitive attributes. This change is a purely mechanical refactoring to prepare for upcoming data format shifts, and has no behavior changes. Bug: 171832118 Test: manual Change-Id: I716193540e8a8baeca72cffbc2ba62bb1f731c49
* | | | Improve Bundle/PersistableBundle docsBernardo Rufino2021-10-061-1/+8
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | around equals(), hashCode(), toString() Test: TH passes Bug: 122589814 Bug: 62611412 Bug: 122589479 Change-Id: Ia644e437f9b5642228c2a7138b0518f73ef2996c
* | | Avoid full unparcelling where possible in BundleBernardo Rufino2021-10-051-1/+6
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and put a warning where it's not possible. This is to make sure we know when to touch bundles provided by apps. In this CL: * deepCopy() now doesn't deserialize lazy objects before copying. It doesn't copy them either, it merely passes them into the new map as the same reference. This works because we implemented fine-grained locking into each lazy value, so concurrent access won't be a problem. Furthermore, LazyValue caches the deserialized object, so we'd still honor the contract of deepCopy() that "Other types of objects (such as Parcelable or Serializable) are referenced as-is and not copied in any way". I had to perform one extra check in the synchronized block in LazyValue to guarantee this (double-checked locking), I explain that in the comments. * Removed filterValues() and codepaths that used it. This was created with the purpose of removing items whose classes weren't available to the system to prevent crashes coming from full deserialization. This is not a concern anymore with lazy bundle, hence we can remove the codepaths altogether (see email for more details). * Put warnings in javadoc of getMap() and PeristableBundle(). Test: Boots Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest Bug: 195622897 Change-Id: I14bb6a7874814f42cbcc6b5fd372c42752aa74c8
* | PersistableBundle.restoreFromXml should return a mutable bundle.Meng Wang2021-04-191-1/+1
|/ | | | | | | | | | | | | | | | | Issue: Currently, restoreFromXml/readFromStream returns an immutable PersistableBundle.EMPTY when the underlying XML file is ill-formatted. Otherwise it returns a mutable one. This inconsistent behavior easily causes crash when returned PersistableBundle is mutated. Fix: Make restoreFromXml consistently return a mutable PersistableBundle. Bug: 185436202 Test: make Change-Id: I3c9ab4df9f0fea2d46d1c9b72ffd4b65790180b2
* Merge "PersistableBundle: writeToStream/readFromStream" am: 0204e4a08e am: ↵Automerger Merge Worker2020-01-091-0/+47
|\ | | | | | | | | | | 083df1ec90 am: 869646b5ab Change-Id: I059547d4a8ed075c82cf483b2b226b3e337203c2
| * PersistableBundle: writeToStream/readFromStreamMeng Wang2020-01-081-0/+47
| | | | | | | | | | | | Bug: 143911192 Test: manual sanity test Change-Id: I208487d572c8148f28fac3307873dfdc90996ae1
* | Rename writeToProto to be dumpDebugJeffrey Huang2019-12-051-1/+1
|/ | | | | | | | | We want to eventually migrate some of these APIs to be @SystemApi for mainline modules. The #dumpDebug name is more appropriate than #writeToProto. Bug: 142279786 Test: Manual Change-Id: I60793e91cedf6b720d4ecef6a8484f4fed4ff30f
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* incidentd: dumping jobscheduler to protoKweku Adams2018-01-091-0/+18
| | | | | | | Bug: 65750819 Test: flash device and check incident.proto output Also test: $ cts-tradefed run cts-dev --module CtsIncidentHostTestCases --test com.android.server.cts.JobSchedulerIncidentTest Change-Id: I4abc01ca893edcbaf4d2254e4f807e06f5cb91f8
* Implement issue #36590595: Add ability to associated a ClipData with JobInfoDianne Hackborn2017-03-311-0/+12
| | | | | | | | | | | Yum! Also needed to have a Context.revokeUriPermission() variant that is sane, so reasonable CTS tests can be written. Test: new ClipDataJobTest added. Change-Id: Ia3135ea788a6e32c971bae7dab3a844d0ef4139c
* Fix issue #35813125: API Review: android.os > BundleDianne Hackborn2017-03-031-3/+6
| | | | | | | | | - Renamed deepcopy to deepCopy. - Clarified docs about when a shallow vs. deep copy happens. Test: booted and ran Change-Id: I2b4400770d781ff51423cd1c860454742e1d3c9c
* resolve merge conflicts of 7983723 to masterAndreas Gampe2016-04-201-3/+1
|\ | | | | | | Change-Id: I1e903d23598c8066b9103499287a7ee04d33c75a
| * Frameworks/base: Add holder to BaseBundleAndreas Gampe2016-04-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move EMPTY_PARCEL into an inner holder class. Add holder to preloaded-classes. Clean up dependencies. Allows to compile-time initialize: * android.os.BaseBundle * android.os.Bundle * android.os.PersistableBundle * android.telephony.CarrierConfigManager Bug: 27265238 Change-Id: Ib8017aa419c2985963b3c68a8046462a38652ef2
* | Merge "Defuse Bundles parsed by the system process." into nyc-dev am: c4b0adeJeff Sharkey2016-03-171-3/+11
|\| | | | | | | | | | | | | am: a0f6318 * commit 'a0f6318f44244ec4e916d3abecf157beb4fefc8c': Defuse Bundles parsed by the system process.
| * Defuse Bundles parsed by the system process.Jeff Sharkey2016-03-161-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's easy for apps to throw custom Parcelables into Bundles, but if the system tries peeking inside one of these Bundles, it triggers a BadParcelableException. If that Bundle was passed away from the Binder thread that delivered it into the system, we end up with a nasty runtime restart. This change mitigates this trouble by "defusing" any Bundles parsed by the system server. That is, if it encounters BadParcelableException while unpacking a Bundle, it logs and delivers an empty Bundle as the result. Simultaneously, to help catch the system process sticking its fingers into Bundles that are destined for other processes, a Bundle now tracks if it's "defusable." For example, any Intents delivered through ActivityThread are marked as being defusable, since they've arrived at their final destination. Any other Bundles are considered to be "in transit" and we log if the system tries unparceling them. Merges several Parcel boolean fields into a flags int. Add better docs to several classes. Bug: 27581063 Change-Id: I28cf3e7439503b5dc9a429bafae5eb48f21f0d93
* | Merge "ShortcutManager: add remaining APIs." into nyc-dev am: 4a07c34ca8Makoto Onuki2016-03-091-0/+2
|\| | | | | | | | | | | | | am: 027fd0ae95 * commit '027fd0ae9512b57ec13448d292609ad41ebd0bb6': ShortcutManager: add remaining APIs.
| * ShortcutManager: add remaining APIs.Makoto Onuki2016-03-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Icons are now persisted. (under /data/system_ce, as PNGs) - the "load icon" APIs in LauncherApps are supported. - Implement updateShortcuts() - Addressed all the comments on the previous CL - @hide the newly added constructor for PersistableBundle - Enhance incoming shortcut validation - A lot of internal clean-up. Bug 27548047 Change-Id: I8e3c1ccd3e0a997a6d271c84d81170f0c022b60e
* | resolve merge conflicts of 1ca3800c44 to masterMakoto Onuki2016-03-081-3/+14
|\| | | | | | | Change-Id: I4657cdf99900cd555c3109605e8cbdbb0fed79e6
| * Introducing ShortcutManagerMakoto Onuki2016-03-041-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What's supported: - Most APIs are implemented, except for SM.updateShortcuts(), the icon APIs in LA, and LA.startShortcut(). - Persisting information, except for icons - Throttling In addition, now PersistableBundle has a public copy constructor from a Bundle. (Do we want to @hide it?) TODOs: - Add icon support - Implement missing APIs - Listen to PACKAGE_* broadcasts and do clean-up - Support multi-launcher apps (pinned shortcuts per launcher) - Dev option to reset throttling - Load throttling config from Settings - Backup & restore - Figure out LauncherApps permissions (BIND_APPWIDGETS??) - Other minor TODOs in the code - Better javadoc Note: This requires Idf2f9ae816e1f3d822a6286a4cf738c14e29a45e Bug 27325877 Change-Id: Ia5aa555a4759df5f79a859338f1dc5e624cd0e35
* | Implement transient extras for jobs.Dianne Hackborn2016-02-111-0/+21
|/ | | | | | | | | You can now associate an arbitrary Bundle of extras with a job, as long as the job is not persisted. Also implement deep-copy of Bundle. Change-Id: I7890d627492b664d9b1f039e8cb82f8868de7be3
* More work on collecting assist data.Dianne Hackborn2015-03-121-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize parceling of AssistData (which is now renamed to AssistStructure) by pooling duplicated class name strings. Change text associated with a view node to a CharSequence, so styling information comes along. Include global text attributes -- size, colors, etc. Introduce a new AssistContent structure, which allows us to propagate information about the intent and data the activity is looking at. This further allows us to propagate permission grants, so the assistant can dig in to that data. The default implementation propagates the base intent of an activity, so if for example you bring up the assistant while doing a share the assistant itself has the same information and access that was given to the share activity (so it could for example share it in another way if it wanted to). Did some optimization of loading PersistableBundle from xml, to avoid duplicating hash maps and such. Changed how we dispatch ACTION_ASSIST to no longer include the more detailed AssistStructure (and new AssistContent) data when launching; now the example code that intercepts that needs to be sure to ask for assist data when it starts its session. This is more like it will finally be, and allows us to get to the UI more quickly. Change-Id: I88420a55761bf48d34ce3013e81bd96a0e087637
* Annotate Bundle with @NullableScott Kennedy2015-03-011-2/+4
| | | | Change-Id: Ide572124deea8271ca5c47009acb62603d644363
* Add put/getBoolean/Array to PersistableBundleCraig Mautner2014-12-091-1/+2
| | | | | | | | | | Due to popular demand the methods putBoolean(), getBoolean(), putBooleanArray() and getBooleanArray() have been added to PersistableBundle. Fixes bug 18390436. Change-Id: Id133ba902aca774f98529e36ce560e873b88ad5b
* Change PersistableBundle API per council's requestCraig Mautner2014-05-301-428/+42
| | | | | | Fixes bug 15192573. Change-Id: Ib98ef132c8c12e68e805cb3c0b1f7ae75940f17c
* Add code for persisting tasks and activities to disk DO NOT MERGECraig Mautner2014-05-231-2/+95
| | | | | | | | | Recent tasks that have the persistable flag set are saved to /data/system/recent_tasks/ on shutdown and in the background. Their thumbnails are saved to /data/system/recent_images/. Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
* Introduce PersistableBundleCraig Mautner2014-04-221-0/+555
The PersistableBundle class is similar to Bundle except that only objects that have meaning across reboots can be stored and there is a limited number of types that can be stored. More specifically Binders, FileDescriptors, Parcelables, Booleans, Bytes, Shorts, Chars, CharSequences, Floats, and ArrayLists cannot be stored. Fixes bug 13736007. Change-Id: If6595b2e6fd92af6b7f60c4f7140ae867c258794