[DK3] Send onPause/onResume keepalive callbacks
Test: CTS in the patch immediately on top of this, [DK4]
Change-Id: I208ceceb37c7977452479361f70f046fabafb37a
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 17389b4..497c105 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -2213,9 +2213,13 @@
/** The requested keepalive was successfully started. */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void onStarted() {}
+ /** The keepalive was resumed after being paused by the system. */
+ public void onResumed() {}
/** The keepalive was successfully stopped. */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void onStopped() {}
+ /** The keepalive was paused automatically by the system. */
+ public void onPaused() {}
/** An error occurred. */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void onError(int error) {}
@@ -2314,6 +2318,18 @@
}
@Override
+ public void onResumed() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> {
+ callback.onResumed();
+ });
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public void onStopped() {
final long token = Binder.clearCallingIdentity();
try {
@@ -2327,6 +2343,19 @@
}
@Override
+ public void onPaused() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> {
+ callback.onPaused();
+ });
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ mExecutor.shutdown();
+ }
+
+ @Override
public void onError(int error) {
final long token = Binder.clearCallingIdentity();
try {