trancoding: lazy-start transcoding service
bug: 186387244 test: atest MediaTranscodeManagerTest; unit tests Change-Id: I354f32d062b9a46ddfc9f86d5f79c778809799a4
This commit is contained in:
@@ -45,12 +45,21 @@ public class MediaServiceManager {
|
||||
*/
|
||||
public static final class ServiceRegisterer {
|
||||
private final String mServiceName;
|
||||
private final boolean mLazyStart;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public ServiceRegisterer(String serviceName, boolean lazyStart) {
|
||||
mServiceName = serviceName;
|
||||
mLazyStart = lazyStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public ServiceRegisterer(String serviceName) {
|
||||
mServiceName = serviceName;
|
||||
this(serviceName, false /*lazyStart*/);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +70,9 @@ public class MediaServiceManager {
|
||||
*/
|
||||
@Nullable
|
||||
public IBinder get() {
|
||||
if (mLazyStart) {
|
||||
return ServiceManager.waitForService(mServiceName);
|
||||
}
|
||||
return ServiceManager.getService(mServiceName);
|
||||
}
|
||||
}
|
||||
@@ -78,7 +90,7 @@ public class MediaServiceManager {
|
||||
*/
|
||||
@NonNull
|
||||
public ServiceRegisterer getMediaTranscodingServiceRegisterer() {
|
||||
return new ServiceRegisterer(MEDIA_TRANSCODING_SERVICE);
|
||||
return new ServiceRegisterer(MEDIA_TRANSCODING_SERVICE, true /*lazyStart*/);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user