Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
diff --git a/api/current.txt b/api/current.txt
index dd70a32..f87aa1d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3425,7 +3425,7 @@
     method public boolean dispatchTouchEvent(android.view.MotionEvent);
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
-    method public void enterPictureInPicture();
+    method public void enterPictureInPictureMode();
     method public android.view.View findViewById(int);
     method public void finish();
     method public void finishActivity(int);
@@ -3465,15 +3465,16 @@
     method public android.view.Window getWindow();
     method public android.view.WindowManager getWindowManager();
     method public boolean hasWindowFocus();
-    method public boolean inMultiWindow();
-    method public boolean inPictureInPicture();
     method public void invalidateOptionsMenu();
     method public boolean isChangingConfigurations();
     method public final boolean isChild();
     method public boolean isDestroyed();
     method public boolean isFinishing();
     method public boolean isImmersive();
+    method public boolean isInMultiWindowMode();
+    method public boolean isInPictureInPictureMode();
     method public boolean isLocalVoiceInteractionSupported();
+    method public boolean isOverlayWithDecorCaptionEnabled();
     method public boolean isTaskRoot();
     method public boolean isVoiceInteraction();
     method public boolean isVoiceInteractionRoot();
@@ -3520,7 +3521,7 @@
     method public void onLowMemory();
     method public boolean onMenuItemSelected(int, android.view.MenuItem);
     method public boolean onMenuOpened(int, android.view.Menu);
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onNavigateUp();
     method public boolean onNavigateUpFromChild(android.app.Activity);
     method protected void onNewIntent(android.content.Intent);
@@ -3528,7 +3529,7 @@
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPanelClosed(int, android.view.Menu);
     method protected void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method protected void onPostCreate(android.os.Bundle);
     method public void onPostCreate(android.os.Bundle, android.os.PersistableBundle);
     method protected void onPostResume();
@@ -3566,7 +3567,6 @@
     method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
     method public void openContextMenu(android.view.View);
     method public void openOptionsMenu();
-    method public void overlayWithDecorCaption(boolean);
     method public void overridePendingTransition(int, int);
     method public void postponeEnterTransition();
     method public void recreate();
@@ -3595,6 +3595,7 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
+    method public void setOverlayWithDecorCaptionEnabled(boolean);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
     method public final deprecated void setProgressBarIndeterminateVisibility(boolean);
@@ -4437,11 +4438,11 @@
     method public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle);
     method public deprecated void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle);
     method public void onLowMemory();
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onOptionsItemSelected(android.view.MenuItem);
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method public void onPrepareOptionsMenu(android.view.Menu);
     method public void onRequestPermissionsResult(int, java.lang.String[], int[]);
     method public void onResume();
@@ -4522,11 +4523,11 @@
     method public void dispatchDestroy();
     method public void dispatchDestroyView();
     method public void dispatchLowMemory();
-    method public void dispatchMultiWindowChanged(boolean);
+    method public void dispatchMultiWindowModeChanged(boolean);
     method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
     method public void dispatchOptionsMenuClosed(android.view.Menu);
     method public void dispatchPause();
-    method public void dispatchPictureInPictureChanged(boolean);
+    method public void dispatchPictureInPictureModeChanged(boolean);
     method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
     method public void dispatchResume();
     method public void dispatchStart();
diff --git a/api/system-current.txt b/api/system-current.txt
index 0fe632d..ac4b072 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3540,7 +3540,7 @@
     method public boolean dispatchTouchEvent(android.view.MotionEvent);
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
-    method public void enterPictureInPicture();
+    method public void enterPictureInPictureMode();
     method public android.view.View findViewById(int);
     method public void finish();
     method public void finishActivity(int);
@@ -3580,8 +3580,6 @@
     method public android.view.Window getWindow();
     method public android.view.WindowManager getWindowManager();
     method public boolean hasWindowFocus();
-    method public boolean inMultiWindow();
-    method public boolean inPictureInPicture();
     method public void invalidateOptionsMenu();
     method public boolean isBackgroundVisibleBehind();
     method public boolean isChangingConfigurations();
@@ -3589,7 +3587,10 @@
     method public boolean isDestroyed();
     method public boolean isFinishing();
     method public boolean isImmersive();
+    method public boolean isInMultiWindowMode();
+    method public boolean isInPictureInPictureMode();
     method public boolean isLocalVoiceInteractionSupported();
+    method public boolean isOverlayWithDecorCaptionEnabled();
     method public boolean isTaskRoot();
     method public boolean isVoiceInteraction();
     method public boolean isVoiceInteractionRoot();
@@ -3637,7 +3638,7 @@
     method public void onLowMemory();
     method public boolean onMenuItemSelected(int, android.view.MenuItem);
     method public boolean onMenuOpened(int, android.view.Menu);
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onNavigateUp();
     method public boolean onNavigateUpFromChild(android.app.Activity);
     method protected void onNewIntent(android.content.Intent);
@@ -3645,7 +3646,7 @@
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPanelClosed(int, android.view.Menu);
     method protected void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method protected void onPostCreate(android.os.Bundle);
     method public void onPostCreate(android.os.Bundle, android.os.PersistableBundle);
     method protected void onPostResume();
@@ -3683,7 +3684,6 @@
     method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
     method public void openContextMenu(android.view.View);
     method public void openOptionsMenu();
-    method public void overlayWithDecorCaption(boolean);
     method public void overridePendingTransition(int, int);
     method public void postponeEnterTransition();
     method public void recreate();
