diff --git a/java/androidpayload/library/src/com/metasploit/meterpreter/AndroidMeterpreter.java b/java/androidpayload/library/src/com/metasploit/meterpreter/AndroidMeterpreter.java index f30de616..3e2d5c4b 100644 --- a/java/androidpayload/library/src/com/metasploit/meterpreter/AndroidMeterpreter.java +++ b/java/androidpayload/library/src/com/metasploit/meterpreter/AndroidMeterpreter.java @@ -68,18 +68,20 @@ public class AndroidMeterpreter extends Meterpreter { final Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { public void run() { - try { - context = (Context) currentApplication.invoke(null, (Object[]) null); - } catch (Exception e) { - e.printStackTrace(); - } synchronized (contextWaiter) { + try { + context = (Context) currentApplication.invoke(null, (Object[]) null); + } catch (Exception e) { + e.printStackTrace(); + } contextWaiter.notify(); } } }); synchronized (contextWaiter) { - contextWaiter.wait(); + if (context == null) { + contextWaiter.wait(100); + } } } }