442 Commits

Author SHA1 Message Date
Adam Lesinski
4ece3d6bb1 ContextImpl: Keep DisplayAdjustments and Display in sync
Make sure that when our Resources get updated, that DisplayAdjustment
and Display properly reflect the potentially new screen dimensions.

Bug:28388969
Change-Id: I340550ea094ece87abc8790dd46aaa60ab3cedd3
2016-06-21 17:55:58 -07:00
Stephan Linzner
ebdc157bc0 Un-deprecated Android mock testing APIs
Some mock APIs don't have an ATSL equivalent yet
will be deprecated in O timeframe now.

Change-Id: Ibb7ec32fba3d16f0ea02d100f4e4fc8f011288f0
Bug: 28295815
2016-05-25 22:54:27 +00:00
Svetoslav Ganov
a9c2500a68 Disallow disable of the system shared libs.
bug:28173410

Change-Id: If731f2d90312a083bb940f83431ba3eccf213947
2016-04-13 19:31:40 -07:00
Suprabh Shukla
78c9eb8947 Added api to delete cache files for a given user
Added an api to delete application cache files for a specific user. This
allows settings to clear cache files for work profile apps as well.

Bug: b/25338468
Change-Id: I52d4944a7a03b6d63ad44dd6bb868aec62815eab
2016-04-12 18:23:56 -07:00
Jeff Sharkey
70168dde6e Make Parcelable classes final, API cleanup.
Remove some Context methods that leaked through.  Add lint rule to
recommend using List<? extends Parcelable> instead of Parcelable[].

Bug: 27932224, 27930145, 27932911
Change-Id: Ia302de46cdb0c5101fa175a09316df91aeefcf0d
2016-03-30 23:31:39 -06:00
Jeff Sharkey
8a372a0a28 Refactoring FBE APIs based on council feedback.
Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
2016-03-17 14:49:08 -06:00
Sudheer Shanka
bbb3ff2b2a Flush package restriction changes for a user.
Change-Id: I7c4481f820b6b368487d00de6c783e64cec99f4b
2016-03-16 01:42:23 +00:00
Vadim Tryshev
66ae66a7f7 Adding getManagedUserBadgedDrawableForDensity() to PackageManager.
It allows badging an image regardless of of the user (no
user id parameter). The styling for managed users is applied.

This is useful for new cases where the existing functions
wouldn't badge the icon, but we need it.

Bug: 25192539
Change-Id: I2fd2f226f626fb2e6cda1cfe072013350e12b41c
2016-03-02 14:55:04 -08:00
Vadim Tryshev
093622f089 Revert "Adding getManagedUserBadgedDrawableForDensity() to PackageManager."
This reverts commit 9f68f41a5866e1feb810b16c769705c10e850d5d.

Caused breakage.

Change-Id: I441737f61f6f38ed9f440211b52bbac0f74982e3
2016-03-02 01:51:42 +00:00
Vadim Tryshev
9f68f41a58 Adding getManagedUserBadgedDrawableForDensity() to PackageManager.
It allows badging an image regardless of of the user (no
user id parameter). The styling for managed users is applied.

This is useful for new cases where the existing functions
wouldn't badge the icon, but we need it.

Bug: 25192539
Change-Id: I20ca2d7265cbc3a47c050a72ec1843cc0a481c74
2016-03-02 00:41:26 +00:00
Todd Kennedy
a67932374d Revert "Revert "Remove deprecated methods / classes""
This reverts commit 5cbeb5902633646fbc0a1be252081e77aaaee7b4.

Change-Id: Id96010364d65e6131221ebbcc8ce5889a2da256c
2016-03-01 07:19:33 -08:00
Todd Kennedy
fe01ea05dd Merge "Revert "Remove deprecated methods / classes"" into nyc-dev 2016-02-24 22:45:50 +00:00
Todd Kennedy
5cbeb59026 Revert "Remove deprecated methods / classes"
This reverts commit 9706c01f9b92cee64bb84782138735225c8588e0.

