blob: 264877c25628fd922eff7e6456dfe94b94c3c5c0 [file] [log] [blame]
Jeff Brown928e0542011-01-10 11:17:36 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Dianne Hackborna924dc0d2011-02-17 14:22:17 -080017package com.android.server.wm;
Jeff Brown928e0542011-01-10 11:17:36 -080018
Jeff Brown9302c872011-07-13 22:51:29 -070019import android.graphics.Region;
20import android.view.InputChannel;
Jeff Brown928e0542011-01-10 11:17:36 -080021import android.view.WindowManagerPolicy;
22
23/**
24 * Functions as a handle for a window that can receive input.
25 * Enables the native input dispatcher to refer indirectly to the window manager's window state.
26 * @hide
27 */
28public final class InputWindowHandle {
29 // Pointer to the native input window handle.
30 // This field is lazily initialized via JNI.
31 @SuppressWarnings("unused")
32 private int ptr;
33
34 // The input application handle.
35 public final InputApplicationHandle inputApplicationHandle;
36
37 // The window manager's window state.
38 public final WindowManagerPolicy.WindowState windowState;
39
Jeff Brown9302c872011-07-13 22:51:29 -070040 // The input channel associated with the window.
41 public InputChannel inputChannel;
42
43 // The window name.
44 public String name;
45
46 // Window layout params attributes. (WindowManager.LayoutParams)
47 public int layoutParamsFlags;
48 public int layoutParamsType;
49
50 // Dispatching timeout.
51 public long dispatchingTimeoutNanos;
52
53 // Window frame.
54 public int frameLeft;
55 public int frameTop;
56 public int frameRight;
57 public int frameBottom;
58
59 // Global scaling factor applied to touch events when they are dispatched
60 // to the window
61 public float scaleFactor;
62
63 // Window touchable region.
64 public final Region touchableRegion = new Region();
65
66 // Window is visible.
67 public boolean visible;
68
69 // Window can receive keys.
70 public boolean canReceiveKeys;
71
72 // Window has focus.
73 public boolean hasFocus;
74
75 // Window has wallpaper. (window is the current wallpaper target)
76 public boolean hasWallpaper;
77
78 // Input event dispatching is paused.
79 public boolean paused;
80
81 // Window layer.
82 public int layer;
83
84 // Id of process and user that owns the window.
85 public int ownerPid;
86 public int ownerUid;
87
88 // Window input features.
89 public int inputFeatures;
90
Jeff Brown928e0542011-01-10 11:17:36 -080091 private native void nativeDispose();
92
93 public InputWindowHandle(InputApplicationHandle inputApplicationHandle,
94 WindowManagerPolicy.WindowState windowState) {
95 this.inputApplicationHandle = inputApplicationHandle;
96 this.windowState = windowState;
97 }
98
99 @Override
100 protected void finalize() throws Throwable {
Jeff Browncc4f7db2011-08-30 20:34:48 -0700101 try {
102 nativeDispose();
103 } finally {
104 super.finalize();
105 }
Jeff Brown928e0542011-01-10 11:17:36 -0800106 }
107}