diff options
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/p2p/WifiP2pService.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index f0aef92..ba8ffec 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -30,6 +30,7 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.content.res.Resources; import android.net.IConnectivityManager; import android.net.ConnectivityManager; @@ -68,6 +69,7 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Slog; import android.util.SparseArray; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -1927,6 +1929,26 @@ public class WifiP2pService extends IWifiP2pManager.Stub { break; } + if ((r.getConfiguration().uiMode & Configuration.UI_MODE_TYPE_APPLIANCE) == + Configuration.UI_MODE_TYPE_APPLIANCE) { + // For appliance devices, add a key listener which accepts. + dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { + + @Override + public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { + // TODO: make the actual key come from a config value. + if (keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) { + sendMessage(PEER_CONNECTION_USER_ACCEPT); + dialog.dismiss(); + return true; + } + return false; + } + }); + // TODO: add timeout for this dialog. + // TODO: update UI in appliance mode to tell user what to do. + } + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.show(); } |