Tests: 5 second delay for LinphoneService ready
This commit is contained in:
parent
8898881d66
commit
c14c020053
2 changed files with 17 additions and 3 deletions
|
@ -86,12 +86,12 @@
|
|||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="ContactPickerActivityNew" android:launchMode="singleTop">
|
||||
<activity android:name="ContactPickerActivityNew">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="ContactPickerActivityOld" android:launchMode="singleTop">
|
||||
<activity android:name="ContactPickerActivityOld">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -69,7 +69,12 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
private Handler mHandler = new Handler();
|
||||
private static LinphoneService instance;
|
||||
|
||||
public static boolean isReady() { return (instance!=null); }
|
||||
// private static boolean mTestDelayElapsed; // add a timer for testing
|
||||
private static boolean mTestDelayElapsed = true; // no timer
|
||||
|
||||
public static boolean isReady() {
|
||||
return mTestDelayElapsed && instance!=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException service not instantiated
|
||||
|
@ -147,6 +152,15 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
}
|
||||
|
||||
startForegroundCompat(NOTIF_ID, mNotif);
|
||||
|
||||
if (!mTestDelayElapsed) {
|
||||
// Only used when testing. Simulates a 5 seconds delay for launching service
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override public void run() {
|
||||
mTestDelayElapsed = true;
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue