I'm trying to use the new API for activity transition only on lollipop (I'm using the compact version tho), so I'm implementing an animation from activity A to activity B, in Activity A:
getWindow().setReenterTransition(null);
getWindow().setExitTransition(null);
getWindow().setAllowEnterTransitionOverlap(false);
getWindow().setAllowReturnTransitionOverlap(false);
because I'm not interested in enter or exit of this activity, the only animations that I want to see are in the shared view with the Activity B.
For launching Activity B:
ActivityCompat.startActivity(this, intent, ActivityOptionsCompat.makeSceneTransitionAnimation(this, fabButton, getString(R.string.transition_fab)).toBundle());
And the setup of Activity B:
getWindow().setEnterTransition(new EmptyTransition());
getWindow().setReturnTransition(null);
getWindow().setAllowEnterTransitionOverlap(false);
getWindow().setAllowReturnTransitionOverlap(false);
getWindow().getEnterTransition().addListener(listener).
Again I'm not interested in the enter transition of return transition because the content is hidden till the enter transition listener method 'onTransitionEnd' is called, so my transition it's all based on the shared element which move/grow from Activity A to Activity B and when this transition is finished I'm bringing the content in.
Everything works fine, but on not very powerful devices (so all non-Nexus) from time to time the Activity A silently crash with:
java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.transferwise.android.debug/com.transferwise.android.activity.LoggedInMainActivity}
And the transition of the shared element happens but then the listener is not called (not event TransitionStart), so the content doesn't enter. The app is not crashing, user can still press back and "try again" but it's not a very good UX.
It's difficult to test it because it happens once every 10/20 times and only on some specific devices (it happens more on a Sony Xperia Z3 compact).
Also:
Danieles-MacBook-Pro-2:~ danielebottillo$ adb shell dumpsys activity p | grep com.package.main.debug
*APP* UID 10349 ProcessRecord{3b27508d 18371:com.package.main.debug/u0a349}
dir=/data/app/com.package.main.debug-1/base.apk publicDir=/data/app/com.package.main.debug-1/base.apk data=/data/data/com.package.main.debug
packageList={com.package.main.debug}
- ActivityRecord{2f07bdf8 u0 com.package.main.debug/com.package.main.activity.ActivityA t1196}
- ActivityRecord{1e871eb3 u0 com.package.main.debug/com.package.main.activity.ActivityB t1196}
- 28ea3e28/com.android.providers.settings/.SettingsProvider->18371:com.package.main.debug/u0a349 s1/1 u0/0 +27m9s645ms
- ReceiverList{40f2178 18371 com.package.main.debug/10349/u0 remote:39e102db}
- ReceiverList{2e7456a6 18371 com.package.main.debug/10349/u0 remote:dde3801}
- ReceiverList{39e2f1b7 18371 com.package.main.debug/10349/u0 remote:362300b6}
- ReceiverList{3afa7bd5 18371 com.package.main.debug/10349/u0 remote:33e4088c}
Proc # 0: fore F/A/T trm:10 18371:com.package.main.debug/u0a349 (top-activity)
PID #18371: ProcessRecord{3b27508d 18371:com.package.main.debug/u0a349}