Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f7a8d7b authored by Henry Fang's avatar Henry Fang Committed by Android (Google) Code Review
Browse files

Merge "Add IBinder extensions to TvInputService"

parents 5a6e438b 86e90122
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+23 −2
Original line number Diff line number Diff line
@@ -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;
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -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);