summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-05-03 11:56:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-03 11:56:25 -0700
commite19dbd9f9d0fea5959d8384d5d9d577d25cc8963 (patch)
treec24f5ecea7e2e72e1ad9dc14050be89a25f61bf0 /services
parent23746be026ae2e9854b33c0e8872463c6191a734 (diff)
parent93de746e5554bc9397ca8109f57875d92e64eabc (diff)
downloadframeworks_base-e19dbd9f9d0fea5959d8384d5d9d577d25cc8963.zip
frameworks_base-e19dbd9f9d0fea5959d8384d5d9d577d25cc8963.tar.gz
frameworks_base-e19dbd9f9d0fea5959d8384d5d9d577d25cc8963.tar.bz2
Merge "Separate the internal and external display rotations." into jb-dev
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/input/InputManagerService.java10
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java5
-rw-r--r--services/jni/com_android_server_input_InputManagerService.cpp24
3 files changed, 26 insertions, 13 deletions
diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java
index 117e064..299649d 100644
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -140,7 +140,8 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
private static native void nativeStart(int ptr);
private static native void nativeSetDisplaySize(int ptr, int displayId,
int width, int height, int externalWidth, int externalHeight);
- private static native void nativeSetDisplayOrientation(int ptr, int displayId, int rotation);
+ private static native void nativeSetDisplayOrientation(int ptr, int displayId,
+ int rotation, int externalRotation);
private static native int nativeGetScanCodeState(int ptr,
int deviceId, int sourceMask, int scanCode);
@@ -287,15 +288,16 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
nativeSetDisplaySize(mPtr, displayId, width, height, externalWidth, externalHeight);
}
- public void setDisplayOrientation(int displayId, int rotation) {
+ public void setDisplayOrientation(int displayId, int rotation, int externalRotation) {
if (rotation < Surface.ROTATION_0 || rotation > Surface.ROTATION_270) {
throw new IllegalArgumentException("Invalid rotation.");
}
if (DEBUG) {
- Slog.d(TAG, "Setting display #" + displayId + " orientation to " + rotation);
+ Slog.d(TAG, "Setting display #" + displayId + " orientation to rotation " + rotation
+ + " external rotation " + externalRotation);
}
- nativeSetDisplayOrientation(mPtr, displayId, rotation);
+ nativeSetDisplayOrientation(mPtr, displayId, rotation, externalRotation);
}
/**
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index ee74e40..8eda9ca 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -5580,7 +5580,8 @@ public class WindowManagerService extends IWindowManager.Stub
mWaitingForConfig = true;
mLayoutNeeded = true;
startFreezingDisplayLocked(inTransaction);
- mInputManager.setDisplayOrientation(0, rotation);
+ mInputManager.setDisplayOrientation(0, rotation,
+ mDisplay != null ? mDisplay.getExternalRotation() : Surface.ROTATION_0);
// We need to update our screen size information to match the new
// rotation. Note that this is redundant with the later call to
@@ -6606,6 +6607,8 @@ public class WindowManagerService extends IWindowManager.Stub
mInputManager.setDisplaySize(Display.DEFAULT_DISPLAY,
mDisplay.getRawWidth(), mDisplay.getRawHeight(),
mDisplay.getRawExternalWidth(), mDisplay.getRawExternalHeight());
+ mInputManager.setDisplayOrientation(Display.DEFAULT_DISPLAY,
+ mDisplay.getRotation(), mDisplay.getExternalRotation());
mPolicy.setInitialDisplaySize(mDisplay, mInitialDisplayWidth, mInitialDisplayHeight);
}
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp
index b6378bf..0e1ce51 100644
--- a/services/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/jni/com_android_server_input_InputManagerService.cpp
@@ -166,7 +166,7 @@ public:
void setDisplaySize(int32_t displayId, int32_t width, int32_t height,
int32_t externalWidth, int32_t externalHeight);
- void setDisplayOrientation(int32_t displayId, int32_t orientation);
+ void setDisplayOrientation(int32_t displayId, int32_t orientation, int32_t externalOrientation);
status_t registerInputChannel(JNIEnv* env, const sp<InputChannel>& inputChannel,
const sp<InputWindowHandle>& inputWindowHandle, bool monitor);
@@ -224,8 +224,9 @@ private:
struct Locked {
// Display size information.
int32_t displayWidth, displayHeight; // -1 when not initialized
- int32_t displayExternalWidth, displayExternalHeight; // -1 when not initialized
int32_t displayOrientation;
+ int32_t displayExternalWidth, displayExternalHeight; // -1 when not initialized
+ int32_t displayExternalOrientation;
// System UI visibility.
int32_t systemUiVisibility;
@@ -275,9 +276,10 @@ NativeInputManager::NativeInputManager(jobject contextObj,
AutoMutex _l(mLock);
mLocked.displayWidth = -1;
mLocked.displayHeight = -1;
+ mLocked.displayOrientation = DISPLAY_ORIENTATION_0;
mLocked.displayExternalWidth = -1;
mLocked.displayExternalHeight = -1;
- mLocked.displayOrientation = DISPLAY_ORIENTATION_0;
+ mLocked.displayExternalOrientation = DISPLAY_ORIENTATION_0;
mLocked.systemUiVisibility = ASYSTEM_UI_VISIBILITY_STATUS_BAR_VISIBLE;
mLocked.pointerSpeed = 0;
@@ -345,7 +347,8 @@ void NativeInputManager::setDisplaySize(int32_t displayId, int32_t width, int32_
}
}
-void NativeInputManager::setDisplayOrientation(int32_t displayId, int32_t orientation) {
+void NativeInputManager::setDisplayOrientation(int32_t displayId, int32_t orientation,
+ int32_t externalOrientation) {
bool changed = false;
if (displayId == 0) {
AutoMutex _l(mLock);
@@ -359,6 +362,11 @@ void NativeInputManager::setDisplayOrientation(int32_t displayId, int32_t orient
controller->setDisplayOrientation(orientation);
}
}
+
+ if (mLocked.displayExternalOrientation != externalOrientation) {
+ changed = true;
+ mLocked.displayExternalOrientation = externalOrientation;
+ }
}
if (changed) {
@@ -444,7 +452,7 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
mLocked.displayWidth, mLocked.displayHeight, mLocked.displayOrientation);
outConfig->setDisplayInfo(0, true /*external*/,
mLocked.displayExternalWidth, mLocked.displayExternalHeight,
- mLocked.displayOrientation);
+ mLocked.displayExternalOrientation);
} // release lock
}
@@ -1041,10 +1049,10 @@ static void nativeSetDisplaySize(JNIEnv* env, jclass clazz, jint ptr,
}
static void nativeSetDisplayOrientation(JNIEnv* env, jclass clazz,
- jint ptr, jint displayId, jint orientation) {
+ jint ptr, jint displayId, jint orientation, jint externalOrientation) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- im->setDisplayOrientation(displayId, orientation);
+ im->setDisplayOrientation(displayId, orientation, externalOrientation);
}
static jint nativeGetScanCodeState(JNIEnv* env, jclass clazz,
@@ -1327,7 +1335,7 @@ static JNINativeMethod gInputManagerMethods[] = {
(void*) nativeStart },
{ "nativeSetDisplaySize", "(IIIIII)V",
(void*) nativeSetDisplaySize },
- { "nativeSetDisplayOrientation", "(III)V",
+ { "nativeSetDisplayOrientation", "(IIII)V",
(void*) nativeSetDisplayOrientation },
{ "nativeGetScanCodeState", "(IIII)I",
(void*) nativeGetScanCodeState },