|
30 | 30 | import android.content.Intent; |
31 | 31 | import android.content.IntentFilter; |
32 | 32 | import android.content.pm.PackageManager; |
| 33 | +import android.content.res.Configuration; |
33 | 34 | import android.content.res.Resources; |
34 | 35 | import android.net.IConnectivityManager; |
35 | 36 | import android.net.ConnectivityManager; |
|
68 | 69 | import android.text.TextUtils; |
69 | 70 | import android.util.Slog; |
70 | 71 | import android.util.SparseArray; |
| 72 | +import android.view.KeyEvent; |
71 | 73 | import android.view.LayoutInflater; |
72 | 74 | import android.view.View; |
73 | 75 | import android.view.ViewGroup; |
@@ -1891,6 +1893,26 @@ public void onCancel(DialogInterface arg0) { |
1891 | 1893 | break; |
1892 | 1894 | } |
1893 | 1895 |
|
| 1896 | + if ((r.getConfiguration().uiMode & Configuration.UI_MODE_TYPE_APPLIANCE) == |
| 1897 | + Configuration.UI_MODE_TYPE_APPLIANCE) { |
| 1898 | + // For appliance devices, add a key listener which accepts. |
| 1899 | + dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { |
| 1900 | + |
| 1901 | + @Override |
| 1902 | + public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { |
| 1903 | + // TODO: make the actual key come from a config value. |
| 1904 | + if (keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) { |
| 1905 | + sendMessage(PEER_CONNECTION_USER_ACCEPT); |
| 1906 | + dialog.dismiss(); |
| 1907 | + return true; |
| 1908 | + } |
| 1909 | + return false; |
| 1910 | + } |
| 1911 | + }); |
| 1912 | + // TODO: add timeout for this dialog. |
| 1913 | + // TODO: update UI in appliance mode to tell user what to do. |
| 1914 | + } |
| 1915 | + |
1894 | 1916 | dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); |
1895 | 1917 | dialog.show(); |
1896 | 1918 | } |
|
0 commit comments