Merge "Add IBinder extensions to TvInputService" am: 7f7a8d7bbb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/10550195 Change-Id: Ic3e92b87b9ff8fff7a2204c3f68fd2c36d7549db
This commit is contained in:
@@ -4936,6 +4936,7 @@ package android.media.tv {
|
||||
}
|
||||
|
||||
public abstract class TvInputService extends android.app.Service {
|
||||
method @Nullable public android.os.IBinder createExtension();
|
||||
method @Nullable public android.media.tv.TvInputInfo onHardwareAdded(android.media.tv.TvInputHardwareInfo);
|
||||
method @Nullable public String onHardwareRemoved(android.media.tv.TvInputHardwareInfo);
|
||||
method @Nullable public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo);
|
||||
|
||||
@@ -152,7 +152,7 @@ public abstract class TvInputService extends Service {
|
||||
|
||||
@Override
|
||||
public final IBinder onBind(Intent intent) {
|
||||
return new ITvInputService.Stub() {
|
||||
ITvInputService.Stub tvInputServiceBinder = new ITvInputService.Stub() {
|
||||
@Override
|
||||
public void registerCallback(ITvInputServiceCallback cb) {
|
||||
if (cb != null) {
|
||||
@@ -181,7 +181,8 @@ public abstract class TvInputService extends Service {
|
||||
args.arg2 = cb;
|
||||
args.arg3 = inputId;
|
||||
args.arg4 = sessionId;
|
||||
mServiceHandler.obtainMessage(ServiceHandler.DO_CREATE_SESSION, args).sendToTarget();
|
||||
mServiceHandler.obtainMessage(ServiceHandler.DO_CREATE_SESSION,
|
||||
args).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,6 +229,26 @@ public abstract class TvInputService extends Service {
|
||||
deviceInfo).sendToTarget();
|
||||
}
|
||||
};
|
||||
IBinder ext = createExtension();
|
||||
if (ext != null) {
|
||||
tvInputServiceBinder.setExtension(ext);
|
||||
}
|
||||
return tvInputServiceBinder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link android.os.Binder}
|
||||
*
|
||||
* <p> if an extension is provided on top of existing {@link TvInputService}; otherwise,
|
||||
* return {@code null}. Override to provide extended interface.
|
||||
*
|
||||
* @see android.os.Binder#setExtension(IBinder)
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
@SystemApi
|
||||
public IBinder createExtension() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4876,6 +4876,7 @@ package android.media.tv {
|
||||
}
|
||||
|
||||
public abstract class TvInputService extends android.app.Service {
|
||||
method @Nullable public android.os.IBinder createExtension();
|
||||
method @Nullable public android.media.tv.TvInputInfo onHardwareAdded(android.media.tv.TvInputHardwareInfo);
|
||||
method @Nullable public String onHardwareRemoved(android.media.tv.TvInputHardwareInfo);
|
||||
method @Nullable public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo);
|
||||
|
||||
Reference in New Issue
Block a user