@@ -3712,6 +3712,7 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
+    method public void setOverlayWithDecorCaptionEnabled(boolean);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
     method public final deprecated void setProgressBarIndeterminateVisibility(boolean);
@@ -4569,11 +4570,11 @@
     method public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle);
     method public deprecated void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle);
     method public void onLowMemory();
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onOptionsItemSelected(android.view.MenuItem);
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method public void onPrepareOptionsMenu(android.view.Menu);
     method public void onRequestPermissionsResult(int, java.lang.String[], int[]);
     method public void onResume();
@@ -4654,11 +4655,11 @@
     method public void dispatchDestroy();
     method public void dispatchDestroyView();
     method public void dispatchLowMemory();
-    method public void dispatchMultiWindowChanged(boolean);
+    method public void dispatchMultiWindowModeChanged(boolean);
     method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
     method public void dispatchOptionsMenuClosed(android.view.Menu);
     method public void dispatchPause();
-    method public void dispatchPictureInPictureChanged(boolean);
+    method public void dispatchPictureInPictureModeChanged(boolean);
     method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
     method public void dispatchResume();
     method public void dispatchStart();
diff --git a/api/test-current.txt b/api/test-current.txt
index d59fa27..f041bd5 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3425,7 +3425,7 @@
     method public boolean dispatchTouchEvent(android.view.MotionEvent);
     method public boolean dispatchTrackballEvent(android.view.MotionEvent);
     method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
-    method public void enterPictureInPicture();
+    method public void enterPictureInPictureMode();
     method public android.view.View findViewById(int);
     method public void finish();
     method public void finishActivity(int);
@@ -3465,15 +3465,16 @@
     method public android.view.Window getWindow();
     method public android.view.WindowManager getWindowManager();
     method public boolean hasWindowFocus();
-    method public boolean inMultiWindow();
-    method public boolean inPictureInPicture();
     method public void invalidateOptionsMenu();
     method public boolean isChangingConfigurations();
     method public final boolean isChild();
     method public boolean isDestroyed();
     method public boolean isFinishing();
     method public boolean isImmersive();
+    method public boolean isInMultiWindowMode();
+    method public boolean isInPictureInPictureMode();
     method public boolean isLocalVoiceInteractionSupported();
+    method public boolean isOverlayWithDecorCaptionEnabled();
     method public boolean isTaskRoot();
     method public boolean isVoiceInteraction();
     method public boolean isVoiceInteractionRoot();
@@ -3520,7 +3521,7 @@
     method public void onLowMemory();
     method public boolean onMenuItemSelected(int, android.view.MenuItem);
     method public boolean onMenuOpened(int, android.view.Menu);
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onNavigateUp();
     method public boolean onNavigateUpFromChild(android.app.Activity);
     method protected void onNewIntent(android.content.Intent);
@@ -3528,7 +3529,7 @@
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPanelClosed(int, android.view.Menu);
     method protected void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method protected void onPostCreate(android.os.Bundle);
     method public void onPostCreate(android.os.Bundle, android.os.PersistableBundle);
     method protected void onPostResume();
@@ -3566,7 +3567,6 @@
     method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
     method public void openContextMenu(android.view.View);
     method public void openOptionsMenu();
-    method public void overlayWithDecorCaption(boolean);
     method public void overridePendingTransition(int, int);
     method public void postponeEnterTransition();
     method public void recreate();
@@ -3595,6 +3595,7 @@
     method public void setImmersive(boolean);
     method public void setIntent(android.content.Intent);
     method public final void setMediaController(android.media.session.MediaController);
+    method public void setOverlayWithDecorCaptionEnabled(boolean);
     method public final deprecated void setProgress(int);
     method public final deprecated void setProgressBarIndeterminate(boolean);
     method public final deprecated void setProgressBarIndeterminateVisibility(boolean);
@@ -4437,11 +4438,11 @@
     method public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle);
     method public deprecated void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle);
     method public void onLowMemory();
-    method public void onMultiWindowChanged(boolean);
+    method public void onMultiWindowModeChanged(boolean);
     method public boolean onOptionsItemSelected(android.view.MenuItem);
     method public void onOptionsMenuClosed(android.view.Menu);
     method public void onPause();
-    method public void onPictureInPictureChanged(boolean);
+    method public void onPictureInPictureModeChanged(boolean);
     method public void onPrepareOptionsMenu(android.view.Menu);
     method public void onRequestPermissionsResult(int, java.lang.String[], int[]);
     method public void onResume();
@@ -4522,11 +4523,11 @@
     method public void dispatchDestroy();
     method public void dispatchDestroyView();
     method public void dispatchLowMemory();
-    method public void dispatchMultiWindowChanged(boolean);
+    method public void dispatchMultiWindowModeChanged(boolean);
     method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
     method public void dispatchOptionsMenuClosed(android.view.Menu);
     method public void dispatchPause();
-    method public void dispatchPictureInPictureChanged(boolean);
+    method public void dispatchPictureInPictureModeChanged(boolean);
     method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
     method public void dispatchResume();
     method public void dispatchStart();
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 0d387e6..0410a6e 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -51,12 +51,7 @@
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
-import android.graphics.drawable.InsetDrawable;
-import android.graphics.drawable.LayerDrawable;
-import android.graphics.drawable.ShapeDrawable;
 import android.hardware.input.InputManager;
 import android.media.AudioManager;
 import android.media.session.MediaController;
