Merge "Revert "Icon support comes to Notification."" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index c70f012..dcce5f4 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -14699,7 +14699,7 @@
method public int[] getChannelMasks();
method public int[] getFormats();
method public int getId();
- method public java.lang.CharSequence getName();
+ method public java.lang.CharSequence getProductName();
method public int[] getSampleRates();
method public int getType();
method public boolean isSink();
diff --git a/api/system-current.txt b/api/system-current.txt
index 1729ef1..d0ce53a 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -15912,7 +15912,7 @@
method public int[] getChannelMasks();
method public int[] getFormats();
method public int getId();
- method public java.lang.CharSequence getName();
+ method public java.lang.CharSequence getProductName();
method public int[] getSampleRates();
method public int getType();
method public boolean isSink();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index f506d59..5dcbe37 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -96,7 +96,7 @@
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.renderscript.RenderScriptCacheDir;
-import android.security.AndroidKeyStoreProvider;
+import android.security.keystore.AndroidKeyStoreProvider;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.content.ReferrerIntent;
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index 657beee..338bd76 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -32,7 +32,7 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
-import android.security.AndroidKeyStoreProvider;
+import android.security.keystore.AndroidKeyStoreProvider;
import android.util.Log;
import android.util.Slog;
diff --git a/docs/html/google/play/billing/billing_reference.jd b/docs/html/google/play/billing/billing_reference.jd
index 01e680f..7884929 100644
--- a/docs/html/google/play/billing/billing_reference.jd
+++ b/docs/html/google/play/billing/billing_reference.jd
@@ -172,8 +172,8 @@
</tr>
<tr>
<td>{@code INAPP_DATA_SIGNATURE}</td>
- <td>String containing the signature of the purchase data that was signed
-with the private key of the developer. The data signature uses the
+ <td>String containing the signature of the purchase data that was signed
+with the private key of the developer. The data signature uses the
RSASSA-PKCS1-v1_5 scheme.</td>
</tr>
</table>
@@ -197,7 +197,13 @@
lose access at that time unless they re-enable automatic renewal
(or manually renew, as described in
<a href="{@docRoot}google/play/billing/billing_subscriptions.html#manual-renewal">Manual
- Renewal</a>).</td>
+ Renewal</a>).
+ If you offer a <a href="{@docRoot}google/play/billing/billing_subscriptions.html#grace-period"
+ >grace period</a>, this value remains set to <code>true</code> for all
+ subscriptions, as long as the grace period has not lapsed. The next billing date
+ is extended dynamically every day until the end of the grace period or until the
+ user fixes their payment method.
+ </td>
</tr>
<tr>
<td>{@code orderId}</td>
diff --git a/docs/html/google/play/billing/billing_subscriptions.jd b/docs/html/google/play/billing/billing_subscriptions.jd
index 8f55354e..f7df752 100644
--- a/docs/html/google/play/billing/billing_subscriptions.jd
+++ b/docs/html/google/play/billing/billing_subscriptions.jd
@@ -47,42 +47,42 @@
</div>
<p>Subscriptions let you sell content, services, or features in your app with
-automated, recurring billing. You can easily adapt an existing In-app Billing
+automated, recurring billing. You can easily adapt an existing In-app Billing
implementation to sell subscriptions.</p>
-<p>This document is focused on highlighting implementation details that are
-specific to subscriptions, along with some strategies for the associated billing
+<p>This document is focused on highlighting implementation details that are
+specific to subscriptions, along with some strategies for the associated billing
and business models.</p>
<h2 id="overview">Overview of Subscriptions</h2>
-<p>A <em>subscription</em> is a product type offered in In-app Billing that
-lets you sell content, services, or features to users from inside your app with
+<p>A <em>subscription</em> is a product type offered in In-app Billing that
+lets you sell content, services, or features to users from inside your app with
recurring, automated billing at the interval you specify. You can sell subscriptions to almost
any
type of digital content, from any type of app or game.</p>
<p>As with other in-app products, you configure and publish subscriptions using
-the Developer Console and then sell them from inside apps installed on
+the Developer Console and then sell them from inside apps installed on
Android devices. In the Developer console, you create subscription
products and add them to a product list, then set a price and optional trial
period for each, choose a billing interval, and then
-publish. For more information about using the Developer Console, see
+publish. For more information about using the Developer Console, see
<a href="#administering">Configuring Subscription Items</a>.</p>
-<p>When users purchase subscriptions in your apps, Google Play handles all
-checkout details so your apps never have to directly process any financial
-transactions. Google Play processes all payments for subscriptions through
-Google Wallet, just as it does for standard in-app products and app purchases.
+<p>When users purchase subscriptions in your apps, Google Play handles all
+checkout details so your apps never have to directly process any financial
+transactions. Google Play processes all payments for subscriptions through
+Google Wallet, just as it does for standard in-app products and app purchases.
This ensures a consistent and familiar purchase flow for your users.</p>
<img src="{@docRoot}images/in-app-billing/v3/billing_subscription_v3.png" style="float:right; border:4px solid ddd;">
-<p>After users have purchased subscriptions, they can view the subscriptions and
-cancel them from the <strong>My Apps</strong> screen in the Play Store app or
-from the app's product details page in the Play Store app. For more information
+<p>After users have purchased subscriptions, they can view the subscriptions and
+cancel them from the <strong>My Apps</strong> screen in the Play Store app or
+from the app's product details page in the Play Store app. For more information
about handling user cancellations, see <a href="#cancellation">Subscription Cancellation</a>.</p>
-<p>In addition to client-side API calls, you can use the server-side API for
-In-app Billing to provide subscription purchasers with extended access to
+<p>In addition to client-side API calls, you can use the server-side API for
+In-app Billing to provide subscription purchasers with extended access to
content (for example, from your web site or another service).
The server-side API lets you validate the status of a subscription when users
sign into your other services. For more information about the API, see <a
@@ -95,12 +95,12 @@
your own business logic to your Android app to determine whether the user has
already purchased a subscription elsewhere, then allow access to your content if
so or offer a subscription purchase from Google Play if not.</li>
-<li>You can implement your own solution for sharing subscriptions across as
-many different apps or products as you want. For example, you could sell a
-subscription that gives a subscriber access to an entire collection of apps,
-games, or other content for a monthly or annual fee. To implement this solution,
-you could add your own business logic to your app to determine whether the user
-has already purchased a given subscription and if so, allow access to your
+<li>You can implement your own solution for sharing subscriptions across as
+many different apps or products as you want. For example, you could sell a
+subscription that gives a subscriber access to an entire collection of apps,
+games, or other content for a monthly or annual fee. To implement this solution,
+you could add your own business logic to your app to determine whether the user
+has already purchased a given subscription and if so, allow access to your
content.</li>
</ul>
</p>
@@ -111,14 +111,14 @@
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en
&answer=140504">policies document</a>.</p>
-<p>To learn about the minimum system requirements for
+<p>To learn about the minimum system requirements for
subscriptions, see the <a href="{@docRoot}google/play/billing/versions.html#Subs">Version Notes</a>.</p>
<h2 id="administering">Configuring Subscription Items</h2>
<p>To create and manage subscriptions, you can use the Developer Console to set
up a
-product list for the app, then configure these attributes for each subscription
+product list for the app, then configure these attributes for each subscription
product:</p>
<ul>
@@ -133,7 +133,7 @@
<li>Additional currency pricing (can be auto-filled)</li>
</ul>
-<p>For details on how to add and configure products in the Developer Console,
+<p>For details on how to add and configure products in the Developer Console,
see <a href="{@docRoot}google/play/billing/billing_admin.html">Administering
In-app Billing</a>.</p>
@@ -149,18 +149,20 @@
— for example you could offer a discount on an annual subscription
relative to the monthly equivalent. </p>
-<p class="caution"><strong>Important</strong>: To change the price of a
-subscription, you can publish a new subscription product ID at a new price,
-then offer it in your app instead of the original product. Users who have
-already purchased will continue to be charged at the
+<p class="caution"><strong>Important</strong>: To change the price of a
+subscription, you can publish a new subscription product ID at a new price,
+then offer it in your app instead of the original product. Users who have
+already purchased will continue to be charged at the
original price, but new users will be charged at the new price.</p>
<h3 id="user-billing">User billing</h3>
-<p>In the Developer Console, you can configure subscription products with
+<p>In the Developer Console, you can configure subscription products with
automated recurring billing at your choice of intervals:</p>
<ul>
+ <li>Weekly — Google Play bills the customer’s Google Wallet account at
+ the time of purchase and every week after the original purchase date.</li>
<li>Monthly — Google Play bills the customer’s Google Wallet account at
the time of purchase and monthly subsequent to the purchase date (exact billing
intervals can vary slightly over time).</li>
@@ -183,32 +185,27 @@
cycles, based on the purchase date. (Seasonal subscriptions are charged
annually, on the first day of the season.)</p>
-<p>Over the life of a subscription, the form of payment billed remains the same
-— Google Play always bills the same form of payment (such as credit card
-or by Direct Carrier Billing) that was originally used to purchase the
-subscription.</p>
-
-<p>When the subscription payment is approved by Google Wallet, Google Play
+<p>When the subscription payment is approved, Google Play
provides a purchase token back to the purchasing app through the In-app Billing
-API. Your apps can store the token locally or pass it to your backend servers,
+API. Your apps can store the token locally or pass it to your backend servers,
which can then use it to validate or cancel the subscription remotely using the
<a
href="{@docRoot}google/play/billing/gp-purchase-status-api.html">Google Play Developer API</a>.</p>
<p>If a recurring payment fails (for example, because the customer’s credit
-card has become invalid), the subscription does not renew. How your app is
+card has become invalid), the subscription does not renew. How your app is
notified depends on the In-app Billing API version that you are using:</p>
<ul>
-<li>With In-app Billing Version 3, the failed or expired subscription is no longer
+<li>With In-app Billing Version 3, the failed or expired subscription is no longer
returned when you call {@code getPurchases}.</li>
-<li>With In-app Billing Version 2, Google Play notifies your app at the end of
-the active cycle that the purchase state of the subscription is now "Expired".
+<li>With In-app Billing Version 2, Google Play notifies your app at the end of
+the active cycle that the purchase state of the subscription is now "Expired".
</li>
</ul>
-<p class="note"><strong>Recommendation</strong>: Include business logic in your
-app to notify your backend servers of subscription purchases, tokens, and any
-billing errors that may occur. Your backend servers can use the server-side API
+<p class="note"><strong>Recommendation</strong>: Include business logic in your
+app to notify your backend servers of subscription purchases, tokens, and any
+billing errors that may occur. Your backend servers can use the server-side API
to query and update your records and follow up with customers directly, if needed.</p>
<h3 id="manual-renewal">Manual Renewal</h3>
@@ -220,8 +217,8 @@
<p>For example, Achilles has a subscription to the <em>Modern Hoplite</em> app.
His subscription is currently due to expire on August 1. On July 10, he
-purchases a 3-month subscription at the current rate. Those three months are
-added to his existing subscription, so the subscription now expires on November
+purchases a 1-month subscription at the current rate. This one month is
+added to his existing subscription, so the subscription now expires on September
1.</p>
<p>It is up to the app to convey this with an appropriate UI. For example, if a
@@ -311,9 +308,9 @@
<h3 id="trials">Free trials</h3>
<p>In the Developer Console, you can set up a free trial period that lets users
-try your subscription content before buying it. The trial period runs for the
-period of time that you set and then automatically converts to a full
-subscription managed according to the subscription's billing interval and
+try your subscription content before buying it. The trial period runs for the
+period of time that you set and then automatically converts to a full
+subscription managed according to the subscription's billing interval and
price. Free trials are supported for monthly and annual subscriptions only, and are not supported for seasonal subscriptions.</p>
<p>To take advantage of a free trial, a user must "purchase" the full
@@ -328,7 +325,7 @@
period and that the initial charge was $0.00. </p>
<p>When the trial period ends, Google Play automatically initiates billing
-against the credit card that the user provided during the initial purchase, at
+against the credit card that the user provided during the initial purchase, at
the amount set
for the full subscription, and continuing at the subscription interval. If
necessary, the user can cancel the subscription at any time during the trial
@@ -367,15 +364,15 @@
that you must also publish the app itself before Google Play will make the
products available for purchase inside the app. </p>
-<p class="caution"><strong>Important</strong>: You can remove the subscription
-product from the product list offered in your app to prevent users from seeing
+<p class="caution"><strong>Important</strong>: You can remove the subscription
+product from the product list offered in your app to prevent users from seeing
or purchasing it.</p>
<h2 id="cancellation">Subscription Cancellation</h2>
<p>Users can view the status of all of their subscriptions and cancel them if
-necessary from the <strong>My Apps</strong> screen in the Play Store app.
-Currently, the In-app Billing API does not provide support for programatically
+necessary from the <strong>My Apps</strong> screen in the Play Store app.
+Currently, the In-app Billing API does not provide support for programatically
canceling subscriptions from inside the purchasing app.</p>
<p>When the user cancels a subscription, Google Play does not offer a refund for
@@ -404,12 +401,12 @@
<h3 id="uninstall">App uninstallation</h3>
-<p>When the user uninstalls an app that includes purchased subscriptions, the
-Play Store app will notify the user that there are active subscriptions. If the
-user chooses to continue with the uninstallation, the app is removed and the
-subscriptions remain active and recurring billing continues. The user can return
-to cancel the associated subscriptions at any time in the <strong>My Apps</strong>
-screen of the Play Store app. If the user chooses to cancel the uninstallation,
+<p>When the user uninstalls an app that includes purchased subscriptions, the
+Play Store app will notify the user that there are active subscriptions. If the
+user chooses to continue with the uninstallation, the app is removed and the
+subscriptions remain active and recurring billing continues. The user can return
+to cancel the associated subscriptions at any time in the <strong>My Apps</strong>
+screen of the Play Store app. If the user chooses to cancel the uninstallation,
the app and subscriptions remain as they were.</p>
<h3 id="refunds">Refunding and revoking subscriptions</h3>
@@ -436,8 +433,8 @@
<h2 id="payment">Payment Processing and Policies</h2>
<p>In general, the terms of Google Play allow you to sell in-app subscriptions
-only through the standard payment processor, Google Wallet. For purchases of
-any subscription products, the transaction fee is the same as the transaction
+only through the standard payment processor, Google Wallet. For purchases of
+any subscription products, the transaction fee is the same as the transaction
fee for application purchases (30%).</p>
<p>Apps published on Google Play that are selling subscriptions must use In-app
@@ -451,7 +448,7 @@
<h3 id="orderId">Subscription order numbers</h3>
<p>To help you track transactions relating to a given subscription, Google
-Wallet provides a base Merchant Order Number for all recurrences of the
+Wallet provides a base Merchant Order Number for all recurrences of the
subscription and denotes
each recurring transaction by appending an integer as follows: </p>
@@ -461,10 +458,29 @@
<code>12999556515565155651.5565135565155651..2</code> (third recurrence orderID)<br />
...<br /></p>
-<p>Google Play provides the order number as the value of the
-{@code orderId} field of the {@code INAPP_PURCHASE_DATA} JSON field (in V3)
+<p>Google Play provides the order number as the value of the
+{@code orderId} field of the {@code INAPP_PURCHASE_DATA} JSON field (in V3)
or the {@code PURCHASE_STATE_CHANGED} intent (in V2).</p>
+<h3 id="grace-period">Grace period for declined payments</h3>
+
+<p>
+ The Developer Console allows you to set a grace period for subscriptions, so you can give
+ your subscribers a chance to update their payment method if a recurring payment is declined.
+ This setting is useful if your subscribers have an expired credit card, subscribed using a
+ prepaid card, or canceled a card without updating their payment information. For
+ information about setting a grace period for subscriptions, see the Developer Console Help
+ topic <a href="https://support.google.com/googleplay/android-developer/answer/140504"
+ class="external-link">Add subscriptions & recurring charges</a>.
+</p>
+
+</p>
+ For information on how setting a grace period affects data returned from the
+ {@code getBuyIntent()} method, see the
+ <a href="{@docRoot}google/play/billing/billing_reference.html#purchase-data-table"
+ >{@code INAPP_PURCHASE_DATA}</a> fields table.
+</p>
+
<h2 id="strategies">Purchase Verification Strategies</h2>
<p>In a typical scenario, your app verifies the order status for new purchases
diff --git a/docs/html/google/play/billing/index.jd b/docs/html/google/play/billing/index.jd
index 47620c8..c671c71 100644
--- a/docs/html/google/play/billing/index.jd
+++ b/docs/html/google/play/billing/index.jd
@@ -7,7 +7,7 @@
<p>In-app Billing is a Google Play service that lets you sell digital content from inside
your applications. You can use the service to sell a wide range of content, including downloadable
-content such as media files or photos, virtual content such as game levels or potions, premium services
+content such as media files or photos, virtual content such as game levels or potions, premium services
and features, and more. You can use In-app Billing to sell products as</p>
<div class="sidebox-wrapper">
@@ -34,17 +34,14 @@
<a href="billing_subscriptions.html#deferred-billing">defer</a> a
subscriber's next billing date until the date you choose. The user still has
access to the content but is not charged during the deferral period.</li>
- <li><strong>Google Play Developer API</strong>—The
- <a href="{@docRoot}google/play/billing/gp-purchase-status-api.html">Google
- Play Developer API</a> allows you to perform a number of publishing and
- app-management tasks. It includes the functionality previously known as the
- <em>Purchase Status API.</em> </li>
- <li><strong>Refund/Revoke subscription</strong>—You can use the
- Google Play Developer API to <a href="billing_subscriptions.html#refunds">refund
- and revoke</a> a user's subscription. If you do this, the user's
- subscription ends
- immediately, and his or her most recent subscription payment is
- refunded.</li>
+ <li><strong>Weekly subscriptions</strong>—You can now set up a
+ recurring <a href="billing_subscriptions.html#user-billing">subscription</a>
+ that bills the user every week.</li>
+ <li><strong>Payment grace period</strong>—If a subscriber misses a
+ subscription payment due to an expired credit card, you can define a
+ <a href="billing_subscriptions.html#grace-period">grace period</a>
+ to the continue the subscription until payment is successful.</li>
+
</ul>
</div>
</div>
@@ -69,7 +66,7 @@
provides a sample application that demonstrates how to sell standard in-app
products and subscriptions from inside an app.</p>
-<p>To get started, read the documents below or take the <a href="{@docRoot}training/in-app-billing/index.html">Selling
+<p>To get started, read the documents below or take the <a href="{@docRoot}training/in-app-billing/index.html">Selling
In-app Products</a> training class.</p>
<dl>
diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java
index 6283e02..5d777b0 100644
--- a/keystore/java/android/security/Credentials.java
+++ b/keystore/java/android/security/Credentials.java
@@ -216,7 +216,7 @@
* particular {@code alias}. All three can exist for any given alias.
* Returns {@code true} if there was at least one of those types.
*/
- static boolean deleteAllTypesForAlias(KeyStore keystore, String alias) {
+ public static boolean deleteAllTypesForAlias(KeyStore keystore, String alias) {
/*
* Make sure every type is deleted. There can be all three types, so
* don't use a conditional here.
@@ -231,7 +231,7 @@
* particular {@code alias}. All three can exist for any given alias.
* Returns {@code true} if there was at least one of those types.
*/
- static boolean deleteCertificateTypesForAlias(KeyStore keystore, String alias) {
+ public static boolean deleteCertificateTypesForAlias(KeyStore keystore, String alias) {
/*
* Make sure every certificate type is deleted. There can be two types,
* so don't use a conditional here.
@@ -252,7 +252,7 @@
* Delete secret key for a particular {@code alias}.
* Returns {@code true} if an entry was was deleted.
*/
- static boolean deleteSecretKeyTypeForAlias(KeyStore keystore, String alias) {
+ public static boolean deleteSecretKeyTypeForAlias(KeyStore keystore, String alias) {
return keystore.delete(Credentials.USER_SECRET_KEY + alias);
}
}
diff --git a/keystore/java/android/security/GateKeeper.java b/keystore/java/android/security/GateKeeper.java
index 5617836..c1df28c 100644
--- a/keystore/java/android/security/GateKeeper.java
+++ b/keystore/java/android/security/GateKeeper.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package android.security;
import android.os.RemoteException;
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 72c74df..06f5b06 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -109,7 +109,7 @@
mContext = getApplicationContext();
}
- static Context getApplicationContext() {
+ public static Context getApplicationContext() {
ActivityThread activityThread = ActivityThread.currentActivityThread();
if (activityThread == null) {
throw new IllegalStateException(
@@ -136,7 +136,7 @@
return mToken;
}
- static int getKeyTypeForAlgorithm(@KeyProperties.KeyAlgorithmEnum String keyType) {
+ public static int getKeyTypeForAlgorithm(@KeyProperties.KeyAlgorithmEnum String keyType) {
if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyType)) {
return NativeConstants.EVP_PKEY_RSA;
} else if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyType)) {
@@ -632,7 +632,7 @@
* Returns a {@link KeyStoreException} corresponding to the provided keystore/keymaster error
* code.
*/
- static KeyStoreException getKeyStoreException(int errorCode) {
+ public static KeyStoreException getKeyStoreException(int errorCode) {
if (errorCode > 0) {
// KeyStore layer error
switch (errorCode) {
@@ -674,7 +674,8 @@
* Returns an {@link InvalidKeyException} corresponding to the provided
* {@link KeyStoreException}.
*/
- InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, KeyStoreException e) {
+ public InvalidKeyException getInvalidKeyException(
+ String keystoreKeyAlias, KeyStoreException e) {
switch (e.getErrorCode()) {
case LOCKED:
return new UserNotAuthenticatedException();
@@ -745,7 +746,7 @@
* Returns an {@link InvalidKeyException} corresponding to the provided keystore/keymaster error
* code.
*/
- InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, int errorCode) {
+ public InvalidKeyException getInvalidKeyException(String keystoreKeyAlias, int errorCode) {
return getInvalidKeyException(keystoreKeyAlias, getKeyStoreException(errorCode));
}
}
diff --git a/keystore/java/android/security/AndroidKeyPairGenerator.java b/keystore/java/android/security/keystore/AndroidKeyPairGeneratorSpi.java
similarity index 96%
rename from keystore/java/android/security/AndroidKeyPairGenerator.java
rename to keystore/java/android/security/keystore/AndroidKeyPairGeneratorSpi.java
index e9f8320..8d3b421 100644
--- a/keystore/java/android/security/AndroidKeyPairGenerator.java
+++ b/keystore/java/android/security/keystore/AndroidKeyPairGeneratorSpi.java
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.annotation.NonNull;
-import android.security.keystore.KeyGenParameterSpec;
-import android.security.keystore.KeyProperties;
+import android.security.Credentials;
+import android.security.KeyPairGeneratorSpec;
+import android.security.KeyStore;
import com.android.org.bouncycastle.x509.X509V3CertificateGenerator;
import com.android.org.conscrypt.NativeConstants;
@@ -55,15 +56,15 @@
*
* {@hide}
*/
-public abstract class AndroidKeyPairGenerator extends KeyPairGeneratorSpi {
+public abstract class AndroidKeyPairGeneratorSpi extends KeyPairGeneratorSpi {
- public static class RSA extends AndroidKeyPairGenerator {
+ public static class RSA extends AndroidKeyPairGeneratorSpi {
public RSA() {
super(KeyProperties.KEY_ALGORITHM_RSA);
}
}
- public static class EC extends AndroidKeyPairGenerator {
+ public static class EC extends AndroidKeyPairGeneratorSpi {
public EC() {
super(KeyProperties.KEY_ALGORITHM_EC);
}
@@ -92,7 +93,7 @@
private int mKeyType;
private int mKeySize;
- protected AndroidKeyPairGenerator(@KeyProperties.KeyAlgorithmEnum String algorithm) {
+ protected AndroidKeyPairGeneratorSpi(@KeyProperties.KeyAlgorithmEnum String algorithm) {
mAlgorithm = algorithm;
}
diff --git a/keystore/java/android/security/AndroidKeyStoreBCWorkaroundProvider.java b/keystore/java/android/security/keystore/AndroidKeyStoreBCWorkaroundProvider.java
similarity index 75%
rename from keystore/java/android/security/AndroidKeyStoreBCWorkaroundProvider.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreBCWorkaroundProvider.java
index 45329cf..3774e36 100644
--- a/keystore/java/android/security/AndroidKeyStoreBCWorkaroundProvider.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreBCWorkaroundProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.Provider;
@@ -40,9 +40,9 @@
// classes when this provider is instantiated and installed early on during each app's
// initialization process.
- private static final String PACKAGE_NAME = "android.security";
+ private static final String PACKAGE_NAME = "android.security.keystore";
private static final String KEYSTORE_SECRET_KEY_CLASS_NAME =
- PACKAGE_NAME + ".KeyStoreSecretKey";
+ PACKAGE_NAME + ".AndroidKeyStoreSecretKey";
AndroidKeyStoreBCWorkaroundProvider() {
super("AndroidKeyStoreBCWorkaround",
@@ -50,25 +50,25 @@
"Android KeyStore security provider to work around Bouncy Castle");
// javax.crypto.Mac
- putMacImpl("HmacSHA1", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA1");
- putMacImpl("HmacSHA224", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA224");
- putMacImpl("HmacSHA256", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA256");
- putMacImpl("HmacSHA384", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA384");
- putMacImpl("HmacSHA512", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA512");
+ putMacImpl("HmacSHA1", PACKAGE_NAME + ".AndroidKeyStoreHmacSpi$HmacSHA1");
+ putMacImpl("HmacSHA224", PACKAGE_NAME + ".AndroidKeyStoreHmacSpi$HmacSHA224");
+ putMacImpl("HmacSHA256", PACKAGE_NAME + ".AndroidKeyStoreHmacSpi$HmacSHA256");
+ putMacImpl("HmacSHA384", PACKAGE_NAME + ".AndroidKeyStoreHmacSpi$HmacSHA384");
+ putMacImpl("HmacSHA512", PACKAGE_NAME + ".AndroidKeyStoreHmacSpi$HmacSHA512");
// javax.crypto.Cipher
putSymmetricCipherImpl("AES/ECB/NoPadding",
- PACKAGE_NAME + ".KeyStoreCipherSpi$AES$ECB$NoPadding");
+ PACKAGE_NAME + ".AndroidKeyStoreCipherSpi$AES$ECB$NoPadding");
putSymmetricCipherImpl("AES/ECB/PKCS7Padding",
- PACKAGE_NAME + ".KeyStoreCipherSpi$AES$ECB$PKCS7Padding");
+ PACKAGE_NAME + ".AndroidKeyStoreCipherSpi$AES$ECB$PKCS7Padding");
putSymmetricCipherImpl("AES/CBC/NoPadding",
- PACKAGE_NAME + ".KeyStoreCipherSpi$AES$CBC$NoPadding");
+ PACKAGE_NAME + ".AndroidKeyStoreCipherSpi$AES$CBC$NoPadding");
putSymmetricCipherImpl("AES/CBC/PKCS7Padding",
- PACKAGE_NAME + ".KeyStoreCipherSpi$AES$CBC$PKCS7Padding");
+ PACKAGE_NAME + ".AndroidKeyStoreCipherSpi$AES$CBC$PKCS7Padding");
putSymmetricCipherImpl("AES/CTR/NoPadding",
- PACKAGE_NAME + ".KeyStoreCipherSpi$AES$CTR$NoPadding");
+ PACKAGE_NAME + ".AndroidKeyStoreCipherSpi$AES$CTR$NoPadding");
}
private void putMacImpl(String algorithm, String implClass) {
diff --git a/keystore/java/android/security/KeyStoreCipherSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpi.java
similarity index 97%
rename from keystore/java/android/security/KeyStoreCipherSpi.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreCipherSpi.java
index b0f1695..27df5e7 100644
--- a/keystore/java/android/security/KeyStoreCipherSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreCipherSpi.java
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.os.IBinder;
+import android.security.KeyStore;
+import android.security.KeyStoreException;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
import android.security.keymaster.OperationResult;
@@ -48,9 +50,10 @@
*
* @hide
*/
-public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCryptoOperation {
+public abstract class AndroidKeyStoreCipherSpi extends CipherSpi
+ implements KeyStoreCryptoOperation {
- public abstract static class AES extends KeyStoreCipherSpi {
+ public abstract static class AES extends AndroidKeyStoreCipherSpi {
protected AES(int keymasterBlockMode, int keymasterPadding, boolean ivUsed) {
super(KeymasterDefs.KM_ALGORITHM_AES,
keymasterBlockMode,
@@ -120,7 +123,7 @@
// Fields below are populated by Cipher.init and KeyStore.begin and should be preserved after
// doFinal finishes.
protected boolean mEncrypting;
- private KeyStoreSecretKey mKey;
+ private AndroidKeyStoreSecretKey mKey;
private SecureRandom mRng;
private boolean mFirstOperationInitiated;
private byte[] mIv;
@@ -147,7 +150,7 @@
*/
private Exception mCachedException;
- protected KeyStoreCipherSpi(
+ protected AndroidKeyStoreCipherSpi(
int keymasterAlgorithm,
int keymasterBlockMode,
int keymasterPadding,
@@ -219,11 +222,11 @@
}
private void init(int opmode, Key key, SecureRandom random) throws InvalidKeyException {
- if (!(key instanceof KeyStoreSecretKey)) {
+ if (!(key instanceof AndroidKeyStoreSecretKey)) {
throw new InvalidKeyException(
"Unsupported key: " + ((key != null) ? key.getClass().getName() : "null"));
}
- mKey = (KeyStoreSecretKey) key;
+ mKey = (AndroidKeyStoreSecretKey) key;
mRng = random;
mIv = null;
mFirstOperationInitiated = false;
diff --git a/keystore/java/android/security/KeyStoreHmacSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreHmacSpi.java
similarity index 90%
rename from keystore/java/android/security/KeyStoreHmacSpi.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreHmacSpi.java
index 5089a25..b82a7f5 100644
--- a/keystore/java/android/security/KeyStoreHmacSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreHmacSpi.java
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.os.IBinder;
+import android.security.KeyStore;
+import android.security.KeyStoreException;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
import android.security.keymaster.OperationResult;
@@ -34,33 +36,33 @@
*
* @hide
*/
-public abstract class KeyStoreHmacSpi extends MacSpi implements KeyStoreCryptoOperation {
+public abstract class AndroidKeyStoreHmacSpi extends MacSpi implements KeyStoreCryptoOperation {
- public static class HmacSHA1 extends KeyStoreHmacSpi {
+ public static class HmacSHA1 extends AndroidKeyStoreHmacSpi {
public HmacSHA1() {
super(KeymasterDefs.KM_DIGEST_SHA1);
}
}
- public static class HmacSHA224 extends KeyStoreHmacSpi {
+ public static class HmacSHA224 extends AndroidKeyStoreHmacSpi {
public HmacSHA224() {
super(KeymasterDefs.KM_DIGEST_SHA_2_224);
}
}
- public static class HmacSHA256 extends KeyStoreHmacSpi {
+ public static class HmacSHA256 extends AndroidKeyStoreHmacSpi {
public HmacSHA256() {
super(KeymasterDefs.KM_DIGEST_SHA_2_256);
}
}
- public static class HmacSHA384 extends KeyStoreHmacSpi {
+ public static class HmacSHA384 extends AndroidKeyStoreHmacSpi {
public HmacSHA384() {
super(KeymasterDefs.KM_DIGEST_SHA_2_384);
}
}
- public static class HmacSHA512 extends KeyStoreHmacSpi {
+ public static class HmacSHA512 extends AndroidKeyStoreHmacSpi {
public HmacSHA512() {
super(KeymasterDefs.KM_DIGEST_SHA_2_512);
}
@@ -71,14 +73,14 @@
private final int mMacSizeBits;
// Fields below are populated by engineInit and should be preserved after engineDoFinal.
- private KeyStoreSecretKey mKey;
+ private AndroidKeyStoreSecretKey mKey;
// Fields below are reset when engineDoFinal succeeds.
private KeyStoreCryptoOperationChunkedStreamer mChunkedStreamer;
private IBinder mOperationToken;
private long mOperationHandle;
- protected KeyStoreHmacSpi(int keymasterDigest) {
+ protected AndroidKeyStoreHmacSpi(int keymasterDigest) {
mKeymasterDigest = keymasterDigest;
mMacSizeBits = KeymasterUtils.getDigestOutputSizeBits(keymasterDigest);
}
@@ -109,11 +111,11 @@
InvalidAlgorithmParameterException {
if (key == null) {
throw new InvalidKeyException("key == null");
- } else if (!(key instanceof KeyStoreSecretKey)) {
+ } else if (!(key instanceof AndroidKeyStoreSecretKey)) {
throw new InvalidKeyException(
"Only Android KeyStore secret keys supported. Key: " + key);
}
- mKey = (KeyStoreSecretKey) key;
+ mKey = (AndroidKeyStoreSecretKey) key;
if (params != null) {
throw new InvalidAlgorithmParameterException(
diff --git a/keystore/java/android/security/KeyStoreKey.java b/keystore/java/android/security/keystore/AndroidKeyStoreKey.java
similarity index 88%
rename from keystore/java/android/security/KeyStoreKey.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreKey.java
index 7a34829..6098e5c 100644
--- a/keystore/java/android/security/KeyStoreKey.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKey.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.Key;
@@ -23,11 +23,11 @@
*
* @hide
*/
-public class KeyStoreKey implements Key {
+public class AndroidKeyStoreKey implements Key {
private final String mAlias;
private final String mAlgorithm;
- public KeyStoreKey(String alias, String algorithm) {
+ public AndroidKeyStoreKey(String alias, String algorithm) {
mAlias = alias;
mAlgorithm = algorithm;
}
diff --git a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
similarity index 96%
rename from keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
index feec00f..0821bf5 100644
--- a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
@@ -14,8 +14,10 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+import android.security.Credentials;
+import android.security.KeyStore;
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
@@ -39,9 +41,9 @@
*
* @hide
*/
-public abstract class KeyStoreKeyGeneratorSpi extends KeyGeneratorSpi {
+public abstract class AndroidKeyStoreKeyGeneratorSpi extends KeyGeneratorSpi {
- public static class AES extends KeyStoreKeyGeneratorSpi {
+ public static class AES extends AndroidKeyStoreKeyGeneratorSpi {
public AES() {
super(KeymasterDefs.KM_ALGORITHM_AES, 128);
}
@@ -58,7 +60,7 @@
}
}
- protected static abstract class HmacBase extends KeyStoreKeyGeneratorSpi {
+ protected static abstract class HmacBase extends AndroidKeyStoreKeyGeneratorSpi {
protected HmacBase(int keymasterDigest) {
super(KeymasterDefs.KM_ALGORITHM_HMAC,
keymasterDigest,
@@ -110,13 +112,13 @@
private int[] mKeymasterPaddings;
private int[] mKeymasterDigests;
- protected KeyStoreKeyGeneratorSpi(
+ protected AndroidKeyStoreKeyGeneratorSpi(
int keymasterAlgorithm,
int defaultKeySizeBits) {
this(keymasterAlgorithm, -1, defaultKeySizeBits);
}
- protected KeyStoreKeyGeneratorSpi(
+ protected AndroidKeyStoreKeyGeneratorSpi(
int keymasterAlgorithm,
int keymasterDigest,
int defaultKeySizeBits) {
@@ -314,6 +316,6 @@
} catch (IllegalArgumentException e) {
throw new ProviderException("Failed to obtain JCA secret key algorithm name", e);
}
- return new KeyStoreSecretKey(keyAliasInKeystore, keyAlgorithmJCA);
+ return new AndroidKeyStoreSecretKey(keyAliasInKeystore, keyAlgorithmJCA);
}
}
diff --git a/keystore/java/android/security/AndroidKeyStoreProvider.java b/keystore/java/android/security/keystore/AndroidKeyStoreProvider.java
similarity index 84%
rename from keystore/java/android/security/AndroidKeyStoreProvider.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreProvider.java
index 257ab54..b20a122 100644
--- a/keystore/java/android/security/AndroidKeyStoreProvider.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreProvider.java
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+
+import android.security.KeyStore;
import java.security.Provider;
import java.security.Security;
@@ -38,25 +40,25 @@
// Instead, they need to be offered by AndroidKeyStoreBCWorkaroundProvider. See its Javadoc
// for details.
- private static final String PACKAGE_NAME = "android.security";
+ private static final String PACKAGE_NAME = "android.security.keystore";
public AndroidKeyStoreProvider() {
super(PROVIDER_NAME, 1.0, "Android KeyStore security provider");
// java.security.KeyStore
- put("KeyStore.AndroidKeyStore", PACKAGE_NAME + ".AndroidKeyStore");
+ put("KeyStore.AndroidKeyStore", PACKAGE_NAME + ".AndroidKeyStoreSpi");
// java.security.KeyPairGenerator
- put("KeyPairGenerator.EC", PACKAGE_NAME + ".AndroidKeyPairGenerator$EC");
- put("KeyPairGenerator.RSA", PACKAGE_NAME + ".AndroidKeyPairGenerator$RSA");
+ put("KeyPairGenerator.EC", PACKAGE_NAME + ".AndroidKeyPairGeneratorSpi$EC");
+ put("KeyPairGenerator.RSA", PACKAGE_NAME + ".AndroidKeyPairGeneratorSpi$RSA");
// javax.crypto.KeyGenerator
- put("KeyGenerator.AES", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$AES");
- put("KeyGenerator.HmacSHA1", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$HmacSHA1");
- put("KeyGenerator.HmacSHA224", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$HmacSHA224");
- put("KeyGenerator.HmacSHA256", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$HmacSHA256");
- put("KeyGenerator.HmacSHA384", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$HmacSHA384");
- put("KeyGenerator.HmacSHA512", PACKAGE_NAME + ".KeyStoreKeyGeneratorSpi$HmacSHA512");
+ put("KeyGenerator.AES", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$AES");
+ put("KeyGenerator.HmacSHA1", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$HmacSHA1");
+ put("KeyGenerator.HmacSHA224", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$HmacSHA224");
+ put("KeyGenerator.HmacSHA256", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$HmacSHA256");
+ put("KeyGenerator.HmacSHA384", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$HmacSHA384");
+ put("KeyGenerator.HmacSHA512", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$HmacSHA512");
// java.security.SecretKeyFactory
putSecretKeyFactoryImpl("AES");
@@ -95,7 +97,7 @@
}
private void putSecretKeyFactoryImpl(String algorithm) {
- put("SecretKeyFactory." + algorithm, PACKAGE_NAME + ".KeyStoreSecretKeyFactorySpi");
+ put("SecretKeyFactory." + algorithm, PACKAGE_NAME + ".AndroidKeyStoreSecretKeyFactorySpi");
}
/**
diff --git a/keystore/java/android/security/KeyStoreSecretKey.java b/keystore/java/android/security/keystore/AndroidKeyStoreSecretKey.java
similarity index 79%
rename from keystore/java/android/security/KeyStoreSecretKey.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreSecretKey.java
index ee25465..f75516b 100644
--- a/keystore/java/android/security/KeyStoreSecretKey.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreSecretKey.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import javax.crypto.SecretKey;
@@ -23,9 +23,9 @@
*
* @hide
*/
-public class KeyStoreSecretKey extends KeyStoreKey implements SecretKey {
+public class AndroidKeyStoreSecretKey extends AndroidKeyStoreKey implements SecretKey {
- public KeyStoreSecretKey(String alias, String algorithm) {
+ public AndroidKeyStoreSecretKey(String alias, String algorithm) {
super(alias, algorithm);
}
}
diff --git a/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreSecretKeyFactorySpi.java
similarity index 95%
rename from keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreSecretKeyFactorySpi.java
index 618ba47..455f170 100644
--- a/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreSecretKeyFactorySpi.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+import android.security.Credentials;
+import android.security.KeyStore;
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterDefs;
-import android.security.keystore.KeyInfo;
-import android.security.keystore.KeyProperties;
import libcore.util.EmptyArray;
@@ -39,7 +39,7 @@
*
* @hide
*/
-public class KeyStoreSecretKeyFactorySpi extends SecretKeyFactorySpi {
+public class AndroidKeyStoreSecretKeyFactorySpi extends SecretKeyFactorySpi {
private final KeyStore mKeyStore = KeyStore.getInstance();
@@ -49,7 +49,7 @@
if (keySpecClass == null) {
throw new InvalidKeySpecException("keySpecClass == null");
}
- if (!(key instanceof KeyStoreSecretKey)) {
+ if (!(key instanceof AndroidKeyStoreSecretKey)) {
throw new InvalidKeySpecException("Only Android KeyStore secret keys supported: " +
((key != null) ? key.getClass().getName() : "null"));
}
@@ -60,7 +60,7 @@
if (!KeyInfo.class.equals(keySpecClass)) {
throw new InvalidKeySpecException("Unsupported key spec: " + keySpecClass.getName());
}
- String keyAliasInKeystore = ((KeyStoreSecretKey) key).getAlias();
+ String keyAliasInKeystore = ((AndroidKeyStoreSecretKey) key).getAlias();
String entryAlias;
if (keyAliasInKeystore.startsWith(Credentials.USER_SECRET_KEY)) {
entryAlias = keyAliasInKeystore.substring(Credentials.USER_SECRET_KEY.length());
diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
similarity index 98%
rename from keystore/java/android/security/AndroidKeyStore.java
rename to keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
index 69bf877..d6145a3 100644
--- a/keystore/java/android/security/AndroidKeyStore.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import com.android.org.conscrypt.OpenSSLEngine;
import com.android.org.conscrypt.OpenSSLKeyHolder;
import libcore.util.EmptyArray;
+import android.security.Credentials;
+import android.security.KeyStoreParameter;
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
@@ -81,7 +83,7 @@
*
* @hide
*/
-public class AndroidKeyStore extends KeyStoreSpi {
+public class AndroidKeyStoreSpi extends KeyStoreSpi {
public static final String NAME = "AndroidKeyStore";
private android.security.KeyStore mKeyStore;
@@ -140,7 +142,7 @@
new UnrecoverableKeyException("Unsupported secret key type").initCause(e);
}
- return new KeyStoreSecretKey(keyAliasInKeystore, keyAlgorithmString);
+ return new AndroidKeyStoreSecretKey(keyAliasInKeystore, keyAlgorithmString);
}
return null;
@@ -476,10 +478,10 @@
}
KeyProtection params = (KeyProtection) param;
- if (key instanceof KeyStoreSecretKey) {
+ if (key instanceof AndroidKeyStoreSecretKey) {
// KeyStore-backed secret key. It cannot be duplicated into another entry and cannot
// overwrite its own entry.
- String keyAliasInKeystore = ((KeyStoreSecretKey) key).getAlias();
+ String keyAliasInKeystore = ((AndroidKeyStoreSecretKey) key).getAlias();
if (keyAliasInKeystore == null) {
throw new KeyStoreException("KeyStore-backed secret key does not have an alias");
}
diff --git a/keystore/java/android/security/ArrayUtils.java b/keystore/java/android/security/keystore/ArrayUtils.java
similarity index 74%
rename from keystore/java/android/security/ArrayUtils.java
rename to keystore/java/android/security/keystore/ArrayUtils.java
index 71b99d0..81be3848 100644
--- a/keystore/java/android/security/ArrayUtils.java
+++ b/keystore/java/android/security/keystore/ArrayUtils.java
@@ -1,4 +1,20 @@
-package android.security;
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.security.keystore;
import libcore.util.EmptyArray;
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index fa3b1cb..f598482 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -21,7 +21,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.text.TextUtils;
-import android.security.ArrayUtils;
import android.security.KeyStore;
import java.math.BigInteger;
diff --git a/keystore/java/android/security/keystore/KeyInfo.java b/keystore/java/android/security/keystore/KeyInfo.java
index aec2512..e4f921e 100644
--- a/keystore/java/android/security/keystore/KeyInfo.java
+++ b/keystore/java/android/security/keystore/KeyInfo.java
@@ -18,7 +18,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.security.ArrayUtils;
import java.security.PrivateKey;
import java.security.spec.KeySpec;
diff --git a/keystore/java/android/security/keystore/KeyProtection.java b/keystore/java/android/security/keystore/KeyProtection.java
index 113159d..48fdd98 100644
--- a/keystore/java/android/security/keystore/KeyProtection.java
+++ b/keystore/java/android/security/keystore/KeyProtection.java
@@ -20,8 +20,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.KeyguardManager;
-import android.content.Context;
-import android.security.ArrayUtils;
import android.security.KeyStore;
import java.security.Key;
diff --git a/keystore/java/android/security/KeyStoreConnectException.java b/keystore/java/android/security/keystore/KeyStoreConnectException.java
similarity index 96%
rename from keystore/java/android/security/KeyStoreConnectException.java
rename to keystore/java/android/security/keystore/KeyStoreConnectException.java
index 885f1f7..e008976 100644
--- a/keystore/java/android/security/KeyStoreConnectException.java
+++ b/keystore/java/android/security/keystore/KeyStoreConnectException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.ProviderException;
diff --git a/keystore/java/android/security/KeyStoreCryptoOperation.java b/keystore/java/android/security/keystore/KeyStoreCryptoOperation.java
similarity index 92%
rename from keystore/java/android/security/KeyStoreCryptoOperation.java
rename to keystore/java/android/security/keystore/KeyStoreCryptoOperation.java
index c5cf211..2c709ae 100644
--- a/keystore/java/android/security/KeyStoreCryptoOperation.java
+++ b/keystore/java/android/security/keystore/KeyStoreCryptoOperation.java
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+
+import android.security.KeyStore;
/**
* Cryptographic operation backed by {@link KeyStore}.
diff --git a/keystore/java/android/security/KeyStoreCryptoOperationChunkedStreamer.java b/keystore/java/android/security/keystore/KeyStoreCryptoOperationChunkedStreamer.java
similarity index 98%
rename from keystore/java/android/security/KeyStoreCryptoOperationChunkedStreamer.java
rename to keystore/java/android/security/keystore/KeyStoreCryptoOperationChunkedStreamer.java
index 0619199..7d57e5f 100644
--- a/keystore/java/android/security/KeyStoreCryptoOperationChunkedStreamer.java
+++ b/keystore/java/android/security/keystore/KeyStoreCryptoOperationChunkedStreamer.java
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.os.IBinder;
+import android.security.KeyStore;
+import android.security.KeyStoreException;
import android.security.keymaster.OperationResult;
import libcore.util.EmptyArray;
diff --git a/keystore/java/android/security/KeyStoreCryptoOperationUtils.java b/keystore/java/android/security/keystore/KeyStoreCryptoOperationUtils.java
similarity index 92%
rename from keystore/java/android/security/KeyStoreCryptoOperationUtils.java
rename to keystore/java/android/security/keystore/KeyStoreCryptoOperationUtils.java
index c9bdd41..6ae76f1 100644
--- a/keystore/java/android/security/KeyStoreCryptoOperationUtils.java
+++ b/keystore/java/android/security/keystore/KeyStoreCryptoOperationUtils.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+import android.security.KeyStore;
import android.security.keymaster.KeymasterDefs;
-import android.security.keystore.UserNotAuthenticatedException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
@@ -41,7 +41,7 @@
* the {@code init} method should succeed.
*/
static InvalidKeyException getInvalidKeyExceptionForInit(
- KeyStore keyStore, KeyStoreKey key, int beginOpResultCode) {
+ KeyStore keyStore, AndroidKeyStoreKey key, int beginOpResultCode) {
if (beginOpResultCode == KeyStore.NO_ERROR) {
return null;
}
@@ -69,8 +69,8 @@
* in response to {@code KeyStore.begin} operation or {@code null} if the {@code init} method
* should succeed.
*/
- static GeneralSecurityException getExceptionForCipherInit(
- KeyStore keyStore, KeyStoreKey key, int beginOpResultCode) {
+ public static GeneralSecurityException getExceptionForCipherInit(
+ KeyStore keyStore, AndroidKeyStoreKey key, int beginOpResultCode) {
if (beginOpResultCode == KeyStore.NO_ERROR) {
return null;
}
diff --git a/keystore/java/android/security/KeymasterUtils.java b/keystore/java/android/security/keystore/KeymasterUtils.java
similarity index 97%
rename from keystore/java/android/security/KeymasterUtils.java
rename to keystore/java/android/security/keystore/KeymasterUtils.java
index 0f8f190..e7529e1 100644
--- a/keystore/java/android/security/KeymasterUtils.java
+++ b/keystore/java/android/security/keystore/KeymasterUtils.java
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.hardware.fingerprint.FingerprintManager;
+import android.security.GateKeeper;
+import android.security.KeyStore;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
diff --git a/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java b/keystore/tests/src/android/security/keystore/AndroidKeyPairGeneratorTest.java
similarity index 98%
rename from keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java
rename to keystore/tests/src/android/security/keystore/AndroidKeyPairGeneratorTest.java
index 9c2f358..cad4e54 100644
--- a/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java
+++ b/keystore/tests/src/android/security/keystore/AndroidKeyPairGeneratorTest.java
@@ -14,8 +14,10 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
+import android.security.Credentials;
+import android.security.KeyPairGeneratorSpec;
import android.test.AndroidTestCase;
import java.io.ByteArrayInputStream;
diff --git a/keystore/tests/src/android/security/AndroidKeyStoreTest.java b/keystore/tests/src/android/security/keystore/AndroidKeyStoreTest.java
similarity index 99%
rename from keystore/tests/src/android/security/AndroidKeyStoreTest.java
rename to keystore/tests/src/android/security/keystore/AndroidKeyStoreTest.java
index 4b2b9b5..2d4e4a0 100644
--- a/keystore/tests/src/android/security/AndroidKeyStoreTest.java
+++ b/keystore/tests/src/android/security/keystore/AndroidKeyStoreTest.java
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import com.android.org.bouncycastle.x509.X509V3CertificateGenerator;
import com.android.org.conscrypt.NativeConstants;
import com.android.org.conscrypt.OpenSSLEngine;
+import android.security.Credentials;
+import android.security.KeyStore;
+import android.security.KeyStoreParameter;
import android.test.AndroidTestCase;
import java.io.ByteArrayInputStream;
@@ -1319,9 +1322,9 @@
}
public void testKeyStore_GetType_Encrypted_Success() throws Exception {
- assertEquals(AndroidKeyStore.NAME, mKeyStore.getType());
+ assertEquals(AndroidKeyStoreSpi.NAME, mKeyStore.getType());
setupPassword();
- assertEquals(AndroidKeyStore.NAME, mKeyStore.getType());
+ assertEquals(AndroidKeyStoreSpi.NAME, mKeyStore.getType());
}
public void testKeyStore_IsCertificateEntry_CA_Encrypted_Success() throws Exception {
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 8f5fea3..e466604 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -280,6 +280,7 @@
}
void PathCache::generateTexture(SkBitmap& bitmap, Texture* texture) {
+ ATRACE_NAME("Upload Path Texture");
SkAutoLockPixels alp(bitmap);
if (!bitmap.readyToDraw()) {
ALOGE("Cannot generate texture from bitmap");
diff --git a/media/java/android/media/AudioDeviceInfo.java b/media/java/android/media/AudioDeviceInfo.java
index 4ecb930..0384d40 100644
--- a/media/java/android/media/AudioDeviceInfo.java
+++ b/media/java/android/media/AudioDeviceInfo.java
@@ -122,8 +122,9 @@
/**
* @return The human-readable name of the audio device.
*/
- public CharSequence getName() {
- return mPort.name();
+ public CharSequence getProductName() {
+ String portName = mPort.name();
+ return portName.length() != 0 ? portName : android.os.Build.MODEL;
}
/**
diff --git a/preloaded-classes b/preloaded-classes
index d2ed762..41a8857 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -1152,8 +1152,8 @@
android.provider.Settings$System
android.provider.Telephony$Mms
android.renderscript.RenderScript
-android.security.AndroidKeyStoreBCWorkaroundProvider
-android.security.AndroidKeyStoreProvider
+android.security.keystore.AndroidKeyStoreBCWorkaroundProvider
+android.security.keystore.AndroidKeyStoreProvider
android.speech.tts.TextToSpeechService
android.speech.tts.TextToSpeechService$SpeechItemV1
android.speech.tts.TextToSpeechService$SynthesisSpeechItemV1
diff --git a/services/core/java/com/android/server/WiredAccessoryManager.java b/services/core/java/com/android/server/WiredAccessoryManager.java
index 0de8c8d..e0e6070 100644
--- a/services/core/java/com/android/server/WiredAccessoryManager.java
+++ b/services/core/java/com/android/server/WiredAccessoryManager.java
@@ -216,9 +216,9 @@
mWakeLock.acquire();
- Log.i(TAG, "MSG_NEW_DEVICE_STATE ");
+ Log.i(TAG, "MSG_NEW_DEVICE_STATE");
Message msg = mHandler.obtainMessage(MSG_NEW_DEVICE_STATE, headsetState,
- mHeadsetState, newName);
+ mHeadsetState, "");
mHandler.sendMessage(msg);
mHeadsetState = headsetState;
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 47ddfec..6c83192 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -564,8 +564,6 @@
return "card=" + card + ";device=" + device + ";";
}
- private final String DEVICE_NAME_A2DP = "a2dp-device";
-
///////////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////////////////////////////////////////////////
@@ -4387,7 +4385,7 @@
}
// must be called synchronized on mConnectedDevices
- private void makeA2dpDeviceAvailable(String address) {
+ private void makeA2dpDeviceAvailable(String address, String name) {
// enable A2DP before notifying A2DP connection to avoid unecessary processing in
// audio policy manager
VolumeStreamState streamState = mStreamStates[AudioSystem.STREAM_MUSIC];
@@ -4395,12 +4393,12 @@
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0, streamState, 0);
setBluetoothA2dpOnInt(true);
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_AVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_AVAILABLE, address, name);
// Reset A2DP suspend state each time a new sink is connected
AudioSystem.setParameters("A2dpSuspended=false");
mConnectedDevices.put(
makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address),
- new DeviceListSpec(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, DEVICE_NAME_A2DP,
+ new DeviceListSpec(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, name,
address));
}
@@ -4414,7 +4412,7 @@
mAvrcpAbsVolSupported = false;
}
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_UNAVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "");
mConnectedDevices.remove(
makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address));
synchronized (mCurAudioRoutes) {
@@ -4444,17 +4442,17 @@
// must be called synchronized on mConnectedDevices
private void makeA2dpSrcAvailable(String address) {
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_AVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_AVAILABLE, address, "");
mConnectedDevices.put(
makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address),
- new DeviceListSpec(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, DEVICE_NAME_A2DP,
+ new DeviceListSpec(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, "",
address));
}
// must be called synchronized on mConnectedDevices
private void makeA2dpSrcUnavailable(String address) {
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_UNAVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "");
mConnectedDevices.remove(
makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address));
}
@@ -4520,7 +4518,7 @@
makeA2dpDeviceUnavailableNow(mDockAddress);
}
}
- makeA2dpDeviceAvailable(address);
+ makeA2dpDeviceAvailable(address, btDevice.getName());
synchronized (mCurAudioRoutes) {
String name = btDevice.getAliasName();
if (!TextUtils.equals(mCurAudioRoutes.bluetoothName, name)) {
@@ -4871,7 +4869,7 @@
if (btDevice == null) {
return;
}
-
+
address = btDevice.getAddress();
BluetoothClass btClass = btDevice.getBluetoothClass();
if (btClass != null) {
@@ -4891,9 +4889,11 @@
}
boolean connected = (state == BluetoothProfile.STATE_CONNECTED);
+
+ String btDeviceName = btDevice.getName();
boolean success =
- handleDeviceConnection(connected, outDevice, address, "Bluetooth Headset") &&
- handleDeviceConnection(connected, inDevice, address, "Bluetooth Headset");
+ handleDeviceConnection(connected, outDevice, address, btDeviceName) &&
+ handleDeviceConnection(connected, inDevice, address, btDeviceName);
if (success) {
synchronized (mScoClients) {
if (connected) {