Loading core/java/android/app/ActivityThread.java +10 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading core/java/android/hardware/display/DisplayManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading services/java/com/android/server/SystemServer.java +4 −5 Original line number Diff line number Diff line Loading @@ -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)); Loading services/java/com/android/server/display/DisplayAdapter.java +17 −22 Original line number Diff line number Diff line Loading @@ -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); } } services/java/com/android/server/display/DisplayDevice.java +13 −1 Original line number Diff line number Diff line Loading @@ -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
core/java/android/app/ActivityThread.java +10 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading
core/java/android/hardware/display/DisplayManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading
services/java/com/android/server/SystemServer.java +4 −5 Original line number Diff line number Diff line Loading @@ -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)); Loading
services/java/com/android/server/display/DisplayAdapter.java +17 −22 Original line number Diff line number Diff line Loading @@ -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); } }
services/java/com/android/server/display/DisplayDevice.java +13 −1 Original line number Diff line number Diff line Loading @@ -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); }