summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--api/system-current.txt1
-rw-r--r--core/java/android/os/Build.java5
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java8
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java2
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java40
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java17
-rw-r--r--services/core/java/com/android/server/am/CompatModePackages.java8
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java71
10 files changed, 87 insertions, 70 deletions
diff --git a/api/current.txt b/api/current.txt
index 40ea98a57e42..09361f208634 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22848,6 +22848,7 @@ package android.os {
field public static final int LOLLIPOP = 21; // 0x15
field public static final int LOLLIPOP_MR1 = 22; // 0x16
field public static final int M = 23; // 0x17
+ field public static final int N = 10000; // 0x2710
}
public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
diff --git a/api/system-current.txt b/api/system-current.txt
index ef9890ce0353..23805a3bd151 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -24792,6 +24792,7 @@ package android.os {
field public static final int LOLLIPOP = 21; // 0x15
field public static final int LOLLIPOP_MR1 = 22; // 0x16
field public static final int M = 23; // 0x17
+ field public static final int N = 10000; // 0x2710
}
public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 37ef83023ed8..85041adbe975 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -634,6 +634,11 @@ public class Build {
* M comes after L.
*/
public static final int M = 23;
+
+ /**
+ * N is for ¯\_(ツ)_/¯.
+ */
+ public static final int N = CUR_DEVELOPMENT;
}
/** The type of build, like "user" or "eng". */
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 13fda2f777d7..dac317a77324 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2736,7 +2736,7 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (ActivityManagerService.this) {
ActivityStack stack = mStackSupervisor.getStack(stackId);
if (stack != null) {
- ActivityRecord r = stack.topRunningActivityLocked(null);
+ ActivityRecord r = stack.topRunningActivityLocked();
if (r != null) {
setFocusedActivityLocked(r, "setFocusedStack");
mStackSupervisor.resumeTopActivitiesLocked(stack, null, null);
@@ -2753,7 +2753,7 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (ActivityManagerService.this) {
TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
if (task != null) {
- ActivityRecord r = task.topRunningActivityLocked(null);
+ ActivityRecord r = task.topRunningActivityLocked();
if (r != null) {
setFocusedActivityLocked(r, "setFocusedTask");
mStackSupervisor.resumeTopActivitiesLocked(task.stack, null, null);
@@ -11353,7 +11353,7 @@ public final class ActivityManagerService extends ActivityManagerNative
public boolean isTopActivityImmersive() {
enforceNotIsolatedCaller("startActivity");
synchronized (this) {
- ActivityRecord r = getFocusedStack().topRunningActivityLocked(null);
+ ActivityRecord r = getFocusedStack().topRunningActivityLocked();
return (r != null) ? r.immersive : false;
}
}
@@ -17744,7 +17744,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the configuration changed, and the caller is not already
// in the process of starting an activity, then find the top
// activity to check if its configuration needs to change.
- starting = mainStack.topRunningActivityLocked(null);
+ starting = mainStack.topRunningActivityLocked();
}
if (starting != null) {
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index d4e798fc45b8..4671cb0a94e3 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -774,7 +774,7 @@ final class ActivityRecord {
boolean unsent = true;
if ((state == ActivityState.RESUMED
|| (service.isSleeping() && task.stack != null
- && task.stack.topRunningActivityLocked(null) == this))
+ && task.stack.topRunningActivityLocked() == this))
&& app != null && app.thread != null) {
try {
ArrayList<ReferrerIntent> ar = new ArrayList<>(1);
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index ebd0130288de..cdb00ef17823 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -403,9 +403,9 @@ final class ActivityStack {
return mStackSupervisor.okToShowLocked(r);
}
- final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
+ final ActivityRecord topRunningActivityLocked() {
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
- ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked(notTop);
+ ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked();
if (r != null) {
return r;
}
@@ -689,7 +689,7 @@ final class ActivityStack {
// NOTE: If {@link TaskRecord#topRunningActivityLocked} return is not null then it is
// okay to show the activity when locked.
if (mStackSupervisor.isCurrentProfileLocked(task.userId)
- || task.topRunningActivityLocked(null) != null) {
+ || task.topRunningActivityLocked() != null) {
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "switchUserLocked: stack=" + getStackId() +
" moving " + task + " to top");
mTaskHistory.remove(i);
@@ -1105,7 +1105,7 @@ final class ActivityStack {
mStackSupervisor.resumeTopActivitiesLocked(topStack, prev, null);
} else {
mStackSupervisor.checkReadyForSleepLocked();
- ActivityRecord top = topStack.topRunningActivityLocked(null);
+ ActivityRecord top = topStack.topRunningActivityLocked();
if (top == null || (prev != null && top != prev)) {
// If there are no more activities available to run,
// do resume anyway to start something. Also if the top
@@ -1326,7 +1326,7 @@ final class ActivityStack {
if (focusedStackId != HOME_STACK_ID) {
return true;
}
- ActivityRecord topHomeActivity = focusedStack.topRunningActivityLocked(null);
+ ActivityRecord topHomeActivity = focusedStack.topRunningActivityLocked();
return topHomeActivity == null || !topHomeActivity.isHomeActivity();
}
@@ -1387,7 +1387,7 @@ final class ActivityStack {
*/
final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges,
boolean preserveWindows) {
- ActivityRecord top = topRunningActivityLocked(null);
+ ActivityRecord top = topRunningActivityLocked();
if (top == null) {
return;
}
@@ -1643,7 +1643,7 @@ final class ActivityStack {
* starting window displayed then remove that starting window. It is possible that the activity
* in this state will never resumed in which case that starting window will be orphaned. */
void cancelInitializingActivities() {
- final ActivityRecord topActivity = topRunningActivityLocked(null);
+ final ActivityRecord topActivity = topRunningActivityLocked();
boolean aboveTop = true;
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
@@ -1719,7 +1719,7 @@ final class ActivityStack {
cancelInitializingActivities();
// Find the first activity that is not finishing.
- final ActivityRecord next = topRunningActivityLocked(null);
+ final ActivityRecord next = topRunningActivityLocked();
// Remember how we'll process this pause/resume situation, and ensure
// that the state is reset however we wind up proceeding.
@@ -2037,7 +2037,7 @@ final class ActivityStack {
// We should be all done, but let's just make sure our activity
// is still at the top and schedule another run if something
// weird happened.
- ActivityRecord nextNext = topRunningActivityLocked(null);
+ ActivityRecord nextNext = topRunningActivityLocked();
if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_STATES,
"Activity config changed during resume: " + next
+ ", new next: " + nextNext);
@@ -2170,12 +2170,12 @@ final class ActivityStack {
// Calculate maximum possible position for this task.
int maxPosition = mTaskHistory.size();
if (!mStackSupervisor.isCurrentProfileLocked(task.userId)
- && task.topRunningActivityLocked(null) == null) {
+ && task.topRunningActivityLocked() == null) {
// Put non-current user tasks below current user tasks.
while (maxPosition > 0) {
final TaskRecord tmpTask = mTaskHistory.get(maxPosition - 1);
if (!mStackSupervisor.isCurrentProfileLocked(tmpTask.userId)
- || tmpTask.topRunningActivityLocked(null) == null) {
+ || tmpTask.topRunningActivityLocked() == null) {
break;
}
maxPosition--;
@@ -2217,13 +2217,13 @@ final class ActivityStack {
int taskNdx = mTaskHistory.size();
final boolean notShownWhenLocked =
(newActivity != null && (newActivity.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0)
- || (newActivity == null && task.topRunningActivityLocked(null) == null);
+ || (newActivity == null && task.topRunningActivityLocked() == null);
if (!mStackSupervisor.isCurrentProfileLocked(task.userId) && notShownWhenLocked) {
// Put non-current user tasks below current user tasks.
while (--taskNdx >= 0) {
final TaskRecord tmpTask = mTaskHistory.get(taskNdx);
if (!mStackSupervisor.isCurrentProfileLocked(tmpTask.userId)
- || tmpTask.topRunningActivityLocked(null) == null) {
+ || tmpTask.topRunningActivityLocked() == null) {
break;
}
}
@@ -2769,7 +2769,7 @@ final class ActivityStack {
private void adjustFocusedActivityLocked(ActivityRecord r, String reason) {
if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
- ActivityRecord next = topRunningActivityLocked(null);
+ ActivityRecord next = topRunningActivityLocked();
final String myReason = reason + " adjustFocus";
if (next != r) {
if (next != null && (mStackId == FREEFORM_WORKSPACE_STACK_ID
@@ -2812,7 +2812,7 @@ final class ActivityStack {
if (stack == null) {
return false;
}
- final ActivityRecord top = stack.topRunningActivityLocked(null);
+ final ActivityRecord top = stack.topRunningActivityLocked();
if (top == null) {
return false;
}
@@ -2913,7 +2913,7 @@ final class ActivityStack {
}
final void finishTopRunningActivityLocked(ProcessRecord app, String reason) {
- ActivityRecord r = topRunningActivityLocked(null);
+ ActivityRecord r = topRunningActivityLocked();
if (r != null && r.app == app) {
// If the top running activity is from this crashing
// process, then terminate it to avoid getting in a loop.
@@ -3618,7 +3618,7 @@ final class ActivityStack {
void releaseBackgroundResources(ActivityRecord r) {
if (hasVisibleBehindActivity() &&
!mHandler.hasMessages(RELEASE_BACKGROUND_RESOURCES_TIMEOUT_MSG)) {
- if (r == topRunningActivityLocked(null)) {
+ if (r == topRunningActivityLocked()) {
// Don't release the top activity if it has requested to run behind the next
// activity.
return;
@@ -3767,7 +3767,7 @@ final class ActivityStack {
final void updateTransitLocked(int transit, Bundle options) {
if (options != null) {
- ActivityRecord r = topRunningActivityLocked(null);
+ ActivityRecord r = topRunningActivityLocked();
if (r != null && r.state != ActivityState.RESUMED) {
r.updateOptionsLocked(options);
} else {
@@ -3840,7 +3840,7 @@ final class ActivityStack {
}
// Set focus to the top running activity of this stack.
- ActivityRecord r = topRunningActivityLocked(null);
+ ActivityRecord r = topRunningActivityLocked();
mService.setFocusedActivityLocked(r, reason);
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr);
@@ -4473,7 +4473,7 @@ final class ActivityStack {
}
ActivityRecord restartPackage(String packageName) {
- ActivityRecord starting = topRunningActivityLocked(null);
+ ActivityRecord starting = topRunningActivityLocked();
// All activities that came from the package must be
// restarted as if there was a config change.
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 05dc8a3c1144..cda9a5dc22bf 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -66,7 +66,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
-import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
@@ -628,7 +627,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (resumedActivity == null || resumedActivity.app == null) {
resumedActivity = stack.mPausingActivity;
if (resumedActivity == null || resumedActivity.app == null) {
- resumedActivity = stack.topRunningActivityLocked(null);
+ resumedActivity = stack.topRunningActivityLocked();
}
}
return resumedActivity;
@@ -644,7 +643,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (!isFrontStack(stack)) {
continue;
}
- ActivityRecord hr = stack.topRunningActivityLocked(null);
+ ActivityRecord hr = stack.topRunningActivityLocked();
if (hr != null) {
if (hr.app == null && app.uid == hr.info.applicationInfo.uid
&& processName.equals(hr.processName)) {
@@ -828,7 +827,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
ActivityRecord topRunningActivityLocked() {
final ActivityStack focusedStack = mFocusedStack;
- ActivityRecord r = focusedStack.topRunningActivityLocked(null);
+ ActivityRecord r = focusedStack.topRunningActivityLocked();
if (r != null) {
return r;
}
@@ -838,7 +837,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
if (stack != focusedStack && isFrontStack(stack)) {
- r = stack.topRunningActivityLocked(null);
+ r = stack.topRunningActivityLocked();
if (r != null) {
return r;
}
@@ -1101,7 +1100,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
} while (!outResult.timeout && outResult.who == null);
} else if (res == ActivityManager.START_TASK_TO_FRONT) {
- ActivityRecord r = stack.topRunningActivityLocked(null);
+ ActivityRecord r = stack.topRunningActivityLocked();
if (r.nowVisible && r.state == RESUMED) {
outResult.timeout = false;
outResult.who = new ComponentName(r.info.packageName, r.info.name);
@@ -2988,7 +2987,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeStack_" + stackId);
- ActivityRecord r = stack.topRunningActivityLocked(null);
+ ActivityRecord r = stack.topRunningActivityLocked();
mTmpBounds.clear();
mTmpConfigs.clear();
@@ -3113,7 +3112,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// to be relaunched due to configuration change.
boolean kept = true;
if (overrideConfig != null) {
- ActivityRecord r = task.topRunningActivityLocked(null);
+ ActivityRecord r = task.topRunningActivityLocked();
if (r != null) {
final ActivityStack stack = task.stack;
kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow);
@@ -3744,7 +3743,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
- final ActivityRecord r = stack.topRunningActivityLocked(null);
+ final ActivityRecord r = stack.topRunningActivityLocked();
final ActivityState state = r == null ? DESTROYED : r.state;
if (isFrontStack(stack)) {
if (r == null) Slog.e(TAG,
diff --git a/services/core/java/com/android/server/am/CompatModePackages.java b/services/core/java/com/android/server/am/CompatModePackages.java
index c36fd06f633b..26264e5da147 100644
--- a/services/core/java/com/android/server/am/CompatModePackages.java
+++ b/services/core/java/com/android/server/am/CompatModePackages.java
@@ -196,7 +196,7 @@ public final class CompatModePackages {
}
public boolean getFrontActivityAskCompatModeLocked() {
- ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
+ ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
if (r == null) {
return false;
}
@@ -208,7 +208,7 @@ public final class CompatModePackages {
}
public void setFrontActivityAskCompatModeLocked(boolean ask) {
- ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
+ ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
if (r != null) {
setPackageAskCompatModeLocked(r.packageName, ask);
}
@@ -230,7 +230,7 @@ public final class CompatModePackages {
}
public int getFrontActivityScreenCompatModeLocked() {
- ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
+ ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
if (r == null) {
return ActivityManager.COMPAT_MODE_UNKNOWN;
}
@@ -238,7 +238,7 @@ public final class CompatModePackages {
}
public void setFrontActivityScreenCompatModeLocked(int mode) {
- ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
+ ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
if (r == null) {
Slog.w(TAG, "setFrontActivityScreenCompatMode failed: no top activity");
return;
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 7e14b2b78f0f..77dbad4340ed 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -557,11 +557,11 @@ final class TaskRecord {
return null;
}
- ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
+ ActivityRecord topRunningActivityLocked() {
if (stack != null) {
for (int activityNdx = mActivities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = mActivities.get(activityNdx);
- if (!r.finishing && r != notTop && stack.okToShowLocked(r)) {
+ if (!r.finishing && stack.okToShowLocked(r)) {
return r;
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 3cf8500d4f94..da4af927e0d7 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -17,6 +17,10 @@
package com.android.server.wm;
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
+import static android.app.ActivityManager.DOCKED_STACK_ID;
+import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
@@ -3186,9 +3190,9 @@ public class WindowManagerService extends IWindowManager.Stub
public int getOrientationLocked() {
if (mDisplayFrozen) {
- if (mLastWindowForcedOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
- if (DEBUG_ORIENTATION) Slog.v(TAG, "Display is frozen, return "
- + mLastWindowForcedOrientation);
+ if (mLastWindowForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Display is frozen, return " + mLastWindowForcedOrientation);
// If the display is frozen, some activities may be in the middle
// of restarting, and thus have removed their old window. If the
// window has the flag to hide the lock screen, then the lock screen
@@ -3210,8 +3214,7 @@ public class WindowManagerService extends IWindowManager.Stub
continue;
}
int req = win.mAttrs.screenOrientation;
- if((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) ||
- (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)){
+ if(req == SCREEN_ORIENTATION_UNSPECIFIED || req == SCREEN_ORIENTATION_BEHIND) {
continue;
}
@@ -3221,7 +3224,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
return (mLastWindowForcedOrientation = req);
}
- mLastWindowForcedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+ mLastWindowForcedOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
if (mPolicy.isKeyguardLocked()) {
// The screen is locked and no top system window is requesting an orientation.
@@ -3232,7 +3235,7 @@ public class WindowManagerService extends IWindowManager.Stub
null : winShowWhenLocked.mAppToken;
if (appShowWhenLocked != null) {
int req = appShowWhenLocked.requestedOrientation;
- if (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND) {
+ if (req == SCREEN_ORIENTATION_BEHIND) {
req = mLastKeyguardForcedOrientation;
}
if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + appShowWhenLocked
@@ -3245,8 +3248,21 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
+ final TaskStack dockedStack = mStackIdToStack.get(DOCKED_STACK_ID);
+ final TaskStack freeformStack = mStackIdToStack.get(FREEFORM_WORKSPACE_STACK_ID);
+ if ((dockedStack != null && dockedStack.isVisibleLocked())
+ || (freeformStack != null && freeformStack.isVisibleLocked())) {
+ // We don't let app affect the system orientation when in freeform or docked mode since
+ // they don't occupy the entire display and their request can conflict with other apps.
+ return SCREEN_ORIENTATION_UNSPECIFIED;
+ }
+
// Top system windows are not requesting an orientation. Start searching from apps.
- int lastOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+ return getAppSpecifiedOrientation();
+ }
+
+ private int getAppSpecifiedOrientation() {
+ int lastOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
boolean findingBehind = false;
boolean lastFullscreen = false;
// TODO: Multi window.
@@ -3263,19 +3279,16 @@ public class WindowManagerService extends IWindowManager.Stub
// if we're about to tear down this window and not seek for
// the behind activity, don't use it for orientation
if (!findingBehind && !atoken.hidden && atoken.hiddenRequested) {
- if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
- + " -- going to hide");
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Skipping " + atoken + " -- going to hide");
continue;
}
if (tokenNdx == firstToken) {
- // If we have hit a new Task, and the bottom
- // of the previous group didn't explicitly say to use
- // the orientation behind it, and the last app was
- // full screen, then we'll stick with the
- // user's orientation.
- if (lastOrientation != ActivityInfo.SCREEN_ORIENTATION_BEHIND
- && lastFullscreen) {
+ // If we have hit a new Task, and the bottom of the previous group didn't
+ // explicitly say to use the orientation behind it, and the last app was
+ // full screen, then we'll stick with the user's orientation.
+ if (lastOrientation != SCREEN_ORIENTATION_BEHIND && lastFullscreen) {
if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken
+ " -- end of group, return " + lastOrientation);
return lastOrientation;
@@ -3284,8 +3297,8 @@ public class WindowManagerService extends IWindowManager.Stub
// We ignore any hidden applications on the top.
if (atoken.hiddenRequested) {
- if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
- + " -- hidden on top");
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Skipping " + atoken + " -- hidden on top");
continue;
}
@@ -3299,23 +3312,22 @@ public class WindowManagerService extends IWindowManager.Stub
// to use the orientation behind it, then just take whatever
// orientation it has and ignores whatever is under it.
lastFullscreen = atoken.appFullscreen;
- if (lastFullscreen && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) {
- if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken
- + " -- full screen, return " + or);
+ if (lastFullscreen && or != SCREEN_ORIENTATION_BEHIND) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Done at " + atoken + " -- full screen, return " + or);
return or;
}
// If this application has requested an explicit orientation, then use it.
- if (or != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
- && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) {
- if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken
- + " -- explicitly set, return " + or);
+ if (or != SCREEN_ORIENTATION_UNSPECIFIED && or != SCREEN_ORIENTATION_BEHIND) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "Done at " + atoken + " -- explicitly set, return " + or);
return or;
}
- findingBehind |= (or == ActivityInfo.SCREEN_ORIENTATION_BEHIND);
+ findingBehind |= (or == SCREEN_ORIENTATION_BEHIND);
}
}
- if (DEBUG_ORIENTATION) Slog.v(TAG, "No app is requesting an orientation, return "
- + mForcedAppOrientation);
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
+ "No app is requesting an orientation, return " + mForcedAppOrientation);
// The next app has not been requested to be visible, so we keep the current orientation
// to prevent freezing/unfreezing the display too early.
return mForcedAppOrientation;
@@ -3418,7 +3430,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- @Override
public void setNewConfiguration(Configuration config) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"setNewConfiguration()")) {