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