@@ -121,7 +116,6 @@
 import com.android.internal.app.IVoiceInteractor;
 import com.android.internal.app.ToolbarActionBar;
 import com.android.internal.app.WindowDecorActionBar;
-import com.android.internal.policy.DecorView;
 import com.android.internal.policy.PhoneWindow;
 
 import java.io.FileDescriptor;
@@ -1855,15 +1849,15 @@
      * visa-versa.
      * @see android.R.attr#resizeableActivity
      *
-     * @param inMultiWindow True if the activity is in multi-window mode.
+     * @param isInMultiWindowMode True if the activity is in multi-window mode.
      */
     @CallSuper
-    public void onMultiWindowChanged(boolean inMultiWindow) {
+    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
         if (DEBUG_LIFECYCLE) Slog.v(TAG,
-                "onMultiWindowChanged " + this + ": " + inMultiWindow);
-        mFragments.dispatchMultiWindowChanged(inMultiWindow);
+                "onMultiWindowModeChanged " + this + ": " + isInMultiWindowMode);
+        mFragments.dispatchMultiWindowModeChanged(isInMultiWindowMode);
         if (mWindow != null) {
-            mWindow.onMultiWindowChanged();
+            mWindow.onMultiWindowModeChanged();
         }
     }
 
@@ -1873,9 +1867,9 @@
      *
      * @return True if the activity is in multi-window mode.
      */
