Support launching home activity on secondary display

- Add a new flag indicating that the display should show
  system decorations, such as status bar, nav bar, home and IME.
- Automatically launches home activity on secondary display
  if the display support system decorations and home
  activity has multiple instances supports.
- Remove ActivityStackSupervisor#mHomeStack and move several
  home stack related methods to ActivityDisplay.

Bug: 111363427
Test: atest ActivityManagerMultiDisplayTests
      atest com.android.server.am
      Manual test on virtual display and chromecast

Change-Id: I48fe245ad12965a19a6768f5dbb4e974ce94b01a
This commit is contained in:
Louis Chang
2018-08-29 17:44:34 +08:00
committed by Andrii Kulian
parent 331101321f
commit bd48dca2d0
16 changed files with 250 additions and 127 deletions

View File

@@ -297,6 +297,15 @@ public final class DisplayManager {
*/
public static final int VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 8;
/**
* Virtual display flag: Indicates that the display should support system decorations. Virtual
* displays without this flag shouldn't show home, IME or any other system decorations.
*
* @see #createVirtualDisplay
* @hide
*/
public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 9;
/** @hide */
public DisplayManager(Context context) {
mContext = context;

View File

@@ -220,6 +220,18 @@ public final class Display {
*/
public static final int FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD = 1 << 5;
/**
* Display flag: Indicates that the display should show system decorations.
* <p>
* This flag identifies secondary displays that should show system decorations, such as status
* bar, navigation bar, home activity or IME.
* </p>
*
* @see #supportsSystemDecorations
* @hide
*/
public static final int FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 6;
/**
* Display flag: Indicates that the contents of the display should not be scaled
* to fit the physical screen dimensions. Used for development only to emulate
@@ -873,6 +885,16 @@ public final class Display {
return mDisplayInfo.removeMode;
}
/**
* Returns whether this display should support showing system decorations.
*
* @see #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
* @hide
*/
public boolean supportsSystemDecorations() {
return (mDisplayInfo.flags & FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0;
}
/**
* Returns the display's HDR capabilities.
*