diff options
| author | 2024-04-09 00:44:14 +0000 | |
|---|---|---|
| committer | 2024-04-09 00:55:11 +0000 | |
| commit | dd07f0325c98afca60b230b5b6603e4711e7394c (patch) | |
| tree | d1e807381e3878ebd92339330efa41522967ea4e | |
| parent | 16769d7f9e531022e28085bce68aef089069fc32 (diff) | |
MediaCas: Add API to update client priority and nice value.
Added updateResourcePriority api to update client priority to
a preferred value along with a nice value.
Bug: 264857199
Bug: 300565729
Test: atest MediaCasTest
(cherry picked from https://android-review.googlesource.com/q/commit:e8d4d794c1a11e864b905ab4696c722731539ff7)
Change-Id: If46a294dc63dbcdc1467045b6bebcc2da78541d9
NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
name: "update_client_profile_priority"
> + namespace: "media"
> + description : "Feature flag to add updateResourcePriority api to MediaCas"
> + bug: "300565729"
> +}
> +
> +flag {
Original patch:
From e8d4d794c1a11e864b905ab4696c722731539ff7 Mon Sep 17 00:00:00 2001
From: Sham Rathod <sham.rathod@ittiam.com>
Date: Thu, 18 Jan 2024 17:27:43 +0530
Subject: [PATCH] MediaCas: Add API to update client priority and nice value.
Added updateResourcePriority api to update client priority to
a preferred value along with a nice value.
Bug: 264857199
Bug: 300565729
Test: atest MediaCasTest
Change-Id: If46a294dc63dbcdc1467045b6bebcc2da78541d9
---
Result patch:
diff --git a/core/api/current.txt b/core/api/current.txt
index 13d5e03..dff7d16 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -22486,6 +22486,7 @@
method public void sendEvent(int, int, @Nullable byte[]) throws android.media.MediaCasException;
method public void setEventListener(@Nullable android.media.MediaCas.EventListener, @Nullable android.os.Handler);
method public void setPrivateData(@NonNull byte[]) throws android.media.MediaCasException;
+ method @FlaggedApi("com.android.media.flags.update_client_profile_priority") public boolean updateResourcePriority(int, int);
field public static final int PLUGIN_STATUS_PHYSICAL_MODULE_CHANGED = 0; // 0x0
field public static final int PLUGIN_STATUS_SESSION_NUMBER_CHANGED = 1; // 0x1
field public static final int SCRAMBLING_MODE_AES128 = 9; // 0x9
diff --git a/media/java/android/media/MediaCas.java b/media/java/android/media/MediaCas.java
index 2d7db5e..8b04644 100644
--- a/media/java/android/media/MediaCas.java
+++
[[[Result patch trimmed due to size. Decoded string size: 3244. Decoded string SHA1: b4fc385ecbc79900316f18b31cf82c5f87ec6b69.]]]
Change-Id: I34af0b4c66280c74fb742057e1ae3061b43de38e
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | media/java/android/media/MediaCas.java | 24 | ||||
| -rw-r--r-- | media/java/android/media/flags/media_better_together.aconfig | 7 |
3 files changed, 32 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 13d5e03da7ed..dff7d16a1f1f 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -22486,6 +22486,7 @@ package android.media { method public void sendEvent(int, int, @Nullable byte[]) throws android.media.MediaCasException; method public void setEventListener(@Nullable android.media.MediaCas.EventListener, @Nullable android.os.Handler); method public void setPrivateData(@NonNull byte[]) throws android.media.MediaCasException; + method @FlaggedApi("com.android.media.flags.update_client_profile_priority") public boolean updateResourcePriority(int, int); field public static final int PLUGIN_STATUS_PHYSICAL_MODULE_CHANGED = 0; // 0x0 field public static final int PLUGIN_STATUS_SESSION_NUMBER_CHANGED = 1; // 0x1 field public static final int SCRAMBLING_MODE_AES128 = 9; // 0x9 diff --git a/media/java/android/media/MediaCas.java b/media/java/android/media/MediaCas.java index 2d7db5e6ed94..8b04644a2989 100644 --- a/media/java/android/media/MediaCas.java +++ b/media/java/android/media/MediaCas.java @@ -16,6 +16,9 @@ package android.media; +import static com.android.media.flags.Flags.FLAG_UPDATE_CLIENT_PROFILE_PRIORITY; + +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -970,6 +973,27 @@ public final class MediaCas implements AutoCloseable { registerClient(context, tvInputServiceSessionId, priorityHint); } + /** + * Updates client priority with an arbitrary value along with a nice value. + * + * <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. + * + * @see <a + * href="https://source.android.com/docs/devices/tv/tuner-framework#priority-nice-value"> + * Priority value and nice value</a> + * @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. + */ + @FlaggedApi(FLAG_UPDATE_CLIENT_PROFILE_PRIORITY) + public boolean updateResourcePriority(int priority, int niceValue) { + return mTunerResourceManager.updateClientPriority(mClientId, priority, niceValue); + } + IHwBinder getBinder() { if (mICas != null) { return null; // Return IHwBinder only for HIDL diff --git a/media/java/android/media/flags/media_better_together.aconfig b/media/java/android/media/flags/media_better_together.aconfig index 8d6982e2b122..e64958a86933 100644 --- a/media/java/android/media/flags/media_better_together.aconfig +++ b/media/java/android/media/flags/media_better_together.aconfig @@ -69,6 +69,13 @@ flag { } flag { + name: "update_client_profile_priority" + namespace: "media" + description : "Feature flag to add updateResourcePriority api to MediaCas" + bug: "300565729" +} + +flag { name: "enable_built_in_speaker_route_suitability_statuses" is_exported: true namespace: "media_solutions" |