summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-01-16 22:16:42 -0800
committerJeff Brown <jeffbrown@google.com>2014-01-16 22:16:42 -0800
commit4ccb823a9f62e57f9d221f83a97e82967e79a9e5 (patch)
tree2c21ff973f7f41f4baabf9531404b87c8af1966a /core/java/android/hardware
parent6f357d3284a833cc50a990e14b39f389b8972254 (diff)
downloadframeworks_base-4ccb823a9f62e57f9d221f83a97e82967e79a9e5.zip
frameworks_base-4ccb823a9f62e57f9d221f83a97e82967e79a9e5.tar.gz
frameworks_base-4ccb823a9f62e57f9d221f83a97e82967e79a9e5.tar.bz2
Refactor display manager service to new pattern.
Transform DisplayManagerService into a SystemService and start cleaning up other local services that it uses from window manager and input manager. Clean up service thread initialization. Remove unnecessary static variables from ActivityManagerService. It's starting to become clear that we really need a better way to manage service dependencies. Boot phases don't quite cut it. Change-Id: If319dbd7cbfbd4812fe55ece969e818d4b20755b
Diffstat (limited to 'core/java/android/hardware')
-rw-r--r--core/java/android/hardware/display/DisplayManagerInternal.java109
-rw-r--r--core/java/android/hardware/display/DisplayViewport.java77
-rw-r--r--core/java/android/hardware/input/InputManagerInternal.java33
3 files changed, 219 insertions, 0 deletions
diff --git a/core/java/android/hardware/display/DisplayManagerInternal.java b/core/java/android/hardware/display/DisplayManagerInternal.java
new file mode 100644
index 0000000..8430973
--- /dev/null
+++ b/core/java/android/hardware/display/DisplayManagerInternal.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.display;
+
+import android.view.DisplayInfo;
+
+/**
+ * Display manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class DisplayManagerInternal {
+ /**
+ * Called by the power manager to blank all displays.
+ */
+ public abstract void blankAllDisplaysFromPowerManager();
+
+ /**
+ * Called by the power manager to unblank all displays.
+ */
+ public abstract void unblankAllDisplaysFromPowerManager();
+
+ /**
+ * Returns information about the specified logical display.
+ *
+ * @param displayId The logical display id.
+ * @return The logical display info, or null if the display does not exist. The
+ * returned object must be treated as immutable.
+ */
+ public abstract DisplayInfo getDisplayInfo(int displayId);
+
+ /**
+ * Registers a display transaction listener to provide the client a chance to
+ * update its surfaces within the same transaction as any display layout updates.
+ *
+ * @param listener The listener to register.
+ */
+ public abstract void registerDisplayTransactionListener(DisplayTransactionListener listener);
+
+ /**
+ * Unregisters a display transaction listener to provide the client a chance to
+ * update its surfaces within the same transaction as any display layout updates.
+ *
+ * @param listener The listener to unregister.
+ */
+ public abstract void unregisterDisplayTransactionListener(DisplayTransactionListener listener);
+
+ /**
+ * Overrides the display information of a particular logical display.
+ * This is used by the window manager to control the size and characteristics
+ * of the default display. It is expected to apply the requested change
+ * to the display information synchronously so that applications will immediately
+ * observe the new state.
+ *
+ * NOTE: This method must be the only entry point by which the window manager
+ * influences the logical configuration of displays.
+ *
+ * @param displayId The logical display id.
+ * @param info The new data to be stored.
+ */
+ public abstract void setDisplayInfoOverrideFromWindowManager(
+ int displayId, DisplayInfo info);
+
+ /**
+ * Called by the window manager to perform traversals while holding a
+ * surface flinger transaction.
+ */
+ public abstract void performTraversalInTransactionFromWindowManager();
+
+ /**
+ * Tells the display manager whether there is interesting unique content on the
+ * specified logical display. This is used to control automatic mirroring.
+ * <p>
+ * If the display has unique content, then the display manager arranges for it
+ * to be presented on a physical display if appropriate. Otherwise, the display manager
+ * may choose to make the physical display mirror some other logical display.
+ * </p>
+ *
+ * @param displayId The logical display id to update.
+ * @param hasContent True if the logical display has content.
+ * @param inTraversal True if called from WindowManagerService during a window traversal
+ * prior to call to performTraversalInTransactionFromWindowManager.
+ */
+ public abstract void setDisplayHasContent(int displayId, boolean hasContent,
+ boolean inTraversal);
+
+ /**
+ * Called within a Surface transaction whenever the size or orientation of a
+ * display may have changed. Provides an opportunity for the client to
+ * update the position of its surfaces as part of the same transaction.
+ */
+ public interface DisplayTransactionListener {
+ void onDisplayTransaction();
+ }
+}
diff --git a/core/java/android/hardware/display/DisplayViewport.java b/core/java/android/hardware/display/DisplayViewport.java
new file mode 100644
index 0000000..c2d498b
--- /dev/null
+++ b/core/java/android/hardware/display/DisplayViewport.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.display;
+
+import android.graphics.Rect;
+
+/**
+ * Describes how the pixels of physical display device reflects the content of
+ * a logical display.
+ * <p>
+ * This information is used by the input system to translate touch input from
+ * physical display coordinates into logical display coordinates.
+ * </p>
+ *
+ * @hide Only for use within the system server.
+ */
+public final class DisplayViewport {
+ // True if this viewport is valid.
+ public boolean valid;
+
+ // The logical display id.
+ public int displayId;
+
+ // The rotation applied to the physical coordinate system.
+ public int orientation;
+
+ // The portion of the logical display that are presented on this physical display.
+ public final Rect logicalFrame = new Rect();
+
+ // The portion of the (rotated) physical display that shows the logical display contents.
+ // The relation between logical and physical frame defines how the coordinate system
+ // should be scaled or translated after rotation.
+ public final Rect physicalFrame = new Rect();
+
+ // The full width and height of the display device, rotated in the same
+ // manner as physicalFrame. This expresses the full native size of the display device.
+ // The physical frame should usually fit within this area.
+ public int deviceWidth;
+ public int deviceHeight;
+
+ public void copyFrom(DisplayViewport viewport) {
+ valid = viewport.valid;
+ displayId = viewport.displayId;
+ orientation = viewport.orientation;
+ logicalFrame.set(viewport.logicalFrame);
+ physicalFrame.set(viewport.physicalFrame);
+ deviceWidth = viewport.deviceWidth;
+ deviceHeight = viewport.deviceHeight;
+ }
+
+ // For debugging purposes.
+ @Override
+ public String toString() {
+ return "DisplayViewport{valid=" + valid
+ + ", displayId=" + displayId
+ + ", orientation=" + orientation
+ + ", logicalFrame=" + logicalFrame
+ + ", physicalFrame=" + physicalFrame
+ + ", deviceWidth=" + deviceWidth
+ + ", deviceHeight=" + deviceHeight
+ + "}";
+ }
+}
diff --git a/core/java/android/hardware/input/InputManagerInternal.java b/core/java/android/hardware/input/InputManagerInternal.java
new file mode 100644
index 0000000..ecd32ea
--- /dev/null
+++ b/core/java/android/hardware/input/InputManagerInternal.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.input;
+
+import android.hardware.display.DisplayViewport;
+
+/**
+ * Input manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class InputManagerInternal {
+ /**
+ * Sets information about the displays as needed by the input system.
+ * The input system should copy this information if required.
+ */
+ public abstract void setDisplayViewports(DisplayViewport defaultViewport,
+ DisplayViewport externalTouchViewport);
+}