diff options
author | wjiang <wjiang@codeaurora.org> | 2013-12-26 13:57:55 +0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-31 14:34:58 -0700 |
commit | a44bb73fa0a03f69f037e77833621ca4fe3d62a3 (patch) | |
tree | 35740b98c53be084ba34be30254557e70e794295 /src/com/android/providers | |
parent | db9853bfbfdd722da34cf0e0266258ecc0a9cb75 (diff) | |
download | android_packages_providers_MediaProvider-a44bb73fa0a03f69f037e77833621ca4fe3d62a3.tar.gz android_packages_providers_MediaProvider-a44bb73fa0a03f69f037e77833621ca4fe3d62a3.tar.bz2 android_packages_providers_MediaProvider-a44bb73fa0a03f69f037e77833621ca4fe3d62a3.zip |
MediaProvider: Avoid issue of android.process.media stop
"OK" and "Cancel" button's click event response at the same time
lead to FATAL EXCEPTION. Make the click events do not happen at
the same time.
CRs-Fixed: 513752
Change-Id: I92fc1dc15be42d0bd9fe54f41fdbb26b3ca4b85c
Diffstat (limited to 'src/com/android/providers')
-rw-r--r-- | src/com/android/providers/media/RingtonePickerActivity.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/providers/media/RingtonePickerActivity.java b/src/com/android/providers/media/RingtonePickerActivity.java index 9f17f9f0..872ba41c 100644 --- a/src/com/android/providers/media/RingtonePickerActivity.java +++ b/src/com/android/providers/media/RingtonePickerActivity.java @@ -108,6 +108,9 @@ public final class RingtonePickerActivity extends AlertActivity implements */ private static Ringtone sPlayingRingtone; + // Whether we have tap the "OK" or "Cancel" button. + private boolean mIsHasClick = false; + private DialogInterface.OnClickListener mRingtoneClickListener = new DialogInterface.OnClickListener() { @@ -259,6 +262,13 @@ public final class RingtonePickerActivity extends AlertActivity implements public void onClick(DialogInterface dialog, int which) { boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE; + // Should't response the "OK" and "Cancel" button's click event at the + // same time. + if (mIsHasClick || (mCursor == null)) { + return; + } + mIsHasClick = true; + // Stop playing the previous ringtone mRingtoneManager.stopPreviousRingtone(); @@ -354,6 +364,12 @@ public final class RingtonePickerActivity extends AlertActivity implements } @Override + protected void onDestroy() { + super.onDestroy(); + mIsHasClick = false; + } + + @Override protected void onPause() { super.onPause(); if (!isChangingConfigurations()) { |