diff options
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/input/InputManagerService.java | 36 |
2 files changed, 36 insertions, 3 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 02c4d5a..729c3f3 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -726,6 +726,7 @@ class ServerThread extends Thread { final StatusBarManagerService statusBarF = statusBar; final DreamManagerService dreamyF = dreamy; final InputManagerService inputManagerF = inputManager; + final BluetoothService bluetoothF = bluetooth; // We now tell the activity manager it is okay to run third party // code. It will call back into us once it has gotten to the state @@ -838,7 +839,7 @@ class ServerThread extends Thread { reportWtf("making DreamManagerService ready", e); } try { - if (inputManagerF != null) inputManagerF.systemReady(); + if (inputManagerF != null) inputManagerF.systemReady(bluetoothF); } catch (Throwable e) { reportWtf("making InputManagerService ready", e); } diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java index a4ed31c..189a9c7 100644 --- a/services/java/com/android/server/input/InputManagerService.java +++ b/services/java/com/android/server/input/InputManagerService.java @@ -26,6 +26,8 @@ import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; import android.Manifest; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; @@ -56,6 +58,7 @@ import android.os.Process; import android.os.RemoteException; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; +import android.server.BluetoothService; import android.util.Log; import android.util.Slog; import android.util.SparseArray; @@ -106,6 +109,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. private final Callbacks mCallbacks; private final InputManagerHandler mHandler; private boolean mSystemReady; + private BluetoothService mBluetoothService; // Persistent data store. Must be locked each time during use. private final PersistentDataStore mDataStore = new PersistentDataStore(); @@ -167,6 +171,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. int repeat, int token); private static native void nativeCancelVibrate(int ptr, int deviceId, int token); private static native void nativeReloadKeyboardLayouts(int ptr); + private static native void nativeReloadDeviceAliases(int ptr); private static native String nativeDump(int ptr); private static native void nativeMonitor(int ptr); @@ -217,12 +222,12 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. updateShowTouchesFromSettings(); } - public void systemReady() { + public void systemReady(BluetoothService bluetoothService) { if (DEBUG) { Slog.d(TAG, "System ready."); } + mBluetoothService = bluetoothService; mSystemReady = true; - reloadKeyboardLayouts(); IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); @@ -237,12 +242,30 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. reloadKeyboardLayouts(); } }, filter, null, mHandler); + + filter = new IntentFilter(BluetoothDevice.ACTION_ALIAS_CHANGED); + mContext.registerReceiver(new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (DEBUG) { + Slog.d(TAG, "Bluetooth alias changed, reloading device names."); + } + reloadDeviceAliases(); + } + }, filter, null, mHandler); + + reloadKeyboardLayouts(); + reloadDeviceAliases(); } private void reloadKeyboardLayouts() { nativeReloadKeyboardLayouts(mPtr); } + private void reloadDeviceAliases() { + nativeReloadDeviceAliases(mPtr); + } + public void setDisplaySize(int displayId, int width, int height, int externalWidth, int externalHeight) { if (width <= 0 || height <= 0 || externalWidth <= 0 || externalHeight <= 0) { @@ -1121,6 +1144,15 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. return result; } + // Native callback. + private String getDeviceAlias(String uniqueId) { + if (mBluetoothService != null && + BluetoothAdapter.checkBluetoothAddress(uniqueId)) { + return mBluetoothService.getRemoteAlias(uniqueId); + } + return null; + } + /** * Callback interface implemented by the Window Manager. |