From 90b570e4f427f14fd17d53561c209d5eb1ac1936 Mon Sep 17 00:00:00 2001 From: yueg Date: Thu, 28 Sep 2017 15:06:58 -0700 Subject: Fix audio route selector. 1. Use onCancel() instead of onDismiss(). onCancel() is not called when changing orientation, so it won't crash on getParentUnsafe(). onCancel() is also not called when pressing home button, but it will be handled by AudioRouteSelectorActivity.onPause(). b/67013452 will happen after the fix. 2. Use FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_MULTIPLE_TASK when starting AudioRouteSelectorActivity. This prevents showing Dialer with AudioRouteSelectorActivity. The downside is that the activity is no longer excluded from recent screen. The two fixes can affect each other, so they are in one CL. Video: https://drive.google.com/open?id=0Bz1rQbdSCWSKYVJkd3R1SkI4c3c Test: manual PiperOrigin-RevId: 170404203 Change-Id: Ifa8ebcd566670115d3865b0d67c311c296fbbd51 --- java/com/android/incallui/AudioRouteSelectorActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'java/com/android/incallui/AudioRouteSelectorActivity.java') diff --git a/java/com/android/incallui/AudioRouteSelectorActivity.java b/java/com/android/incallui/AudioRouteSelectorActivity.java index f0ae79bc2..2fdc89aa8 100644 --- a/java/com/android/incallui/AudioRouteSelectorActivity.java +++ b/java/com/android/incallui/AudioRouteSelectorActivity.java @@ -57,7 +57,9 @@ public class AudioRouteSelectorActivity extends FragmentActivity if (audioRouteSelectorDialogFragment != null) { audioRouteSelectorDialogFragment.dismiss(); } - // We don't expect the activity to resume - finish(); + // We don't expect the activity to resume, except for orientation change. + if (!isChangingConfigurations()) { + finish(); + } } } -- cgit v1.2.3