44e440cc7e834de7811f005998acb32716835b00 |
|
20-Apr-2015 |
Neil Fuller <nfuller@google.com> |
Add checks for types in Parcel / avoid class initialization Make Parcel more stringent to avoid initializing classes that are not related to Parcelable. Two new checks: 1) That the class found on the stream implements Parcelable. 2) That the type of the CREATOR field declared on the class found on the stream actually implements Parcelable.Creator. For (1) the new check that a class in the stream is actually Parcelable. This will affect handling of invalid streams or code that didn't obey the requirements. For (2) this change could break some apps that had a CREATOR field in a Parcelable class that was not declared to be (at least) a Parcelable.Creator: it is no longer sufficient for the type to implement Parcelable.Creator, the field must be declared as such. This change includes doc updates for Parcelable to make the requirement around the declared type of the CREATOR field more concrete. This change also makes the generics slightly tidier/explicit, annotates code as unchecked where needed and removes some assumptions that can not be guaranteed with Java's type system and the current definitions. For example, there's no guarantee right now that Parcelable.Creator returns objects that are actually Parcelable, or that the CREATOR object associated with a Parcelable will return objects of the surrounding class. The first we can't do something about without breaking the public API (due to implementations like TextUtils.CHAR_SEQUENCE_CREATOR). The second is currently typically implicitly enforced with an implicit cast in the (app's) calling code (e.g. callers to readParcelable() that causes a language-introduced cast to the type expected). A larger refactoring of Parcel would be required to ensure that the class that is produced by Creator is of a type compatible with the class that declared CREATOR, and is not a goal for this change. A fix is included for a class that doesn't implement Parcelable like it should and would probably fail check (1). Bug: 1171613 Change-Id: I31d07516efee29a320e80f4bc4f96aaac628f81c
/frameworks/base/core/java/android/content/pm/PackageCleanItem.java
|
752cd922f7091dfd5401faf70dc248934a9dbb6d |
|
24-Sep-2012 |
Jeff Sharkey <jsharkey@android.com> |
Always bind to DefaultContainerService as OWNER. When PackageManagerService deals with external storage, always bind to DefaultContainerService as USER_OWNER. This avoids binding to a stopped user, which would fail. Bug: 7203111 Change-Id: I8e303c7558e8b5cbe4fea0acc9a472b598df0caa
/frameworks/base/core/java/android/content/pm/PackageCleanItem.java
|
7767eac3232ba2fb9828766813cdb481d6a97584 |
|
24-Aug-2012 |
Dianne Hackborn <hackbod@google.com> |
Keep track of whether an app is installed for each user. This add a new per-user state for an app, indicating whether it is installed for that user. All system apps are always installed for all users (we still use disable to "uninstall" them). Now when you call into the package manager to install an app, it will only install the app for that user unless you supply a flag saying to install for all users. Only being installed for the user is just the normal install state, but all other users have marked in their state for that app that it is not installed. When you call the package manager APIs for information about apps, uninstalled apps are treated as really being not visible (somewhat more-so than disabled apps), unless you use the GET_UNINSTALLED_PACKAGES flag. If another user calls to install an app that is already installed, just not for them, then the normal install process takes place but in addition that user's installed state is toggled on. The package manager will not send PACKAGE_ADDED, PACKAGE_REMOVED, PACKAGE_REPLACED etc broadcasts to users who don't have a package installed or not being involved in a change in the install state. There are a few things that are not quite right with this -- for example if you go through a full install (with a new apk) of an app for one user who doesn't have it already installed, you will still get the PACKAGED_REPLACED messages even though this is technically the first install for your user. I'm not sure how much of an issue this is. When you call the existing API to uninstall an app, this toggles the installed state of the app for that user to be off. Only if that is the last user user that has the app uinstalled will it actually be removed from the device. Again there is a new flag you can pass in to force the app to be uninstalled for all users. Also fixed issues with cleaning external storage of apps, which was not dealing with multiple users. We now keep track of cleaning each user for each package. Change-Id: I00e66452b149defc08c5e0183fa673f532465ed5
/frameworks/base/core/java/android/content/pm/PackageCleanItem.java
|