diff options
author | Hall Liu <hallliu@google.com> | 2021-03-09 20:24:50 -0800 |
---|---|---|
committer | Hall Liu <hallliu@google.com> | 2021-03-09 20:29:40 -0800 |
commit | eb7c9eaf16b3a740e1cd93b296f65ad543b130bd (patch) | |
tree | ec71be7cbde0a044798159d8fcd1dddda3bde7da | |
parent | 1e21d8530b5ff5c266e278115c5bd901f502c566 (diff) |
Add onBindClient for testing
Add an overrideable method in ConnectionService that gets called when
telecom binds, since onBind is final and it's unsafe to make not-final.
Bug: 181057509
Test: atest CtsTelecomTestCases
Change-Id: I80088185402789fec499b8659ca8b74bcec05748
-rw-r--r-- | core/api/test-current.txt | 4 | ||||
-rwxr-xr-x | telecomm/java/android/telecom/ConnectionService.java | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 68721418b407..a3203275ad18 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -1600,6 +1600,10 @@ package android.telecom { method @NonNull public android.telecom.ConnectionRequest.Builder setVideoState(int); } + public abstract class ConnectionService extends android.app.Service { + method public void onBindClient(@Nullable android.content.Intent); + } + } package android.telephony { diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 580513c12453..b022154ea917 100755 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.app.Service; import android.content.ComponentName; import android.content.Intent; @@ -1887,6 +1888,7 @@ public abstract class ConnectionService extends Service { /** {@inheritDoc} */ @Override public final IBinder onBind(Intent intent) { + onBindClient(intent); return mBinder; } @@ -1897,6 +1899,13 @@ public abstract class ConnectionService extends Service { return super.onUnbind(intent); } + /** + * Used for testing to let the test suite know when the connection service has been bound. + * @hide + */ + @TestApi + public void onBindClient(@Nullable Intent intent) { + } /** * This can be used by telecom to either create a new outgoing conference call or attach |