Require uptime < 24h to use APF adb commands
In order to prevent APF adb commands to be used in production, they
check that uptime is < 24h.
In the unlikely case this leads to test failures, a more elaborate
solution can be implemented (e.g. restarting / disconnecting IpClient
after some timeout).
Test: TH
Change-Id: Ida39b0c40cabe84d32bf634d28d3e5530b4d40ed
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index 03abfc3..848b4de 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -1414,6 +1414,11 @@
* Handle "adb shell cmd apf" command.
*/
public String apfShellCommand(String cmd, @Nullable String optarg) {
+ final long oneDayInMs = 86400 * 1000;
+ if (SystemClock.elapsedRealtime() >= oneDayInMs) {
+ return "Error: This test interface requires uptime < 24h";
+ }
+
final CompletableFuture<String> result = new CompletableFuture<>();
getHandler().post(() -> {