Loading packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java +21 −2 Original line number Diff line number Diff line Loading @@ -133,12 +133,19 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener + mNotificationRampTimeMs + "ms"); } try { Thread.sleep(mNotificationRampTimeMs); player.start(); } catch (InterruptedException e) { Log.e(mTag, "Exception while sleeping to sync notification playback" + " with ducking", e); } try { player.start(); if (DEBUG) { Log.d(mTag, "player.start"); } } catch (Exception e) { player.release(); player = null; // playing the notification didn't work, revert the focus request abandonAudioFocusAfterError(); } if (mPlayer != null) { if (DEBUG) { Log.d(mTag, "mPlayer.release"); } mPlayer.release(); Loading @@ -147,6 +154,8 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener } catch (Exception e) { Log.w(mTag, "error loading sound for " + mCmd.uri, e); // playing the notification didn't work, revert the focus request abandonAudioFocusAfterError(); } this.notify(); } Loading @@ -154,6 +163,16 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener } }; private void abandonAudioFocusAfterError() { synchronized (mQueueAudioFocusLock) { if (mAudioManagerWithAudioFocus != null) { if (DEBUG) Log.d(mTag, "abandoning focus after playback error"); mAudioManagerWithAudioFocus.abandonAudioFocus(null); mAudioManagerWithAudioFocus = null; } } } private void startSound(Command cmd) { // Preparing can be slow, so if there is something else // is playing, let it continue until we're done, so there Loading Loading
packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java +21 −2 Original line number Diff line number Diff line Loading @@ -133,12 +133,19 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener + mNotificationRampTimeMs + "ms"); } try { Thread.sleep(mNotificationRampTimeMs); player.start(); } catch (InterruptedException e) { Log.e(mTag, "Exception while sleeping to sync notification playback" + " with ducking", e); } try { player.start(); if (DEBUG) { Log.d(mTag, "player.start"); } } catch (Exception e) { player.release(); player = null; // playing the notification didn't work, revert the focus request abandonAudioFocusAfterError(); } if (mPlayer != null) { if (DEBUG) { Log.d(mTag, "mPlayer.release"); } mPlayer.release(); Loading @@ -147,6 +154,8 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener } catch (Exception e) { Log.w(mTag, "error loading sound for " + mCmd.uri, e); // playing the notification didn't work, revert the focus request abandonAudioFocusAfterError(); } this.notify(); } Loading @@ -154,6 +163,16 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener } }; private void abandonAudioFocusAfterError() { synchronized (mQueueAudioFocusLock) { if (mAudioManagerWithAudioFocus != null) { if (DEBUG) Log.d(mTag, "abandoning focus after playback error"); mAudioManagerWithAudioFocus.abandonAudioFocus(null); mAudioManagerWithAudioFocus = null; } } } private void startSound(Command cmd) { // Preparing can be slow, so if there is something else // is playing, let it continue until we're done, so there Loading