comparison app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 477:d7461da8145b stable-1.9.3-9

only bind to the MonitorService for localhost monitor connections
author Carl Byington <carl@five-ten-sg.com>
date Sun, 20 Oct 2019 14:47:27 -0700
parents 2cc170e3fc9b
children 3a83f40439d7
comparison
equal deleted inserted replaced
476:186d340afd3b 477:d7461da8145b
187 187
188 class MyServiceConnection implements ServiceConnection { 188 class MyServiceConnection implements ServiceConnection {
189 public void onServiceConnected(ComponentName className, IBinder service) { 189 public void onServiceConnected(ComponentName className, IBinder service) {
190 bound = service; 190 bound = service;
191 Log.i(TAG, "bound to service"); 191 Log.i(TAG, "bound to service");
192 192 DoConnect();
193 }
194 public void DoConnect() {
193 try { 195 try {
194 InetAddress serverAddr = InetAddress.getByName(target); 196 InetAddress serverAddr = InetAddress.getByName(target);
195 int tries = 0; 197 int tries = 0;
196 while (tries < 10) { 198 while (tries < 10) {
197 try { 199 try {
282 keymap.put(0x83, vt320.KEY_F20); // vk_f20 284 keymap.put(0x83, vt320.KEY_F20); // vk_f20
283 keymap.put(0x84, vt320.KEY_F21); // vk_f21 285 keymap.put(0x84, vt320.KEY_F21); // vk_f21
284 keymap.put(0x85, vt320.KEY_F22); // vk_f22 286 keymap.put(0x85, vt320.KEY_F22); // vk_f22
285 keymap.put(0x86, vt320.KEY_F23); // vk_f23 287 keymap.put(0x86, vt320.KEY_F23); // vk_f23
286 keymap.put(0x87, vt320.KEY_F24); // vk_f24 288 keymap.put(0x87, vt320.KEY_F24); // vk_f24
287 // bind to the monitor service 289 if (target == "localhost") {
288 Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService"); 290 // bind to the monitor service for localhost connections
289 intent.setPackage("com.five_ten_sg.connectbot.monitor"); 291 Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService");
290 parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE); 292 intent.setPackage("com.five_ten_sg.connectbot.monitor");
293 parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE);
294 }
295 else {
296 // direct socket connection to external device
297 monitor_connection.DoConnect();
298 }
291 Log.i(TAG, "constructor"); 299 Log.i(TAG, "constructor");
292 } 300 }
293 301
294 302
295 public void Disconnect() { 303 public void Disconnect() {