Merge "TIAF API review: remove prepare()" into tm-dev
This commit is contained in:
commit
365b716cb6
@ -26139,7 +26139,6 @@ package android.media.tv.interactive {
|
||||
|
||||
public final class TvInteractiveAppManager {
|
||||
method @NonNull public java.util.List<android.media.tv.interactive.TvInteractiveAppServiceInfo> getTvInteractiveAppServiceList();
|
||||
method public void prepare(@NonNull String, int);
|
||||
method public void registerAppLinkInfo(@NonNull String, @NonNull android.media.tv.interactive.AppLinkInfo);
|
||||
method public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback);
|
||||
method public void sendAppLinkCommand(@NonNull String, @NonNull android.os.Bundle);
|
||||
@ -26191,7 +26190,6 @@ package android.media.tv.interactive {
|
||||
method public void onAppLinkCommand(@NonNull android.os.Bundle);
|
||||
method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
|
||||
method @Nullable public abstract android.media.tv.interactive.TvInteractiveAppService.Session onCreateSession(@NonNull String, int);
|
||||
method public abstract void onPrepare(int);
|
||||
method public void onRegisterAppLinkInfo(@NonNull android.media.tv.interactive.AppLinkInfo);
|
||||
method public void onUnregisterAppLinkInfo(@NonNull android.media.tv.interactive.AppLinkInfo);
|
||||
field public static final String COMMAND_PARAMETER_KEY_CHANGE_CHANNEL_QUIETLY = "command_change_channel_quietly";
|
||||
|
@ -34,7 +34,6 @@ import android.view.Surface;
|
||||
*/
|
||||
interface ITvInteractiveAppManager {
|
||||
List<TvInteractiveAppServiceInfo> getTvInteractiveAppServiceList(int userId);
|
||||
void prepare(String tiasId, int type, int userId);
|
||||
void registerAppLinkInfo(String tiasId, in AppLinkInfo info, int userId);
|
||||
void unregisterAppLinkInfo(String tiasId, in AppLinkInfo info, int userId);
|
||||
void sendAppLinkCommand(String tiasId, in Bundle command, int userId);
|
||||
|
@ -32,7 +32,6 @@ oneway interface ITvInteractiveAppService {
|
||||
void unregisterCallback(in ITvInteractiveAppServiceCallback callback);
|
||||
void createSession(in InputChannel channel, in ITvInteractiveAppSessionCallback callback,
|
||||
in String iAppServiceId, int type);
|
||||
void prepare(int type);
|
||||
void registerAppLinkInfo(in AppLinkInfo info);
|
||||
void unregisterAppLinkInfo(in AppLinkInfo info);
|
||||
void sendAppLinkCommand(in Bundle command);
|
||||
|
@ -30,7 +30,6 @@ import android.media.tv.BroadcastInfoResponse;
|
||||
import android.media.tv.TvContentRating;
|
||||
import android.media.tv.TvInputManager;
|
||||
import android.media.tv.TvTrackInfo;
|
||||
import android.media.tv.interactive.TvInteractiveAppServiceInfo.InteractiveAppType;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -774,25 +773,6 @@ public final class TvInteractiveAppManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares TV Interactive App service environment for the given type.
|
||||
*
|
||||
* <p>This method brings up the corresponding {@link TvInteractiveAppService} and prepare needed
|
||||
* resources. It's used to set up the resources in advance, or handle non-session operations.
|
||||
*
|
||||
* @param tvIAppServiceId The ID of TV interactive service to prepare the resources. The
|
||||
* ID can be found in {@link TvInteractiveAppServiceInfo#getId()}.
|
||||
*
|
||||
* @see TvInteractiveAppService.Session
|
||||
*/
|
||||
public void prepare(@NonNull String tvIAppServiceId, @InteractiveAppType int type) {
|
||||
try {
|
||||
mService.prepare(tvIAppServiceId, type, mUserId);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an Android application link info record which can be used to launch the specific
|
||||
* Android application by TV interactive App RTE.
|
||||
|
@ -217,11 +217,6 @@ public abstract class TvInteractiveAppService extends Service {
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(int type) {
|
||||
onPrepare(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAppLinkInfo(AppLinkInfo appLinkInfo) {
|
||||
onRegisterAppLinkInfo(appLinkInfo);
|
||||
@ -240,11 +235,6 @@ public abstract class TvInteractiveAppService extends Service {
|
||||
return tvIAppServiceBinder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares TV Interactive App service for the given type.
|
||||
*/
|
||||
public abstract void onPrepare(@TvInteractiveAppServiceInfo.InteractiveAppType int type);
|
||||
|
||||
/**
|
||||
* Called when a request to register an Android application link info record is received.
|
||||
*/
|
||||
|
@ -664,42 +664,6 @@ public class TvInteractiveAppManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(String tiasId, int type, int userId) {
|
||||
// TODO: bind service
|
||||
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), userId, "prepare");
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mLock) {
|
||||
UserState userState = getOrCreateUserStateLocked(resolvedUserId);
|
||||
TvInteractiveAppState iAppState = userState.mIAppMap.get(tiasId);
|
||||
if (iAppState == null) {
|
||||
Slogf.e(TAG, "failed to prepare TIAS - unknown TIAS id " + tiasId);
|
||||
return;
|
||||
}
|
||||
ComponentName componentName = iAppState.mInfo.getComponent();
|
||||
ServiceState serviceState = userState.mServiceStateMap.get(componentName);
|
||||
if (serviceState == null) {
|
||||
serviceState = new ServiceState(
|
||||
componentName, tiasId, resolvedUserId, true, type);
|
||||
userState.mServiceStateMap.put(componentName, serviceState);
|
||||
updateServiceConnectionLocked(componentName, resolvedUserId);
|
||||
} else if (serviceState.mService != null) {
|
||||
serviceState.mService.prepare(type);
|
||||
} else {
|
||||
serviceState.mPendingPrepare = true;
|
||||
serviceState.mPendingPrepareType = type;
|
||||
updateServiceConnectionLocked(componentName, resolvedUserId);
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slogf.e(TAG, "error in prepare", e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAppLinkInfo(String tiasId, AppLinkInfo appLinkInfo, int userId) {
|
||||
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
|
||||
@ -1705,7 +1669,6 @@ public class TvInteractiveAppManagerService extends SystemService {
|
||||
}
|
||||
|
||||
boolean shouldBind = (!serviceState.mSessionTokens.isEmpty())
|
||||
|| (serviceState.mPendingPrepare)
|
||||
|| (!serviceState.mPendingAppLinkInfo.isEmpty())
|
||||
|| (!serviceState.mPendingAppLinkCommand.isEmpty());
|
||||
|
||||
@ -1857,22 +1820,13 @@ public class TvInteractiveAppManagerService extends SystemService {
|
||||
private final List<Pair<AppLinkInfo, Boolean>> mPendingAppLinkInfo = new ArrayList<>();
|
||||
private final List<Bundle> mPendingAppLinkCommand = new ArrayList<>();
|
||||
|
||||
private boolean mPendingPrepare = false;
|
||||
private Integer mPendingPrepareType = null;
|
||||
private ITvInteractiveAppService mService;
|
||||
private ServiceCallback mCallback;
|
||||
private boolean mBound;
|
||||
private boolean mReconnecting;
|
||||
|
||||
private ServiceState(ComponentName component, String tias, int userId) {
|
||||
this(component, tias, userId, false, null);
|
||||
}
|
||||
|
||||
private ServiceState(ComponentName component, String tias, int userId,
|
||||
boolean pendingPrepare, Integer prepareType) {
|
||||
mComponent = component;
|
||||
mPendingPrepare = pendingPrepare;
|
||||
mPendingPrepareType = prepareType;
|
||||
mConnection = new InteractiveAppServiceConnection(component, userId);
|
||||
mIAppServiceId = tias;
|
||||
}
|
||||
@ -1920,19 +1874,6 @@ public class TvInteractiveAppManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
if (serviceState.mPendingPrepare) {
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
serviceState.mService.prepare(serviceState.mPendingPrepareType);
|
||||
serviceState.mPendingPrepare = false;
|
||||
serviceState.mPendingPrepareType = null;
|
||||
} catch (RemoteException e) {
|
||||
Slogf.e(TAG, "error in prepare when onServiceConnected", e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
|
||||
if (!serviceState.mPendingAppLinkInfo.isEmpty()) {
|
||||
for (Iterator<Pair<AppLinkInfo, Boolean>> it =
|
||||
serviceState.mPendingAppLinkInfo.iterator();
|
||||
|
Loading…
x
Reference in New Issue
Block a user