diff options
25 files changed, 287 insertions, 167 deletions
diff --git a/api/current.txt b/api/current.txt index 90020d17b643..9c090bb56e27 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5317,11 +5317,6 @@ package android.app { method public void onRejectSharedElements(java.util.List<android.view.View>); method public void onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); method public void onSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); - method public void onSharedElementsArrived(java.util.List<java.lang.String>, java.util.List<android.view.View>, android.app.SharedElementCallback.OnSharedElementsReadyListener); - } - - public static abstract interface SharedElementCallback.OnSharedElementsReadyListener { - method public abstract void onSharedElementsReady(); } public deprecated class TabActivity extends android.app.ActivityGroup { diff --git a/api/system-current.txt b/api/system-current.txt index b13ecd30816c..231aafec30b7 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5408,11 +5408,6 @@ package android.app { method public void onRejectSharedElements(java.util.List<android.view.View>); method public void onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); method public void onSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>); - method public void onSharedElementsArrived(java.util.List<java.lang.String>, java.util.List<android.view.View>, android.app.SharedElementCallback.OnSharedElementsReadyListener); - } - - public static abstract interface SharedElementCallback.OnSharedElementsReadyListener { - method public abstract void onSharedElementsReady(); } public deprecated class TabActivity extends android.app.ActivityGroup { @@ -5920,6 +5915,7 @@ package android.app.backup { method public android.app.backup.RestoreSession beginRestoreSession(); method public void dataChanged(); method public static void dataChanged(java.lang.String); + method public long getAvailableRestoreToken(java.lang.String); method public java.lang.String getCurrentTransport(); method public boolean isBackupEnabled(); method public java.lang.String[] listAllTransports(); diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java index e84a8dabf3b7..c053c830adfc 100644 --- a/core/java/android/app/EnterTransitionCoordinator.java +++ b/core/java/android/app/EnterTransitionCoordinator.java @@ -18,7 +18,6 @@ package android.app; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; -import android.app.SharedElementCallback.OnSharedElementsReadyListener; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.ResultReceiver; @@ -141,13 +140,13 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } else { decor.getViewTreeObserver() .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - decor.getViewTreeObserver().removeOnPreDrawListener(this); - viewsReady(sharedElements); - return true; - } - }); + @Override + public boolean onPreDraw() { + decor.getViewTreeObserver().removeOnPreDrawListener(this); + viewsReady(sharedElements); + return true; + } + }); } } @@ -384,33 +383,23 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator { } final Bundle sharedElementState = mSharedElementsBundle; mSharedElementsBundle = null; - OnSharedElementsReadyListener listener = new OnSharedElementsReadyListener() { - @Override - public void onSharedElementsReady() { - final View decorView = getDecor(); - if (decorView != null) { - decorView.getViewTreeObserver() - .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + final View decorView = getDecor(); + if (decorView != null) { + decorView.getViewTreeObserver() + .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + decorView.getViewTreeObserver().removeOnPreDrawListener(this); + startTransition(new Runnable() { @Override - public boolean onPreDraw() { - decorView.getViewTreeObserver().removeOnPreDrawListener(this); - startTransition(new Runnable() { - @Override - public void run() { - startSharedElementTransition(sharedElementState); - } - }); - return false; + public void run() { + startSharedElementTransition(sharedElementState); } }); - decorView.invalidate(); - } - } - }; - if (mListener == null) { - listener.onSharedElementsReady(); - } else { - mListener.onSharedElementsArrived(mSharedElementNames, mSharedElements, listener); + return false; + } + }); + decorView.invalidate(); } } diff --git a/core/java/android/app/ExitTransitionCoordinator.java b/core/java/android/app/ExitTransitionCoordinator.java index 169952ad1a0b..dd3df47942cc 100644 --- a/core/java/android/app/ExitTransitionCoordinator.java +++ b/core/java/android/app/ExitTransitionCoordinator.java @@ -18,7 +18,6 @@ package android.app; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; -import android.app.SharedElementCallback.OnSharedElementsReadyListener; import android.content.Intent; import android.graphics.Color; import android.graphics.Matrix; @@ -28,7 +27,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.os.ResultReceiver; import android.transition.Transition; import android.transition.TransitionManager; import android.view.View; @@ -410,38 +408,18 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator { if (!mSharedElementNotified) { mSharedElementNotified = true; delayCancel(); - if (mListener == null) { - mResultReceiver.send(MSG_TAKE_SHARED_ELEMENTS, mSharedElementBundle); - notifyExitComplete(); - } else { - final ResultReceiver resultReceiver = mResultReceiver; - final Bundle sharedElementBundle = mSharedElementBundle; - mListener.onSharedElementsArrived(mSharedElementNames, mSharedElements, - new OnSharedElementsReadyListener() { - @Override - public void onSharedElementsReady() { - resultReceiver.send(MSG_TAKE_SHARED_ELEMENTS, - sharedElementBundle); - notifyExitComplete(); - } - }); - } - } else { - notifyExitComplete(); + mResultReceiver.send(MSG_TAKE_SHARED_ELEMENTS, mSharedElementBundle); } - } - } - - private void notifyExitComplete() { - if (!mExitNotified && mExitComplete) { - mExitNotified = true; - mResultReceiver.send(MSG_EXIT_TRANSITION_COMPLETE, null); - mResultReceiver = null; // done talking - ViewGroup decorView = getDecor(); - if (!mIsReturning && decorView != null) { - decorView.suppressLayout(false); + if (!mExitNotified && mExitComplete) { + mExitNotified = true; + mResultReceiver.send(MSG_EXIT_TRANSITION_COMPLETE, null); + mResultReceiver = null; // done talking + ViewGroup decorView = getDecor(); + if (!mIsReturning && decorView != null) { + decorView.suppressLayout(false); + } + finishIfNecessary(); } - finishIfNecessary(); } } diff --git a/core/java/android/app/SharedElementCallback.java b/core/java/android/app/SharedElementCallback.java index 9c70f1d25a2c..6ac24013672c 100644 --- a/core/java/android/app/SharedElementCallback.java +++ b/core/java/android/app/SharedElementCallback.java @@ -221,42 +221,4 @@ public abstract class SharedElementCallback { } return view; } - - /** - * Called during an Activity Transition when the shared elements have arrived at the - * final location and are ready to be transferred. This method is called for both the - * source and destination Activities. - * <p> - * When the shared elements are ready to be transferred, - * {@link OnSharedElementsReadyListener#onSharedElementsReady()} - * must be called to trigger the transfer. - * <p> - * The default behavior is to trigger the transfer immediately. - * - * @param sharedElementNames The names of the shared elements that are being transferred.. - * @param sharedElements The shared elements that are part of the View hierarchy. - * @param listener The listener to call when the shared elements are ready to be hidden - * in the source Activity or shown in the destination Activity. - */ - public void onSharedElementsArrived(List<String> sharedElementNames, - List<View> sharedElements, OnSharedElementsReadyListener listener) { - listener.onSharedElementsReady(); - } - - /** - * Listener to be called after {@link - * SharedElementCallback#onSharedElementsArrived(OnSharedElementsReadyListener)} - * when the shared elements are ready to be hidden in the source Activity and shown in the - * destination Activity. - */ - public interface OnSharedElementsReadyListener { - - /** - * Call this method during or after the OnSharedElementsReadyListener has been received - * in {@link SharedElementCallback#onSharedElementsArrived(OnSharedElementsReadyListener)} - * to indicate that the shared elements are ready to be hidden in the source and shown - * in the destination Activity. - */ - void onSharedElementsReady(); - } } diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java index 9151a162aeed..8b7930590126 100644 --- a/core/java/android/app/backup/BackupManager.java +++ b/core/java/android/app/backup/BackupManager.java @@ -339,4 +339,30 @@ public class BackupManager { } } } + + /** + * Ask the framework which dataset, if any, the given package's data would be + * restored from if we were to install it right now. + * + * <p>Callers must hold the android.permission.BACKUP permission to use this method. + * + * @param packageName The name of the package whose most-suitable dataset we + * wish to look up + * @return The dataset token from which a restore should be attempted, or zero if + * no suitable data is available. + * + * @hide + */ + @SystemApi + public long getAvailableRestoreToken(String packageName) { + checkServiceBinder(); + if (sService != null) { + try { + return sService.getAvailableRestoreToken(packageName); + } catch (RemoteException e) { + Log.e(TAG, "getAvailableRestoreToken() couldn't connect"); + } + } + return 0; + } } diff --git a/core/java/android/app/backup/IBackupManager.aidl b/core/java/android/app/backup/IBackupManager.aidl index 8f36dc473ff1..87e4ef120730 100644 --- a/core/java/android/app/backup/IBackupManager.aidl +++ b/core/java/android/app/backup/IBackupManager.aidl @@ -313,4 +313,17 @@ interface IBackupManager { * is being queried. */ boolean isBackupServiceActive(int whichUser); + + /** + * Ask the framework which dataset, if any, the given package's data would be + * restored from if we were to install it right now. + * + * <p>Callers must hold the android.permission.BACKUP permission to use this method. + * + * @param packageName The name of the package whose most-suitable dataset we + * wish to look up + * @return The dataset token from which a restore should be attempted, or zero if + * no suitable data is available. + */ + long getAvailableRestoreToken(String packageName); } diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java index 36bce0bdbdee..f951dc2d0629 100644 --- a/core/java/android/widget/ActionMenuPresenter.java +++ b/core/java/android/widget/ActionMenuPresenter.java @@ -397,7 +397,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter public void updateMenuView(boolean cleared) { final ViewGroup menuViewParent = (ViewGroup) ((View) mMenuView).getParent(); if (menuViewParent != null) { - setupItemAnimations(); +// setupItemAnimations(); ActionBarTransition.beginDelayedTransition(menuViewParent); } super.updateMenuView(cleared); diff --git a/core/java/com/android/internal/logging/MetricsConstants.java b/core/java/com/android/internal/logging/MetricsConstants.java index e5cba8415110..ee225a192a24 100644 --- a/core/java/com/android/internal/logging/MetricsConstants.java +++ b/core/java/com/android/internal/logging/MetricsConstants.java @@ -32,9 +32,16 @@ public interface MetricsConstants { public static final int ACCOUNTS_ACCOUNT_SYNC = 9; public static final int ACCOUNTS_CHOOSE_ACCOUNT_ACTIVITY = 10; public static final int ACCOUNTS_MANAGE_ACCOUNTS = 11; + public static final int ACTION_WIFI_ADD_NETWORK = 134; + public static final int ACTION_WIFI_CONNECT = 135; + public static final int ACTION_WIFI_FORCE_SCAN = 136; + public static final int ACTION_WIFI_FORGET = 137; + public static final int ACTION_WIFI_OFF = 138; + public static final int ACTION_WIFI_ON = 139; public static final int APN = 12; public static final int APN_EDITOR = 13; public static final int APPLICATION = 16; + public static final int APPLICATIONS_ADVANCED = 130; public static final int APPLICATIONS_APP_LAUNCH = 17; public static final int APPLICATIONS_APP_PERMISSION = 18; public static final int APPLICATIONS_APP_STORAGE = 19; @@ -85,8 +92,13 @@ public interface MetricsConstants { public static final int INPUTMETHOD_USER_DICTIONARY_ADD_WORD = 62; public static final int LOCATION = 63; public static final int LOCATION_MODE = 64; + public static final int LOCATION_SCANNING = 131; public static final int MAIN_SETTINGS = 1; public static final int MANAGE_APPLICATIONS = 65; + public static final int MANAGE_APPLICATIONS_ALL = 132; + public static final int MANAGE_APPLICATIONS_NOTIFICATIONS = 133; + public static final int MANAGE_DOMAIN_URLS = 143; + public static final int MANAGE_PERMISSIONS = 140; public static final int MASTER_CLEAR = 66; public static final int MASTER_CLEAR_CONFIRM = 67; public static final int NET_DATA_USAGE_METERED = 68; @@ -94,10 +106,15 @@ public interface MetricsConstants { public static final int NFC_PAYMENT = 70; public static final int NOTIFICATION = 71; public static final int NOTIFICATION_APP_NOTIFICATION = 72; + public static final int NOTIFICATION_ITEM = 128; + public static final int NOTIFICATION_ITEM_ACTION = 129; public static final int NOTIFICATION_OTHER_SOUND = 73; + public static final int NOTIFICATION_PANEL = 127; public static final int NOTIFICATION_REDACTION = 74; public static final int NOTIFICATION_STATION = 75; public static final int NOTIFICATION_ZEN_MODE = 76; + public static final int NOTIFICATION_ZEN_MODE_AUTOMATION = 142; + public static final int NOTIFICATION_ZEN_MODE_PRIORITY = 141; public static final int OWNER_INFO = 77; public static final int PRINT_JOB_SETTINGS = 78; public static final int PRINT_SERVICE_SETTINGS = 79; @@ -132,7 +149,6 @@ public interface MetricsConstants { public static final int TRUST_AGENT = 91; public static final int TTS_ENGINE_SETTINGS = 93; public static final int TTS_TEXT_TO_SPEECH = 94; - public static final int TYPE_UNKNOWN = 0; public static final int USAGE_ACCESS = 95; public static final int USER = 96; public static final int USERS_APP_RESTRICTIONS = 97; diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java index 103854320997..0d5db775cac3 100644 --- a/core/java/com/android/internal/logging/MetricsLogger.java +++ b/core/java/com/android/internal/logging/MetricsLogger.java @@ -26,23 +26,7 @@ import android.os.Build; */ public class MetricsLogger implements MetricsConstants { // These constants are temporary, they should migrate to MetricsConstants. - public static final int APPLICATIONS_ADVANCED = 132; - public static final int LOCATION_SCANNING = 133; - public static final int MANAGE_APPLICATIONS_ALL = 134; - public static final int MANAGE_APPLICATIONS_NOTIFICATIONS = 135; - - public static final int ACTION_WIFI_ADD_NETWORK = 136; - public static final int ACTION_WIFI_CONNECT = 137; - public static final int ACTION_WIFI_FORCE_SCAN = 138; - public static final int ACTION_WIFI_FORGET = 139; - public static final int ACTION_WIFI_OFF = 140; - public static final int ACTION_WIFI_ON = 141; - - public static final int MANAGE_PERMISSIONS = 142; - public static final int NOTIFICATION_ZEN_MODE_PRIORITY = 143; - public static final int NOTIFICATION_ZEN_MODE_AUTOMATION = 144; - - public static final int MANAGE_DOMAIN_URLS = 143; + // next value is 144; public static void visible(Context context, int category) throws IllegalArgumentException { if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) { diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 50a0d166eeb4..2654a259927b 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -379,11 +379,11 @@ <dimen name="text_handle_min_size">40dp</dimen> <!-- Lighting and shadow properties --> - <dimen name="light_y">-200dp</dimen> - <dimen name="light_z">800dp</dimen> - <dimen name="light_radius">600dp</dimen> - <item type="dimen" format="float" name="ambient_shadow_alpha">0.075</item> - <item type="dimen" format="float" name="spot_shadow_alpha">0.15</item> + <dimen name="light_y">0dp</dimen> + <dimen name="light_z">600dp</dimen> + <dimen name="light_radius">800dp</dimen> + <item type="dimen" format="float" name="ambient_shadow_alpha">0.039</item> + <item type="dimen" format="float" name="spot_shadow_alpha">0.19</item> <!-- Floating toolbar dimensions --> <dimen name="floating_toolbar_height">48dp</dimen> diff --git a/docs/html/google/play-services/setup.jd b/docs/html/google/play-services/setup.jd index e75235e78aec..70e71078714e 100644 --- a/docs/html/google/play-services/setup.jd +++ b/docs/html/google/play-services/setup.jd @@ -9,7 +9,7 @@ page.title=Setting Up Google Play Services <h2>In this document</h2> <ol> <li><a href="#Setup">Add Google Play Services to Your Project</a></li> - <li><a href="#Proguard">Create a Proguard Exception</a></li> + <li><a href="#Proguard">Create a ProGuard Exception</a></li> <li><a href="#ensure">Ensure Devices Have the Google Play services APK</a></li> </ol> @@ -195,6 +195,17 @@ you include an API that does have a separate library.)</p> </tr> </table> +<p class="note"><strong>Note:</strong> ProGuard directives are included in the Play services +client libraries to preserve the required classes. The +<a href="{@docRoot}tools/building/plugin-for-gradle.html">Android Plugin for Gradle</a> +automatically appends ProGuard configuration files in an AAR (Android ARchive) package and appends +that package to your ProGuard configuration. During project creation, Android Studio automatically +creates the ProGuard configuration files and <code>build.gradle</code> properties for ProGuard use. +To use ProGuard with Android Studio, you must enable the ProGuard setting in your +<code>build.gradle</code> <code>buildTypes</code>. For more information, see the +<a href="{@docRoot}tools/help/proguard.html">ProGuard</a> topic. </p> + + </div><!-- end studio --> <div class="select-ide eclipse"> @@ -230,6 +241,33 @@ element: you can begin developing features with the <a href="{@docRoot}reference/gms-packages.html">Google Play services APIs</a>.</p> + +<h2 id="Proguard">Create a ProGuard Exception</h2> + +<p>To prevent <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> from stripping away +required classes, add the following lines in the +<code><project_directory>/proguard-project.txt</code> file: +<pre> +-keep class * extends java.util.ListResourceBundle { + protected Object[][] getContents(); +} + +-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { + public static final *** NULL; +} + +-keepnames @com.google.android.gms.common.annotation.KeepName class * +-keepclassmembernames class * { + @com.google.android.gms.common.annotation.KeepName *; +} + +-keepnames class * implements android.os.Parcelable { + public static final ** CREATOR; +} +</pre> + + + </div><!-- end eclipse --> <div class="select-ide other"> @@ -263,8 +301,6 @@ workspace—you should not reference the library directly from the Android S you can begin developing features with the <a href="{@docRoot}reference/gms-packages.html">Google Play services APIs</a>.</p> -</div><!-- end other --> - <h2 id="Proguard">Create a Proguard Exception</h2> @@ -290,11 +326,9 @@ required classes, add the following lines in the } </pre> -<p class="note"><strong>Note:</strong> When using Android Studio, you must add Proguard -to your <code>build.gradle</code> file's build types. For more information, see the -<a href="http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Running-ProGuard" ->Gradle Plugin User Guide</a>. -</ol> + +</div><!-- end other --> + <h2 id="ensure">Ensure Devices Have the Google Play services APK</h2> diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index a2f71e5e30f2..78eee37528c1 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -211,7 +211,11 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { updateLayerFromTypedArray(layer, a); a.recycle(); - if (layer.mDrawable == null) { + // If the layer doesn't have a drawable or unresolved theme + // attribute for a drawable, attempt to parse one from the child + // element. + if (layer.mDrawable == null && (layer.mThemeAttrs == null || + layer.mThemeAttrs[R.styleable.LayerDrawableItem_drawable] == 0)) { while ((type = parser.next()) == XmlPullParser.TEXT) { } if (type != XmlPullParser.START_TAG) { diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h index a5776a4b029c..da70e9b608eb 100644 --- a/include/androidfw/ResourceTypes.h +++ b/include/androidfw/ResourceTypes.h @@ -112,7 +112,7 @@ struct __assertChar16Size { * * The PNG chunk type is "npTc". */ -struct Res_png_9patch +struct alignas(uintptr_t) Res_png_9patch { Res_png_9patch() : wasDeserialized(false), xDivsOffset(0), yDivsOffset(0), colorsOffset(0) { } diff --git a/keystore/java/android/security/AndroidKeyStoreProvider.java b/keystore/java/android/security/AndroidKeyStoreProvider.java index 635b2fa94b09..43f3b30fa4fb 100644 --- a/keystore/java/android/security/AndroidKeyStoreProvider.java +++ b/keystore/java/android/security/AndroidKeyStoreProvider.java @@ -64,6 +64,7 @@ public class AndroidKeyStoreProvider extends Provider { putSecretKeyFactoryImpl("HmacSHA512"); // 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"); diff --git a/keystore/java/android/security/KeyStoreKeyConstraints.java b/keystore/java/android/security/KeyStoreKeyConstraints.java index d0f02a7e6ec8..e61092f1bef1 100644 --- a/keystore/java/android/security/KeyStoreKeyConstraints.java +++ b/keystore/java/android/security/KeyStoreKeyConstraints.java @@ -123,7 +123,7 @@ public abstract class KeyStoreKeyConstraints { } @Retention(RetentionPolicy.SOURCE) - @IntDef({Algorithm.AES, Algorithm.HMAC}) + @IntDef({Algorithm.AES, Algorithm.HMAC, Algorithm.RSA, Algorithm.EC}) public @interface AlgorithmEnum {} /** @@ -135,12 +135,22 @@ public abstract class KeyStoreKeyConstraints { /** * Key algorithm: AES. */ - public static final int AES = 0; + public static final int AES = 1 << 0; /** * Key algorithm: HMAC. */ - public static final int HMAC = 1; + public static final int HMAC = 1 << 1; + + /** + * Key algorithm: RSA. + */ + public static final int RSA = 1 << 2; + + /** + * Key algorithm: EC. + */ + public static final int EC = 1 << 3; /** * @hide @@ -151,6 +161,10 @@ public abstract class KeyStoreKeyConstraints { return KeymasterDefs.KM_ALGORITHM_AES; case HMAC: return KeymasterDefs.KM_ALGORITHM_HMAC; + case RSA: + return KeymasterDefs.KM_ALGORITHM_RSA; + case EC: + return KeymasterDefs.KM_ALGORITHM_ECDSA; default: throw new IllegalArgumentException("Unknown algorithm: " + algorithm); } @@ -165,6 +179,10 @@ public abstract class KeyStoreKeyConstraints { return AES; case KeymasterDefs.KM_ALGORITHM_HMAC: return HMAC; + case KeymasterDefs.KM_ALGORITHM_RSA: + return RSA; + case KeymasterDefs.KM_ALGORITHM_ECDSA: + return EC; default: throw new IllegalArgumentException("Unknown algorithm: " + algorithm); } @@ -179,6 +197,10 @@ public abstract class KeyStoreKeyConstraints { return "AES"; case HMAC: return "HMAC"; + case RSA: + return "RSA"; + case EC: + return "EC"; default: throw new IllegalArgumentException("Unknown algorithm: " + algorithm); } @@ -213,8 +235,18 @@ public abstract class KeyStoreKeyConstraints { throw new IllegalArgumentException("HMAC digest not specified"); } switch (digest) { + case Digest.MD5: + return "HmacMD5"; + case Digest.SHA1: + return "HmacSHA1"; + case Digest.SHA224: + return "HmacSHA224"; case Digest.SHA256: return "HmacSHA256"; + case Digest.SHA384: + return "HmacSHA384"; + case Digest.SHA512: + return "HmacSHA512"; default: throw new IllegalArgumentException( "Unsupported HMAC digest: " + digest); @@ -223,11 +255,32 @@ public abstract class KeyStoreKeyConstraints { throw new IllegalArgumentException("Unsupported key algorithm: " + algorithm); } } + + /** + * @hide + */ + public static String toJCAKeyPairAlgorithm(@AlgorithmEnum int algorithm) { + switch (algorithm) { + case RSA: + return "RSA"; + case EC: + return "EC"; + default: + throw new IllegalArgumentException("Unsupported key alorithm: " + algorithm); + } + } } @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, - value = {Padding.NONE, Padding.PKCS7}) + value = { + Padding.NONE, + Padding.PKCS7, + Padding.RSA_PKCS1_ENCRYPTION, + Padding.RSA_PKCS1_SIGNATURE, + Padding.RSA_OAEP, + Padding.RSA_PSS, + }) public @interface PaddingEnum {} /** @@ -247,6 +300,26 @@ public abstract class KeyStoreKeyConstraints { public static final int PKCS7 = 1 << 1; /** + * RSA PKCS#1 v1.5 padding for encryption/decryption. + */ + public static final int RSA_PKCS1_ENCRYPTION = 1 << 2; + + /** + * RSA PKCS#1 v1.5 padding for signatures. + */ + public static final int RSA_PKCS1_SIGNATURE = 1 << 3; + + /** + * RSA Optimal Asymmetric Encryption Padding (OAEP). + */ + public static final int RSA_OAEP = 1 << 4; + + /** + * RSA PKCS#1 v2.1 Probabilistic Signature Scheme (PSS) padding. + */ + public static final int RSA_PSS = 1 << 5; + + /** * @hide */ public static int toKeymaster(int padding) { @@ -255,6 +328,14 @@ public abstract class KeyStoreKeyConstraints { return KeymasterDefs.KM_PAD_NONE; case PKCS7: return KeymasterDefs.KM_PAD_PKCS7; + case RSA_PKCS1_ENCRYPTION: + return KeymasterDefs.KM_PAD_RSA_PKCS1_1_5_ENCRYPT; + case RSA_PKCS1_SIGNATURE: + return KeymasterDefs.KM_PAD_RSA_PKCS1_1_5_SIGN; + case RSA_OAEP: + return KeymasterDefs.KM_PAD_RSA_OAEP; + case RSA_PSS: + return KeymasterDefs.KM_PAD_RSA_PSS; default: throw new IllegalArgumentException("Unknown padding: " + padding); } @@ -269,6 +350,14 @@ public abstract class KeyStoreKeyConstraints { return NONE; case KeymasterDefs.KM_PAD_PKCS7: return PKCS7; + case KeymasterDefs.KM_PAD_RSA_PKCS1_1_5_ENCRYPT: + return RSA_PKCS1_ENCRYPTION; + case KeymasterDefs.KM_PAD_RSA_PKCS1_1_5_SIGN: + return RSA_PKCS1_SIGNATURE; + case KeymasterDefs.KM_PAD_RSA_OAEP: + return RSA_OAEP; + case KeymasterDefs.KM_PAD_RSA_PSS: + return RSA_PSS; default: throw new IllegalArgumentException("Unknown padding: " + padding); } @@ -283,6 +372,14 @@ public abstract class KeyStoreKeyConstraints { return "NONE"; case PKCS7: return "PKCS#7"; + case RSA_PKCS1_ENCRYPTION: + return "RSA PKCS#1 (encryption)"; + case RSA_PKCS1_SIGNATURE: + return "RSA PKCS#1 (signature)"; + case RSA_OAEP: + return "RSA OAEP"; + case RSA_PSS: + return "RSA PSS"; default: throw new IllegalArgumentException("Unknown padding: " + padding); } @@ -291,12 +388,18 @@ public abstract class KeyStoreKeyConstraints { /** * @hide */ - public static @PaddingEnum int fromJCAPadding(String padding) { + public static @PaddingEnum int fromJCACipherPadding(String padding) { String paddingLower = padding.toLowerCase(Locale.US); if ("nopadding".equals(paddingLower)) { return NONE; } else if ("pkcs7padding".equals(paddingLower)) { return PKCS7; + } else if ("pkcs1padding".equals(paddingLower)) { + return RSA_PKCS1_ENCRYPTION; + } else if (("oaeppadding".equals(paddingLower)) + || ((paddingLower.startsWith("oaepwith")) + && (paddingLower.endsWith("padding")))) { + return RSA_OAEP; } else { throw new IllegalArgumentException("Unknown padding: " + padding); } diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp index 0a210d6927dc..a4100a2d44fb 100644 --- a/libs/hwui/AmbientShadow.cpp +++ b/libs/hwui/AmbientShadow.cpp @@ -45,8 +45,9 @@ /** * Other constants: */ -// For the edge of the penumbra, the opacity is 0. -#define OUTER_OPACITY (0.0f) +// For the edge of the penumbra, the opacity is 0. After transform (1 - alpha), +// it is 1. +#define TRANSFORMED_OUTER_OPACITY (1.0f) // Once the alpha difference is greater than this threshold, we will allocate extra // edge vertices. @@ -83,11 +84,13 @@ inline float getAlphaFromFactoredZ(float factoredZ) { return 1.0 / (1 + MathUtils::max(factoredZ, 0.0f)); } +// The shader is using gaussian function e^-(1-x)*(1-x)*4, therefore, we transform +// the alpha value to (1 - alpha) inline float getTransformedAlphaFromAlpha(float alpha) { - return acosf(1.0f - 2.0f * alpha); + return 1.0f - alpha; } -// The output is ranged from 0 to M_PI. +// The output is ranged from 0 to 1. inline float getTransformedAlphaFromFactoredZ(float factoredZ) { return getTransformedAlphaFromAlpha(getAlphaFromFactoredZ(factoredZ)); } @@ -249,7 +252,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque, indexBuffer[indexBufferIndex++] = vertexBufferIndex; indexBuffer[indexBufferIndex++] = currentInnerVertexIndex; AlphaVertex::set(&shadowVertices[vertexBufferIndex++], outerVertex.x, - outerVertex.y, OUTER_OPACITY); + outerVertex.y, TRANSFORMED_OUTER_OPACITY); if (j == 0) { outerStart = outerVertex; @@ -285,7 +288,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque, (outerLast * startWeight + outerNext * k) / extraVerticesNumber; indexBuffer[indexBufferIndex++] = vertexBufferIndex; AlphaVertex::set(&shadowVertices[vertexBufferIndex++], currentOuter.x, - currentOuter.y, OUTER_OPACITY); + currentOuter.y, TRANSFORMED_OUTER_OPACITY); if (!isCasterOpaque) { umbraVertices[umbraIndex++] = vertexBufferIndex; diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp index e9b22e20bc18..41adda15f367 100644 --- a/libs/hwui/ProgramCache.cpp +++ b/libs/hwui/ProgramCache.cpp @@ -240,8 +240,9 @@ const char* gFS_Main_ModulateColor = const char* gFS_Main_ApplyVertexAlphaLinearInterp = " fragColor *= alpha;\n"; const char* gFS_Main_ApplyVertexAlphaShadowInterp = - " fragColor *= (1.0 - cos(alpha)) / 2.0;\n"; - + // Use a gaussian function for the shadow fall off. Note that alpha here + // is actually (1.0 - alpha) for saving computation. + " fragColor *= exp(- alpha * alpha * 4.0) - 0.018;\n"; const char* gFS_Main_FetchTexture[2] = { // Don't modulate " fragColor = texture2D(baseSampler, outTexCoords);\n", diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp index b3b06d672dc7..db3c2d9a5060 100644 --- a/libs/hwui/SpotShadow.cpp +++ b/libs/hwui/SpotShadow.cpp @@ -44,6 +44,9 @@ // For each RADIANS_DIVISOR, we would allocate one more vertex b/t the normals. #define SPOT_CORNER_RADIANS_DIVISOR (M_PI / SPOT_EXTRA_CORNER_VERTEX_PER_PI) +// For performance, we use (1 - alpha) value for the shader input. +#define TRANSFORMED_PENUMBRA_ALPHA 1.0f +#define TRANSFORMED_UMBRA_ALPHA 0.0f #include <math.h> #include <stdlib.h> @@ -964,11 +967,11 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength // Fill the IB and VB for the penumbra area. for (int i = 0; i < newPenumbraLength; i++) { AlphaVertex::set(&shadowVertices[vertexBufferIndex++], newPenumbra[i].x, - newPenumbra[i].y, 0.0f); + newPenumbra[i].y, TRANSFORMED_PENUMBRA_ALPHA); } for (int i = 0; i < umbraLength; i++) { AlphaVertex::set(&shadowVertices[vertexBufferIndex++], umbra[i].x, umbra[i].y, - M_PI); + TRANSFORMED_UMBRA_ALPHA); } for (int i = 0; i < verticesPairIndex; i++) { @@ -1008,14 +1011,14 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength indexBuffer[indexBufferIndex++] = newPenumbraLength + i; indexBuffer[indexBufferIndex++] = vertexBufferIndex; AlphaVertex::set(&shadowVertices[vertexBufferIndex++], - closerVertex.x, closerVertex.y, M_PI); + closerVertex.x, closerVertex.y, TRANSFORMED_UMBRA_ALPHA); } } else { // If there is no occluded umbra at all, then draw the triangle fan // starting from the centroid to all umbra vertices. int lastCentroidIndex = vertexBufferIndex; AlphaVertex::set(&shadowVertices[vertexBufferIndex++], centroid.x, - centroid.y, M_PI); + centroid.y, TRANSFORMED_UMBRA_ALPHA); for (int i = 0; i < umbraLength; i++) { indexBuffer[indexBufferIndex++] = newPenumbraLength + i; indexBuffer[indexBufferIndex++] = lastCentroidIndex; diff --git a/packages/StatementService/Android.mk b/packages/StatementService/Android.mk index f0adb1cd1ca8..470d824a1868 100644 --- a/packages/StatementService/Android.mk +++ b/packages/StatementService/Android.mk @@ -24,6 +24,8 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_PACKAGE_NAME := StatementService LOCAL_PRIVILEGED_MODULE := true +LOCAL_JAVA_LIBRARIES += org.apache.http.legacy + LOCAL_STATIC_JAVA_LIBRARIES := \ libprotobuf-java-nano \ volley diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 96840a2703eb..1bed4f37d1f3 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -2209,7 +2209,10 @@ public class BackupManagerService { // Get the restore-set token for the best-available restore set for this package: // the active set if possible, else the ancestral one. Returns zero if none available. - long getAvailableRestoreToken(String packageName) { + public long getAvailableRestoreToken(String packageName) { + mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, + "getAvailableRestoreToken"); + long token = mAncestralToken; synchronized (mQueueLock) { if (mEverStoredApps.contains(packageName)) { diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java index 99bbdae6e7d7..5859c6a223d0 100644 --- a/services/backup/java/com/android/server/backup/Trampoline.java +++ b/services/backup/java/com/android/server/backup/Trampoline.java @@ -317,6 +317,12 @@ public class Trampoline extends IBackupManager.Stub { } @Override + public long getAvailableRestoreToken(String packageName) { + BackupManagerService svc = mService; + return (svc != null) ? svc.getAvailableRestoreToken(packageName) : 0; + } + + @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 59008fd335be..dadc872b2229 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4010,7 +4010,8 @@ public class PackageManagerService extends IPackageManager.Stub { if (ps != null) { // Try to get the status from User settings first int status = getDomainVerificationStatusLPr(ps, userId); - if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) { + if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS || + status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED) { result.add(info); } else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) { neverList.add(info); diff --git a/tests/Compatibility/Android.mk b/tests/Compatibility/Android.mk index 0ec4d9d5d77e..c2f89ddc7619 100644 --- a/tests/Compatibility/Android.mk +++ b/tests/Compatibility/Android.mk @@ -25,7 +25,7 @@ LOCAL_SRC_FILES := \ LOCAL_PACKAGE_NAME := AppCompatibilityTest - +LOCAL_CERTIFICATE := platform include $(BUILD_PACKAGE) include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/Compatibility/AndroidManifest.xml b/tests/Compatibility/AndroidManifest.xml index 28845328eb24..8ae5bc516050 100644 --- a/tests/Compatibility/AndroidManifest.xml +++ b/tests/Compatibility/AndroidManifest.xml @@ -19,7 +19,7 @@ <application > <uses-library android:name="android.test.runner" /> </application> - + <uses-permission android:name="android.permission.REAL_GET_TASKS" /> <instrumentation android:name=".AppCompatibilityRunner" android:targetPackage="com.android.compatibilitytest" |