Change-Id: I14c53ab140220e48f6728b1173ea58760bbeb7f9
2016-02-24 22:45:00 +00:00
Todd Kennedy
ca67844e0c Merge "Remove deprecated methods / classes" into nyc-dev 2016-02-24 21:02:58 +00:00
Jeff Sharkey
2c1ba9a961 Make BackupManager encryption aware.
Backup requires both CE and DE storage to be available, so delay
spinning up the backup system until the user is unlocked, since
that's when CE storage becomes available.  Note that devices without
FBE immediately transition USER_SYSTEM into the unlocked state,
since their CE is always available.

Offer to backup and restore files under both CE and DE.  Since DE
is effectively the same as CE, most logic is simply duplicated for
now, but it could be simplified in the future.  Since system apps
can force their default storage location to DE, we always build
explicit CE and DE paths.

Add getDataDir() to give clean access to the top-level private data
directory, but disclaim that apps shouldn't create files there.

Bug: 26279618
Change-Id: Ic34a4b330223725db93b1d0f5c9dffc88002c61f
2016-02-18 10:54:11 -07:00
Andrei Stingaceanu
eb84b1843a Suspend packages - one call for multiple packages
Refactor setPackageSuspended into setPackagesSuspended. The rationale
is that the consumers of this API are likely to want to remove
multiple packages at once. Rather than calling the API N times, call
it just once.

The good part is that we already have the broadcast intent for
suspended packages take an array so only one broadcast. Less stress
on the system.

Another good part is that (right now) we only have one consumer of
this API and it will be easy to make changes once this CL goes in.

As a shell command, for consistency only allowed one package at
a time.

Bug: 22776761
Change-Id: Ic8b8cf64d0a288ea3a282bb7b72f9d663b3b0049
2016-02-17 15:14:33 +00:00
Andrei Stingaceanu
5ae4e73ef0 Merge "Suspend packages - new API for retrieving the suspended status" into nyc-dev 2016-02-17 11:57:51 +00:00
Todd Kennedy
9706c01f9b Remove deprecated methods / classes
Now that we've moved the majority of system components to the
PackageInstaller, we can remove the majority of the "installPackage"
methods and the VerificationParams/ContainerEncryptionParams
classes. There are still some lingering references to the two
installPackage() methods left [both internal and external; play
is using these methods via reflection].

Bug: 24542768
Change-Id: Ib65323d842d9f0e7fed60e37e6b5f103c94c859b
2016-02-16 13:39:55 -08:00
Andrei Stingaceanu
355b232d79 Suspend packages - new API for retrieving the suspended status
Instead of always rebuilding the full ApplicationInfo for a
package when callers are only interested in the suspended status
add a new fast API in Packagemanager (which only checks the
suspended user setting for the requested package and returns
a boolean) and change the appropriate caller code too.

Bug: 26794775
Bug: 22776761
Change-Id: Ide8428ef734479360d5a8a75fd8e0ed8ddf2da7a
2016-02-16 14:57:29 +00:00
Jeff Sharkey
115d2c189a Add feature versions for devices and apps.
We're starting to see more instances of device features that will
increment separately from the SDK API level, such as camera HAL,
GPU capabilities, Bluetooth, and other hardware standards.

This change adds the ability for device features to specify a
version, which is defined to be backwards compatible.  That is, apps
requesting an older version of a feature must continue working on
devices with a newer version of that same feature.

When a version is undefined, we assume the default version "0".

Bug: 27162500
Change-Id: If890bf3f3dbb715e8feb80e7059a0d65618482ea
2016-02-15 17:45:42 -07:00
Svet Ganov
d7b1f41109 Add an API to query the package name of the services shared lib
The servcies shared lib contains components apps can invoke such
as services to bind to, activities to start, UI choosers, etc.
This lib is built from AOSP code but an OEM may chage its
package name. For example, Google renames the package names for
GMS apps from android.foo.bar to com.google.android.foo.bar.
While we have more than one shared lib that are a part of the
platform (currently shared and services libs) the serivces lib
is the only one clients need to start components in, thus need
to know its package name. This change adds an API to query the
package name of the services shared lib. The API is hidden as
currently the only clients are a part of the system.