-    public boolean inMultiWindow() {
+    public boolean isInMultiWindowMode() {
         try {
-            return ActivityManagerNative.getDefault().inMultiWindow(mToken);
+            return ActivityManagerNative.getDefault().isInMultiWindowMode(mToken);
         } catch (RemoteException e) {
         }
         return false;
@@ -1885,13 +1879,13 @@
      * Called by the system when the activity changes to and from picture-in-picture mode.
      * @see android.R.attr#supportsPictureInPicture
      *
-     * @param inPictureInPicture True if the activity is in picture-in-picture mode.
+     * @param isInPictureInPictureMode True if the activity is in picture-in-picture mode.
      */
     @CallSuper
-    public void onPictureInPictureChanged(boolean inPictureInPicture) {
+    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
         if (DEBUG_LIFECYCLE) Slog.v(TAG,
-                "onPictureInPictureChanged " + this + ": " + inPictureInPicture);
-        mFragments.dispatchPictureInPictureChanged(inPictureInPicture);
+                "onPictureInPictureModeChanged " + this + ": " + isInPictureInPictureMode);
+        mFragments.dispatchPictureInPictureModeChanged(isInPictureInPictureMode);
     }
 
     /**
@@ -1900,9 +1894,9 @@
      *
      * @return True if the activity is in picture-in-picture mode.
      */
-    public boolean inPictureInPicture() {
+    public boolean isInPictureInPictureMode() {
         try {
-            return ActivityManagerNative.getDefault().inPictureInPicture(mToken);
+            return ActivityManagerNative.getDefault().isInPictureInPictureMode(mToken);
         } catch (RemoteException e) {
         }
         return false;
@@ -1912,9 +1906,9 @@
      * Puts the activity in picture-in-picture mode.
      * @see android.R.attr#supportsPictureInPicture
      */
-    public void enterPictureInPicture() {
+    public void enterPictureInPictureMode() {
         try {
-            ActivityManagerNative.getDefault().enterPictureInPicture(mToken);
+            ActivityManagerNative.getDefault().enterPictureInPictureMode(mToken);
         } catch (RemoteException e) {
         }
     }
@@ -6915,14 +6909,25 @@
     }
 
     /**
+     * Check whether the caption on freeform windows is displayed directly on the content.
+     *
+     * @return True if caption is displayed on content, false if it pushes the content down.
+     *
+     * @see {@link #setOverlayWithDecorCaptionEnabled(boolean)}
+     */
+    public boolean isOverlayWithDecorCaptionEnabled() {
+        return mWindow.isOverlayWithDecorCaptionEnabled();
+    }
+
+    /**
      * Set whether the caption should displayed directly on the content rather than push it down.
      *
      * This affects only freeform windows since they display the caption and only the main
      * window of the activity. The caption is used to drag the window around and also shows
      * maximize and close action buttons.
      */
-    public void overlayWithDecorCaption(boolean overlay) {
-        mWindow.setOverlayDecorCaption(overlay);
+    public void setOverlayWithDecorCaptionEnabled(boolean enabled) {
+        mWindow.setOverlayWithDecorCaptionEnabled(enabled);
     }
 
     /**
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 4bf48a3..33621852 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2890,7 +2890,7 @@
         case IN_MULTI_WINDOW_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             final IBinder token = data.readStrongBinder();
-            final boolean inMultiWindow = inMultiWindow(token);
+            final boolean inMultiWindow = isInMultiWindowMode(token);
             reply.writeNoException();
             reply.writeInt(inMultiWindow ? 1 : 0);
             return true;
@@ -2898,7 +2898,7 @@
         case IN_PICTURE_IN_PICTURE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             final IBinder token = data.readStrongBinder();
-            final boolean inPip = inPictureInPicture(token);
+            final boolean inPip = isInPictureInPictureMode(token);
             reply.writeNoException();
             reply.writeInt(inPip ? 1 : 0);
             return true;
@@ -2906,7 +2906,7 @@
         case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             final IBinder token = data.readStrongBinder();
-            enterPictureInPicture(token);
+            enterPictureInPictureMode(token);
             reply.writeNoException();
             return true;
         }
@@ -6837,7 +6837,7 @@
     }
 
     @Override
-    public boolean inMultiWindow(IBinder token) throws RemoteException {
+    public boolean isInMultiWindowMode(IBinder token) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
         data.writeInterfaceToken(IActivityManager.descriptor);
@@ -6851,7 +6851,7 @@
     }
 
     @Override
-    public boolean inPictureInPicture(IBinder token) throws RemoteException {
+    public boolean isInPictureInPictureMode(IBinder token) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
         data.writeInterfaceToken(IActivityManager.descriptor);
@@ -6865,7 +6865,7 @@
     }
 
     @Override
-    public void enterPictureInPicture(IBinder token) throws RemoteException {
+    public void enterPictureInPictureMode(IBinder token) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
         data.writeInterfaceToken(IActivityManager.descriptor);
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index dbc6c84..f7aef26 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1284,15 +1284,15 @@
         }
 
         @Override
-        public void scheduleMultiWindowChanged(IBinder token, boolean inMultiWindow)
+        public void scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode)
                 throws RemoteException {
-            sendMessage(H.MULTI_WINDOW_CHANGED, token, inMultiWindow ? 1 : 0);
+            sendMessage(H.MULTI_WINDOW_MODE_CHANGED, token, isInMultiWindowMode ? 1 : 0);
         }
 
         @Override
-        public void schedulePictureInPictureChanged(IBinder token, boolean inPip)
+        public void schedulePictureInPictureModeChanged(IBinder token, boolean isInPipMode)
                 throws RemoteException {
-            sendMessage(H.PICTURE_IN_PICTURE_CHANGED, token, inPip ? 1 : 0);
+            sendMessage(H.PICTURE_IN_PICTURE_MODE_CHANGED, token, isInPipMode ? 1 : 0);
         }
 
         @Override
@@ -1364,8 +1364,8 @@
         public static final int ENTER_ANIMATION_COMPLETE = 149;
         public static final int START_BINDER_TRACKING = 150;
         public static final int STOP_BINDER_TRACKING_AND_DUMP = 151;
-        public static final int MULTI_WINDOW_CHANGED = 152;
-        public static final int PICTURE_IN_PICTURE_CHANGED = 153;
+        public static final int MULTI_WINDOW_MODE_CHANGED = 152;
+        public static final int PICTURE_IN_PICTURE_MODE_CHANGED = 153;
         public static final int LOCAL_VOICE_INTERACTION_STARTED = 154;
 
         String codeToString(int code) {
@@ -1420,8 +1420,8 @@
                     case CANCEL_VISIBLE_BEHIND: return "CANCEL_VISIBLE_BEHIND";
                     case BACKGROUND_VISIBLE_BEHIND_CHANGED: return "BACKGROUND_VISIBLE_BEHIND_CHANGED";
                     case ENTER_ANIMATION_COMPLETE: return "ENTER_ANIMATION_COMPLETE";
-                    case MULTI_WINDOW_CHANGED: return "MULTI_WINDOW_CHANGED";
-                    case PICTURE_IN_PICTURE_CHANGED: return "PICTURE_IN_PICTURE_CHANGED";
+                    case MULTI_WINDOW_MODE_CHANGED: return "MULTI_WINDOW_MODE_CHANGED";
+                    case PICTURE_IN_PICTURE_MODE_CHANGED: return "PICTURE_IN_PICTURE_MODE_CHANGED";
                     case LOCAL_VOICE_INTERACTION_STARTED: return "LOCAL_VOICE_INTERACTION_STARTED";
                 }
             }
@@ -1666,11 +1666,11 @@
                 case STOP_BINDER_TRACKING_AND_DUMP:
                     handleStopBinderTrackingAndDump((ParcelFileDescriptor) msg.obj);
                     break;
-                case MULTI_WINDOW_CHANGED:
-                    handleMultiWindowChanged((IBinder) msg.obj, msg.arg1 == 1);
+                case MULTI_WINDOW_MODE_CHANGED:
+                    handleMultiWindowModeChanged((IBinder) msg.obj, msg.arg1 == 1);
                     break;
-                case PICTURE_IN_PICTURE_CHANGED:
-                    handlePictureInPictureChanged((IBinder) msg.obj, msg.arg1 == 1);
+                case PICTURE_IN_PICTURE_MODE_CHANGED:
+                    handlePictureInPictureModeChanged((IBinder) msg.obj, msg.arg1 == 1);
                     break;
                 case LOCAL_VOICE_INTERACTION_STARTED:
                     handleLocalVoiceInteractionStarted((IBinder) ((SomeArgs) msg.obj).arg1,
@@ -2924,17 +2924,17 @@
         }
     }
 
-    private void handleMultiWindowChanged(IBinder token, boolean inMultiWindow) {
+    private void handleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode) {
         final ActivityClientRecord r = mActivities.get(token);
         if (r != null) {
-            r.activity.onMultiWindowChanged(inMultiWindow);
+            r.activity.onMultiWindowModeChanged(isInMultiWindowMode);
         }
     }
 
-    private void handlePictureInPictureChanged(IBinder token, boolean inPip) {
+    private void handlePictureInPictureModeChanged(IBinder token, boolean isInPipMode) {
         final ActivityClientRecord r = mActivities.get(token);
         if (r != null) {
-            r.activity.onPictureInPictureChanged(inPip);
+            r.activity.onPictureInPictureModeChanged(isInPipMode);
         }
     }
 
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 744ddf7..ea86dd0 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -736,7 +736,7 @@
             data.enforceInterface(IApplicationThread.descriptor);
             final IBinder b = data.readStrongBinder();
             final boolean inMultiWindow = data.readInt() != 0;
-            scheduleMultiWindowChanged(b, inMultiWindow);
+            scheduleMultiWindowModeChanged(b, inMultiWindow);
             return true;
         }
 
@@ -745,7 +745,7 @@
             data.enforceInterface(IApplicationThread.descriptor);
             final IBinder b = data.readStrongBinder();
             final boolean inPip = data.readInt() != 0;
-            schedulePictureInPictureChanged(b, inPip);
+            schedulePictureInPictureModeChanged(b, inPip);
             return true;
         }
 
@@ -1498,24 +1498,24 @@
     }
 
     @Override
-    public final void scheduleMultiWindowChanged(
-            IBinder token, boolean inMultiWindow) throws RemoteException {
+    public final void scheduleMultiWindowModeChanged(
+            IBinder token, boolean isInMultiWindowMode) throws RemoteException {
         Parcel data = Parcel.obtain();
         data.writeInterfaceToken(IApplicationThread.descriptor);
         data.writeStrongBinder(token);
-        data.writeInt(inMultiWindow ? 1 : 0);
+        data.writeInt(isInMultiWindowMode ? 1 : 0);
         mRemote.transact(SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION, data, null,
                 IBinder.FLAG_ONEWAY);
         data.recycle();
     }
 
     @Override
-    public final void schedulePictureInPictureChanged(IBinder token, boolean inPip)
+    public final void schedulePictureInPictureModeChanged(IBinder token, boolean isInPipMode)
             throws RemoteException {
         Parcel data = Parcel.obtain();
         data.writeInterfaceToken(IApplicationThread.descriptor);
         data.writeStrongBinder(token);
-        data.writeInt(inPip ? 1 : 0);
+        data.writeInt(isInPipMode ? 1 : 0);
         mRemote.transact(SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION, data, null,
                 IBinder.FLAG_ONEWAY);
         data.recycle();
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index f7a4557..bb3c719 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -1582,21 +1582,21 @@
 
     /**
      * Called when the Fragment's activity changes from fullscreen mode to multi-window mode and
-     * visa-versa. This is generally tied to {@link Activity#onMultiWindowChanged} of the containing
-     * Activity.
+     * visa-versa. This is generally tied to {@link Activity#onMultiWindowModeChanged} of the
+     * containing Activity.
      *
-     * @param inMultiWindow True if the activity is in multi-window mode.
+     * @param isInMultiWindowMode True if the activity is in multi-window mode.
      */
-    public void onMultiWindowChanged(boolean inMultiWindow) {
+    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
     }
 
     /**
      * Called by the system when the activity changes to and from picture-in-picture mode. This is
-     * generally tied to {@link Activity#onPictureInPictureChanged} of the containing Activity.
+     * generally tied to {@link Activity#onPictureInPictureModeChanged} of the containing Activity.
      *
-     * @param inPictureInPicture True if the activity is in picture-in-picture mode.
+     * @param isInPictureInPictureMode True if the activity is in picture-in-picture mode.
      */
-    public void onPictureInPictureChanged(boolean inPictureInPicture) {
+    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
     }
 
     public void onConfigurationChanged(Configuration newConfig) {
@@ -2334,17 +2334,17 @@
         }
     }
 
-    void performMultiWindowChanged(boolean inMultiWindow) {
-        onMultiWindowChanged(inMultiWindow);
+    void performMultiWindowModeChanged(boolean isInMultiWindowMode) {
+        onMultiWindowModeChanged(isInMultiWindowMode);
         if (mChildFragmentManager != null) {
-            mChildFragmentManager.dispatchMultiWindowChanged(inMultiWindow);
+            mChildFragmentManager.dispatchMultiWindowModeChanged(isInMultiWindowMode);
         }
     }
 
-    void performPictureInPictureChanged(boolean inPictureInPicture) {
-        onPictureInPictureChanged(inPictureInPicture);
+    void performPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
+        onPictureInPictureModeChanged(isInPictureInPictureMode);
         if (mChildFragmentManager != null) {
-            mChildFragmentManager.dispatchPictureInPictureChanged(inPictureInPicture);
+            mChildFragmentManager.dispatchPictureInPictureModeChanged(isInPictureInPictureMode);
         }
     }
 
diff --git a/core/java/android/app/FragmentController.java b/core/java/android/app/FragmentController.java
index 57b0ff1..b3d2df5 100644
--- a/core/java/android/app/FragmentController.java
+++ b/core/java/android/app/FragmentController.java
@@ -247,10 +247,10 @@
      * the activity changed.
      * <p>Call when the multi-window mode of the activity changed.
      *
-     * @see Fragment#onMultiWindowChanged
+     * @see Fragment#onMultiWindowModeChanged
      */
-    public void dispatchMultiWindowChanged(boolean inMultiWindow) {
-        mHost.mFragmentManager.dispatchMultiWindowChanged(inMultiWindow);
+    public void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode) {
+        mHost.mFragmentManager.dispatchMultiWindowModeChanged(isInMultiWindowMode);
     }
 
     /**
@@ -258,10 +258,10 @@
      * mode of the activity changed.
      * <p>Call when the picture-in-picture mode of the activity changed.
      *
-     * @see Fragment#onPictureInPictureChanged
+     * @see Fragment#onPictureInPictureModeChanged
      */
-    public void dispatchPictureInPictureChanged(boolean inPictureInPicture) {
-        mHost.mFragmentManager.dispatchPictureInPictureChanged(inPictureInPicture);
+    public void dispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
+        mHost.mFragmentManager.dispatchPictureInPictureModeChanged(isInPictureInPictureMode);
     }
 
     /**
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 2852baf..8369f17 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -2069,26 +2069,26 @@
         mParent = null;
     }
 
-    public void dispatchMultiWindowChanged(boolean inMultiWindow) {
+    public void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode) {
         if (mAdded == null) {
             return;
         }
         for (int i = mAdded.size() - 1; i >= 0; --i) {
             final Fragment f = mAdded.get(i);
             if (f != null) {
-                f.performMultiWindowChanged(inMultiWindow);
+                f.performMultiWindowModeChanged(isInMultiWindowMode);
             }
         }
     }
 
-    public void dispatchPictureInPictureChanged(boolean inPictureInPicture) {
+    public void dispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
         if (mAdded == null) {
             return;
         }
         for (int i = mAdded.size() - 1; i >= 0; --i) {
             final Fragment f = mAdded.get(i);
             if (f != null) {
-                f.performPictureInPictureChanged(inPictureInPicture);
+                f.performPictureInPictureModeChanged(isInPictureInPictureMode);
             }
         }
     }
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 417c0679..8ee6fd0 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -623,11 +623,11 @@
 
     public int getAppStartMode(int uid, String packageName) throws RemoteException;
 
-    public boolean inMultiWindow(IBinder token) throws RemoteException;
+    public boolean isInMultiWindowMode(IBinder token) throws RemoteException;
 
-    public boolean inPictureInPicture(IBinder token) throws RemoteException;
+    public boolean isInPictureInPictureMode(IBinder token) throws RemoteException;
 
-    public void enterPictureInPicture(IBinder token) throws RemoteException;
+    public void enterPictureInPictureMode(IBinder token) throws RemoteException;
 
     public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
             throws RemoteException;
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 628bde0..a3b2638 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -158,8 +158,8 @@
     void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException;
     void startBinderTracking() throws RemoteException;
     void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException;
-    void scheduleMultiWindowChanged(IBinder token, boolean multiWindowMode) throws RemoteException;
-    void schedulePictureInPictureChanged(IBinder token, boolean multiWindowMode) throws RemoteException;
+    void scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode) throws RemoteException;
+    void schedulePictureInPictureModeChanged(IBinder token, boolean isInPictureInPictureMode) throws RemoteException;
     void scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor) throws RemoteException;
 
     String descriptor = "android.app.IApplicationThread";
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 36ee3e6..2f3f0bf 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -298,7 +298,7 @@
 
     private boolean mDestroyed;
 
-    private boolean mOverlayWithDecorCaption = false;
+    private boolean mOverlayWithDecorCaptionEnabled = false;
 
     // The current window attributes.
     private final WindowManager.LayoutParams mWindowAttributes =
@@ -2139,13 +2139,13 @@
      * down. This affects only freeform windows since they display the caption.
      * @hide
      */
-    public void setOverlayDecorCaption(boolean overlayCaption) {
-        mOverlayWithDecorCaption = overlayCaption;
+    public void setOverlayWithDecorCaptionEnabled(boolean enabled) {
+        mOverlayWithDecorCaptionEnabled = enabled;
     }
 
     /** @hide */
-    public boolean getOverlayDecorCaption() {
-        return mOverlayWithDecorCaption;
+    public boolean isOverlayWithDecorCaptionEnabled() {
+        return mOverlayWithDecorCaptionEnabled;
     }
 
     /** @hide */
@@ -2181,7 +2181,7 @@
      * Called when the activity changes from fullscreen mode to multi-window mode and visa-versa.
      * @hide
      */
-    public abstract void onMultiWindowChanged();
+    public abstract void onMultiWindowModeChanged();
 
     /**
      * Called when the activity just relaunched.
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index c1392fe..23b0df2 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -415,7 +415,7 @@
          * Returns true if the window is current in multi-windowing mode. i.e. it shares the
          * screen with other application windows.
          */
-        public boolean inMultiWindowMode();
+        public boolean isInMultiWindowMode();
     }
 
     /**
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 794a6d6..d80b63a 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -680,7 +680,7 @@
     }
 
     @Override
-    public void onMultiWindowChanged() {
+    public void onMultiWindowModeChanged() {
         if (mDecor != null) {
             mDecor.onConfigurationChanged(getContext().getResources().getConfiguration());
         }
diff --git a/core/java/com/android/internal/widget/DecorCaptionView.java b/core/java/com/android/internal/widget/DecorCaptionView.java
index 409a17f..e59d7ba 100644
--- a/core/java/com/android/internal/widget/DecorCaptionView.java
+++ b/core/java/com/android/internal/widget/DecorCaptionView.java
@@ -136,7 +136,7 @@
     public void setPhoneWindow(PhoneWindow owner, boolean show) {
         mOwner = owner;
         mShow = show;
-        mOverlayWithAppContent = owner.getOverlayDecorCaption();
+        mOverlayWithAppContent = owner.isOverlayWithDecorCaptionEnabled();
         if (mOverlayWithAppContent) {
             // The caption is covering the content, so we make its background transparent to make
             // the content visible.
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
index 3e04e2a..68c0c2a 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
@@ -235,7 +235,7 @@
         // With new multi-window mode we have to pick how we are launched.
         // By default we'd be launched in-place above the existing app.
         // By setting launch-to-side ActivityManager will open us to side.
-        if (inMultiWindow()) {
+        if (isInMultiWindowMode()) {
             intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index d7777d5..fff7d78 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -428,8 +428,8 @@
     }
 
     @Override
-    public void onMultiWindowChanged(boolean inMultiWindow) {
-        super.onMultiWindowChanged(inMultiWindow);
+    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
+        super.onMultiWindowModeChanged(isInMultiWindowMode);
         EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
                 false /* fromOrientationChange */));
 
@@ -449,7 +449,7 @@
             mRecentsView.updateStack(loadPlan.getTaskStack());
         }
 
-        EventBus.getDefault().send(new MultiWindowStateChangedEvent(inMultiWindow));
+        EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode));
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 95f26d4..6a2ecf4e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -654,7 +654,7 @@
         }
 
         @Override
