summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorChilun Huang <chilunhuang@google.com>2018-11-12 01:50:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-11-12 01:50:25 +0000
commite01fd194262aca57be3e1bbf0c7ed99a289869cd (patch)
treeb87375a73602c0aa522eed47e1bfda13eb853f49 /core/java/android
parent662547a8bbdd9efafe3c0d6c6e95b148c95c2cb4 (diff)
parent8753ad366b02f661c438afba8207fc0b67e10d9c (diff)
Merge "Implement new API of external display settings (1/2)"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/display/DisplayManager.java3
-rw-r--r--core/java/android/view/Display.java6
-rw-r--r--core/java/android/view/DisplayInfo.java1
-rw-r--r--core/java/android/view/IWindowManager.aidl116
-rw-r--r--core/java/android/view/WindowManager.java71
-rw-r--r--core/java/android/view/WindowManagerImpl.java26
6 files changed, 223 insertions, 0 deletions
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java
index 01ef58e987d7..82e765dee447 100644
--- a/core/java/android/hardware/display/DisplayManager.java
+++ b/core/java/android/hardware/display/DisplayManager.java
@@ -263,6 +263,7 @@ public final class DisplayManager {
* @see KeyguardManager#isDeviceLocked()
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use IWindowManager#shouldShowWithInsecureKeyguard
// TODO: Update name and documentation and un-hide the flag. Don't change the value before that.
public static final int VIRTUAL_DISPLAY_FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD = 1 << 5;
@@ -295,6 +296,7 @@ public final class DisplayManager {
* @see #createVirtualDisplay
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use WindowManager#REMOVE_CONTENT_MODE_DESTROY
public static final int VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 8;
/**
@@ -304,6 +306,7 @@ public final class DisplayManager {
* @see #createVirtualDisplay
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use IWindowManager#setShouldShowSystemDecors
public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 9;
/** @hide */
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 719a401ce0cf..3f14379c9bc9 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -218,6 +218,7 @@ public final class Display {
* @see #getFlags
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use IWindowManager#shouldShowWithInsecureKeyguard
public static final int FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD = 1 << 5;
/**
@@ -230,6 +231,7 @@ public final class Display {
* @see #supportsSystemDecorations
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use IWindowManager#setShouldShowSystemDecors
public static final int FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 6;
/**
@@ -384,6 +386,7 @@ public final class Display {
*
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
public static final int REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY = 0;
/**
* Indicates that when display is removed, all its stacks and tasks will be removed, all
@@ -391,6 +394,7 @@ public final class Display {
*
* @hide
*/
+ // TODO (b/114338689): Remove the flag and use WindowManager#REMOVE_CONTENT_MODE_DESTROY
public static final int REMOVE_MODE_DESTROY_CONTENT = 1;
/**
@@ -881,6 +885,7 @@ public final class Display {
* @see #REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY
* @see #REMOVE_MODE_DESTROY_CONTENT
*/
+ // TODO (b/114338689): Remove the method and use IWindowManager#getRemoveContentMode
public int getRemoveMode() {
return mDisplayInfo.removeMode;
}
@@ -891,6 +896,7 @@ public final class Display {
* @see #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
* @hide
*/
+ // TODO (b/114338689): Remove the method and use IWindowManager#shouldShowSystemDecors
public boolean supportsSystemDecorations() {
return (mDisplayInfo.flags & FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0;
}
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index 34bcbdd94041..43de1f89649c 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -266,6 +266,7 @@ public final class DisplayInfo implements Parcelable {
*
* @see Display#getRemoveMode()
*/
+ // TODO (b/114338689): Remove the flag and use IWindowManager#getRemoveContentMode
public int removeMode = Display.REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY;
public static final Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 5c07f44cec61..c836c9ec0def 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -432,4 +432,120 @@ interface IWindowManager
* @param displayId The id of the display.
*/
void dontOverrideDisplayInfo(int displayId);
+
+ /**
+ * Gets the windowing mode of the display.
+ *
+ * @param displayId The id of the display.
+ * @return {@link WindowConfiguration.WindowingMode}
+ */
+ int getWindowingMode(int displayId);
+
+ /**
+ * Sets the windowing mode of the display.
+ *
+ * @param displayId The id of the display.
+ * @param mode {@link WindowConfiguration.WindowingMode}
+ */
+ void setWindowingMode(int displayId, int mode);
+
+ /**
+ * Gets current remove content mode of the display.
+ * <p>
+ * What actions should be performed with the display's content when it is removed. Default
+ * behavior for public displays in this case is to move all activities to the primary display
+ * and make it focused. For private display is to destroy all activities.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @return The remove content mode of the display.
+ * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
+ * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
+ */
+ int getRemoveContentMode(int displayId);
+
+ /**
+ * Sets the remove content mode of the display.
+ * <p>
+ * This mode indicates what actions should be performed with the display's content when it is
+ * removed.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @param mode Remove content mode.
+ * @see WindowManager#REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY
+ * @see WindowManager#REMOVE_CONTENT_MODE_DESTROY
+ */
+ void setRemoveContentMode(int displayId, int mode);
+
+ /**
+ * Indicates that the display should show its content when non-secure keyguard is shown.
+ * <p>
+ * This flag identifies secondary displays that will continue showing content if keyguard can be
+ * dismissed without entering credentials.
+ * </p><p>
+ * An example of usage is a virtual display which content is displayed on external hardware
+ * display that is not visible to the system directly.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @return {@code true} if the display should show its content when non-secure keyguard is
+ * shown.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ */
+ boolean shouldShowWithInsecureKeyguard(int displayId);
+
+ /**
+ * Sets that the display should show its content when non-secure keyguard is shown.
+ *
+ * @param displayId The id of the display.
+ * @param shouldShow Indicates that the display should show its content when non-secure keyguard
+ * is shown.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ */
+ void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow);
+
+ /**
+ * Indicates the display should show system decors.
+ * <p>
+ * System decors include status bar, navigation bar, launcher.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @return {@code true} if the display should show system decors.
+ */
+ boolean shouldShowSystemDecors(int displayId);
+
+ /**
+ * Sets that the display should show system decors.
+ * <p>
+ * System decors include status bar, navigation bar, launcher.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @param shouldShow Indicates that the display should show system decors.
+ */
+ void setShouldShowSystemDecors(int displayId, boolean shouldShow);
+
+ /**
+ * Indicates that the display should show IME.
+ *
+ * @param displayId The id of the display.
+ * @return {@code true} if the display should show IME.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ */
+ boolean shouldShowIme(int displayId);
+
+ /**
+ * Sets that the display should show IME.
+ *
+ * @param displayId The id of the display.
+ * @param shouldShow Indicates that the display should show IME.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ */
+ void setShouldShowIme(int displayId, boolean shouldShow);
}
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 2d77cb4f3aca..8d8a37061035 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -315,6 +315,36 @@ public interface WindowManager extends ViewManager {
@interface TransitionFlags {}
/**
+ * Remove content mode: Indicates remove content mode is currently not defined.
+ * @hide
+ */
+ int REMOVE_CONTENT_MODE_UNDEFINED = 0;
+
+ /**
+ * Remove content mode: Indicates that when display is removed, all its activities will be moved
+ * to the primary display and the topmost activity should become focused.
+ * @hide
+ */
+ int REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY = 1;
+
+ /**
+ * Remove content mode: Indicates that when display is removed, all its stacks and tasks will be
+ * removed, all activities will be destroyed according to the usual lifecycle.
+ * @hide
+ */
+ int REMOVE_CONTENT_MODE_DESTROY = 2;
+
+ /**
+ * @hide
+ */
+ @IntDef(prefix = { "REMOVE_CONTENT_MODE_" }, value = {
+ REMOVE_CONTENT_MODE_UNDEFINED,
+ REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY,
+ REMOVE_CONTENT_MODE_DESTROY,
+ })
+ @interface RemoveContentMode {}
+
+ /**
* Exception that is thrown when trying to add view whose
* {@link LayoutParams} {@link LayoutParams#token}
* is invalid.
@@ -422,6 +452,47 @@ public interface WindowManager extends ViewManager {
@RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
public Region getCurrentImeTouchRegion();
+ /**
+ * Sets that the display should show its content when non-secure keyguard is shown.
+ *
+ * @param displayId Display ID.
+ * @param shouldShow Indicates that the display should show its content when non-secure keyguard
+ * is shown.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ * @hide
+ */
+ @TestApi
+ default void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
+ }
+
+ /**
+ * Sets that the display should show system decors.
+ * <p>
+ * System decors include status bar, navigation bar, launcher.
+ * </p>
+ *
+ * @param displayId The id of the display.
+ * @param shouldShow Indicates that the display should show system decors.
+ * @hide
+ */
+ @TestApi
+ default void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
+ }
+
+ /**
+ * Sets that the display should show IME.
+ *
+ * @param displayId Display ID.
+ * @param shouldShow Indicates that the display should show IME.
+ * @see KeyguardManager#isDeviceSecure()
+ * @see KeyguardManager#isDeviceLocked()
+ * @hide
+ */
+ @TestApi
+ default void setShouldShowIme(int displayId, boolean shouldShow) {
+ }
+
public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
/**
* X position for this window. With the default gravity it is ignored.
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 2339d35f7317..a102f6c8a74d 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -157,4 +157,30 @@ public final class WindowManagerImpl implements WindowManager {
}
return null;
}
+
+ @Override
+ public void setShouldShowWithInsecureKeyguard(int displayId, boolean shouldShow) {
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .setShouldShowWithInsecureKeyguard(displayId, shouldShow);
+ } catch (RemoteException e) {
+ }
+ }
+
+ @Override
+ public void setShouldShowSystemDecors(int displayId, boolean shouldShow) {
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .setShouldShowSystemDecors(displayId, shouldShow);
+ } catch (RemoteException e) {
+ }
+ }
+
+ @Override
+ public void setShouldShowIme(int displayId, boolean shouldShow) {
+ try {
+ WindowManagerGlobal.getWindowManagerService().setShouldShowIme(displayId, shouldShow);
+ } catch (RemoteException e) {
+ }
+ }
}