summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-05-20 15:39:18 -0700
committerDanesh M <daneshm90@gmail.com>2014-05-20 15:40:32 -0700
commitde5ae6cd1a4640f8f8769a0ed4ea5048d3017ac5 (patch)
treecf0e8b164355267f49af89345f60428e966b6488
parentc8a2a6b1ca703d0c6078b7f57663781245b787e7 (diff)
downloadandroid_packages_apps_Nfc-de5ae6cd1a4640f8f8769a0ed4ea5048d3017ac5.tar.gz
android_packages_apps_Nfc-de5ae6cd1a4640f8f8769a0ed4ea5048d3017ac5.tar.bz2
android_packages_apps_Nfc-de5ae6cd1a4640f8f8769a0ed4ea5048d3017ac5.zip
Nfc : Switch to notification sound
Use the notification sound, since the service might get unbound before the sound has had a chance to finish This fixes the issue where on beam completes, the notification sound is cancelled before it finishes. Change-Id: I6c00f43ed17dc7fadf27da58e3f95f540be8d22e
-rw-r--r--src/com/android/nfc/handover/HandoverService.java13
-rw-r--r--src/com/android/nfc/handover/HandoverTransfer.java3
2 files changed, 4 insertions, 12 deletions
diff --git a/src/com/android/nfc/handover/HandoverService.java b/src/com/android/nfc/handover/HandoverService.java
index 35a49fae..7f986944 100644
--- a/src/com/android/nfc/handover/HandoverService.java
+++ b/src/com/android/nfc/handover/HandoverService.java
@@ -23,8 +23,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.media.AudioManager;
-import android.media.SoundPool;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -120,7 +118,6 @@ public class HandoverService extends Service implements HandoverTransfer.Callbac
final HashMap<Pair<String, Boolean>, HandoverTransfer> mTransfers;
final Messenger mMessenger;
- SoundPool mSoundPool;
int mSuccessSound;
BluetoothAdapter mBluetoothAdapter;
@@ -144,9 +141,6 @@ public class HandoverService extends Service implements HandoverTransfer.Callbac
public void onCreate() {
super.onCreate();
- mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
- mSuccessSound = mSoundPool.load(this, R.raw.end, 1);
-
IntentFilter filter = new IntentFilter(ACTION_BT_OPP_TRANSFER_DONE);
filter.addAction(ACTION_BT_OPP_TRANSFER_PROGRESS);
filter.addAction(ACTION_CANCEL_HANDOVER_TRANSFER);
@@ -158,9 +152,6 @@ public class HandoverService extends Service implements HandoverTransfer.Callbac
@Override
public void onDestroy() {
super.onDestroy();
- if (mSoundPool != null) {
- mSoundPool.release();
- }
unregisterReceiver(mReceiver);
}
@@ -435,9 +426,7 @@ public class HandoverService extends Service implements HandoverTransfer.Callbac
notifyClientTransferComplete(transfer.getTransferId());
// Play success sound
- if (success) {
- mSoundPool.play(mSuccessSound, 1.0f, 1.0f, 0, 0, 1.0f);
- } else {
+ if (!success) {
if (DBG) Log.d(TAG, "Transfer failed, final state: " +
Integer.toString(transfer.mState));
}
diff --git a/src/com/android/nfc/handover/HandoverTransfer.java b/src/com/android/nfc/handover/HandoverTransfer.java
index c2f2ad5d..6e7221f4 100644
--- a/src/com/android/nfc/handover/HandoverTransfer.java
+++ b/src/com/android/nfc/handover/HandoverTransfer.java
@@ -260,6 +260,9 @@ public class HandoverTransfer implements Handler.Callback,
android.R.drawable.stat_sys_upload_done);
notBuilder.setTicker(mContext.getString(R.string.beam_complete));
notBuilder.setContentTitle(mContext.getString(R.string.beam_complete));
+ Uri uri = Uri.parse("android.resource://" + mContext.getPackageName()
+ + "/" + R.raw.end);
+ notBuilder.setSound(uri);
if (mIncoming) {
notBuilder.setContentText(mContext.getString(R.string.beam_touch_to_view));