From 04a8494ccc32914e1041d52829169168bb8dd91d Mon Sep 17 00:00:00 2001 From: AWS Date: Fri, 15 Sep 2017 00:38:59 +0000 Subject: [PATCH] AWS SDK for Android 2.6.1 --- CHANGELOG.md | 11 ++ aws-android-sdk-apigateway-core/pom.xml | 4 +- aws-android-sdk-auth-core/pom.xml | 19 +-- .../src/main/AndroidManifest.xml | 8 +- .../auth/core/DefaultSignInResultHandler.java | 2 +- .../auth/core/signin/SignInManager.java | 1 - .../signin/ui/SplitBackgroundDrawable.java | 6 +- .../core/signin/ui/buttons/SignInButton.java | 13 +- aws-android-sdk-auth-facebook/pom.xml | 8 +- .../src/main/AndroidManifest.xml | 22 ++- .../mobile/auth/facebook/FacebookButton.java | 28 +++- .../src/main/res/values/config.xml | 14 ++ aws-android-sdk-auth-google/pom.xml | 8 +- .../src/main/AndroidManifest.xml | 10 +- .../mobile/auth/google/GoogleButton.java | 36 +++-- aws-android-sdk-auth-ui/pom.xml | 25 +--- .../src/main/AndroidManifest.xml | 9 +- .../mobile/auth/ui/AuthUIConfiguration.java | 7 +- .../mobile/auth/ui/SignInActivity.java | 9 +- .../amazonaws/mobile/auth/ui/SignInView.java | 26 ++-- aws-android-sdk-auth-userpools/pom.xml | 9 +- .../src/main/AndroidManifest.xml | 2 +- aws-android-sdk-autoscaling/pom.xml | 4 +- aws-android-sdk-cloudwatch/pom.xml | 4 +- aws-android-sdk-cognito/pom.xml | 6 +- ...azonaws.aws-android-sdk-cognito.properties | 2 +- aws-android-sdk-cognitoauth/pom.xml | 5 +- .../pom.xml | 6 +- aws-android-sdk-core/pom.xml | 2 +- .../com/amazonaws/util/VersionInfoUtils.java | 2 +- ....amazonaws.aws-android-sdk-core.properties | 2 +- .../amazonaws/util/VersionInfoUtilsTest.java | 2 +- aws-android-sdk-ddb-document/pom.xml | 6 +- aws-android-sdk-ddb-mapper/pom.xml | 8 +- aws-android-sdk-ddb/pom.xml | 4 +- aws-android-sdk-ec2/pom.xml | 4 +- aws-android-sdk-elb/pom.xml | 4 +- aws-android-sdk-iot/pom.xml | 4 +- aws-android-sdk-kinesis/pom.xml | 4 +- aws-android-sdk-kms/pom.xml | 4 +- aws-android-sdk-lambda/pom.xml | 4 +- aws-android-sdk-lex/pom.xml | 5 +- aws-android-sdk-logs/pom.xml | 4 +- aws-android-sdk-machinelearning/pom.xml | 4 +- aws-android-sdk-mobileanalytics/pom.xml | 4 +- aws-android-sdk-pinpoint/pom.xml | 4 +- .../notification/NotificationClient.java | 139 +++++++++++++++++- .../notification/NotificationClientTest.java | 68 +++++++++ aws-android-sdk-polly/pom.xml | 4 +- aws-android-sdk-rekognition/pom.xml | 4 +- aws-android-sdk-s3/pom.xml | 6 +- aws-android-sdk-sdb/pom.xml | 4 +- aws-android-sdk-ses/pom.xml | 4 +- aws-android-sdk-sns/pom.xml | 6 +- aws-android-sdk-sqs/pom.xml | 4 +- pom.xml | 2 +- 56 files changed, 409 insertions(+), 207 deletions(-) create mode 100644 aws-android-sdk-auth-facebook/src/main/res/values/config.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 6929f83bcd..28cc182970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log - AWS SDK for Android +## [Release 2.6.1](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.6.1) + +### Bug Fixes: + +- **AWS Auth SDK** + - Fixed border and shadow for Facebook and Google SignIn buttons. + - Fixed the Android Support Package dependencies of the different auth clients. The Android Support Packages support-v4 and appcompat-v7 of all the auth clients now have the same version 23.0.1 and are optional dependencies. Apps consuming the auth clients will now declare the appcompat-v7 and support-v4 dependencies in the gradle manually. + +- **Amazon Pinpoint** + - Notification icon handling has been improved. By default, when the Notification icon uses the app icon, the icon will now be shown in color on Apps targeting SDK version 21 or greater. This will be achieved by setting the large icon to the app icon and generating the small icon by converting the app icon image to gray scale. For Apps targeting SDK version below 21, the behavior remains the same and the color icon is shown. + ## [Release 2.6.0](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.6.0) ### New Features: diff --git a/aws-android-sdk-apigateway-core/pom.xml b/aws-android-sdk-apigateway-core/pom.xml index 6331ad326e..2695eb824f 100644 --- a/aws-android-sdk-apigateway-core/pom.xml +++ b/aws-android-sdk-apigateway-core/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-auth-core/pom.xml b/aws-android-sdk-auth-core/pom.xml index 0a88ad4ef2..6e3fbbfffa 100644 --- a/aws-android-sdk-auth-core/pom.xml +++ b/aws-android-sdk-auth-core/pom.xml @@ -21,22 +21,15 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 - - - android-support - file://${env.ANDROID_HOME}/extras/android/m2repository/ - - - com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 @@ -45,14 +38,6 @@ 4.1.1.4 provided - - - com.android.support - support-v4 - 24.2.0 - aar - provided - diff --git a/aws-android-sdk-auth-core/src/main/AndroidManifest.xml b/aws-android-sdk-auth-core/src/main/AndroidManifest.xml index d0d3b575f7..41124dc455 100644 --- a/aws-android-sdk-auth-core/src/main/AndroidManifest.xml +++ b/aws-android-sdk-auth-core/src/main/AndroidManifest.xml @@ -1,9 +1,5 @@ - + - diff --git a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/DefaultSignInResultHandler.java b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/DefaultSignInResultHandler.java index eb4a3166c6..1642287a28 100644 --- a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/DefaultSignInResultHandler.java +++ b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/DefaultSignInResultHandler.java @@ -27,7 +27,7 @@ /** * A default base class easing the work required for implementing the SignInResultHandler for - * {@link IdentityManager#signInOrSignUp(Context, SignInResultHandler)} by providing default + * {@link IdentityManager#setUpToAuthenticate(Context, SignInResultHandler)} by providing default * behavior in the case that the user cancels signing in or encounters an error. The default for * canceling is to toast that sign-in was canceled. The default for a sign-in error is to show * an alert dialog specifying the error message. diff --git a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/SignInManager.java b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/SignInManager.java index 9a4086fff1..dcae45052d 100644 --- a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/SignInManager.java +++ b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/SignInManager.java @@ -20,7 +20,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.support.annotation.NonNull; import android.util.SparseArray; import android.view.View; diff --git a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/SplitBackgroundDrawable.java b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/SplitBackgroundDrawable.java index 6c453c86bc..c02a9e25f3 100644 --- a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/SplitBackgroundDrawable.java +++ b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/SplitBackgroundDrawable.java @@ -24,8 +24,6 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; /** * Provides drawable for a vertically split background. @@ -54,7 +52,7 @@ public void setSplitPointDistanceFromTop(int distanceFromTop) { } @Override - public void draw(@NonNull final Canvas canvas) { + public void draw(final Canvas canvas) { final Rect b = getBounds(); paint.setColor(this.topBackgroundColor); float y = distanceFromTopToSplitPoint < b.height() ? distanceFromTopToSplitPoint : b.height(); @@ -69,7 +67,7 @@ public void setAlpha(final int alpha) { } @Override - public void setColorFilter(@Nullable final ColorFilter colorFilter) { + public void setColorFilter(final ColorFilter colorFilter) { } @Override diff --git a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/buttons/SignInButton.java b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/buttons/SignInButton.java index e0aa132741..bf00a9179c 100644 --- a/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/buttons/SignInButton.java +++ b/aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/signin/ui/buttons/SignInButton.java @@ -29,7 +29,6 @@ import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.StateListDrawable; -import android.support.annotation.Nullable; import android.text.TextPaint; import android.text.method.TransformationMethod; import android.util.AttributeSet; @@ -85,7 +84,7 @@ public class SignInButton extends LinearLayout { /** Boolean to keep track of whether the button should only display the image and no text. */ protected boolean isSmallStyle = false; - public SignInButton(final Context context, @Nullable final AttributeSet attrs, + public SignInButton(final Context context, final AttributeSet attrs, final int defStyleAttr, final SignInButtonAttributes buttonAttributes) { super(context, attrs, defStyleAttr); this.attributes = buttonAttributes; @@ -167,19 +166,11 @@ private Drawable getButtonBackground(final int buttonFaceColor) { attributes.getBottomShadowColor(), attributes.getBottomShadowColor()}); outerShadowBottomDrawable.setCornerRadius(dp(cornerRadius)); - final GradientDrawable border = new GradientDrawable(); - border.setColor(BORDER_COLOR); - border.setCornerRadius(dp(cornerRadius)); - final LayerDrawable layerDrawable = new LayerDrawable( - new Drawable[] {border, - outerShadowTopDrawable, + new Drawable[] {outerShadowTopDrawable, outerShadowBottomDrawable, insetBackgroundDrawable}); - // Border for the button. - layerDrawable.setLayerInset(0, 0, 0, 0, 0); - // Top shadow is the furthest down drawable, so it is ok if this overlaps the bottom shadow. layerDrawable.setLayerInset(1, 0, 0, 0, 0); diff --git a/aws-android-sdk-auth-facebook/pom.xml b/aws-android-sdk-auth-facebook/pom.xml index 036648f7d9..d308c06d80 100644 --- a/aws-android-sdk-auth-facebook/pom.xml +++ b/aws-android-sdk-auth-facebook/pom.xml @@ -21,7 +21,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -36,7 +36,7 @@ com.amazonaws aws-android-sdk-auth-core false - 2.6.0 + 2.6.1 aar @@ -65,9 +65,9 @@ com.android.support support-v4 - 21.0.0 + 23.0.1 aar - false + true diff --git a/aws-android-sdk-auth-facebook/src/main/AndroidManifest.xml b/aws-android-sdk-auth-facebook/src/main/AndroidManifest.xml index 29bf920341..2965cd08cd 100644 --- a/aws-android-sdk-auth-facebook/src/main/AndroidManifest.xml +++ b/aws-android-sdk-auth-facebook/src/main/AndroidManifest.xml @@ -1,13 +1,31 @@ - + + + + + + + + + + + + + + diff --git a/aws-android-sdk-auth-facebook/src/main/java/com/amazonaws/mobile/auth/facebook/FacebookButton.java b/aws-android-sdk-auth-facebook/src/main/java/com/amazonaws/mobile/auth/facebook/FacebookButton.java index 8049a73ee1..67f74dedda 100644 --- a/aws-android-sdk-auth-facebook/src/main/java/com/amazonaws/mobile/auth/facebook/FacebookButton.java +++ b/aws-android-sdk-auth-facebook/src/main/java/com/amazonaws/mobile/auth/facebook/FacebookButton.java @@ -49,6 +49,15 @@ public class FacebookButton extends SignInButton { /** Button background color when pressed. */ private static final int FB_BACKGROUND_COLOR_PRESSED = 0xFF2D4570; + /** Button top shadow color. */ + private static final int BUTTON_TOP_SHADOW_COLOR = 0xFFCCCCCC; + + /** Button top shadow thickness in pixels. */ + private static final int BUTTON_TOP_SHADOW_THICKNESS = (int) dp(1); + + /** Button bottom shadow thickness in pixels. */ + private static final int BUTTON_BOTTOM_SHADOW_THICKNESS = (int) dp(2); + /** * Constructor. * @param context context. @@ -77,13 +86,16 @@ public FacebookButton(@NonNull final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr, - new SignInButtonAttributes() - .withCornerRadius(CORNER_RADIUS) - .withBackgroundColor(FB_BACKGROUND_COLOR) - .withBackgroundColorPressed(FB_BACKGROUND_COLOR_PRESSED) - .withTextColor(Color.WHITE) - .withDefaultTextResourceId(R.string.default_facebook_button_text) - .withImageIconResourceId(R.drawable.facebook_icon) + new SignInButtonAttributes() + .withCornerRadius(CORNER_RADIUS) + .withBackgroundColor(FB_BACKGROUND_COLOR) + .withBackgroundColorPressed(FB_BACKGROUND_COLOR_PRESSED) + .withTextColor(Color.WHITE) + .withDefaultTextResourceId(R.string.default_facebook_button_text) + .withImageIconResourceId(R.drawable.facebook_icon) + .withTopShadowColor(BUTTON_TOP_SHADOW_COLOR) + .withTopShadowThickness(BUTTON_TOP_SHADOW_THICKNESS) + .withBottomShadowThickness(BUTTON_BOTTOM_SHADOW_THICKNESS) ); @@ -97,7 +109,7 @@ public FacebookButton(@NonNull final Context context, } catch (Exception exception) { exception.printStackTrace(); Log.e(LOG_TAG, "Cannot initialize the SignInButton. Please check if IdentityManager : " - + " startUpAuth and setUpToAuthenticate are invoked"); + + " startUpAuth and setUpToAuthenticate are invoked"); } } } diff --git a/aws-android-sdk-auth-facebook/src/main/res/values/config.xml b/aws-android-sdk-auth-facebook/src/main/res/values/config.xml new file mode 100644 index 0000000000..8b106a4ed5 --- /dev/null +++ b/aws-android-sdk-auth-facebook/src/main/res/values/config.xml @@ -0,0 +1,14 @@ + + + + + YOUR-FACEBOOK-APPLICATION-ID + + + fbYOUR-FACEBOOK-APPLICATION-ID + diff --git a/aws-android-sdk-auth-google/pom.xml b/aws-android-sdk-auth-google/pom.xml index b543280a98..e147a1b98d 100644 --- a/aws-android-sdk-auth-google/pom.xml +++ b/aws-android-sdk-auth-google/pom.xml @@ -21,7 +21,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -40,7 +40,7 @@ com.amazonaws aws-android-sdk-auth-core false - 2.6.0 + 2.6.1 aar @@ -54,8 +54,8 @@ com.android.support support-v4 - 24.2.0 - false + 23.0.1 + true aar diff --git a/aws-android-sdk-auth-google/src/main/AndroidManifest.xml b/aws-android-sdk-auth-google/src/main/AndroidManifest.xml index 1950a7dc0e..cc1623ea01 100644 --- a/aws-android-sdk-auth-google/src/main/AndroidManifest.xml +++ b/aws-android-sdk-auth-google/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ @@ -9,7 +10,10 @@ - - + + + + diff --git a/aws-android-sdk-auth-google/src/main/java/com/amazonaws/mobile/auth/google/GoogleButton.java b/aws-android-sdk-auth-google/src/main/java/com/amazonaws/mobile/auth/google/GoogleButton.java index 71e4573368..febdac4fee 100644 --- a/aws-android-sdk-auth-google/src/main/java/com/amazonaws/mobile/auth/google/GoogleButton.java +++ b/aws-android-sdk-auth-google/src/main/java/com/amazonaws/mobile/auth/google/GoogleButton.java @@ -39,7 +39,7 @@ public class GoogleButton extends SignInButton { private static final String LOG_TAG = GoogleButton.class.getSimpleName(); /** Button corner radius. */ - private static final int CORNER_RADIUS = dp(4); + private static final int CORNER_RADIUS = 4; /** Button background color. */ private static final int GOOGLE_BACKGROUND_COLOR = Color.WHITE; @@ -50,11 +50,14 @@ public class GoogleButton extends SignInButton { /** Text Color. */ private static final int TEXT_COLOR = Color.DKGRAY; + /** Button top shadow color. */ + private static final int BUTTON_TOP_SHADOW_COLOR = 0xFFCCCCCC; + /** Button top shadow thickness in pixels. */ - private static final int BUTTON_TOP_SHADOW_THICKNESS = (int) dp(3); - + private static final int BUTTON_TOP_SHADOW_THICKNESS = (int) dp(1); + /** Button bottom shadow thickness in pixels. */ - private static final int BUTTON_BOTTOM_SHADOW_THICKNESS = (int) dp(3); + private static final int BUTTON_BOTTOM_SHADOW_THICKNESS = (int) dp(2); /** * Constructor. @@ -84,15 +87,16 @@ public GoogleButton(@NonNull final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr, - new SignInButtonAttributes() - .withCornerRadius(CORNER_RADIUS) - .withBackgroundColor(GOOGLE_BACKGROUND_COLOR) - .withBackgroundColorPressed(GOOGLE_BACKGROUND_COLOR_PRESSED) - .withTextColor(TEXT_COLOR) - .withDefaultTextResourceId(R.string.default_google_button_text) - .withImageIconResourceId(R.drawable.google_icon) - .withTopShadowThickness(BUTTON_TOP_SHADOW_THICKNESS) - .withBottomShadowThickness(BUTTON_BOTTOM_SHADOW_THICKNESS) + new SignInButtonAttributes() + .withCornerRadius(CORNER_RADIUS) + .withBackgroundColor(GOOGLE_BACKGROUND_COLOR) + .withBackgroundColorPressed(GOOGLE_BACKGROUND_COLOR_PRESSED) + .withTextColor(TEXT_COLOR) + .withDefaultTextResourceId(R.string.default_google_button_text) + .withImageIconResourceId(R.drawable.google_icon) + .withTopShadowColor(BUTTON_TOP_SHADOW_COLOR) + .withTopShadowThickness(BUTTON_TOP_SHADOW_THICKNESS) + .withBottomShadowThickness(BUTTON_BOTTOM_SHADOW_THICKNESS) ); if (isInEditMode()) { @@ -103,9 +107,9 @@ public GoogleButton(@NonNull final Context context, final SignInManager signInManager = SignInManager.getInstance(); signInManager.initializeSignInButton(GoogleSignInProvider.class, this); } catch (Exception exception) { - exception.printStackTrace(); - Log.e(LOG_TAG, "Cannot initialize the SignInButton. Please check if IdentityManager :" - + " startUpAuth and setUpToAuthenticate are invoked"); + exception.printStackTrace(); + Log.e(LOG_TAG, "Cannot initialize the SignInButton. Please check if IdentityManager :" + + " startUpAuth and setUpToAuthenticate are invoked"); } } diff --git a/aws-android-sdk-auth-ui/pom.xml b/aws-android-sdk-auth-ui/pom.xml index afd91e17b7..35871bcc4a 100644 --- a/aws-android-sdk-auth-ui/pom.xml +++ b/aws-android-sdk-auth-ui/pom.xml @@ -21,7 +21,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -36,28 +36,28 @@ com.amazonaws aws-android-sdk-auth-core false - 2.6.0 + 2.6.1 aar com.amazonaws aws-android-sdk-auth-google true - 2.6.0 + 2.6.1 aar com.amazonaws aws-android-sdk-auth-facebook true - 2.6.0 + 2.6.1 aar com.amazonaws aws-android-sdk-auth-userpools true - 2.6.0 + 2.6.1 aar @@ -66,22 +66,11 @@ 4.1.1.4 provided - - com.android.support - support-v4 - 23.0.0 - aar - com.android.support appcompat-v7 - 23.0.0 - aar - - - com.android.support - cardview-v7 - 23.0.0 + true + 23.0.1 aar diff --git a/aws-android-sdk-auth-ui/src/main/AndroidManifest.xml b/aws-android-sdk-auth-ui/src/main/AndroidManifest.xml index 69bb55f53a..6661118ad6 100644 --- a/aws-android-sdk-auth-ui/src/main/AndroidManifest.xml +++ b/aws-android-sdk-auth-ui/src/main/AndroidManifest.xml @@ -3,13 +3,10 @@ - - - + + - + signInButton) { + public Builder signInButton(final Class signInButton) { ArrayList> signInButtonList; if (configuration.get(CONFIG_KEY_SIGN_IN_BUTTONS) == null) { signInButtonList = new ArrayList>(); diff --git a/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInActivity.java b/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInActivity.java index 97b0a187f3..62d90c5ac7 100644 --- a/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInActivity.java +++ b/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInActivity.java @@ -20,7 +20,6 @@ import android.content.Intent; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; @@ -124,8 +123,8 @@ protected void onResume() { @Override public void onRequestPermissionsResult(final int requestCode, - @NonNull final String[] permissions, - @NonNull final int[] grantResults) { + final String[] permissions, + final int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); signInManager.handleRequestPermissionsResult(requestCode, permissions, grantResults); } @@ -154,7 +153,7 @@ public void onBackPressed() { * @param context The context from which the SignInActivity will be started * @param config Reference to AuthUIConfiguration object */ - public static void startSignInActivity(@NonNull final Context context, + public static void startSignInActivity(final Context context, final AuthUIConfiguration config) { try { String uuid = UUID.randomUUID().toString(); @@ -178,7 +177,7 @@ public static void startSignInActivity(@NonNull final Context context, * * @param context The context from which the SignInActivity will be started */ - public static void startSignInActivity(@NonNull final Context context) { + public static void startSignInActivity(final Context context) { try { Intent intent = new Intent(context, SignInActivity.class); context.startActivity(intent); diff --git a/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInView.java b/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInView.java index d1fd9add12..918484e830 100644 --- a/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInView.java +++ b/aws-android-sdk-auth-ui/src/main/java/com/amazonaws/mobile/auth/ui/SignInView.java @@ -21,8 +21,6 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -58,7 +56,7 @@ public class SignInView extends LinearLayout { private static final int IMAGE_LAYOUT_MARGINS = dp(10); /** String that represents the SDK Version. */ - private static final String SDK_VERSION = "2.6.0"; + private static final String SDK_VERSION = "2.6.1"; /** Common Prefix of the namespaces of different SignIn providers. */ private static final String NAMESPACE_COMMON_PREFIX = "com.amazonaws.mobile.auth"; @@ -145,7 +143,7 @@ public class SignInView extends LinearLayout { * Consructor. * @param context Activity Context */ - public SignInView(@NonNull final Context context) { + public SignInView(final Context context) { this(context, null); } @@ -154,8 +152,8 @@ public SignInView(@NonNull final Context context) { * @param context Activity Context * @param attrs Attribute Set */ - public SignInView(@NonNull final Context context, - @Nullable final AttributeSet attrs) { + public SignInView(final Context context, + final AttributeSet attrs) { this(context, attrs, 0); } @@ -203,7 +201,7 @@ private void setUpSplitBackgroundDrawable() { * Sets up the image view that displays the logo image. * @param context The activity context. */ - private void setUpImageView(@NonNull final Context context) { + private void setUpImageView(final Context context) { /** * ImageView that holds the logo image. */ @@ -225,7 +223,7 @@ private void setUpImageView(@NonNull final Context context) { * Sets up the UserPools UI with the Email and Password FormView. * @param context The activity context. */ - private void setUpUserPools(@NonNull final Context context) { + private void setUpUserPools(final Context context) { /** * Use Reflection for UserPoolSignIn dependency. */ @@ -245,7 +243,7 @@ private void setUpUserPools(@NonNull final Context context) { * Sets up the divider that divides the UserPools UI and the SignInButtons. * @param context The activity context. */ - private void setUpDivider(@NonNull final Context context) { + private void setUpDivider(final Context context) { /** * Create "--or sign in with--" divider if userpools is configured. * Else create "--sign in with--" divider. @@ -262,7 +260,7 @@ private void setUpDivider(@NonNull final Context context) { * Sets up the SignIn Buttons. * @param context The activity context. */ - private void setUpSignInButtons(@NonNull final Context context) { + private void setUpSignInButtons(final Context context) { /** * Get the height, width and margins for the sign in buttons. */ @@ -293,8 +291,8 @@ private void setUpSignInButtons(@NonNull final Context context) { * @param attrs Attribute Set * @param defStyleAttr Default Style Attribute */ - public SignInView(@NonNull final Context context, - @Nullable final AttributeSet attrs, + public SignInView(final Context context, + final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr); @@ -469,7 +467,7 @@ private Object invokeReflectedMethod(final String className, * @param context The activity context. * @return AuthUIConfiguration The configuration object passed in by the application. */ - private AuthUIConfiguration getConfiguration(@NonNull final Context context) { + private AuthUIConfiguration getConfiguration(final Context context) { try { Intent intent = ((Activity) context).getIntent(); String uuid = (String)(intent.getSerializableExtra(CONFIGURATION_KEY)); @@ -503,7 +501,7 @@ private void purgeConfigurationStoreEntry(final String uuid) { * Add SignInButtons to the view. * @param context The activity context. */ - private void addSignInButtonsToView(@NonNull final Context context) { + private void addSignInButtonsToView(final Context context) { try { if (this.config != null) { ArrayList> signInButtons = this.config.getSignInButtons(); diff --git a/aws-android-sdk-auth-userpools/pom.xml b/aws-android-sdk-auth-userpools/pom.xml index 660f19b27d..d59867b128 100644 --- a/aws-android-sdk-auth-userpools/pom.xml +++ b/aws-android-sdk-auth-userpools/pom.xml @@ -21,7 +21,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -36,14 +36,14 @@ com.amazonaws aws-android-sdk-cognitoidentityprovider false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-auth-core false - 2.6.0 + 2.6.1 aar @@ -57,7 +57,8 @@ com.android.support support-v4 - 24.2.0 + true + 23.0.1 aar diff --git a/aws-android-sdk-auth-userpools/src/main/AndroidManifest.xml b/aws-android-sdk-auth-userpools/src/main/AndroidManifest.xml index 0037533195..eb0689c521 100644 --- a/aws-android-sdk-auth-userpools/src/main/AndroidManifest.xml +++ b/aws-android-sdk-auth-userpools/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ - + com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-cloudwatch/pom.xml b/aws-android-sdk-cloudwatch/pom.xml index 6e59112149..98a205aadb 100644 --- a/aws-android-sdk-cloudwatch/pom.xml +++ b/aws-android-sdk-cloudwatch/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-cognito/pom.xml b/aws-android-sdk-cognito/pom.xml index bc393ab1ea..885188586c 100644 --- a/aws-android-sdk-cognito/pom.xml +++ b/aws-android-sdk-cognito/pom.xml @@ -6,14 +6,14 @@ aws-android-sdk-cognito jar AWS SDK for Android - Amazon Cognito Sync - 2.6.0 + 2.6.1 The AWS Android SDK for Amazon Cognito Sync module holds the client classes that are used for communicating with Amazon Cognito Sync Service http://aws.amazon.com/sdkforandroid com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -29,7 +29,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.google.android diff --git a/aws-android-sdk-cognito/src/main/resources/fabric/com.amazonaws.aws-android-sdk-cognito.properties b/aws-android-sdk-cognito/src/main/resources/fabric/com.amazonaws.aws-android-sdk-cognito.properties index 4ed4284741..be74ff88ea 100644 --- a/aws-android-sdk-cognito/src/main/resources/fabric/com.amazonaws.aws-android-sdk-cognito.properties +++ b/aws-android-sdk-cognito/src/main/resources/fabric/com.amazonaws.aws-android-sdk-cognito.properties @@ -1,3 +1,3 @@ fabric-identifier=com.amazonaws.aws-android-sdk-cognito -fabric-version=2.6.0 +fabric-version=2.6.1 fabric-build-type=binary diff --git a/aws-android-sdk-cognitoauth/pom.xml b/aws-android-sdk-cognitoauth/pom.xml index d01a9dcdfe..821d96e9d1 100644 --- a/aws-android-sdk-cognitoauth/pom.xml +++ b/aws-android-sdk-cognitoauth/pom.xml @@ -6,14 +6,14 @@ aws-android-sdk-cognitoauth aar AWS SDK for Android - Amazon Cognito Auth - 2.6.0 + 2.6.1 The AWS Android SDK with app integration for Amazon Cognito Your User Pools Service http://aws.amazon.com/sdkforandroid com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -56,7 +56,6 @@ 15 - 19.1.0 diff --git a/aws-android-sdk-cognitoidentityprovider/pom.xml b/aws-android-sdk-cognitoidentityprovider/pom.xml index 55b9209c22..b84ee7980f 100644 --- a/aws-android-sdk-cognitoidentityprovider/pom.xml +++ b/aws-android-sdk-cognitoidentityprovider/pom.xml @@ -6,14 +6,14 @@ aws-android-sdk-cognitoidentityprovider jar AWS SDK for Android - Amazon Cognito Identity Provider - 2.6.0 + 2.6.1 The AWS Android SDK for Amazon Cognito Identity Provider module holds the client classes that are used for communicating with Amazon Cognito Identity Provider Service http://aws.amazon.com/sdkforandroid com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -29,7 +29,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.google.android diff --git a/aws-android-sdk-core/pom.xml b/aws-android-sdk-core/pom.xml index 54f2ead744..f61a7d0c21 100644 --- a/aws-android-sdk-core/pom.xml +++ b/aws-android-sdk-core/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java b/aws-android-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java index ef021ec3fd..2f8f4ba101 100644 --- a/aws-android-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java +++ b/aws-android-sdk-core/src/main/java/com/amazonaws/util/VersionInfoUtils.java @@ -26,7 +26,7 @@ public class VersionInfoUtils { private static final int DEFAULT_STRING_LENGTH = 128; /** SDK version info */ - private static volatile String version = "2.6.0"; + private static volatile String version = "2.6.1"; // changed build // logic diff --git a/aws-android-sdk-core/src/main/resources/fabric/com.amazonaws.aws-android-sdk-core.properties b/aws-android-sdk-core/src/main/resources/fabric/com.amazonaws.aws-android-sdk-core.properties index 6b0f25dc2c..36b2c93a3d 100644 --- a/aws-android-sdk-core/src/main/resources/fabric/com.amazonaws.aws-android-sdk-core.properties +++ b/aws-android-sdk-core/src/main/resources/fabric/com.amazonaws.aws-android-sdk-core.properties @@ -1,3 +1,3 @@ fabric-identifier=com.amazonaws.aws-android-sdk-core -fabric-version=2.6.0 +fabric-version=2.6.1 fabric-build-type=binary diff --git a/aws-android-sdk-core/src/test/java/com/amazonaws/util/VersionInfoUtilsTest.java b/aws-android-sdk-core/src/test/java/com/amazonaws/util/VersionInfoUtilsTest.java index 5fc0ef0227..a79c35ebd8 100644 --- a/aws-android-sdk-core/src/test/java/com/amazonaws/util/VersionInfoUtilsTest.java +++ b/aws-android-sdk-core/src/test/java/com/amazonaws/util/VersionInfoUtilsTest.java @@ -24,7 +24,7 @@ public class VersionInfoUtilsTest { @Test public void getVersion() { - assertEquals("2.6.0", VersionInfoUtils.getVersion()); + assertEquals("2.6.1", VersionInfoUtils.getVersion()); } @Test diff --git a/aws-android-sdk-ddb-document/pom.xml b/aws-android-sdk-ddb-document/pom.xml index 5230511192..927a63393f 100644 --- a/aws-android-sdk-ddb-document/pom.xml +++ b/aws-android-sdk-ddb-document/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,13 +20,13 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-ddb false - 2.6.0 + 2.6.1 com.google.guava diff --git a/aws-android-sdk-ddb-mapper/pom.xml b/aws-android-sdk-ddb-mapper/pom.xml index 6b390bf5ce..ac96e5afbf 100644 --- a/aws-android-sdk-ddb-mapper/pom.xml +++ b/aws-android-sdk-ddb-mapper/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,19 +20,19 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-ddb false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-s3 false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-ddb/pom.xml b/aws-android-sdk-ddb/pom.xml index b37d6d9b7e..7c5c8c694a 100644 --- a/aws-android-sdk-ddb/pom.xml +++ b/aws-android-sdk-ddb/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-ec2/pom.xml b/aws-android-sdk-ec2/pom.xml index 4a4e0fdacc..db532d301e 100644 --- a/aws-android-sdk-ec2/pom.xml +++ b/aws-android-sdk-ec2/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-elb/pom.xml b/aws-android-sdk-elb/pom.xml index 8429c2054f..a4d59b46aa 100644 --- a/aws-android-sdk-elb/pom.xml +++ b/aws-android-sdk-elb/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-iot/pom.xml b/aws-android-sdk-iot/pom.xml index 1e51bfda50..c2096ebc44 100644 --- a/aws-android-sdk-iot/pom.xml +++ b/aws-android-sdk-iot/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 org.eclipse.paho diff --git a/aws-android-sdk-kinesis/pom.xml b/aws-android-sdk-kinesis/pom.xml index fed498c7cd..fd492cd34f 100644 --- a/aws-android-sdk-kinesis/pom.xml +++ b/aws-android-sdk-kinesis/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-kms/pom.xml b/aws-android-sdk-kms/pom.xml index 239524dae3..85ec4bf10d 100644 --- a/aws-android-sdk-kms/pom.xml +++ b/aws-android-sdk-kms/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-lambda/pom.xml b/aws-android-sdk-lambda/pom.xml index 2b26f1c865..f061dd0c57 100644 --- a/aws-android-sdk-lambda/pom.xml +++ b/aws-android-sdk-lambda/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-lex/pom.xml b/aws-android-sdk-lex/pom.xml index fef14e330d..ba5367a9fb 100644 --- a/aws-android-sdk-lex/pom.xml +++ b/aws-android-sdk-lex/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -33,7 +33,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.google.android @@ -70,7 +70,6 @@ 11 - 19.1.0 ${project.basedir}/src/main/jni diff --git a/aws-android-sdk-logs/pom.xml b/aws-android-sdk-logs/pom.xml index 309e13cd41..25c16a0d53 100644 --- a/aws-android-sdk-logs/pom.xml +++ b/aws-android-sdk-logs/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-machinelearning/pom.xml b/aws-android-sdk-machinelearning/pom.xml index 578913f1da..d5dd9ccfb5 100644 --- a/aws-android-sdk-machinelearning/pom.xml +++ b/aws-android-sdk-machinelearning/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-mobileanalytics/pom.xml b/aws-android-sdk-mobileanalytics/pom.xml index 8277110a0c..20b4845010 100644 --- a/aws-android-sdk-mobileanalytics/pom.xml +++ b/aws-android-sdk-mobileanalytics/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-pinpoint/pom.xml b/aws-android-sdk-pinpoint/pom.xml index 8fd0b05514..73abe86d08 100644 --- a/aws-android-sdk-pinpoint/pom.xml +++ b/aws-android-sdk-pinpoint/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClient.java b/aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClient.java index bffcf86787..1d3e7fdf29 100644 --- a/aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClient.java +++ b/aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClient.java @@ -221,6 +221,19 @@ void addCampaignAttributesToEvent(final AnalyticsEvent pushEvent, final Map= ANDROID_LOLLIPOP) { + final Resources resources = getPackageResources(); + + if (resources != null) { + final Bitmap iconBitmap; + if (largeIconBitmap == null) { + // We have to get the iconResId as a bitmap to call setLargeIcon. + iconBitmap = BitmapFactory.decodeResource(resources, iconResId); + } else { + iconBitmap = largeIconBitmap; + } + if (iconBitmap != null) { + setLargeIconMethod.invoke(notificationBuilder, iconBitmap); + if (android.os.Build.VERSION.SDK_INT >= ANDROID_MARSHMALLOW) { + final Bitmap smallBitmap + = convertBitmapToAlphaGreyscale(iconBitmap); + setSmallIconMethod + .invoke(notificationBuilder, createWithBitmapMethod.invoke(iconClass, smallBitmap)); + } else { + setSmallIconResIdMethod.invoke(notificationBuilder, iconResId); + } + return; + } + } + } + setSmallIconResIdMethod.invoke(notificationBuilder, iconResId); + } + + private boolean buildNotificationIcons(final int iconResId, final String imageIconUrl, + final String imageSmallIconUrl, final Object notificationBuilder) { try { + boolean setLargeIcon = false; + Bitmap largeIconBitmap = null; if (imageIconUrl != null) { try { - setLargeIconMethod.invoke(notificationBuilder, new DownloadImageTask().execute(imageIconUrl).get()); + largeIconBitmap = new DownloadImageTask().execute(imageIconUrl).get(); + setLargeIconMethod.invoke(notificationBuilder, largeIconBitmap); + setLargeIcon = true; } catch (final InterruptedException e) { log.error("Interrupted when downloading image : " + e.getMessage(), e); } catch (final ExecutionException e) { @@ -320,17 +423,33 @@ private boolean buildNotificationIcons(final int iconResId, final String imageIc && android.os.Build.VERSION.SDK_INT >= ANDROID_MARSHMALLOW) { try { final Bitmap iconBitmap = new DownloadImageTask().execute(imageSmallIconUrl).get(); - setSmallIconMethod - .invoke(notificationBuilder, createWithBitmapMethod.invoke(iconClass, iconBitmap)); + if (!setLargeIcon && android.os.Build.VERSION.SDK_INT >= ANDROID_LOLLIPOP) { + setSmallIconWithFallbackToLargeIconForSDKAbove20(notificationBuilder, + false, iconResId, iconBitmap); + } else { + setSmallIconMethod.invoke(notificationBuilder, + createWithBitmapMethod.invoke(iconClass, iconBitmap)); + } } catch (final InterruptedException e) { log.error("Interrupted when downloading small icon : " + e.getMessage(), e); - setSmallIconResIdMethod.invoke(notificationBuilder, iconResId); + setSmallIconWithFallbackToLargeIconForSDKAbove20(notificationBuilder, + setLargeIcon, iconResId, null); + } catch (final ExecutionException e) { log.error("Failed execute download image small icon thread : " + e.getMessage(), e); - setSmallIconResIdMethod.invoke(notificationBuilder, iconResId); + setSmallIconWithFallbackToLargeIconForSDKAbove20(notificationBuilder, + setLargeIcon, iconResId, null); } } else { - setSmallIconResIdMethod.invoke(notificationBuilder, iconResId); + if (setLargeIcon && android.os.Build.VERSION.SDK_INT >= ANDROID_MARSHMALLOW) { + final Bitmap smallBitmap = + convertBitmapToAlphaGreyscale(largeIconBitmap); + setSmallIconMethod + .invoke(notificationBuilder, createWithBitmapMethod.invoke(iconClass, smallBitmap)); + } else { + setSmallIconWithFallbackToLargeIconForSDKAbove20(notificationBuilder, + setLargeIcon, iconResId, null); + } } return true; } catch (final InvocationTargetException ex) { @@ -444,6 +563,10 @@ private Intent notificationIntent(final Bundle pushBundle, final String campaign return notificationIntent; } + /* package */ int getNotificationRequestId(final String campaignId, final String activityId) { + return (campaignId + ":" + activityId).hashCode(); + } + private boolean displayNotification(final Bundle pushBundle, final Class targetClass, String imageUrl, String iconImageUrl, String iconSmallImageUrl, Map campaignAttributes, String intentAction) { @@ -455,7 +578,7 @@ private boolean displayNotification(final Bundle pushBundle, final Class targ final String campaignId = campaignAttributes.get(CAMPAIGN_ID_ATTRIBUTE_KEY); final String activityId = campaignAttributes.get(CAMPAIGN_ACTIVITY_ID_ATTRIBUTE_KEY); - final int requestID = (campaignId + ":" + activityId + ":" + System.currentTimeMillis()).hashCode(); + final int requestID = getNotificationRequestId(campaignId, activityId); final int iconResId = getNotificationIconResourceId(pushBundle.getString(NOTIFICATION_ICON_PUSH_KEY)); if (iconResId == 0) { diff --git a/aws-android-sdk-pinpoint/src/test/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientTest.java b/aws-android-sdk-pinpoint/src/test/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientTest.java index f1cfea5d1e..4d5da1bceb 100644 --- a/aws-android-sdk-pinpoint/src/test/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientTest.java +++ b/aws-android-sdk-pinpoint/src/test/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientTest.java @@ -16,6 +16,8 @@ package com.amazonaws.mobileconnectors.pinpoint.targeting.notification; import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Color; import com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsEvent; import com.amazonaws.mobileconnectors.pinpoint.internal.event.EventRecorder; import org.json.JSONException; @@ -41,12 +43,14 @@ import com.amazonaws.mobileconnectors.pinpoint.targeting.TargetingClient; import android.app.Service; import android.os.Bundle; +import org.robolectric.shadows.ShadowBitmap; import java.util.Map; import static junit.framework.Assert.assertTrue; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.times; @@ -300,6 +304,21 @@ public void testEmptyBundle() { assertEquals(NotificationClient.CampaignPushResult.NOT_HANDLED, result); } + @Test + public void verifyNotificationRequestIdIsTheSameForTheSameCampaignIdandActivityId() { + assertEquals(target.getNotificationRequestId("abc","123"), + target.getNotificationRequestId("abc","123")); + } + + @Test + public void verifyNotificationRequestIdIsDifferentForDifferingCampignIdOrActivityId() { + assertNotEquals(target.getNotificationRequestId("abc","123"), + target.getNotificationRequestId("abc","567")); + + assertNotEquals(target.getNotificationRequestId("abc","123"), + target.getNotificationRequestId("efg","123")); + } + @Test public void testAreAppNotificationsEnabled_returnsFalse_whenOptOutProviderReturnsTrue() { mockAppLevelOptOutProvider(true); @@ -326,4 +345,53 @@ public boolean isOptedOut() { ); } + @Test + public void testConvertBitmapToAlphaGrayscale() { + // Create a color image to be converted to grayscale; + //final Bitmap inputBitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888); + final int[] inputPixels = new int[255*255]; + + for (int x = 0; x < 255; x++) { + for (int y = 0; y < 255; y++) { + if (x < 10 || y < 10) { + // Outsides transparent. + inputPixels[y * 10 + x] = Color.TRANSPARENT; + } else { + inputPixels[y * 10 + x] = Color.argb(255, x, y, 255 - x); + } + } + } + + final Bitmap inputBitmap = Bitmap.createBitmap(inputPixels, 255, 255, Bitmap.Config.ARGB_8888); + + final Bitmap outputBitmap = NotificationClient.convertBitmapToAlphaGreyscale(inputBitmap); + // Verify the output is white with greyscale in the alpha channel. + for (int x = 0; x < 255; x++) { + for (int y = 0; y < 255; y++) { + final int pixel = outputBitmap.getPixel(x, y); + //System.out.println(String.format("x: %d y: %d a: %d r: %d g: %d b: %d", + // x, y, Color.alpha(pixel), Color.red(pixel), Color.green(pixel), Color.blue(pixel))); + if (x < 10 || y < 10) { + // Outsides transparent. + // TODO: Fix this test to use ShadowBitmap so this check can be enabled. + //assertEquals(0x00FFFFFF, outputBitmap.getPixel(x, y)); + } else { + // Pixel should not be transparent. + // TODO: Fix this test to use ShadowBitmap so this check can be enabled. + //assertNotEquals(0, Color.alpha(pixel)); + } + } + } + + // call the method again with the converted image, it should leave the bitmap unchanged. + final Bitmap dupOutput = NotificationClient.convertBitmapToAlphaGreyscale(outputBitmap); + + for (int x = 0; x < 255; x++) { + for (int y = 0; y < 255; y++) { + // TODO: Fix this test to use ShadowBitmap so this check can be enabled. + //assertEquals(outputBitmap.getPixel(x, y), dupOutput.getPixel(x, y)); + } + } + } + } diff --git a/aws-android-sdk-polly/pom.xml b/aws-android-sdk-polly/pom.xml index e2571d0e0e..6e5189ca58 100644 --- a/aws-android-sdk-polly/pom.xml +++ b/aws-android-sdk-polly/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-rekognition/pom.xml b/aws-android-sdk-rekognition/pom.xml index c99d887fc9..e6537612e5 100644 --- a/aws-android-sdk-rekognition/pom.xml +++ b/aws-android-sdk-rekognition/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-s3/pom.xml b/aws-android-sdk-s3/pom.xml index 1051fcf5d5..02f92cb259 100644 --- a/aws-android-sdk-s3/pom.xml +++ b/aws-android-sdk-s3/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,13 +20,13 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-kms false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-sdb/pom.xml b/aws-android-sdk-sdb/pom.xml index b3ee59607b..3521bccc8a 100644 --- a/aws-android-sdk-sdb/pom.xml +++ b/aws-android-sdk-sdb/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 junit diff --git a/aws-android-sdk-ses/pom.xml b/aws-android-sdk-ses/pom.xml index 9be6c6f3c5..970d1fd9e2 100644 --- a/aws-android-sdk-ses/pom.xml +++ b/aws-android-sdk-ses/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-sns/pom.xml b/aws-android-sdk-sns/pom.xml index 29599f3225..6a3f098e2d 100644 --- a/aws-android-sdk-sns/pom.xml +++ b/aws-android-sdk-sns/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,13 +20,13 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 com.amazonaws aws-android-sdk-sqs false - 2.6.0 + 2.6.1 diff --git a/aws-android-sdk-sqs/pom.xml b/aws-android-sdk-sqs/pom.xml index dded502609..4affad8764 100644 --- a/aws-android-sdk-sqs/pom.xml +++ b/aws-android-sdk-sqs/pom.xml @@ -12,7 +12,7 @@ com.amazonaws aws-android-sdk-pom - 2.6.0 + 2.6.1 @@ -20,7 +20,7 @@ com.amazonaws aws-android-sdk-core false - 2.6.0 + 2.6.1 diff --git a/pom.xml b/pom.xml index 22163eae58..d3d1d5a46e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ aws-android-sdk-pom pom AWS SDK for Android - 2.6.0 + 2.6.1 The Amazon Web Services SDK for Android provides Android APIs for building software on AWS’ cost-effective, scalable, and reliable infrastructure products. The AWS SDK for Android allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Auto Scaling, etc). http://aws.amazon.com/sdkforandroid