Change-Id: Ied48fa4819024522791764b22b3336d4f4b42cc3
2016-02-09 18:49:27 -08:00
Jeff Sharkey
35871f2c2b Offer to migrate databases and SharedPreferences.
Databases and SharedPreferences often involve multiple files under
the hood, so developers wanting to migrate them between different
storage contexts should ask us to make sure all relevant files are
migrated correctly.

This makes a best-effort attempt to recover from battery pulls
during migration, while still trying to alert developers to
conflicting files.

Bug: 26668510, 25860525
Change-Id: I9ffa3e8cb6191dfd4237b9466a081d6d77df3ba0
2016-01-30 17:03:23 -07:00
Stephan Linzner
b51617f466 Deprecated platform Android testing APIs
- Deprecated most android.test.* APIs
- Kept ProviderTestCase2 and LoaderTestCase since we don't have a
replacement yet
- Deprecated android.test.suitebuilder
- Added Javadoc to all deprecated APIs with links to corresponding
Android Testing Support Library APIs
- Removed all trailing whitespace

Bug: 22314304
Change-Id: I1b1f0dd5132364110f1dfd4e3eb2dd044700d859
2016-01-27 18:09:58 -08:00
Selim Cinek
e6ff946cd4 Switched the work profile badge used in the notifications
Change-Id: I62616f1ae8fcda9953853b9859c69a9f1e6f44ca
2016-01-21 19:42:49 -08:00
Todd Kennedy
12705131b9 Hide ephemerality
Change-Id: Ibf60366b3f00b1920e330cd804bcc1c550f8882a

Bug: 26404647
2016-01-11 16:21:03 -08:00
Jeff Sharkey
cd65448ccd Even more PackageManager caller triage.
Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
2016-01-08 18:35:54 -07:00
Jeff Sharkey
8588bc1ef1 Add flags to requests for package UID/GIDs.
This gives callers the ability to request details for missing
packages.  Also add annotations for userId and appId variables and
start tagging their usage.

Change-Id: I63d5d7f870ac4b7ebae501e0ba4f40e08b14f3f6
2016-01-07 10:33:26 -07:00
Jeff Sharkey
e06b4d1d9f Consistent naming for PackageManager methods.
When hidden PackageManager methods take a userId argument, they
should be named explicitly with the "AsUser" suffix.  This fixes
several lagging examples so that we can pave the way to safely
start passing flags to new methods without scary overloading.

Also fix spacing issues in various logging statements.

Change-Id: I1e42f7f66427410275df713bea04f6e0445fba28
2016-01-06 15:21:06 -07:00
Alex Klyubin
31ffb44241 No need to pass digest of AndroidManifest.xml around.
When an APK is being installed, the full path to the file is
occasionally passed between processes. To detect changes to the file
during these handovers, the digest of the AndroidManifest.xml entry
could be passed around as well.

This security feature is no longer used and is no longer needed. APKs
should be installed using the modern Package Installer API
(android.content.pm.PackageInstaller).

Bug: 24542768
Change-Id: I2762634c85448e7adcd47ffc9a5294c021e127bd
2016-01-04 12:31:29 -08:00
Andrei Stingaceanu
1e2839188f Wire call to suspend a package
Adds APIs in DevicePolicyManager and PackageManager for allowing
a device admin to suspend a package. PackageManagerService sets
or unsets a new PackageUserState 'suspended' setting. Terminal
command to suspend/unsuspend has been added via
PackageManagerShellCommand (as root).

Next steps:
* use the new 'suspended' setting for denying access to start app
(probably in ActivityStackSupervisor)
* broadcast a PACKAGE_(UN)SUSPENDED intent for launchers to pick up
* remove app from recents (go further and kill it if it is running)
* erase existing notifications for this app

Bug: 22776576
Change-Id: I718b3498f6a53cc0c6fdfb6d15031e53ddca4353
2015-12-16 18:14:14 +00:00
Dianne Hackborn
0c6cc308cf Merge "Add new target SDK filtering feature to BroadcastOptions." 2015-12-10 20:13:29 +00:00
Dianne Hackborn
e0e413e2b1 Add new target SDK filtering feature to BroadcastOptions.
You can now control the range of target SDKs that receivers
will be need to have in order to receive your broadcast.

