summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/display
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-12-05 12:28:25 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-12-05 12:28:25 -0800
commit384e6fe84d446067dccec69404e4a3ca507ebe07 (patch)
tree27c2cead41faada62dec81aa56025eb88f9c230d /services/java/com/android/server/display
parentfb21aa84a804c8d7dd0aad7df1e4a336ed59f991 (diff)
parent1edc61119d145b05f0b5e1323a2fc0fa6a29d4bc (diff)
downloadframeworks_base-384e6fe84d446067dccec69404e4a3ca507ebe07.zip
frameworks_base-384e6fe84d446067dccec69404e4a3ca507ebe07.tar.gz
frameworks_base-384e6fe84d446067dccec69404e4a3ca507ebe07.tar.bz2
am 1edc6111: am 61e21940: am 7fcb5dc5: Merge "Pin electron beam surface to natural orientation." into jb-mr1.1-dev
* commit '1edc61119d145b05f0b5e1323a2fc0fa6a29d4bc': Pin electron beam surface to natural orientation.
Diffstat (limited to 'services/java/com/android/server/display')
-rw-r--r--services/java/com/android/server/display/DisplayManagerService.java40
-rw-r--r--services/java/com/android/server/display/DisplayTransactionListener.java26
2 files changed, 66 insertions, 0 deletions
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index e58a0a5..e09970e 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -41,6 +41,7 @@ import android.view.DisplayInfo;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* Manages attached displays.
@@ -152,6 +153,10 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
new SparseArray<LogicalDisplay>();
private int mNextNonDefaultDisplayId = Display.DEFAULT_DISPLAY + 1;
+ // List of all display transaction listeners.
+ private final CopyOnWriteArrayList<DisplayTransactionListener> mDisplayTransactionListeners =
+ new CopyOnWriteArrayList<DisplayTransactionListener>();
+
// Set to true if all displays have been blanked by the power manager.
private int mAllDisplayBlankStateFromPowerManager;
@@ -261,6 +266,36 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
}
/**
+ * 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 void registerDisplayTransactionListener(DisplayTransactionListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener must not be null");
+ }
+
+ // List is self-synchronized copy-on-write.
+ mDisplayTransactionListeners.add(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 void unregisterDisplayTransactionListener(DisplayTransactionListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener must not be null");
+ }
+
+ // List is self-synchronized copy-on-write.
+ mDisplayTransactionListeners.remove(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
@@ -298,6 +333,11 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
performTraversalInTransactionLocked();
}
+
+ // List is self-synchronized copy-on-write.
+ for (DisplayTransactionListener listener : mDisplayTransactionListeners) {
+ listener.onDisplayTransaction();
+ }
}
/**
diff --git a/services/java/com/android/server/display/DisplayTransactionListener.java b/services/java/com/android/server/display/DisplayTransactionListener.java
new file mode 100644
index 0000000..34eb8f9
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayTransactionListener.java
@@ -0,0 +1,26 @@
+/*
+ * 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 com.android.server.display;
+
+/**
+ * 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();
+}