summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jean-Michel Trivi <jmtrivi@google.com> 2017-04-24 23:39:41 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-04-24 23:39:45 +0000
commit9e55fcbdc254da098bb792f460296ff0649c3b00 (patch)
tree2c73b06fb64311afbc4dea3cdb5c8c2336e746e4
parent76831f7e393b7496c3c8f4fb1a7eb31ae35551ac (diff)
parentc2769ab2ac908b4ea344cf22cfe8ff968a906649 (diff)
Merge "AudioService: make PlaybackActivityMonitor less log-chatty" into oc-dev
-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;