-        public void onMultiWindowChanged() {
+        public void onMultiWindowModeChanged() {
         }
 
         @Override
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 9bd4117..530b9d3 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -351,7 +351,6 @@
 import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_PINNABLE;
 import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_OPEN;
 import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_RELAUNCH;
-import static com.android.server.wm.AppTransition.TRANSIT_DOCK_TASK_FROM_RECENTS;
 import static com.android.server.wm.AppTransition.TRANSIT_TASK_IN_PLACE;
 import static com.android.server.wm.AppTransition.TRANSIT_TASK_OPEN;
 import static com.android.server.wm.AppTransition.TRANSIT_TASK_TO_FRONT;
@@ -7222,7 +7221,7 @@
     }
 
     @Override
-    public boolean inMultiWindow(IBinder token) {
+    public boolean isInMultiWindowMode(IBinder token) {
         final long origId = Binder.clearCallingIdentity();
         try {
             synchronized(this) {
@@ -7239,7 +7238,7 @@
     }
 
     @Override
-    public boolean inPictureInPicture(IBinder token) {
+    public boolean isInPictureInPictureMode(IBinder token) {
         final long origId = Binder.clearCallingIdentity();
         try {
             synchronized(this) {
@@ -7255,24 +7254,24 @@
     }
 
     @Override
-    public void enterPictureInPicture(IBinder token) {
+    public void enterPictureInPictureMode(IBinder token) {
         final long origId = Binder.clearCallingIdentity();
         try {
             synchronized(this) {
                 if (!mSupportsPictureInPicture) {
-                    throw new IllegalStateException("enterPictureInPicture: "
+                    throw new IllegalStateException("enterPictureInPictureMode: "
                             + "Device doesn't support picture-in-picture mode.");
                 }
 
                 final ActivityRecord r = ActivityRecord.forTokenLocked(token);
 
                 if (r == null) {
-                    throw new IllegalStateException("enterPictureInPicture: "
+                    throw new IllegalStateException("enterPictureInPictureMode: "
                             + "Can't find activity for token=" + token);
                 }
 
                 if (!r.supportsPictureInPicture()) {
-                    throw new IllegalArgumentException("enterPictureInPicture: "
+                    throw new IllegalArgumentException("enterPictureInPictureMode: "
                             + "Picture-In-Picture not supported for r=" + r);
                 }
 
@@ -7281,7 +7280,7 @@
                         ? mDefaultPinnedStackBounds : null;
 
                 mStackSupervisor.moveActivityToPinnedStackLocked(
-                        r, "enterPictureInPicture", bounds);
+                        r, "enterPictureInPictureMode", bounds);
             }
         } finally {
             Binder.restoreCallingIdentity(origId);
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 5219827..48f87b6 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -23,7 +23,6 @@
 import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
 import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SAVED_STATE;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_THUMBNAILS;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_STATES;
@@ -452,24 +451,24 @@
         }
     }
 
-    void scheduleMultiWindowChanged() {
+    void scheduleMultiWindowModeChanged() {
         if (task == null || task.stack == null || app == null || app.thread == null) {
             return;
         }
         try {
             // An activity is considered to be in multi-window mode if its task isn't fullscreen.
-            app.thread.scheduleMultiWindowChanged(appToken, !task.mFullscreen);
+            app.thread.scheduleMultiWindowModeChanged(appToken, !task.mFullscreen);
         } catch (Exception e) {
             // If process died, I don't care.
         }
     }
 
-    void schedulePictureInPictureChanged() {
+    void schedulePictureInPictureModeChanged() {
         if (task == null || task.stack == null || app == null || app.thread == null) {
             return;
         }
         try {
-            app.thread.schedulePictureInPictureChanged(
+            app.thread.schedulePictureInPictureModeChanged(
                     appToken, task.stack.mStackId == PINNED_STACK_ID);
         } catch (Exception e) {
             // If process died, no one cares.
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index a9ef1d6..b297938 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4986,7 +4986,7 @@
 
     private void postAddTask(TaskRecord task, ActivityStack prevStack) {
         if (prevStack != null) {
-            mStackSupervisor.scheduleReportPictureInPictureChangedIfNeeded(task, prevStack);
+            mStackSupervisor.scheduleReportPictureInPictureModeChangedIfNeeded(task, prevStack);
         } else if (task.voiceSession != null) {
             try {
                 task.voiceSession.taskStarted(task.intent, task.taskId);
@@ -5045,7 +5045,7 @@
         r.setTask(task, null);
         task.addActivityToTop(r);
         setAppTask(r, task);
-        mStackSupervisor.scheduleReportPictureInPictureChangedIfNeeded(task, prevStack);
+        mStackSupervisor.scheduleReportPictureInPictureModeChangedIfNeeded(task, prevStack);
         moveToFrontAndResumeStateIfNeeded(r, wasFocused, wasResumed, "moveActivityToStack");
         if (wasResumed) {
             prevStack.mResumedActivity = null;
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 950320e..0d70e99 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -102,7 +102,6 @@
 import java.util.Objects;
 import java.util.Set;
 
-import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS;
 import static android.Manifest.permission.START_ANY_ACTIVITY;
 import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
 import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
@@ -3524,7 +3523,7 @@
         mActivityMetricsLogger.logWindowState();
     }
 
-    void scheduleReportMultiWindowChanged(TaskRecord task) {
+    void scheduleReportMultiWindowModeChanged(TaskRecord task) {
         for (int i = task.mActivities.size() - 1; i >= 0; i--) {
             final ActivityRecord r = task.mActivities.get(i);
             if (r.app != null && r.app.thread != null) {
@@ -3537,7 +3536,7 @@
         }
     }
 
-    void scheduleReportPictureInPictureChangedIfNeeded(TaskRecord task, ActivityStack prevStack) {
+    void scheduleReportPictureInPictureModeChangedIfNeeded(TaskRecord task, ActivityStack prevStack) {
         final ActivityStack stack = task.stack;
         if (prevStack == null || prevStack == stack
                 || (prevStack.mStackId != PINNED_STACK_ID && stack.mStackId != PINNED_STACK_ID)) {
@@ -3575,7 +3574,7 @@
                     synchronized (mService) {
                         for (int i = mMultiWindowModeChangedActivities.size() - 1; i >= 0; i--) {
                             final ActivityRecord r = mMultiWindowModeChangedActivities.remove(i);
-                            r.scheduleMultiWindowChanged();
+                            r.scheduleMultiWindowModeChanged();
                         }
                     }
                 } break;
@@ -3583,7 +3582,7 @@
                     synchronized (mService) {
                         for (int i = mPipModeChangedActivities.size() - 1; i >= 0; i--) {
                             final ActivityRecord r = mPipModeChangedActivities.remove(i);
-                            r.schedulePictureInPictureChanged();
+                            r.schedulePictureInPictureModeChanged();
                         }
                     }
                 } break;
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 0f1ebeb..b157070 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -1449,7 +1449,7 @@
         }
 
         if (mFullscreen != oldFullscreen) {
-            mService.mStackSupervisor.scheduleReportMultiWindowChanged(this);
+            mService.mStackSupervisor.scheduleReportMultiWindowModeChanged(this);
         }
 
         return !mOverrideConfig.equals(oldConfig) ? mOverrideConfig : null;
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 574faa0..747e31e 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -18,7 +18,6 @@
 
 import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
 import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
-import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
 import static android.app.ActivityManager.StackId.HOME_STACK_ID;
 import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
 import static android.content.pm.PackageManager.FEATURE_TELEVISION;
@@ -38,7 +37,6 @@
 import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_CLOSED;
 import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_OPEN;
 
-import android.Manifest;
 import android.app.ActivityManager;
 import android.app.ActivityManager.StackId;
 import android.app.ActivityManagerInternal;
@@ -4647,7 +4645,7 @@
         // TYPE_SYSTEM_ERROR is above the NavigationBar so it can't be allowed to extend over it.
         // Also, we don't allow windows in multi-window mode to extend out of the screen.
         if ((fl & FLAG_LAYOUT_NO_LIMITS) != 0 && attrs.type != TYPE_SYSTEM_ERROR
-                && !win.inMultiWindowMode()) {
+                && !win.isInMultiWindowMode()) {
             df.left = df.top = -10000;
             df.right = df.bottom = 10000;
             if (attrs.type != TYPE_WALLPAPER) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 0866c03..57ead8b 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -642,7 +642,7 @@
         mHaveFrame = true;
 
         final Task task = getTask();
-        final boolean fullscreenTask = !inMultiWindowMode();
+        final boolean fullscreenTask = !isInMultiWindowMode();
         final boolean windowsAreFloating = task != null && task.isFloating();
 
         // If the task has temp inset bounds set, we have to make sure all its windows uses
@@ -2226,7 +2226,7 @@
     }
 
     @Override
-    public boolean inMultiWindowMode() {
+    public boolean isInMultiWindowMode() {
         final Task task = getTask();
         return task != null && !task.isFullscreen();
     }
@@ -2527,7 +2527,7 @@
         final int pw = mContainingFrame.width();
         final int ph = mContainingFrame.height();
         final Task task = getTask();
-        final boolean nonFullscreenTask = inMultiWindowMode();
+        final boolean nonFullscreenTask = isInMultiWindowMode();
         final boolean fitToDisplay = task != null && !task.isFloating() && !layoutInParentFrame();
         float x, y;
         int w,h;