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

Commit f3a2ac35 authored by Henry Fang's avatar Henry Fang Committed by Automerger Merge Worker
Browse files

Merge "Fix permission error of binding to TvInputService" am: e1215118 am:...

Merge "Fix permission error of binding to TvInputService" am: e1215118 am: 37c71286 am: 7563aa2b am: f6675682

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1895043

Change-Id: I82333867c1c68fd27e19c20d62e00119c8919fc7
parents a46305c1 f6675682
Loading
Loading
Loading
Loading
+29 −14
Original line number Diff line number Diff line
@@ -3012,23 +3012,35 @@ public final class TvInputManagerService extends SystemService {
        public void addHardwareInput(int deviceId, TvInputInfo inputInfo) {
            ensureHardwarePermission();
            ensureValidInput(inputInfo);
            final long identity = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    mTvInputHardwareManager.addHardwareInput(deviceId, inputInfo);
                    addHardwareInputLocked(inputInfo);
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        public void addHdmiInput(int id, TvInputInfo inputInfo) {
            ensureHardwarePermission();
            ensureValidInput(inputInfo);
            final long identity = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    mTvInputHardwareManager.addHdmiInput(id, inputInfo);
                    addHardwareInputLocked(inputInfo);
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        public void removeHardwareInput(String inputId) {
            ensureHardwarePermission();
            final long identity = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    ServiceState serviceState = getServiceStateLocked(mComponent, mUserId);
                    boolean removed = serviceState.hardwareInputMap.remove(inputId) != null;
@@ -3039,6 +3051,9 @@ public final class TvInputManagerService extends SystemService {
                        Slog.e(TAG, "failed to remove input " + inputId);
                    }
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }
    }