OSDN Git Service

Defuse Bundles parsed by the system process.
authorJeff Sharkey <jsharkey@android.com>
Thu, 10 Mar 2016 05:30:56 +0000 (22:30 -0700)
committerJeff Sharkey <jsharkey@android.com>
Wed, 16 Mar 2016 20:45:26 +0000 (14:45 -0600)
commitd136e51a99df5275eaafdde407e89e78c02b829b
tree6f8489a5c9ac0280e04037c259e12a266fd16443
parent08e5936485a830ee80c4bf42a8402e1d13a783f9
Defuse Bundles parsed by the system process.

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
14 files changed:
core/java/android/app/ActivityOptions.java
core/java/android/app/ContextImpl.java
core/java/android/app/LoadedApk.java
core/java/android/content/ClipData.java
core/java/android/content/Intent.java
core/java/android/os/BadParcelableException.java
core/java/android/os/BaseBundle.java
core/java/android/os/Bundle.java
core/java/android/os/PersistableBundle.java
core/java/android/view/WindowManagerGlobal.java
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/notification/NotificationManagerService.java
services/java/com/android/server/SystemServer.java