| Jeff Brown | 928e054 | 2011-01-10 11:17:36 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.server; |
| 18 | |
| 19 | import android.view.WindowManagerPolicy; |
| 20 | |
| 21 | /** |
| 22 | * Functions as a handle for a window that can receive input. |
| 23 | * Enables the native input dispatcher to refer indirectly to the window manager's window state. |
| 24 | * @hide |
| 25 | */ |
| 26 | public final class InputWindowHandle { |
| 27 | // Pointer to the native input window handle. |
| 28 | // This field is lazily initialized via JNI. |
| 29 | @SuppressWarnings("unused") |
| 30 | private int ptr; |
| 31 | |
| 32 | // The input application handle. |
| 33 | public final InputApplicationHandle inputApplicationHandle; |
| 34 | |
| 35 | // The window manager's window state. |
| 36 | public final WindowManagerPolicy.WindowState windowState; |
| 37 | |
| 38 | private native void nativeDispose(); |
| 39 | |
| 40 | public InputWindowHandle(InputApplicationHandle inputApplicationHandle, |
| 41 | WindowManagerPolicy.WindowState windowState) { |
| 42 | this.inputApplicationHandle = inputApplicationHandle; |
| 43 | this.windowState = windowState; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | protected void finalize() throws Throwable { |
| 48 | nativeDispose(); |
| 49 | super.finalize(); |
| 50 | } |
| 51 | } |