Use this for CONNECTIVITY_ACTION to not allow N+ applications
to receive these broadcasts through their manifest.

Also tweak the broadcast debug output code to now include the
disposition of each receiver in the list.  This is becoming
important as skipping receivers is becoming a more common
thing to have happen.

Change-Id: I251daf68575c07cbb447536286ab4e68b7015148
2015-12-10 12:12:00 -08:00
Jeff Sharkey
98cb23dccf Merge "Slight API renaming, better behavior." 2015-12-09 22:51:43 +00:00
Jeff Sharkey
e13529a4ad Slight API renaming, better behavior.
Rename APIs to reflect that they're storage-related.  Also move
credential-storage APIs to be system API.

Return a null Context when device-encrypted storage isn't
supported.  This is the easiest way to keep legacy apps working when
upgrading from M to N.

Reduce strictness of path checking so we don't crash when working
with special packages like "android".

Bug: 22358539, 26104027
Change-Id: I38c24fc003488186210a6ae3b64270f86e1efe56
2015-12-09 15:22:54 -07:00
Jeff Sharkey
103d61b9f7 Merge "Shift around encryption public APIs." 2015-12-08 22:29:52 +00:00
Jeff Sharkey
7a30a30ebe Shift around encryption public APIs.
There are far too many Context APIs with special directory paths
to replicate device-encryption versions of them all.  Instead, add
methods to clone a Context that explicitly stores its data in either
credential- or device-encrypted storage.

Methods to test the behavior of a given Context.

Bug: 22358539
Change-Id: I6a6290a9b282605ce9a1f82742fc2c4c50536754
2015-12-08 15:24:29 -07:00
Svet Ganov
2acf063da0 Ephemeral cookie API
Add APIs for an ephemeral app to set a cookie which is a small
peice of data cached longer than the app itself. This is useful
for avoiding the user to login every time they use the ephemeral
app. The cookie is stored after an ephemeral app is uninstalled.
Normal apps or ephemeral apps upgraded to full apps can also use
these APIs with the difference that once they are uninstalled
the cookie is deleted.

The cookie size defaults to 16KB and is configurable by a global
settings which can be adjusted via gservices. Also eviction policy
is time based with a default of one month and is configurable by
a global setting which can be adjusted via gservices. If the cert
of the app cahnges (when ephemeral is installed, uninstalled and
installed again) the cooke is wiped to prevent data leaks.

This cahange also adds an API for apps to know whether they run in
an ephemeral mode since it this mode some APIs will not be available.
Another API exposed by this change is private for the system and
exposes all ephemeral apps - installed and uninstalled. Only the
system can call this API. When an ephemeral app is uninstalled the
system stores its name, icon, and permissions. When the app is
reinstalled or a full version is installed the permissions are
propagated.

Change-Id: Id4a73a7750bfbabda0bfcb9bf9018d2062e94367
2015-12-08 19:17:15 +00:00
Jeff Sharkey
6a6cdafaec APIs to obtain SharedPreferences paths.
Needed for apps that want to migrate SharedPreferences from CE to DE
storage.  Note that a device will only ever enter a CE mode with a
factory reset, so apps should only be using these APIs when they
want to migrate files to a consistent location on non-FBE devices
for simplicity.

Bug: 25503089
Change-Id: Ic846215da1617d116a048e036415ac7ad523b770
2015-12-07 19:25:25 -07:00
Jeff Sharkey
8fc29cf105 API to create SharedPreferences from File.
Needed to support storage of SharedPreferences on both credential-
encrypted and device-encrypted storage paths.

Bug: 22358539
Change-Id: I576b696951b2a9de817d5be63d31b06f7e166a19
2015-11-30 18:01:20 -07:00
Piotr Jastrzebski
cfa292e1da Add core-oj to the list of core library jars.
With some core classes moved to separate core-oj jar
we need to use the new jar.

(cherry-picked from f898cda2f499b14f92bc7fb75f44110cdec7654f)

