diff options
| author | Andrii Kulian <akulian@google.com> | 2016-04-07 09:36:33 -0700 |
|---|---|---|
| committer | Andrii Kulian <akulian@google.com> | 2016-04-08 11:58:43 -0700 |
| commit | 701214b2823e6d2ed87f9825ecec7cc164e1b7b5 (patch) | |
| tree | 4942966301c37c8e0594daae924aade54a70e137 /core/java | |
| parent | b4e39f5b2fcb74259a0a33ac4ad3d07a0073204f (diff) | |
Fix multiple configuration changes in multiwindow
When in split-screen mode and activity handles configuration changes
it gets 2 onConfigurationChanged calls which originate from
ActivityManagerService#updateConfigurationLocked:
1. app.thread.scheduleConfigurationChanged calls to all process records
send configuration of the whole screen for corresponding orientation,
which leads to CONFIGURATION_CHANGED message in ActivityThread.
2. mStackSupervisor.resizeStackLocked call resizes both visible stacks and
eventually ActivityThread receives ACTIVITY_CONFIGURATION_CHANGED
message with correct configuration corresponding to space occupied in
split-screen.
In this CL if component callback is an instance of Activity and it had
override config set - onConfigurationChanged will not be triggered unless
override config has changed.
Bug: 27948331
Change-Id: Ia73b045570b44eb5b351811bf6c4f63d78c3f909
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 96e1eaaba7a9..36e962e81338 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4727,8 +4727,16 @@ public final class ActivityThread { if (callbacks != null) { final int N = callbacks.size(); for (int i=0; i<N; i++) { - performConfigurationChanged(callbacks.get(i), null, config, null, - REPORT_TO_ACTIVITY); + ComponentCallbacks2 cb = callbacks.get(i); + if (cb instanceof Activity) { + // If callback is an Activity - call corresponding method to consider override + // config and avoid onConfigurationChanged if it hasn't changed. + Activity a = (Activity) cb; + performConfigurationChangedForActivity(mActivities.get(a.getActivityToken()), + config, REPORT_TO_ACTIVITY); + } else { + performConfigurationChanged(cb, null, config, null, REPORT_TO_ACTIVITY); + } } } } |
