diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-04-05 14:27:12 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-04-05 14:42:11 -0700 |
commit | 4532e6158474a263d9d26c2b42240bcf7ce9b172 (patch) | |
tree | e0055acd68c0a8729077695ac671935aa58a1fad /services/java/com/android/server/input/InputWindowHandle.java | |
parent | 9df6e7a926ce480baf70e97ee1b9ea387193f6ad (diff) | |
download | frameworks_base-4532e6158474a263d9d26c2b42240bcf7ce9b172.zip frameworks_base-4532e6158474a263d9d26c2b42240bcf7ce9b172.tar.gz frameworks_base-4532e6158474a263d9d26c2b42240bcf7ce9b172.tar.bz2 |
Refactor input system into its own service.
Extracted the input system from the window manager service into
a new input manager service. This will make it easier to
offer new input-related features to applications.
Cleaned up the input manager service JNI layer somewhat to get rid
of all of the unnecessary checks for whether the input manager
had been initialized. Simplified the callback layer as well.
Change-Id: I3175d01307aed1420780d3c093d2694b41edf66e
Diffstat (limited to 'services/java/com/android/server/input/InputWindowHandle.java')
-rw-r--r-- | services/java/com/android/server/input/InputWindowHandle.java | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/services/java/com/android/server/input/InputWindowHandle.java b/services/java/com/android/server/input/InputWindowHandle.java new file mode 100644 index 0000000..03d66af --- /dev/null +++ b/services/java/com/android/server/input/InputWindowHandle.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011 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.input; + +import android.graphics.Region; +import android.view.InputChannel; + +/** + * Functions as a handle for a window that can receive input. + * Enables the native input dispatcher to refer indirectly to the window manager's window state. + * @hide + */ +public final class InputWindowHandle { + // Pointer to the native input window handle. + // This field is lazily initialized via JNI. + @SuppressWarnings("unused") + private int ptr; + + // The input application handle. + public final InputApplicationHandle inputApplicationHandle; + + // The window manager's window state. + public final Object windowState; + + // The input channel associated with the window. + public InputChannel inputChannel; + + // The window name. + public String name; + + // Window layout params attributes. (WindowManager.LayoutParams) + public int layoutParamsFlags; + public int layoutParamsType; + + // Dispatching timeout. + public long dispatchingTimeoutNanos; + + // Window frame. + public int frameLeft; + public int frameTop; + public int frameRight; + public int frameBottom; + + // Global scaling factor applied to touch events when they are dispatched + // to the window + public float scaleFactor; + + // Window touchable region. + public final Region touchableRegion = new Region(); + + // Window is visible. + public boolean visible; + + // Window can receive keys. + public boolean canReceiveKeys; + + // Window has focus. + public boolean hasFocus; + + // Window has wallpaper. (window is the current wallpaper target) + public boolean hasWallpaper; + + // Input event dispatching is paused. + public boolean paused; + + // Window layer. + public int layer; + + // Id of process and user that owns the window. + public int ownerPid; + public int ownerUid; + + // Window input features. + public int inputFeatures; + + private native void nativeDispose(); + + public InputWindowHandle(InputApplicationHandle inputApplicationHandle, + Object windowState) { + this.inputApplicationHandle = inputApplicationHandle; + this.windowState = windowState; + } + + @Override + protected void finalize() throws Throwable { + try { + nativeDispose(); + } finally { + super.finalize(); + } + } +} |