Allow opening activity to specify orientation.

An activity's window is initially not visible. This means it is not
accounted for until it becomes visible, which means requested
orientations will not be honored until after onCreate.

This changelist removes the visibility check previously used determining
the orientation.

This changelist also addresses an issue where an ActivityRecord member
variable tracking the last configuration sent was not being initially
updated.

Fixes: 33844887
Fixes: 33814250
Fixes: 34165818
Fixes: 34177026
Fixes: 33809086
Fixes: 34111451
Fixes: 33844423

Test: Verified reported issues fixed in apps mentioned in bugs
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts.ActivityManagerAppConfigurationTests
Change-Id: If9243792b9f2d137dc5addbf6fb735a0048fa192
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index bcc720d..d643769 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1151,10 +1151,11 @@
      */
     @Override
     int getOrientation() {
-        if (hidden || hiddenRequested) {
-            return SCREEN_ORIENTATION_UNSET;
+        if (fillsParent() && (isVisible() || mService.mOpeningApps.contains(this))) {
+            return mOrientation;
         }
-        return mOrientation;
+
+        return SCREEN_ORIENTATION_UNSET;
     }
 
     /** Returns the app's preferred orientation regardless of its currently visibility state. */