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

Commit 37c71286 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

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

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


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


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