Skip to content

Commit 8827359

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Merge "Notify applications when input devices change."
2 parents d4fecc2 + af9e8d3 commit 8827359

File tree

17 files changed

+742
-220
lines changed

17 files changed

+742
-220
lines changed

Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ LOCAL_SRC_FILES += \
111111
core/java/android/database/IContentObserver.aidl \
112112
core/java/android/hardware/ISerialManager.aidl \
113113
core/java/android/hardware/input/IInputManager.aidl \
114+
core/java/android/hardware/input/IInputDevicesChangedListener.aidl \
114115
core/java/android/hardware/usb/IUsbManager.aidl \
115116
core/java/android/net/IConnectivityManager.aidl \
116117
core/java/android/net/INetworkManagementEventObserver.aidl \

api/current.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9822,10 +9822,20 @@ package android.hardware {
98229822
package android.hardware.input {
98239823

98249824
public final class InputManager {
9825+
method public android.view.InputDevice getInputDevice(int);
9826+
method public int[] getInputDeviceIds();
9827+
method public void registerInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener, android.os.Handler);
9828+
method public void unregisterInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener);
98259829
field public static final java.lang.String ACTION_QUERY_KEYBOARD_LAYOUTS = "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS";
98269830
field public static final java.lang.String META_DATA_KEYBOARD_LAYOUTS = "android.hardware.input.metadata.KEYBOARD_LAYOUTS";
98279831
}
98289832

9833+
public static abstract interface InputManager.InputDeviceListener {
9834+
method public abstract void onInputDeviceAdded(int);
9835+
method public abstract void onInputDeviceChanged(int);
9836+
method public abstract void onInputDeviceRemoved(int);
9837+
}
9838+
98299839
}
98309840

98319841
package android.hardware.usb {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2012 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 android.hardware.input;
18+
19+
/** @hide */
20+
interface IInputDevicesChangedListener {
21+
/* Called when input devices changed, such as a device being added,
22+
* removed or changing configuration.
23+
*
24+
* The parameter is an array of pairs (deviceId, generation) indicating the current
25+
* device id and generation of all input devices. The client can determine what
26+
* has happened by comparing the result to its prior observations.
27+
*/
28+
oneway void onInputDevicesChanged(in int[] deviceIdAndGeneration);
29+
}

core/java/android/hardware/input/IInputManager.aidl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package android.hardware.input;
1818

1919
import android.hardware.input.KeyboardLayout;
20+
import android.hardware.input.IInputDevicesChangedListener;
2021
import android.view.InputDevice;
2122
import android.view.InputEvent;
2223

@@ -42,4 +43,7 @@ interface IInputManager {
4243
String getKeyboardLayoutForInputDevice(String inputDeviceDescriptor);
4344
void setKeyboardLayoutForInputDevice(String inputDeviceDescriptor,
4445
String keyboardLayoutDescriptor);
46+
47+
// Registers an input devices changed listener.
48+
void registerInputDevicesChangedListener(IInputDevicesChangedListener listener);
4549
}

0 commit comments

Comments
 (0)