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

Commit b32d880e authored by Haofan Wang's avatar Haofan Wang
Browse files

[PATCH] Fix TRM deadlock scenario in reclaim

Do not hold mLock whilst reclaim occurs.
Allow reclaim request client to release resources.
Do not assume reclaimed resource was released successfully.
Add TunerClient helper class to TunerResourceServiceManagerTest.

Bug: 356652298
Test: cts-tradefed run cts --skip-device-info -m CtsTvTestCases -t android.media.tv.tuner
Test: atest FrameworksServicesTests:com.android.server.tv.tunerresourcemanager.TunerResourceManagerServiceTest
Flag: EXEMPT bugfix
Change-Id: I6ed6fe5ef1cecdda86852c13e1031904aaa78e6f
parent d299a2a6
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -26,6 +26,11 @@ import java.util.Set;
 * @hide
 */
public class CasResource {
    /**
     * Handle of the current resource. Should not be changed and should be aligned with the driver
     * level implementation.
     */
    final int mHandle;

    private final int mSystemId;

@@ -39,11 +44,16 @@ public class CasResource {
    private Map<Integer, Integer> mOwnerClientIdsToSessionNum = new HashMap<>();

    CasResource(Builder builder) {
        this.mHandle = builder.mHandle;
        this.mSystemId = builder.mSystemId;
        this.mMaxSessionNum = builder.mMaxSessionNum;
        this.mAvailableSessionNum = builder.mMaxSessionNum;
    }

    public int getHandle() {
        return mHandle;
    }

    public int getSystemId() {
        return mSystemId;
    }
@@ -136,10 +146,12 @@ public class CasResource {
     */
    public static class Builder {

        private final int mHandle;
        private int mSystemId;
        protected int mMaxSessionNum;

        Builder(int systemId) {
        Builder(int handle, int systemId) {
            this.mHandle = handle;
            this.mSystemId = systemId;
        }

+2 −2
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ public final class CiCamResource extends CasResource {
     * Builder class for {@link CiCamResource}.
     */
    public static class Builder extends CasResource.Builder {
        Builder(int systemId) {
            super(systemId);
        Builder(int handle, int systemId) {
            super(handle, systemId);
        }

        /**
+525 −387

File changed.

Preview size limit exceeded, changes collapsed.

+331 −440

File changed.

Preview size limit exceeded, changes collapsed.