-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bugfixes for older versions of Android #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfixes for older versions of Android #382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments but LGTM.
@@ -106,4 +107,8 @@ public static Intent createBaseIntent( | |||
.putExtra(ExtraConstants.EXTRA_FLOW_PARAMS, | |||
checkNotNull(flowParams, "flowParams cannot be null")); | |||
} | |||
|
|||
public SmartLock getSmartLockInstance(AppCompatBase activity, String tag) { | |||
return SmartLock.getInstance(activity, tag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this method do anything besides pass through? Seems like we could just use the static method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just passes through. As you noted below, this makes shadowing it possible.
.addConnectionCallbacks(this) | ||
.addOnConnectionFailedListener(this) | ||
.addApi(Auth.CREDENTIALS_API) | ||
.enableAutoManage(activity, this) | ||
.build(); | ||
mCredentialsApiClient.connect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing wrong with this but the fact that you had to do it is concerning. If you can reliably reproduce a situation where this is critical could you file a bug and tell the Gms client folks about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll see if I can isolate it.
try { | ||
ft.add(result, tag).disallowAddToBackStack().commit(); | ||
} catch (IllegalStateException e) { | ||
Log.e(TAG, "Can not add fragment", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case should we return null or propagate the error somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to return null, and updated the usage to check for null.
@@ -45,4 +51,9 @@ public FirebaseAuth getFirebaseAuth() { | |||
public CredentialsApi getCredentialsApi() { | |||
return credentialsApi; | |||
} | |||
|
|||
@Implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think I see why you implemented this method, is it just so you can shadow it easily?
I did some testing on an older android device (4.4) with lower memory and uncovered a couple issues.
onCreate
otherwise the activity may be destroyed before it attaches (like when it gets backgrounded by the Facebook sign in on a low-memory device)SmartLock.getInstance
to onCreate required me to rework the SmartLock testing procedure, since it relied on being able to intercept the call after onCreate was finished.GoogleApiClient
was not connecting even thoughenableAutoManage
was called. Explicitly callingconnect
fixed this.