blob: 3cf7edcd6b2eb203fc3e4ffe3538c6798ae5ad50 [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
Jeff Brown4532e612012-04-05 14:27:12 -070017package com.android.server.input;
Jeff Brown928e0542011-01-10 11:17:36 -080018
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")
Ashok Bhat7e2a9dc2014-01-02 19:43:30 +000029 private long ptr;
Jeff Brown928e0542011-01-10 11:17:36 -080030
31 // The window manager's application window token.
Jeff Brown4532e612012-04-05 14:27:12 -070032 public final Object appWindowToken;
Jeff Brown928e0542011-01-10 11:17:36 -080033
Jeff Brown9302c872011-07-13 22:51:29 -070034 // Application name.
35 public String name;
36
37 // Dispatching timeout.
38 public long dispatchingTimeoutNanos;
39
Jeff Brown928e0542011-01-10 11:17:36 -080040 private native void nativeDispose();
41
Jeff Brown4532e612012-04-05 14:27:12 -070042 public InputApplicationHandle(Object appWindowToken) {
Jeff Brown928e0542011-01-10 11:17:36 -080043 this.appWindowToken = appWindowToken;
44 }
45
46 @Override
47 protected void finalize() throws Throwable {
Jeff Browncc4f7db2011-08-30 20:34:48 -070048 try {
49 nativeDispose();
50 } finally {
51 super.finalize();
52 }
Jeff Brown928e0542011-01-10 11:17:36 -080053 }
54}