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

Commit fc174636 authored by Amy Zhang's avatar Amy Zhang
Browse files

Allow Tuner to update client priority without override the default

priority

The updateResourcePriority(int, int) in Tuner used to update priority
and nice value at the same time.

Now we bypass the priority settings with only nice value setting
in the Tuner Resource Manager when the user gives negative priority.

Test: atest com.android.server.tv.tunerresourcemanager
Bug: 176186744
Change-Id: I0dc1326691ac02b4dc4d8f9c0252f6150284ef82
parent 663b6185
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -454,10 +454,12 @@ public class Tuner implements AutoCloseable {
     *
     * <p>Tuner resource manager (TRM) uses the client priority value to decide whether it is able
     * to reclaim insufficient resources from another client.
     *
     * <p>The nice value represents how much the client intends to give up the resource when an
     * insufficient resource situation happens.
     *
     * @param priority the new priority.
     * @param priority the new priority. Any negative value would cause no-op on priority setting
     *                 and the API would only process nice value setting in that case.
     * @param niceValue the nice value.
     */
    public void updateResourcePriority(int priority, int niceValue) {
+3 −0
Original line number Diff line number Diff line
@@ -126,6 +126,9 @@ public final class ClientProfile {
    }

    public void setPriority(int priority) {
        if (priority < 0) {
            return;
        }
        mPriority = priority;
    }

+8 −0
Original line number Diff line number Diff line
@@ -815,6 +815,14 @@ public class TunerResourceManagerServiceTest {
                shareClientId1[0],
                400/*priority*/,
                0/*niceValue*/);
        mTunerResourceManagerService.updateClientPriorityInternal(
                shareClientId1[0],
                -1/*invalid priority*/,
                0/*niceValue*/);
        assertThat(mTunerResourceManagerService
                .getClientProfile(shareClientId1[0])
                .getPriority())
                .isEqualTo(400);

        /**** Init Frontend Resources ****/