Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd6e1500 authored by Jeff Brown's avatar Jeff Brown
Browse files

Add initial multi-display support.

Split the DisplayManager into two parts.  One part is bound
to a Context and takes care of Display compatibility and
caching Display objects on behalf of the Context.  The other
part is global and takes care of communicating with the
DisplayManagerService, handling callbacks, and caching
DisplayInfo objects on behalf of the process.

Implemented support for enumerating Displays and getting
callbacks when displays are added, removed or changed.

Elaborated the roles of DisplayManagerService, DisplayAdapter,
and DisplayDevice.  We now support having multiple display
adapters registered, each of which can register multiple display
devices and configure them dynamically.

Added an OverlayDisplayAdapter which is used to simulate
secondary displays by means of overlay windows.  Different
configurations of overlays can be selected using a new
setting in the Developer Settings panel.  The overlays can
be repositioned and resized by the user for convenience.

At the moment, all displays are mirrors of display 0 and
no display transformations are applied.  This will be improved
in future patches.

Refactored the way that the window manager creates its threads.
The OverlayDisplayAdapter needs to be able to use hardware
acceleration so it must share the same UI thread as the Keyguard
and window manager policy.  We now handle this explicitly as
part of starting up the system server.  This puts us in a
better position to consider how we might want to share (or not
share) Loopers among components.

Overlay displays are disabled when in safe mode or in only-core
mode to reduce the number of dependencies started in these modes.

Change-Id: Ic2a661d5448dde01b095ab150697cb6791d69bb5
parent c53abc4d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ LOCAL_SRC_FILES += \
	core/java/android/database/IContentObserver.aidl \
	core/java/android/hardware/ISerialManager.aidl \
	core/java/android/hardware/display/IDisplayManager.aidl \
	core/java/android/hardware/display/IDisplayManagerCallback.aidl \
	core/java/android/hardware/input/IInputManager.aidl \
	core/java/android/hardware/input/IInputDevicesChangedListener.aidl \
	core/java/android/hardware/usb/IUsbManager.aidl \
+3 −1
Original line number Diff line number Diff line
@@ -9997,7 +9997,8 @@ package android.hardware {
package android.hardware.display {
  public final class DisplayManager {
    method public android.view.Display getDisplay(int, android.content.Context);
    method public android.view.Display getDisplay(int);
    method public android.view.Display[] getDisplays();
    method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
    method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
  }
@@ -23453,6 +23454,7 @@ package android.view {
    method public int getRotation();
    method public void getSize(android.graphics.Point);
    method public deprecated int getWidth();
    method public boolean isValid();
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
  }
+3 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManagerGlobal;
import android.os.Binder;
import android.os.Bundle;
import android.os.Debug;
@@ -376,7 +377,8 @@ public class ActivityManager {
            return true;
        }

        Display display = DisplayManager.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY);
        Display display = DisplayManagerGlobal.getInstance().getRealDisplay(
                Display.DEFAULT_DISPLAY);
        Point p = new Point();
        display.getRealSize(p);
        int pixels = p.x * p.y;
+2 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.database.sqlite.SQLiteDebug.DbStats;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManagerGlobal;
import android.net.IConnectivityManager;
import android.net.Proxy;
import android.net.ProxyProperties;
@@ -1557,7 +1558,7 @@ public final class ActivityThread {
            return dm;
        }

        DisplayManager displayManager = DisplayManager.getInstance();
        DisplayManagerGlobal displayManager = DisplayManagerGlobal.getInstance();
        if (displayManager == null) {
            // may be null early in system startup
            dm = new DisplayMetrics();
+5 −4
Original line number Diff line number Diff line
@@ -349,9 +349,10 @@ class ContextImpl extends Context {
                    return InputManager.getInstance();
                }});

        registerService(DISPLAY_SERVICE, new StaticServiceFetcher() {
            public Object createStaticService() {
                return DisplayManager.getInstance();
        registerService(DISPLAY_SERVICE, new ServiceFetcher() {
                @Override
                public Object createService(ContextImpl ctx) {
                    return new DisplayManager(ctx.getOuterContext());
                }});

        registerService(INPUT_METHOD_SERVICE, new ServiceFetcher() {
Loading