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

Commit c566ca54 authored by Dongwon Kang's avatar Dongwon Kang
Browse files

TIF: fix a regression introduced while addressing merge conflict in TIS

Plus, a small code refactoring on DO_CREATE_SESSION for lower indentation
depth.

Bug: 16833301
Change-Id: Id0cb2df26015ea8286a1cf03024c44fa15f2628e
parent 4b4038a0
Loading
Loading
Loading
Loading
+35 −33
Original line number Diff line number Diff line
@@ -1057,6 +1057,7 @@ public abstract class TvInputService extends Service {
        private TvInputManager.Session mHardwareSession;
        private ITvInputSession mProxySession;
        private ITvInputSessionCallback mProxySessionCallback;
        private Handler mServiceHandler;

        /**
         * Returns the hardware TV input ID the external device is connected to.
@@ -1085,7 +1086,7 @@ public abstract class TvInputService extends Service {
                    args.arg3 = null;
                    onRelease();
                }
                mHandler.obtainMessage(ServiceHandler.DO_NOTIFY_SESSION_CREATED, args)
                mServiceHandler.obtainMessage(ServiceHandler.DO_NOTIFY_SESSION_CREATED, args)
                        .sendToTarget();
            }

@@ -1209,8 +1210,8 @@ public abstract class TvInputService extends Service {
                    InputChannel channel = (InputChannel) args.arg1;
                    ITvInputSessionCallback cb = (ITvInputSessionCallback) args.arg2;
                    String inputId = (String) args.arg3;
                    Session sessionImpl = onCreateSession(inputId);
                    args.recycle();
                    Session sessionImpl = onCreateSession(inputId);
                    if (sessionImpl == null) {
                        try {
                            // Failed to create a session.
@@ -1218,7 +1219,8 @@ public abstract class TvInputService extends Service {
                        } catch (RemoteException e) {
                            Log.e(TAG, "error in onSessionCreated");
                        }
                    } else {
                        return;
                    }
                    sessionImpl.setSessionCallback(cb);
                    ITvInputSession stub = new ITvInputSessionWrapper(TvInputService.this,
                            sessionImpl, channel);
@@ -1226,15 +1228,7 @@ public abstract class TvInputService extends Service {
                        HardwareSession proxySession =
                                ((HardwareSession) sessionImpl);
                        String harewareInputId = proxySession.getHardwareInputId();
                            if (!TextUtils.isEmpty(harewareInputId)) {
                                // TODO: check if the given ID is really hardware TV input.
                                proxySession.mProxySession = stub;
                                proxySession.mProxySessionCallback = cb;
                                TvInputManager manager = (TvInputManager) getSystemService(
                                        Context.TV_INPUT_SERVICE);
                                manager.createSession(harewareInputId,
                                        proxySession.mHardwareSessionCallback, mServiceHandler);
                            } else {
                        if (TextUtils.isEmpty(harewareInputId)) {
                            sessionImpl.onRelease();
                            Log.w(TAG, "Hardware input id is not setup yet.");
                            try {
@@ -1242,7 +1236,16 @@ public abstract class TvInputService extends Service {
                            } catch (RemoteException e) {
                                Log.e(TAG, "error in onSessionCreated");
                            }
                            return;
                        }
                        // TODO: check if the given ID is really hardware TV input.
                        proxySession.mProxySession = stub;
                        proxySession.mProxySessionCallback = cb;
                        proxySession.mServiceHandler = mServiceHandler;
                        TvInputManager manager = (TvInputManager) getSystemService(
                                Context.TV_INPUT_SERVICE);
                        manager.createSession(harewareInputId,
                                proxySession.mHardwareSessionCallback, mServiceHandler);
                    } else {
                        SomeArgs someArgs = SomeArgs.obtain();
                        someArgs.arg1 = stub;
@@ -1251,7 +1254,6 @@ public abstract class TvInputService extends Service {
                        mServiceHandler.obtainMessage(ServiceHandler.DO_NOTIFY_SESSION_CREATED,
                                someArgs).sendToTarget();
                    }
                    }
                    return;
                }
                case DO_NOTIFY_SESSION_CREATED: {