Add MediaCommunicationManager#getVersion()

Bug: 179634039
Test: Passed test
Change-Id: I9413936558d809f7076c1d6ec11b2d4165089ad3
This commit is contained in:
Hyundo Moon
2021-02-08 15:31:56 +09:00
parent 4f5f93cbd7
commit 87e7346178
2 changed files with 21 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ package android.media {
}
public class MediaCommunicationManager {
method @IntRange(from=1) public int getVersion();
}
public class MediaController2 implements java.lang.AutoCloseable {

View File

@@ -15,6 +15,7 @@
*/
package android.media;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.SystemService;
import android.content.Context;
@@ -30,6 +31,16 @@ import com.android.modules.utils.build.SdkLevel;
public class MediaCommunicationManager {
private static final String TAG = "MediaCommunicationManager";
/**
* The manager version used from beginning.
*/
private static final int VERSION_1 = 1;
/**
* Current manager version.
*/
private static final int CURRENT_VERSION = VERSION_1;
private final Context mContext;
private final IMediaCommunicationService mService;
@@ -43,7 +54,14 @@ public class MediaCommunicationManager {
mContext = context;
mService = IMediaCommunicationService.Stub.asInterface(
MediaFrameworkInitializer.getMediaServiceManager()
.getMediaCommunicationServiceRegisterer()
.get());
.getMediaCommunicationServiceRegisterer()
.get());
}
/**
* Gets the version of this {@link MediaCommunicationManager}.
*/
public @IntRange(from = 1) int getVersion() {
return CURRENT_VERSION;
}
}