/services/java/com/android/server/input/InputApplicationHandle.java

https://github.com/aizuzi/platform_frameworks_base · Java · 54 lines · 20 code · 8 blank · 26 comment · 0 complexity · e6780b4ea47098fa7b912f8476feda51 MD5 · raw file

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