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

Commit 848c2dc9 authored by Jeff Brown's avatar Jeff Brown
Browse files

Stub out display manager service implementation.

Reverting to the previous stub as the display adapter registration
and the logical to physical mapping is not at all what we are going
to need moving forward.

Fixed up the service initialization order so that the display manager
service has a context from the start.

Change-Id: I717f2f1099c7a77180ef207c371ec8329258850a
parent 82d53ce2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1553,10 +1553,20 @@ public final class ActivityThread {
        if (dm != null && !forceUpdate) {
            return dm;
        }

        DisplayManager displayManager = DisplayManager.getInstance();
        if (displayManager == null) {
            // may be null early in system startup
            dm = new DisplayMetrics();
            dm.setToDefaults();
            return dm;
        }

        if (dm == null) {
            dm = new DisplayMetrics();
            mDisplayMetrics.put(ci, dm);
        }

        CompatibilityInfoHolder cih = new CompatibilityInfoHolder();
        cih.set(ci);
        Display d = WindowManagerImpl.getDefault().makeCompatible(cih).getDefaultDisplay();
+7 −2
Original line number Diff line number Diff line
@@ -45,15 +45,20 @@ public final class DisplayManager {

    /**
     * Gets an instance of the display manager.
     * @return The display manager instance.
     *
     * @return The display manager instance, may be null early in system startup
     * before the display manager has been fully initialized.
     *
     * @hide
     */
    public static DisplayManager getInstance() {
        synchronized (DisplayManager.class) {
            if (sInstance == null) {
                IBinder b = ServiceManager.getService(Context.DISPLAY_SERVICE);
                if (b != null) {
                    sInstance = new DisplayManager(IDisplayManager.Stub.asInterface(b));
                }
            }
            return sInstance;
        }
    }
+4 −5
Original line number Diff line number Diff line
@@ -155,13 +155,12 @@ class ServerThread extends Thread {
            power = new PowerManagerService();
            ServiceManager.addService(Context.POWER_SERVICE, power);

            Slog.i(TAG, "Display Manager");
            display = new DisplayManagerService();
            ServiceManager.addService(Context.DISPLAY_SERVICE, display, true);

            Slog.i(TAG, "Activity Manager");
            context = ActivityManagerService.main(factoryTest);
            display.setContext(context);

            Slog.i(TAG, "Display Manager");
            display = new DisplayManagerService(context);
            ServiceManager.addService(Context.DISPLAY_SERVICE, display, true);

            Slog.i(TAG, "Telephony Registry");
            ServiceManager.addService("telephony.registry", new TelephonyRegistry(context));
+17 −22
Original line number Diff line number Diff line
@@ -16,38 +16,33 @@

package com.android.server.display;

import android.view.Display;

/**
 * A display adapter makes a single display devices available to the system.
 * A display adapter makes zero or more display devices available to the system
 * and provides facilities for discovering when displays are connected or disconnected.
 * <p>
 * For now, all display adapters are registered in the system server but
 * in principle it could be done from other processes.
 * </p>
 */
public abstract class DisplayAdapter {
    /** The current logical Display assignment for this adapter. Will change if other logical
     * display is assigned to this adapter */
    private int mDisplayId = Display.NO_DISPLAY;

    /** Assign the displayId
     * @hide */
    public void setDisplayId(int displayId) {
        mDisplayId = displayId;
    }

    /** Retrieve the displayId
     * @hide */
    public int getDisplayId() {
        return mDisplayId;
    }

    /**
     * Gets the display adapter name.
     * Gets the display adapter name for debugging purposes.
     *
     * @return The display adapter name.
     */
    public abstract String getName();

    // TODO: dynamically register display devices
    public abstract DisplayDevice getDisplayDevice();
    /**
     * Registers the display adapter with the display manager.
     * The display adapter should register any built-in display devices now.
     * Other display devices can be registered dynamically later.
     *
     * @param listener The listener for callbacks.
     */
    public abstract void register(Listener listener);

    public interface Listener {
        public void onDisplayDeviceAdded(DisplayDevice device);
        public void onDisplayDeviceRemoved(DisplayDevice device);
    }
}
+13 −1
Original line number Diff line number Diff line
@@ -18,8 +18,20 @@ package com.android.server.display;

/**
 * Represents a physical display device such as the built-in display
 * or an external monitor.
 * an external monitor, or a WiFi display.
 */
public abstract class DisplayDevice {
    /**
     * Gets the display adapter that makes the display device available.
     *
     * @return The display adapter.
     */
    public abstract DisplayAdapter getAdapter();

    /**
     * Gets information about the display device.
     *
     * @param outInfo The object to populate with the information.
     */
    public abstract void getInfo(DisplayDeviceInfo outInfo);
}
Loading