Ejemplo n.º 1
0
 /** Stops a playing ringtone. */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:28:26.979 -0500",
     hash_original_method = "25B57E3869C6FCC0565FBD24EEAB9FA0",
     hash_generated_method = "D54276E98CE38A3B15A1D16585CD8968")
 public void stop() {
   if (mAudio != null) {
     mAudio.reset();
     mAudio.release();
     mAudio = null;
   }
 }
Ejemplo n.º 2
0
 @DSComment("Private Method")
 @DSBan(DSCat.PRIVATE_METHOD)
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:28:26.967 -0500",
     hash_original_method = "3D9FD67EE5212878A40EB00FDD255FB4",
     hash_generated_method = "64022A1AA54923F2F5BCB6D43B903CE2")
 private void openMediaPlayer() throws IOException {
   if (mAudio != null) {
     mAudio.release();
   }
   mAudio = new MediaPlayer();
   if (mUri != null) {
     mAudio.setDataSource(mContext, mUri);
   } else if (mFileDescriptor != null) {
     mAudio.setDataSource(mFileDescriptor);
   } else if (mAssetFileDescriptor != null) {
     // Note: using getDeclaredLength so that our behavior is the same
     // as previous versions when the content provider is returning
     // a full file.
     if (mAssetFileDescriptor.getDeclaredLength() < 0) {
       mAudio.setDataSource(mAssetFileDescriptor.getFileDescriptor());
     } else {
       mAudio.setDataSource(
           mAssetFileDescriptor.getFileDescriptor(),
           mAssetFileDescriptor.getStartOffset(),
           mAssetFileDescriptor.getDeclaredLength());
     }
   } else {
     throw new IOException("No data source set.");
   }
   mAudio.setAudioStreamType(mStreamType);
   mAudio.prepare();
 }
Ejemplo n.º 3
0
 /**
  * Whether this ringtone is currently playing.
  *
  * @return True if playing, false otherwise.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:28:26.981 -0500",
     hash_original_method = "0CA36CF7485684069EDD095AE8455157",
     hash_generated_method = "113EE03FEC2AB5B9B31E6309FF6709D4")
 public boolean isPlaying() {
   return mAudio != null && mAudio.isPlaying();
 }
Ejemplo n.º 4
0
 /** Plays the ringtone. */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:28:26.977 -0500",
     hash_original_method = "F9F3FD902406E9F982D2A30CB15B8CC4",
     hash_generated_method = "D19C91221B1080DB646063B49CD92AD8")
 public void play() {
   if (mAudio == null) {
     try {
       openMediaPlayer();
     } catch (Exception ex) {
       Log.e(TAG, "play() caught ", ex);
       mAudio = null;
     }
   }
   if (mAudio != null) {
     // do not ringtones if stream volume is 0
     // (typically because ringer mode is silent).
     if (mAudioManager.getStreamVolume(mStreamType) != 0) {
       mAudio.start();
     }
   }
 }