facebook/facebook-android-sdk — pull request #322 by blundell (2014-02-12 12:51:10+00:00)
Title: Loading sessions off main thread

When running with [http://developer.android.com/reference/android/os/StrictMode.html](StrictMode) enabled the UiLifeCycleHelper crashes with a Disk Read.

```java
D/StrictMode(26546): StrictMode policy violation; ~duration=224 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=95 violation=2
D/StrictMode(26546): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1089)
D/StrictMode(26546): at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:178)
D/StrictMode(26546): at android.app.SharedPreferencesImpl.getAll(SharedPreferencesImpl.java:190)
D/StrictMode(26546): at com.facebook.SharedPreferencesTokenCachingStrategy.load(SharedPreferencesTokenCachingStrategy.java:127)
D/StrictMode(26546): at com.facebook.Session.(Session.java:242)
D/StrictMode(26546): at com.facebook.Session.(Session.java:212)
D/StrictMode(26546): at com.facebook.UiLifecycleHelper.onCreate(UiLifecycleHelper.java:87)
D/StrictMode(26546): at com.novoda.example.SignInFragment.onCreate(SignInFragment.java:56)
```

This has been fixed with an ASynchronous load for the session when it is retrieved from the `Preferences` aka Disk. It deprecates the current single constructor in favor of a explanatory factory creation method.

Files changed for the fix are:
`facebook/src/com/facebook/Session.java`
`facebook/src/com/facebook/UiLifecycleHelper.java`

This Pull Request contains the contents of #321 and if merged fixes #321