174744 Commits

Author SHA1 Message Date
Alex Klyubin
64b0062a37 Merge "Load fewer classes when AndroidKeyStore provider is installed." 2015-04-03 19:47:17 +00:00
Alex Klyubin
6def5afcbc Load fewer classes when AndroidKeyStore provider is installed.
This avoids loading all AndroidKeyStore crypto SPI classes when the
AndroidKeyStore provider is instantiated and installed. This provider
is installed early on during the initialization of each app. Most apps
don't need these classes loaded.

Bug: 18088752
Change-Id: Ib43c9dd6a7d434b128916e0f9c8652ba61df0d47
2015-04-03 12:45:16 -07:00
Alex Klyubin
08963653fc Merge "Rename KeymasterException to KeyStoreException." 2015-04-03 19:13:49 +00:00
Chad Brubaker
377885e1e6 Merge "Mark all test keys as no auth required" 2015-04-03 19:13:37 +00:00
Alex Klyubin
b292e49b32 Merge "Obtain SPI without using Reflection." 2015-04-03 19:13:18 +00:00
Alex Klyubin
a0f656f9bd Obtain SPI without using Reflection.
Bug: 18088752
Change-Id: I76d42e17f5f28af6fd9a96ee812d286f6c6a085b
2015-04-03 12:09:56 -07:00
Miao Wang
6aed9ec1b8 Merge "[RenderScript] update exception reporting for copyTo() after autoPadding added." 2015-04-03 17:38:14 +00:00
Miao Wang
d9b6328509 [RenderScript] update exception reporting for copyTo() after
autoPadding added.

 - This CL fixes recent CTS failures about copyPadded after
   lmp-mr1-dev changes pushed to aosp.

Change-Id: Ica1f4fd934cd83ca4357ea7e7c82dcc7f844b689
2015-04-03 09:15:39 -07:00
Fyodor Kupolov
3d8b7f4d50 Merge "Support for storing OAT files in app directory" 2015-04-02 23:11:11 +00:00
Alex Klyubin
b4834ae3fa Rename KeymasterException to KeyStoreException.
The code in question talks to KeyStore which returns error codes
which are a mix of keystore and keymaster error codes. To better
match the layering of KeyStore on top of keystore and keymaster,
this CL renames KeymasterException into KeyStoreException. It also
adds human-readable error messages to exceptions raised by keystore
rather than keymaster (e.g., key not found).

Bug: 18088752
Change-Id: I4cd1235e16518c9f2e8c5557a457774c6e687b88
2015-04-02 15:57:27 -07:00
Chad Brubaker
ce7ad24b63 Mark all test keys as no auth required
Now that auth token checks are in keystore keys without any auth tags
are invalid.

Also adds a test to check that a key with auth required fails when none
is present.

Change-Id: I0d5d44d70a849978e9b2e809675b8343c6650ff2
2015-04-02 14:41:37 -07:00
Alex Klyubin
3cc9e5d68d Merge "Improve the AndroidKeyStore-backed HMAC state machine." 2015-04-02 21:06:28 +00:00
Alex Klyubin
9635a56acf Merge "Expose new key use constraints in KeyPairGeneratorSpec." 2015-04-02 21:03:11 +00:00
Alex Klyubin
d2eec1a786 Merge "Add exception types for AndroidKeyStore key validity issues." 2015-04-02 20:24:48 +00:00
Alex Klyubin
855fa31eb5 Expose new key use constraints in KeyPairGeneratorSpec.
The constraints are currently ignored.

Bug: 18088752
Change-Id: Iabd2018200afb2bf8ac1748d1def47af74bfb9d3
2015-04-02 10:04:33 -07:00
Olawale Ogunwale
e4d4e22f26 Merge "[ActivityManager] Avoid improper resume top activity." 2015-04-02 16:39:18 +00:00
riddle_hsu
558e849a77 [ActivityManager] Avoid improper resume top activity.
When there is a process died, only resume top if
it contains visible activity.

This can fix case 1 in
https://android-review.googlesource.com/#/c/120901/

Change-Id: I45584e76f9e863980d04bbb593d7d26a8900acd0
2015-04-02 16:43:13 +08:00
Elliott Hughes
64c8a07345 Merge "Early return in RemoteViewsAdapter is too late" 2015-04-01 23:34:25 +00:00
Alex Klyubin
0b188927f4 Add exception types for AndroidKeyStore key validity issues.
Bug: 18088752
Change-Id: I7494cb6a793e2b57bb849a4253bba2803778c161
2015-04-01 16:22:00 -07:00
Alex Klyubin
a80eee052d Improve the AndroidKeyStore-backed HMAC state machine.
This defers the start of a new KeyStore operation after Mac.doFinal
until the next Mac.update or .doFinal. Previously, the a new KeyStore
operation was started immediately, at the end of doFinal.

Bug: 18088752
Change-Id: I2d594067ef261f519631d09f7a6087b715801656
2015-04-01 16:03:03 -07:00
Alex Klyubin
97467d82a3 Merge "Cleanse HTTP, HTTPS, and FTP URLs in Uri.toSafeString." 2015-04-01 20:15:53 +00:00
Alex Klyubin
3f24a1d94a Cleanse HTTP, HTTPS, and FTP URLs in Uri.toSafeString.
This makes the hidden API android.net.Uri.toSafeString omit most parts
of HTTP, HTTPS, and FTP URLs to avoid leaking anything unsafe. Only
the host and port are retained for these URLs.

Bug: 19215516
Change-Id: I2e9e33d9afaa9de5dd07a40532d56f0a2179f62a
2015-04-01 13:09:22 -07:00
Alex Klyubin
04047af628 Merge "Use Keymaster-friendly validity dates." 2015-04-01 20:01:00 +00:00
Andreas Gampe
e816f917e0 Merge "Frameworks/base: Use system property for cache prune counter" 2015-04-01 19:52:27 +00:00
Andreas Gampe
e324ba0e7c Frameworks/base: Use system property for cache prune counter
Expose ART's -Xzygote-max-boot-retry through a new system property
dalvik.vm.zygote.max-boot-retry.

Bug: 19983101
Change-Id: Ib88f807e0082d71292c14c7af38e02cca5a5602c
2015-04-01 19:50:58 +00:00
Alex Klyubin
5045b7189c Use Keymaster-friendly validity dates.
Keymaster HAL currently requires that key validity start and end dates
always be specified. The framework API does not. This CL expresses
the framework API's "not specified" instants to Keymaster as instants
in distant past or future.

Bug: 18088752
Change-Id: Ia9d66d5e57bfca30628cdef6e0925a2781a3acfb
2015-04-01 10:44:30 -07:00
Alex Klyubin
c461452eb7 Merge "Hook in user authenticators and their exceptions." 2015-04-01 17:34:37 +00:00
Alex Klyubin
c6cc9d820d Merge "A way to obtain KeyStore operation handle from crypto primitives." 2015-04-01 17:34:08 +00:00
Olawale Ogunwale
086071e730 Merge "[ActivityManager] Reduce report wrong anr activity" 2015-04-01 17:32:37 +00:00
Mark Salyzyn
c90a44184f Merge "idmap: scan missing include for sys/stat.h" 2015-04-01 16:53:53 +00:00
Mark Salyzyn
b62286e60c idmap: scan missing include for sys/stat.h
scan.cpp gets sys/stat.h inherited from
private/android_filesystem_config.h it should
not rely on this in the future. The intent is
to move fs_config function into libcutils and
thus deprecate any need for sys/stat.h in this
include file.

Bug: 19908228
Change-Id: If547e86513b06c536972138ae571c3d9c714ffe9
2015-04-01 16:52:14 +00:00
Mark Salyzyn
5218065dec Merge "app_main missing include for sys/stat.h" 2015-04-01 16:28:05 +00:00
Mark Salyzyn
fc737fb76c app_main missing include for sys/stat.h
app_main.c gets sys/stat.h inherited from
private/android_filesystem_config.h it should
not rely on this in the future. The intent is
to move fs_config function into libcutils and
thus deprecate any need for sys/stat.h in this
include file.

Bug: 19908228
Change-Id: I477b825e582742113f849aaa1df50c41e496b6f6
2015-04-01 16:02:32 +00:00
Olawale Ogunwale
6091dcbb80 Merge "[ActivityManager] Improve multi-thread access the same provider" 2015-04-01 14:58:21 +00:00
riddle_hsu
db46d6b074 [ActivityManager] Reduce report wrong anr activity
Symptom:
Report ANR on wrong activity.

Reproduce steps:
 (All launchMode, taskAffinity are default and
  without additional intent flag)
 Case 1:
  1.Launch activity A from launcher.
  2.Activity A starts B activity.
  3.Press home key.
  4.Launch activity A from launcher (B is top).
  5.Press back key twice to finish B and A,
    A sleep 10s in onResume.
  6.ANR will report on launcher.

 Case 2:
  1.Launch activity A from launcher.
  2.Press home key.
  3.Kill process of A.
  4.Launch activity A from launcher.
  5.A sleep 10s in onResume, press back key immediately.
  6.ANR will report on launcher.

Possible root cause:
Focused activity will not be updated every time when activity
resumed. (the condition to call setFocusedActivityLocked)

Case 1:
Launcher was stopped and not waitingVisible due to launcher
is not the previous one, then getWaitingHistoryRecordLocked
has no chance to correct the real ANR activity.

Case 2:
Due to process of next activity is died, bring existed
task will not set mResumedActivity (it will be set when its
process is started), so when assigning waitingVisible from
processStoppingActivitiesLocked, the return value of
allResumedActivitiesVisible will be true even there is no
mResumedActivity. That results set waitingVisible to false
to previous activity (e.g. launcher), then also cannot
correct ANR target as case 1.

