From 2fb7de3d51bea5daf8790c0bc5070bd2ecba2a2a Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Wed, 1 Feb 2017 17:09:18 +0000 Subject: [PATCH] Revert "Allow opening activity to specify orientation." This reverts commit f0a6fdbf53882949db0a141693dd33302b42d51b. Reason for revert: Submitted before complete. Change-Id: I545ff45b5e870c79d66884b7a2a80981293b1b24 --- .../com/android/server/am/ActivityRecord.java | 15 +---- .../server/am/ActivityStackSupervisor.java | 14 +---- .../com/android/server/wm/AppWindowToken.java | 7 +-- .../android/server/wm/WindowContainer.java | 9 +-- .../server/wm/WindowManagerService.java | 9 --- .../server/wm/WindowContainerTests.java | 58 +++---------------- 6 files changed, 22 insertions(+), 90 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 38b36a677a4d9..baf7772206919 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -1899,22 +1899,11 @@ final class ActivityRecord implements AppWindowContainerListener { task.taskId, requestedOrientation); } - /** - * Set the last reported global configuration to the client. Should be called whenever a new - * global configuration is sent to the client for this activity. - */ - void setLastReportedGlobalConfiguration(@NonNull Configuration config) { + // TODO: now used only in one place to address race-condition. Remove when that will be fixed. + void setLastReportedConfiguration(@NonNull Configuration config) { mLastReportedConfiguration.setTo(config); } - /** - * Set the last reported merged configuration to the client. Should be called whenever a new - * merged configuration is sent to the client for this activity. - */ - void setLastReportedMergedOverrideConfiguration(@NonNull Configuration config) { - mLastReportedOverrideConfiguration.setTo(config); - } - /** Call when override config was sent to the Window Manager to update internal records. */ void onOverrideConfigurationSent() { mLastReportedOverrideConfiguration.setTo(task.getMergedOverrideConfiguration()); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index ef06fc581ebb4..b2b3e61ca534f 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1333,18 +1333,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // Because we could be starting an Activity in the system process this may not go across // a Binder interface which would create a new Configuration. Consequently we have to // always create a new Configuration here. - - final Configuration globalConfiguration = - new Configuration(mService.getGlobalConfiguration()); - r.setLastReportedGlobalConfiguration(globalConfiguration); - final Configuration mergedOverrideConfiguration = - new Configuration(task.getMergedOverrideConfiguration()); - r.setLastReportedMergedOverrideConfiguration(mergedOverrideConfiguration); - app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken, System.identityHashCode(r), r.info, - globalConfiguration, - mergedOverrideConfiguration, r.compat, + new Configuration(mService.getGlobalConfiguration()), + new Configuration(task.getMergedOverrideConfiguration()), r.compat, r.launchedFromPackage, task.voiceInteractor, app.repProcState, r.icicle, r.persistentState, results, newIntents, !andResume, mService.isNextTransitionForward(), profilerInfo); @@ -1739,7 +1731,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // We'll update with whatever configuration it now says // it used to launch. if (config != null) { - r.setLastReportedGlobalConfiguration(config); + r.setLastReportedConfiguration(config); } // We are now idle. If someone is waiting for a thumbnail from diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index d643769736163..bcc720d05424e 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -1151,11 +1151,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree */ @Override int getOrientation() { - if (fillsParent() && (isVisible() || mService.mOpeningApps.contains(this))) { - return mOrientation; + if (hidden || hiddenRequested) { + return SCREEN_ORIENTATION_UNSET; } - - return SCREEN_ORIENTATION_UNSET; + return mOrientation; } /** Returns the app's preferred orientation regardless of its currently visibility state. */ diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 5e25da31d4eb7..5b96263b18172 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -510,13 +510,14 @@ class WindowContainer implements Comparable