Change-Id: Ica148f11bcc77f57d22944ff78c501611a293167
2015-11-20 14:06:55 +00:00
Jeff Sharkey
15447798a3 Initial file-based encryption public APIs.
Define two explicit directories where device-encrypted and
credential-encrypted data will be stored.  Third-party apps only
need access to the device-encrypted directory, so that's the only
API exposed for now.

General cleanup in how ApplicationInfo details are derived.

Bug: 22358539
Change-Id: If0a0108721a4aa1c3052b4912e08604bbf24e1ae
2015-11-06 18:35:27 -08:00
Nicolas Prevot
9a80e53b27 Add more methods that take a userId to PackageManager.
Add methods installPackageAsUser and installExistingPackageAsUser
and deletePackageAsUser and getPackageInfoAsUser.

BUG:23516394
Change-Id: I15e30d2ec45ab18c7f8c0ac02cfc617c50fedb44
2015-09-24 10:57:51 +01:00
Nicolas Prévot
3355eca23e Revert "Add more methods that take a userId to PackageManager."
This reverts commit 3b0fc3cf24e1fecdbc11808483c2109415ebfdd2.

It breaks the build. I had missed other places that extend PackageManager.

Change-Id: Iff012ed4ec8d2d32821586eca85fce55ae67f5b5
2015-09-23 11:34:38 +00:00
Nicolas Prevot
3b0fc3cf24 Add more methods that take a userId to PackageManager.
Add methods installPackageAsUser and installExistingPackageAsUser
and deletePackageAsUser and getPackageInfoAsUser.

Change-Id: I9a3ff96f968b4f8d21a57cc7760679628d35c1a9
BUG:23516394
2015-09-21 11:39:42 +01:00
Svetoslav Ganov
c875ad14dd am 56de6167: am f6c2d8a9: am 6da43a83: am 9352af2a: Merge "Remove dependencies on the package installer\'s package name" into mnc-dev
* commit '56de616725aca7d875fafc2a94e00ae9874fedf9':
  Remove dependencies on the package installer's package name
2015-07-29 19:23:52 +00:00
Svet Ganov
f1b7f20bb8 Remove dependencies on the package installer's package name
bug:22700053

Change-Id: I8540eb8577fbec84e1a67e31e1c31ba654c828a4
2015-07-29 08:33:46 -07:00
Dianne Hackborn
808dd5cc8a am 4753b5bc: am 4f73990a: am aa3694f2: am f1f8b9cc: Merge "Fix issue #21626564: MMS should be receivied while Dozing" into mnc-dev
* commit '4753b5bcf4877e125a8e38d5bcd2ac46c1744429':
  Fix issue #21626564: MMS should be receivied while Dozing
2015-07-15 02:21:54 +00:00
Fyodor Kupolov
1fa2a08882 am 1281575c: am 41fac5e8: am 189f3136: am 98724126: Merge "Added sendBroadcastMultiplePermissions method" into mnc-dev
* commit '1281575c257d52f256f4a08559611e6ec0b6190e':
  Added sendBroadcastMultiplePermissions method
2015-07-15 01:42:58 +00:00
Dianne Hackborn
fd854ee58c Fix issue #21626564: MMS should be receivied while Dozing
We now place whoever is receiving the MMS on the temporary
whitelist while doing so, so they can get network access to
download it.

There was also an issue that needed to be fixed where we
were no longer updating the list of allowed uids while
dozing based on their proc states...  we now do that.

Also did a bit of optimization of the temp white list update
path do the network policy manager, instead of going through
a broadcast we now directly call in to the network policy
manager.  This also allows us to have a synchronous version
of updating the list, so we can know the app has network access
before we tell it to do anything.

Finally added battery stats events for things going on and off
the whitelist so we can diagnose the behavior there.

Change-Id: Ic7fe010af680034d9f8cb014bb135b2addef7455
2015-07-14 18:33:08 -07:00
Fyodor Kupolov
d4fd8c766d Added sendBroadcastMultiplePermissions method
Added Context.sendBroadcastMultiplePermissions(Intent intent, String[]
receiverPermissions) method, which allows an array of required permissions
to be enforced.

Bug: 21852542
Change-Id: I27c9130e8f004b428452501ebc8a36aabde1f343
2015-07-14 17:25:42 -07:00