Hi So Lin,
I’ve been able to look into your issue and am in agreement that this is a Google problem. Here’s more specifics:
I could only reproduce the issue you mentioned on devices running Android 5.1. On Android 5.0 and 4.4, Google Play Services closed as expected.
On top of your code snippet above, we were able to reproduce the issue with our Leaderboards and Achievements sample.
Lastly, we tested this with two Unity-made games (Lara Croft: Relic Run and Crossy Road), and those also caused Google Play Games to crash in the same way.
Here’s the exception that’s thrown in all the aforementioned tests:
E/AndroidRuntime(12238): FATAL EXCEPTION: main
E/AndroidRuntime(12238): Process: com.google.android.play.games.ui, PID: 12238
E/AndroidRuntime(12238): java.lang.SecurityException: Not signed in when calling API
E/AndroidRuntime(12238): at android.os.Parcel.readException(Parcel.java:1546)
E/AndroidRuntime(12238): at android.os.Parcel.readException(Parcel.java:1499)
E/AndroidRuntime(12238): at com.google.android.gms.games.internal.IGamesService$Stub$Proxy.getLeaderboardIntentV2(IGamesService.java:6576)
E/AndroidRuntime(12238): at com.google.android.gms.games.internal.GamesClientImpl.getLeaderboardIntent$2e1cfbaf(GamesClientImpl.java:3503)
E/AndroidRuntime(12238): at com.google.android.gms.games.internal.api.LeaderboardsImpl.getLeaderboardIntentInternal(LeaderboardsImpl.java:294)
E/AndroidRuntime(12238): at com.google.android.gms.games.ui.client.leaderboards.ClientLeaderboardFragment.showLeaderboardScoreUi(ClientLeaderboardFragment.java:34)
E/AndroidRuntime(12238): at com.google.android.gms.games.ui.common.leaderboards.LeaderboardFragment.onLeaderboardClicked(LeaderboardFragment.java:102)
E/AndroidRuntime(12238): at com.google.android.gms.games.ui.common.leaderboards.LeaderboardAdapter$LeaderboardViewHolder.onRootViewClicked(LeaderboardAdapter.java:83)
E/AndroidRuntime(12238): at com.google.android.gms.games.ui.card.OnyxBaseCardView.onClick(OnyxBaseCardView.java:373)
E/AndroidRuntime(12238): at com.google.android.gms.games.ui.card.OnyxSmallCardView.onClick(OnyxSmallCardView.java:353)
E/AndroidRuntime(12238): at android.view.View.performClick(View.java:4780)
E/AndroidRuntime(12238): at android.view.View$PerformClick.run(View.java:19866)
E/AndroidRuntime(12238): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(12238): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(12238): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(12238): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime(12238): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(12238): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(12238): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime(12238): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)