Skip to content

Commit f460cbe

Browse files
author
AWS
committed
AWS SDK for Android 2.6.7
1 parent f37b085 commit f460cbe

File tree

85 files changed

+1983
-520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1983
-520
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Change Log - AWS SDK for Android
22

3+
## [Release 2.6.7](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.6.7)
4+
5+
### New Features
6+
7+
- **AWS MobileClient**
8+
- Added `AWSMobileClient` to initialize the SDK and create instances of other SDK clients. Currently support is limited to `SignInUI`. AWSMobileClient creates the `AWSConfiguration` based on `awsconfiguration.json`, fetches the Cognito Identity and registers the SignIn providers with the permissions based on the `AWSConfiguration`.
9+
10+
### Enhancements
11+
12+
- **Amazon Polly**
13+
- Added support for new voices - `Aditi` and `Seoyeon`.
14+
- Added support for new language code - `ko-KR`.
15+
16+
- **Amazon Pinpoint**
17+
- Added support for notification channel on Android SDK 26 (Oreo).
18+
- On Android SDK 23 (Marshmallow) and newer devices, the large icon is not set if it is not present from the push payload and a small icon is set in the push payload. This allows setting only the small icon from the campaign in the Pinpoint console.
19+
- On Android SDK 23 and newer devices, if the small icon is set in a format that is an opaque color image, it is now converted to greyscale to prevent displaying a grey box. Small icons in the correct format of opaque white with a transparent background will still render appropriately.
20+
21+
### Bug Fixes:
22+
23+
- **General**
24+
- Fixed domain returned for `cn-north-1` region and region parsing for `amazonaws.com.cn` domains. See [pr #362](https://github.com/aws/aws-sdk-android/pull/362).
25+
26+
- **AWS IoT**
27+
- Increased default time to keep alive to 300 seconds.
28+
329
## [Release 2.6.6](https://github.com/aws/aws-sdk-android/releases/tag/release_v2.6.6)
430

531
### Bug Fixes:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,4 @@ If you are using a Mac, you may run into issues when trying to compile, because
278278

279279
## To learn more about Android Development
280280

281-
For more information on Android development, see the Android developer site at: [developer.android.com](http://developer.android.com/index.html)
281+
For more information on Android development, see the Android developer site at: [developer.android.com](http://developer.android.com/index.html)

aws-android-sdk-apigateway-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
<parent>
1313
<groupId>com.amazonaws</groupId>
1414
<artifactId>aws-android-sdk-pom</artifactId>
15-
<version>2.6.6</version>
15+
<version>2.6.7</version>
1616
</parent>
1717

1818
<dependencies>
1919
<dependency>
2020
<groupId>com.amazonaws</groupId>
2121
<artifactId>aws-android-sdk-core</artifactId>
2222
<optional>false</optional>
23-
<version>2.6.6</version>
23+
<version>2.6.7</version>
2424
</dependency>
2525
</dependencies>
2626

aws-android-sdk-auth-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<parent>
2222
<groupId>com.amazonaws</groupId>
2323
<artifactId>aws-android-sdk-pom</artifactId>
24-
<version>2.6.6</version>
24+
<version>2.6.7</version>
2525
</parent>
2626

2727
<dependencies>
2828
<dependency>
2929
<groupId>com.amazonaws</groupId>
3030
<artifactId>aws-android-sdk-core</artifactId>
3131
<optional>false</optional>
32-
<version>2.6.6</version>
32+
<version>2.6.7</version>
3333
</dependency>
3434

3535
<dependency>

aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/DefaultSignInResultHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/**
2929
* A default base class easing the work required for implementing the SignInResultHandler for
30-
* {@link IdentityManager#setUpToAuthenticate(Context, SignInResultHandler)} by providing default
30+
* {@link IdentityManager#login(Context, SignInResultHandler)} by providing default
3131
* behavior in the case that the user cancels signing in or encounters an error. The default for
3232
* canceling is to toast that sign-in was canceled. The default for a sign-in error is to show
3333
* an alert dialog specifying the error message.

aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/IdentityManager.java

Lines changed: 90 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Amazon.com, Inc. or its affiliates.
2+
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates.
33
* All Rights Reserved.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,8 +25,6 @@
2525
import com.amazonaws.ClientConfiguration;
2626
import com.amazonaws.SDKGlobalConfiguration;
2727

28-
import com.amazonaws.mobile.config.AWSConfiguration;
29-
3028
import com.amazonaws.auth.AWSBasicCognitoIdentityProvider;
3129
import com.amazonaws.auth.AWSCredentials;
3230
import com.amazonaws.auth.AWSCredentialsProvider;
@@ -39,11 +37,14 @@
3937
import com.amazonaws.mobile.auth.core.signin.SignInProvider;
4038
import com.amazonaws.mobile.auth.core.signin.SignInProviderResultHandler;
4139
import com.amazonaws.mobile.auth.core.internal.util.ThreadUtils;
40+
import com.amazonaws.mobile.config.AWSConfiguration;
4241

4342
import com.amazonaws.regions.Region;
4443
import com.amazonaws.regions.Regions;
4544

4645
import java.io.IOException;
46+
import java.lang.reflect.Method;
47+
import java.util.Arrays;
4748
import java.util.Collection;
4849
import java.util.Date;
4950
import java.util.HashMap;
@@ -55,6 +56,8 @@
5556
import java.util.concurrent.ExecutorService;
5657
import java.util.concurrent.Executors;
5758

59+
import org.json.JSONArray;
60+
5861
/**
5962
* The identity manager keeps track of the current sign-in provider and is responsible
6063
* for caching credentials.
@@ -169,6 +172,16 @@ public String refresh() {
169172
}
170173
}
171174

175+
/**
176+
* @param context the application context.
177+
*/
178+
public IdentityManager(final Context context) {
179+
this.appContext = context.getApplicationContext();
180+
this.awsConfiguration = null;
181+
this.clientConfiguration = null;
182+
this.credentialsProviderHolder = null;
183+
}
184+
172185
/**
173186
* Constructor.
174187
* Initializes with the application context and the AWSConfiguration passed in.
@@ -253,14 +266,22 @@ public static void setDefaultIdentityManager(IdentityManager identityManager) {
253266
}
254267

255268
/**
256-
* Retrieve the AWSConfiguration object
269+
* Retrieve the AWSConfiguration object that represents the `awsconfiguration.json`.
257270
*
258271
* @return AWSConfiguration Return the reference to the AWSConfiguration object
259272
*/
260273
public AWSConfiguration getConfiguration() {
261274
return this.awsConfiguration;
262275
}
263276

277+
/**
278+
* Set the AWSConfiguration.
279+
* @param configuration
280+
*/
281+
public void setConfiguration(AWSConfiguration configuration) {
282+
this.awsConfiguration = configuration;
283+
}
284+
264285
/**
265286
* Check if the credentials are expired.
266287
*
@@ -589,26 +610,8 @@ public void run() {
589610
private void handleUnauthenticated(final Activity callingActivity,
590611
final StartupAuthResultHandler startupAuthResultHandler,
591612
final AuthException ex) {
592-
// Optional Sign-in can dispose the sign-in manager right away here, while mandatory sign-in, needs
593-
// it to stay around a bit longer, since it will be required to call sign-in or sign-up.
594-
595613
SignInManager.dispose();
596614

597-
if (getCachedUserID() != null) {
598-
handleStartupAuthResult(callingActivity, startupAuthResultHandler, ex, null);
599-
}
600-
601-
getUserID(new IdentityHandler() {
602-
@Override
603-
public void onIdentityId(final String identityId) {
604-
handleStartupAuthResult(callingActivity, startupAuthResultHandler, ex, null);
605-
}
606-
607-
@Override
608-
public void handleError(final Exception exception) {
609-
handleStartupAuthResult(callingActivity, startupAuthResultHandler, ex, exception);
610-
}
611-
});
612615
handleStartupAuthResult(callingActivity, startupAuthResultHandler, ex, null);
613616
}
614617

@@ -643,10 +646,12 @@ public void run() {
643646
* @param startupAuthResultHandler a handler for returning results.
644647
* @param minimumDelay the minimum delay to wait before returning the sign-in result.
645648
*/
646-
public void doStartupAuth(final Activity callingActivity,
649+
public void resumeSession(final Activity callingActivity,
647650
final StartupAuthResultHandler startupAuthResultHandler,
648651
final long minimumDelay) {
649652

653+
Log.d(LOG_TAG, "Resume session called.");
654+
650655
executorService.submit(new Runnable() {
651656
public void run() {
652657
Log.d(LOG_TAG, "Starting up authentication...");
@@ -732,9 +737,44 @@ public void onError(final IdentityProvider provider, final Exception ex) {
732737
* @param callingActivity the calling activity.
733738
* @param startupAuthResultHandler a handler for returning results.
734739
*/
735-
public void doStartupAuth(final Activity callingActivity,
740+
public void resumeSession(final Activity callingActivity,
741+
final StartupAuthResultHandler startupAuthResultHandler) {
742+
resumeSession(callingActivity, startupAuthResultHandler, 0);
743+
}
744+
745+
/**
746+
* This should be called from your app's splash activity upon start-up. If the user was previously
747+
* signed in, this will attempt to refresh their identity using the previously sign-ed in provider.
748+
* If the user was not previously signed in or their identity could not be refreshed with the
749+
* previously signed in provider and sign-in is optional, it will attempt to obtain an unauthenticated (guest)
750+
* identity.
751+
*
752+
* @param callingActivity the calling activity.
753+
* @param startupAuthResultHandler a handler for returning results.
754+
* @deprecated Please use {@link #resumeSession(Activity, StartupAuthResultHandler)} method instead.
755+
*/
756+
@Deprecated
757+
public void doStartUpAuth(final Activity callingActivity,
736758
final StartupAuthResultHandler startupAuthResultHandler) {
737-
doStartupAuth(callingActivity, startupAuthResultHandler, 0);
759+
resumeSession(callingActivity, startupAuthResultHandler, 0);
760+
}
761+
762+
/**
763+
* This should be called from your app's splash activity upon start-up. If the user was previously
764+
* signed in, this will attempt to refresh their identity using the previously sign-ed in provider.
765+
* If the user was not previously signed in or their identity could not be refreshed with the
766+
* previously signed in provider and sign-in is optional, it will attempt to obtain an unauthenticated (guest)
767+
* identity.
768+
*
769+
* @param callingActivity the calling activity.
770+
* @param startupAuthResultHandler a handler for returning results.
771+
* @deprecated Please use {@link #resumeSession(Activity, StartupAuthResultHandler, long)} method instead.
772+
*/
773+
@Deprecated
774+
public void doStartUpAuth(final Activity callingActivity,
775+
final StartupAuthResultHandler startupAuthResultHandler,
776+
final long minimumDelay) {
777+
resumeSession(callingActivity, startupAuthResultHandler, minimumDelay);
738778
}
739779

740780
/**
@@ -751,13 +791,34 @@ public void expireSignInTimeout() {
751791
*
752792
* @param context context.
753793
* @param signInResultHandler the results handler.
794+
* @deprecated Please use {@link #login(Context, SignInResultHandler)} method instead.
754795
*/
796+
@Deprecated
755797
public void setUpToAuthenticate(final Context context,
756798
final SignInResultHandler signInResultHandler) {
757-
// Start the sign-in activity. We do not finish the calling activity allowing the user to navigate back.
758-
final SignInManager signInManager = SignInManager.getInstance(
759-
context.getApplicationContext());
760-
signInManager.setResultHandler(signInResultHandler);
799+
this.login(context, signInResultHandler);
800+
}
801+
802+
/**
803+
* Call login to initiate sign-in with a provider.
804+
*
805+
* Note: This should not be called when already signed in with a provider.
806+
*
807+
* @param context context.
808+
* @param signInResultHandler the results handler.
809+
*/
810+
public void login(final Context context,
811+
final SignInResultHandler signInResultHandler) {
812+
// Start the sign-in activity.
813+
// We do not finish the calling activity allowing the user to navigate back.
814+
try {
815+
SignInManager
816+
.getInstance(context.getApplicationContext())
817+
.setResultHandler(signInResultHandler);
818+
} catch (final Exception exception) {
819+
Log.e(LOG_TAG, "Error in instantiating SignInManager. " +
820+
"Check the context and completion handler.", exception);
821+
}
761822
}
762823

763824
private void setCredentialsProvider(final Context context,

aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/StartupAuthResult.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
package com.amazonaws.mobile.auth.core;
1919

2020
/**
21-
* The result for IdentityManager's doStartupAuth().
21+
* Callback function result for calling
22+
* {@link IdentityManager#resumeSession(Activity, StartupAuthResultHandler, long)}.
2223
*/
2324
public class StartupAuthResult {
2425
private final IdentityManager identityManager;
2526
private final StartupAuthErrorDetails errors;
2627

2728
public StartupAuthResult(final IdentityManager identityManager,
28-
final StartupAuthErrorDetails startupAuthErrorDetails) {
29+
final StartupAuthErrorDetails startupAuthErrorDetails) {
2930
this.identityManager = identityManager;
3031
this.errors = startupAuthErrorDetails;
3132
}
@@ -41,13 +42,13 @@ public boolean isUserSignedIn() {
4142
* @return true if an unauthenticated (guest) identity was obtained, otherwise false.
4243
*/
4344
public boolean isUserAnonymous() {
44-
return didObtainIdentity() && !isUserSignedIn();
45+
return isIdentityIdAvailable() && !isUserSignedIn();
4546
}
4647

4748
/**
4849
* @return true if an identity was obtained, either unauthenticated (guest) or authenticated with a provider.
4950
*/
50-
private boolean didObtainIdentity() {
51+
public boolean isIdentityIdAvailable() {
5152
return identityManager.getCachedUserID() != null;
5253
}
5354

aws-android-sdk-auth-core/src/main/java/com/amazonaws/mobile/auth/core/StartupAuthResultHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
package com.amazonaws.mobile.auth.core;
1919

2020
/**
21-
* Interface for calling IdentityManager's doStartupAuth().
21+
* Callback function for calling
22+
* {@link IdentityManager#resumeSession(Activity, StartupAuthResultHandler, long)}.
2223
*/
2324
public interface StartupAuthResultHandler {
2425
/**

0 commit comments

Comments
 (0)