Change-Id: I0b24f46a8fab266382ebc6e2ed84ebeca9358768
2015-04-01 18:58:07 +08:00
riddle_hsu
57307b21cb [ActivityManager] Improve multi-thread access the same provider
Application may use many threads to load data from provider.
If the target provider needs to start process, each access
will occupy one binder thread of system server until the
provider process started and published.

Sometimes application uses more than 16 threads to access
the same provider, and the provider process needs a little
long time to start, then all binder threads of system server
are waiting. But when the provider is ready, it is unable to
publish to notify those waiting threads because no availabe
binder thread to use. And device will become almost hang.

Improvement:
If there is already a thread acquiring provider, let other threads
(which try to acquire the same provider) wait the result of the
first one. That reduces IPC to save binder thread of system server.

Remove calling removeContentProvider in installProvider because
we have ensured only get one provider holder for the same provider,
the original race that gets a new useless holder will not happen.

Change-Id: I521f2603db8ced56912f5dc54342a70451e68381
2015-04-01 15:06:18 +08:00
Alex Klyubin
52886ca77d A way to obtain KeyStore operation handle from crypto primitives.
This adds AndroidKeyStore.getKeyStoreOperationHandle method which can
be used to obtain the KeyStore operation handle corresponding to the
provided JCA cryto primitive (provided it's backed by
AndroidKeyStore).

Bug: 18088752
Change-Id: Iaa3b6f9b2281b2ec2de8fd5946d353dc7fdb3d2d
2015-03-31 21:19:26 -07:00
Alex Klyubin
c8e557470f Hook in user authenticators and their exceptions.
Bug: 18088752
Change-Id: I2835dbe51d09587a3081597c6aaf536aa1427e24
2015-03-31 19:50:13 -07:00
Alex Klyubin
562c6a71f9 Merge "UNSUPPORTED_TAG_LENGTH -> UNSUPPORTED_MAC_LENGTH" 2015-04-01 00:47:01 +00:00
Alex Klyubin
c0eb55ccc7 UNSUPPORTED_TAG_LENGTH -> UNSUPPORTED_MAC_LENGTH
This is to follow naming from keymaster_defs.h

Bug: 18088752
Change-Id: If2bc91dde54f1cefcd4325d1f62d0e0b77fc5d59
2015-03-31 17:16:31 -07:00
Alex Klyubin
b7a34e4955 Merge "Add license banner to recently added AndroidKeyStore files." 2015-03-31 23:52:46 +00:00
Alex Klyubin
cc21bb3a56 Add license banner to recently added AndroidKeyStore files.
Bug: 18088752
Change-Id: I027f9530a02cca081aae8eb94833d2fdcb678e9a
2015-03-31 16:50:37 -07:00
Alex Klyubin
19e79e12d8 Merge "Add SecretKeyFactory backed by AndroidKeyStore." 2015-03-31 23:32:41 +00:00
Alex Klyubin
acc835f385 Add SecretKeyFactory backed by AndroidKeyStore.
This factory provides a way to obtain information about a SecretKey
backed by AndroidKeyStore. The information is provided in a form of an
instance of KeyStoreKeySpec class.

EXAMPLE

SecretKeyFactory factory = SecretKeyFactory.getInstance(
        key.getAlgorithm(), "AndroidKeyStore");
KeyStoreKeySpec keySpec =
    factory.getKeySpec(key, KeyStoreKeySpec.class);

Bug: 18088752
Change-Id: I26c9dd544f80230fe7039501eeb471eaf875452b
2015-03-31 15:29:48 -07:00
Craig Mautner
d720dedb03 Merge "Clear the previous states before setting the new app visibility" 2015-03-31 22:24:15 +00:00
Yang Ni
63dde9c88d Merge "Fix value size data type in closure creation." 2015-03-31 21:32:24 +00:00
Alex Klyubin
5960c3d566 Merge "Add unauthenticated AES ciphers backed by AndroidKeyStore." 2015-03-31 21:00:17 +00:00
Alex Klyubin
b406f24291 Add unauthenticated AES ciphers backed by AndroidKeyStore.
This adds the following AES transformations:
* AES/ECB/NoPadding
* AES/ECB/PKCS7Padding
* AES/CBC/NoPadding
* AES/CBC/PKCS7Padding
* AES/CTR/NoPadding

Bug: 18088752
Change-Id: I3e4702e59868f8f2225c31b1c159d20008b9999d
2015-03-31 13:59:07 -07:00
Chad Brubaker
5491ea9e5b Merge "Include operation handle in OperationResult" 2015-03-31 17:49:16 +00:00
Olawale Ogunwale
d052a3d37b Merge "[ActivityManager] Fix index out of bounds when updating next pss time." 2015-03-31 16:09:16 +00:00