mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
setSystemTime: Try two methods
This commit is contained in:
@@ -257,10 +257,17 @@ public class BaseAndroidTest extends TestCase
|
|||||||
cal.get(Calendar.YEAR),
|
cal.get(Calendar.YEAR),
|
||||||
cal.get(Calendar.SECOND));
|
cal.get(Calendar.SECOND));
|
||||||
|
|
||||||
|
// Set time (method 1)
|
||||||
// Run twice to override daylight saving time
|
// Run twice to override daylight saving time
|
||||||
device.executeShellCommand("date " + date);
|
device.executeShellCommand("date " + date);
|
||||||
device.executeShellCommand("date " + date);
|
device.executeShellCommand("date " + date);
|
||||||
|
|
||||||
|
// Set time (method 2)
|
||||||
|
// Run in addition to the method above because one of these mail fail, depending
|
||||||
|
// on the Android API version.
|
||||||
|
command = String.format("date -u @%d", cal.getTimeInMillis() / 1000);
|
||||||
|
device.executeShellCommand(command);
|
||||||
|
|
||||||
// Wait for system events to settle
|
// Wait for system events to settle
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user