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
17package com.android.server.input;
18
19/**
20 * Functions as a handle for an application that can receive input.
21 * Enables the native input dispatcher to refer indirectly to the window manager's
22 * application window token.
23 * @hide
24 */
25public final class InputApplicationHandle {
26    // Pointer to the native input application handle.
27    // This field is lazily initialized via JNI.
28    @SuppressWarnings("unused")
29    private int ptr;
30
31    // The window manager's application window token.
32    public final Object appWindowToken;
33
34    // Application name.
35    public String name;
36
37    // Dispatching timeout.
38    public long dispatchingTimeoutNanos;
39
40    private native void nativeDispose();
41
42    public InputApplicationHandle(Object appWindowToken) {
43        this.appWindowToken = appWindowToken;
44    }
45
46    @Override
47    protected void finalize() throws Throwable {
48        try {
49            nativeDispose();
50        } finally {
51            super.finalize();
52        }
53    }
54}
55