From 0e7b7c96be5e61f519ab2e5a258fa17d9c32efcb Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Thu, 10 Aug 2017 14:59:00 -0700 Subject: [PATCH] Update references to O MR1 to proper codename. Bug: 38225467 Test: manual Change-Id: I5ae29e5763967f6a752f720e043ccb1ceb57e311 --- core/java/android/app/Activity.java | 4 ++-- services/core/java/com/android/server/am/ActivityRecord.java | 3 ++- services/core/java/com/android/server/wm/AppWindowToken.java | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index adb3152d4ae7..b2fd169ff55c 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -16,7 +16,7 @@ package android.app; -import static android.os.Build.VERSION_CODES.O; +import static android.os.Build.VERSION_CODES.O_MR1; import static java.lang.Character.MIN_VALUE; @@ -973,7 +973,7 @@ public class Activity extends ContextThemeWrapper protected void onCreate(@Nullable Bundle savedInstanceState) { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState); - if (getApplicationInfo().targetSdkVersion > O && mActivityInfo.isFixedOrientation()) { + if (getApplicationInfo().targetSdkVersion >= O_MR1 && mActivityInfo.isFixedOrientation()) { final TypedArray ta = obtainStyledAttributes(com.android.internal.R.styleable.Window); final boolean isTranslucentOrFloating = ActivityInfo.isTranslucentOrFloating(ta); ta.recycle(); diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 7a19cc3c2c20..76ed800779a4 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -74,6 +74,7 @@ import static android.content.res.Configuration.UI_MODE_TYPE_MASK; import static android.content.res.Configuration.UI_MODE_TYPE_VR_HEADSET; import static android.os.Build.VERSION_CODES.HONEYCOMB; import static android.os.Build.VERSION_CODES.O; +import static android.os.Build.VERSION_CODES.O_MR1; import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.view.WindowManagerPolicy.NAV_BAR_LEFT; @@ -2171,7 +2172,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo void setRequestedOrientation(int requestedOrientation) { if (ActivityInfo.isFixedOrientation(requestedOrientation) && !fullscreen - && appInfo.targetSdkVersion > O) { + && appInfo.targetSdkVersion >= O_MR1) { throw new IllegalStateException("Only fullscreen activities can request orientation"); } diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 2e4de8c58650..46049f593105 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -22,6 +22,7 @@ import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; +import static android.os.Build.VERSION_CODES.O_MR1; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD; import static android.view.WindowManager.LayoutParams.FLAG_SECURE; @@ -1293,11 +1294,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree */ @Override int getOrientation(int candidate) { - // We do not allow non-fullscreen apps to influence orientation beyond O. While we do - // throw an exception in {@link Activity#onCreate} and + // We do not allow non-fullscreen apps to influence orientation starting in O-MR1. While we + // do throw an exception in {@link Activity#onCreate} and // {@link Activity#setRequestedOrientation}, we also ignore the orientation here so that // other calculations aren't affected. - if (!fillsParent() && mTargetSdk > O) { + if (!fillsParent() && mTargetSdk >= O_MR1) { // Can't specify orientation if app doesn't fill parent. return SCREEN_ORIENTATION_UNSET; } -- 2.11.0