Bugfixes for older versions of Android#382
Bugfixes for older versions of Android#382amandle merged 5 commits intofirebase:version-1.0.0-devfrom
Conversation
samtstern
left a comment
There was a problem hiding this comment.
Some comments but LGTM.
| } | ||
|
|
||
| public SmartLock getSmartLockInstance(AppCompatBase activity, String tag) { | ||
| return SmartLock.getInstance(activity, tag); |
There was a problem hiding this comment.
Does this method do anything besides pass through? Seems like we could just use the static method.
There was a problem hiding this comment.
It just passes through. As you noted below, this makes shadowing it possible.
| .addApi(Auth.CREDENTIALS_API) | ||
| .enableAutoManage(activity, this) | ||
| .build(); | ||
| mCredentialsApiClient.connect(); |
There was a problem hiding this comment.
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.
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.
In this case should we return null or propagate the error somehow?
There was a problem hiding this comment.
Changed this to return null, and updated the usage to check for null.
| return credentialsApi; | ||
| } | ||
|
|
||
| @Implementation |
There was a problem hiding this comment.
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.
onCreateotherwise the activity may be destroyed before it attaches (like when it gets backgrounded by the Facebook sign in on a low-memory device)SmartLock.getInstanceto onCreate required me to rework the SmartLock testing procedure, since it relied on being able to intercept the call after onCreate was finished.GoogleApiClientwas not connecting even thoughenableAutoManagewas called. Explicitly callingconnectfixed this.