[DK3] Send onPause/onResume keepalive callbacks

Test: CTS in the patch immediately on top of this, [DK4]
Change-Id: I208ceceb37c7977452479361f70f046fabafb37a
This commit is contained in:
Chalard Jean
2023-01-19 23:14:02 +09:00
committed by chiachangwang
parent f0b261e7cc
commit bdb8282604
5 changed files with 163 additions and 14 deletions

View File

@@ -2213,9 +2213,13 @@ public class ConnectivityManager {
/** 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) {}
@@ -2313,6 +2317,18 @@ public class ConnectivityManager {
}
}
@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();
@@ -2326,6 +2342,19 @@ public class ConnectivityManager {
mExecutor.shutdown();
}
@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();