Skip to content

Conversation

amandle
Copy link
Contributor

@amandle amandle commented Oct 27, 2016

I did some testing on an older android device (4.4) with lower memory and uncovered a couple issues.

  • The SmartLock fragment has to be added in 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)
  • Moving the 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.
  • On the 4.4 device the GoogleApiClient was not connecting even though enableAutoManage was called. Explicitly calling connect fixed this.

Copy link
Contributor

@samtstern samtstern left a 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.

}

public SmartLock getSmartLockInstance(AppCompatBase activity, String tag) {
return SmartLock.getInstance(activity, tag);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

.addApi(Auth.CREDENTIALS_API)
.enableAutoManage(activity, this)
.build();
mCredentialsApiClient.connect();
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

return credentialsApi;
}

@Implementation
Copy link
Contributor

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?

@amandle amandle merged commit f9d4ab6 into firebase:version-1.0.0-dev Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants