summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jean-Michel Trivi <jmtrivi@google.com> 2017-04-24 11:59:29 -0700
committer Jean-Michel Trivi <jmtrivi@google.com> 2017-04-24 14:10:28 -0700
commitc2769ab2ac908b4ea344cf22cfe8ff968a906649 (patch)
tree50aa50c0431354d7c2fbae4bee1285eef0e16cad
parentb8305e91860788b7cdf8e8e8db8f7c37fd8a8b47 (diff)
AudioService: make PlaybackActivityMonitor less log-chatty
Do not log error messages on release errors. Do not try to terminate VolumeShaper when releasing a player. Use coding convention for "private" and "static" keywords. Test: make Change-Id: Ic1ff376c1ce4750708c368756f7b4a8a2c05c50c
-rw-r--r--services/core/java/com/android/server/audio/PlaybackActivityMonitor.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
index 9eda9294031e..aea4cb563d1b 100644
--- a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
+++ b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
@@ -46,12 +46,12 @@ import java.util.Set;
public final class PlaybackActivityMonitor
implements AudioPlaybackConfiguration.PlayerDeathMonitor, PlayerFocusEnforcer {
- public final static String TAG = "AudioService.PlaybackActivityMonitor";
+ public static final String TAG = "AudioService.PlaybackActivityMonitor";
- private final static boolean DEBUG = false;
- private final static int VOLUME_SHAPER_SYSTEM_DUCK_ID = 1;
+ private static final boolean DEBUG = false;
+ private static final int VOLUME_SHAPER_SYSTEM_DUCK_ID = 1;
- private final VolumeShaper.Configuration DUCK_VSHAPE =
+ private static final VolumeShaper.Configuration DUCK_VSHAPE =
new VolumeShaper.Configuration.Builder()
.setId(VOLUME_SHAPER_SYSTEM_DUCK_ID)
.setCurve(new float[] { 0.f, 1.f } /* times */,
@@ -62,16 +62,12 @@ public final class PlaybackActivityMonitor
new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build()))
.build();
- private final VolumeShaper.Configuration DUCK_ID =
+ private static final VolumeShaper.Configuration DUCK_ID =
new VolumeShaper.Configuration(VOLUME_SHAPER_SYSTEM_DUCK_ID);
- private final VolumeShaper.Operation PLAY_CREATE_IF_NEEDED =
+ private static final VolumeShaper.Operation PLAY_CREATE_IF_NEEDED =
new VolumeShaper.Operation.Builder(VolumeShaper.Operation.PLAY)
.createIfNeeded()
.build();
- private final VolumeShaper.Operation TERMINATE =
- new VolumeShaper.Operation.Builder()
- .terminate()
- .build();
private final ArrayList<PlayMonitorClient> mClients = new ArrayList<PlayMonitorClient>();
// a public client is one that needs an anonymized version of the playback configurations, we
@@ -166,14 +162,7 @@ public final class PlaybackActivityMonitor
synchronized(mPlayerLock) {
final AudioPlaybackConfiguration apc = mPlayers.get(new Integer(piid));
if (checkConfigurationCaller(piid, apc, binderUid)) {
- try {
- apc.getPlayerProxy().applyVolumeShaper(
- DUCK_ID,
- TERMINATE);
- } catch (Exception e) { /* silent failure, happens with binder failure */ }
mPlayers.remove(new Integer(piid));
- } else {
- Log.e(TAG, "Error releasing player " + piid);
}
}
}
@@ -206,16 +195,16 @@ public final class PlaybackActivityMonitor
}
/**
- * Check that piid and uid are valid for the given configuration.
+ * Check that piid and uid are valid for the given valid configuration.
* @param piid the piid of the player.
* @param apc the configuration found for this piid.
* @param binderUid actual uid of client trying to signal a player state/event/attributes.
- * @return true if the call is valid and the change should proceed, false otherwise.
+ * @return true if the call is valid and the change should proceed, false otherwise. Always
+ * returns false when apc is null.
*/
private static boolean checkConfigurationCaller(int piid,
final AudioPlaybackConfiguration apc, int binderUid) {
if (apc == null) {
- Log.e(TAG, "Invalid operation: unknown player " + piid);
return false;
} else if ((binderUid != 0) && (apc.getClientUid() != binderUid)) {
Log.e(TAG, "Forbidden operation from uid " + binderUid + " for player " + piid);
@@ -509,7 +498,7 @@ public final class PlaybackActivityMonitor
/**
* Inner class to track clients that want to be notified of playback updates
*/
- private final static class PlayMonitorClient implements IBinder.DeathRecipient {
+ private static final class PlayMonitorClient implements IBinder.DeathRecipient {
// can afford to be static because only one PlaybackActivityMonitor ever instantiated
static PlaybackActivityMonitor sListenerDeathMonitor;