summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
AgeCommit message (Collapse)Author
2016-03-22Clear voicemail status text when loading succeededTa-wei Yen
In ag/874775, mStateText.setText(null) is removed from VoicemailPlaybackLayout#setClipPosition(). This caused the error in mStateText not to be cleared after the voicemail is sucessfully loaded. This CL adds a setSuccess() method to the layout that clears the message, which will be called from onPrepared() once the voicemail is loaded. Fixes:27770842 Change-Id: Ic42e40b99d36f817532dec780b63311c1967300c
2016-03-13Add share voicemail functionality.Sarmad Hashmi
+Send intent to other applications with temporary file permission granted +Add voicemails folder to FileProvider paths +When creating file in VoicemailArchiveProvider, append extension to file name +Check voicemail content exists before archiving it +Refactor voicemail code +Add tests for checking file extension +Add tests for archiving and sharing vociemails +Archive tab should not archive on share button press BUG=22798485 Change-Id: Id8068aba92f7f1ca58532dca6c405cb2908841a3
2016-03-03Add files for voicemail archive tab.Sarmad Hashmi
+ Added VoicemailArchiveActivity which displays all voicemails archived by the user + VoicemailArchivePlaybackPresenter is the same as VoicemailPlaybackPresenter except that it does not need to request content from the voicemail server +Added tests (combined common methods and attributes for regular voicemail tab and voicemail archive used for tests) BUG=22797391 Change-Id: I4064eea945b9e257ec6c7ada35cf5ac1657dc866
2016-03-02Update seek position by using volume rocker in talkback mode.Qi Wang
Bug: 25452893 Change-Id: Iae3b0a2c2db4642d7cebc74c3ae47f5ab7ad7bc2
2016-03-01Check content before requesting a voicemail audioTa-wei Yen
Formerly dialer only checks for content when the view is loaded, will only acknowledge the new content status if the fetch succeeded, and will send a intent every time it thinks there is no content. Suppose the server took really long to finish the fetch, but eventually succeeds, it will cause the voicemail fetch to fail every time. After this fix before a fetch intent is sent, content availability will be checked first. The following step is taken to simulate a slow fetching server: 1.disable prefetch in telephony 2.disable the content fetch on dialer load 3.set fetch timeout to 1ms Verified a similar behavior to b/27388041. Voicemail load fails even if the content is already there. This fix was then applied. Voicemail fail for the first time as it should (timeout), but plays normally after the second time. Bug:27412247 Change-Id: I184e04fb88772f9006cf6db0fe50d6e773a45d4a
2016-02-24Fix bug where 00:00 duration is shown for voicemails without a duration.Sarmad Hashmi
Instead of showing a 00:00 duration, nothing is displayed. When the content is loaded, the duration field for the call log entry associated with the voicemail is updated with the duration fetched from the mediaplayer. The proper duration is then displayed in MM:SS format. BUG=24175525 Change-Id: I1cafebae4fcbc749f573accfcf8833b598675f0b (cherry picked from commit 6f3016d9065564bf09a5759f16563a05abbe105d)
2015-12-10Fix potential NPE in VoicemailPlaybackPresenterYorke Lee
Bug: 26092525 Change-Id: Id3e54a197ed8bfb51b9b01bbc98a4ee81b28d9ee
2015-11-11Fix NPE in requestContentJay Shrauner
Null check mVoicemailUri. Bug:25634572 Change-Id: I1d4a810516244ecc56426d757590360ed9d3e308
2015-10-27Retain progress for voicemail playback when rebinding voicemail card.Nancy Chen
When rebinding the voicemail card, onPrepared gets called and resets the voicemail playback to 0 because mPosition is not updated to the most recent value. Update mPosition in this case to the position of the media player and then call onPrepared. Bug: 25080811 Change-Id: Ief3a021f4c11bac7b8c0a563765e14c897cb43b5
2015-10-21Fix NPE when plugging and unplugging earphones.Nancy Chen
Crashes because the VoicemailPlaybackPresenter is alerted when the state of the headset changes but the corresponding view may be out of focus. Bug: 25090589 Change-Id: Iabe24eb969777ae3919ede05474f35d6c596b20e
2015-10-12Fix NPE in requestContentJay Shrauner
Check for null context in resumePlayback. Bug:24858686 Change-Id: I7c65e3ae836535f15936ecb397a68ee6590f31ed
2015-09-17Handle wired headset during voicemail playback.Nancy Chen
- Switch to wired headset when plugged in even if playing on speaker - Remember if wired headset overrode speaker so it can be turned back on when the headset is unplugged. - Ensure proximity sensor is turned on iff the earpiece is the audio source. Bug: 23816959 Change-Id: I952c24ee51139f21a17344acd7698c9ed8f52860
2015-09-17Resume voicemail playback at previous position on resume.Nancy Chen
Make sure that the position is saved when navigating away from the voicemail playback so that it can be restored when resuming. Also: - Disable seekbar when not loaded - Gray out seekbar handle when seek is disabled Bug: 23566924 Change-Id: Ic9d84425d7a3cde9d212bd758eb518577161d7ec
2015-09-17Display duration and prepare voicemail if voicemail is downloaded.Nancy Chen
We should always know what the duration of the voicemail is even before it is downloaded. As such, when a voicemail is expanded, set the voicemail duration. For a downloaded voicemail, we can go even further and prepare the audio file when the card is expanded. This means the voicemail can be played immediately when the user clicks "play" instead of having to wait for the media player to buffer each time. Bug: 23566924 Change-Id: I0ce7570eab72b0bf079d3eb8cd10b71981576a9f
2015-09-15Fix VoicemailPlaybackTests.Andrew Lee
There appears to be two issues which were borking this, although I'm not sure why there was the change (maybe it's been around a long time). A single instance of presenter is retained over time, which is no good for our case where we're creating different FakeAsyncTaskExecutors each time, so added a method for testing where we can clear the instance. Secondly, the method checking the text views didn't work anymore. Not sure why, but I added a hook into the state text so the tests can continue to check for that. Bug: 23640774 Change-Id: Ie729627f3bb4ee08476d5ad0198e43cfea72ce5c
2015-09-14Refactor all voicemail audio handling to new audio manager class.Nancy Chen
Since voicemail audio handling is about to get more complicated (adding head phone switching and bluetooth), we need a separate class to handle audio. Bug: 23816959 Change-Id: If891739ef80f5646145d7a44ec70f5b7544010b0
2015-09-10Improve speakerphone setting.Andrew Lee
+ Persist speakerphone setting across resume/pause. + Allow toggling speakerphone before voicemail is played or while loading. Bug: 23566924 Bug: 23716100 Change-Id: Icc7342be85bd6df0f4678134b222f2200d3fc56d
2015-08-27Only show loading text when downloading VM.Andrew Lee
In other cases (eg. buffering), just load without showing the text, since it will likely appear only for a very short time, and give the appearance of flickering. Bug: 22333980 Change-Id: Ic2bbba7a2127654aaf12546b177c465c9311ddc1
2015-08-26Merge "Populate TextViews with 00:00 after inflation."Andrew Lee
2015-08-26Populate TextViews with 00:00 after inflation.Andrew Lee
But, set them to INVISIBLE, so they layout, but don't appear. This prevents jank caused by the seekbar resizing later on when times are set for the first time. Bug: 22333980 Change-Id: I8523659b837008bae1789c1beaccc7edf9c15554
2015-08-26Merge "Do not call "onPrepared" unless the media player is prepared."Nancy Chen
2015-08-26Merge "Check for whether view exists before attempting to resume play."Nancy Chen
2015-08-26Do not call "onPrepared" unless the media player is prepared.Nancy Chen
In setPlaybackView, if the MediaPlayer is not null, onPrepared is called. However, there can be a race condition where the MediaPlayer is not null, but also not yet prepared (since preparation is an asynchronous call). Bug: 23228984 Change-Id: I1536de9b2c67c0ae796224a717b1047fac0a8da4
2015-08-26Check for whether view exists before attempting to resume play.Nancy Chen
If the view does not exist, this probably means resumePlayback() was called as a result of an asynchronous callback that returned after navigating away from the voicemail playback view. In this case, just return null. Bug: 23521761 Change-Id: I75e5e997bce463739612d65f61413d06eae82de3
2015-08-22am 37ae6aad: am 50297150: am bc891fe6: am 93f905e4: am 9d1d797b: Prevent NPE ↵Andrew Lee
in VoicemailPlaybackPresenter. * commit '37ae6aad573094dbb49ab9e37d7e044539962aa7': Prevent NPE in VoicemailPlaybackPresenter.
2015-08-21Prevent NPE in VoicemailPlaybackPresenter.Andrew Lee
Bug: 23386856 Change-Id: Ib87184199e8578a1fe3b0a6457b26069673f56ca
2015-08-19Show snackbar to undo last deleted voicemail.Nancy Chen
Snackbar will appear for 3 seconds during which the user can undo the last deletion. The way it works is the snackbar appears for 3 seconds and a delayed callback is set for 3 seconds after which the voicemail is permanently deleted from the database. If a second (or third or fourth) voicemail is deleted subsequently, the previous voicemails that were waiting for the undo timeout are deleted immediately. Bug: 22460745 Change-Id: I84b70994275975e4e3020321884d382cc87098dc
2015-07-21Merge "Reset voicemail playback when call log is paused." into mnc-devNancy Chen
2015-07-20Don't auto expand next voicemail after deletingYorke Lee
Pipe onVoicemailDeleted notification through to CallLogAdapter. Reset expanded position when that happens. Bug: 22534894 Change-Id: Iec69082bd8b3259f500b523da6d0710bece69fa4
2015-07-17Reset voicemail playback when call log is paused.Nancy Chen
If the user navigates away from the call log, reset the currently playing voicemail playback. Which includes resetting the start point, pausing playback, and refreshing the play icon. Bug: 22530093 Change-Id: I78eda2d86cf0f5b24136a7a9ba299214f155672b
2015-07-15Pause playback when voicemail is deleted.Nancy Chen
We don't want the voicemail to continue playing after deleted, so perform the pause behavior when the delete button is pressed. Bug: 22462516 Change-Id: I664c5aed0c2bd1910cdf1f20a33c0117dde8d0cc
2015-07-08Fix some voicemail playback bugsYorke Lee
* Don't fetch voicemail until playback is started * Prevent multiple voicemail fetches for the same voicemail * Fixed an issue where the seekbar would be stuck in the same position even after seeking * Fix for playback position getting reset after the voicemail view is scrolled out of view and back in * Respect the invariant that if mMediaPlayer is null, mPrepared is always false. This fixes potential NPEs when resuming playback. Bug: 22127956 Bug: 22333494 Change-Id: I5c419424950c0e21317cbd133ca6f7e1edd9fd31
2015-07-06Fix NPE in setSpeakerphoneOnJay Shrauner
Null check mActivity Bug:22301343 Change-Id: Ia020f2a8c74cf16786af9ab7132da4eb9b9d0401
2015-07-03Fix NPE in pausePlaybackJay Shrauner
Null check mActivity as we do in onPause Bug:22249553 Change-Id: I147fbd517696205a2eb478a6df032f50cbbd5b34
2015-06-30Protect against null mViewYorke Lee
Bug: 22194812 Change-Id: I95e07820ed97d02fe61ee3ceee62c7e76c6f1cb5
2015-06-29Add missing null check in VoicemailPlaybackPresenterYorke Lee
Bug: 22171979 Change-Id: Ia26ba711b888de3c787167bf9af99fcf26a80b7a
2015-06-26Null protect invocation of getContentResolver.Andrew Lee
Bug: 22118779 Change-Id: I9a11c2fc05f8a6f418bc0e6daa55dfb61707bd6a
2015-06-25Merge "Enable proximity sensor onPause." into mnc-devAndrew Lee
2015-06-24Merge "Fix potential crash if uri is unavailable." into mnc-devNancy Chen
2015-06-24Enable proximity sensor onPause.Andrew Lee
+ When using speakerphone, add flag to keep the screen on. Bug: 22047261 Change-Id: I4e28ab526218b4cc1f53f2ec98c4749f24ac95af
2015-06-23Protect against null context.Andrew Lee
Bug: 22031896 Change-Id: I2da646a30a119c5be07dba8ad71c8e902969454e
2015-06-23Fix potential crash if uri is unavailable.Nancy Chen
If the voicemail is in the process of deleting, the uri may be unavailable after the async task has started executing. Make a null check first. Bug: 21978479 Change-Id: I0ec93e66b055c4e5d9ce2743a3cffc689c835f78
2015-06-19Rewrite of MediaPlayer logic.Andrew Lee
+ Control MediaPlayer instance more tightly. Wait until prepareContent to initialize instance. Release MediaPlayer when it is no longer needed. + Instead of using isFinishing, check explicitly for orientation change to know whether to release MediaPlayer. + Change Presenter to singleton, to address audio change wonkiness. + Only create a Presenter if the call log fragment shows voicemail. + ... fixing a variety of cases. - Temporarily disable proximity sensor until blocking issue is fixed. Bug: 21856243 Change-Id: Ic06e98bb5278467c3cce726a06b6cf3d855861a2
2015-06-18Pass activity into VoicemailPlaybackPresenter.Andrew Lee
We will use it to set windows flags to help make playback behaviors reasonable. Bug: 21856243 Change-Id: I7c1ecb9e225a507ea8956ccc31d667361a4b6824
2015-06-15Add play voicemail primary action to call log.Andrew Lee
+ Add voicemail primary action button, which expands the call log and plays immediately when clicked. + Pass expand/collapse listener into the view holder. This is necessary because it needs to be triggered when the "play" primary action is clicked so that the CallLogAdapter correctly registers what has been added and binded. + Update primary action button state when showing or hiding actions, so the visibility of the voicemail play button is managed properly. + Ensure voicemail playback state is consistent between multiple call log items when the user initiates a collapse or expand. Add reset function to help manage this. + With the reset, protect against the possibility of functions in the presenter being called when no voicemail playback view is set. Bug: 21654755 Change-Id: I7bcf67d27fa08fe77d1334dc084b52effe8d3ccc
2015-06-12Merge "Don't pass media player to VM playback layout." into mnc-devAndrew Lee
2015-06-12Don't pass media player to VM playback layout.Andrew Lee
Better to ask the presenter, where it can check if the media player is in the appropriate prepared state. Bug: 21765119 Change-Id: Ieeade86900da1eb0ed9407bea17a7fc6219b3ad2
2015-06-12Merge "Paranoid mIsPrepared checks." into mnc-devAndrew Lee
2015-06-11Merge "Default to earpiece for all voicemail." into mnc-devAndrew Lee
2015-06-11Default to earpiece for all voicemail.Andrew Lee
Bug: 21654804 Change-Id: I9fa76a33231ae95f4a233b4f6615c56280a0228e
2015-06-11Paranoid mIsPrepared checks.Andrew Lee
Returning early if media player is not prepared in all these cases, just in case. Bug: 21764908 Change-Id: Ieca0e9fd1c323ea5150464683600542fefb318b3
2015-06-11Check mIsPrepared before querying MediaPlayer.Andrew Lee
Bug: 21764908 Change-Id: I5336ccadf13724430c2f3ee76c37efacd73cd27f
2015-06-09Fix some more unit tests...Andrew Lee
+ Pull out voicemail playback tests into their own test class. + Fix CallDetailActivity unit tests. + Some minor tweaks to functional code to facilitate. Bug: 21471763 Change-Id: I0f1747ab7ad6eba7dd2a7f6f8cfd060b409771bc
2015-06-05Handle FetchResultHandler race condition.Andrew Lee
Previously, the voicemail only needed to be looked up once, but now a single presenter may load multiple voicemails. As such, destroy the old FetchResultHandler if one already exists. Bug: 21663448 Change-Id: Ibdb08f03760b770d0800bd44d4cdcf0ca7c57fc9
2015-06-05Merge "Add delete action to voicemail in call log." into mnc-devAndrew Lee
2015-06-05Add delete action to voicemail in call log.Andrew Lee
+ Cleanup some asset and variable naming. Bug: 21239168 Change-Id: I4c99484bee1fcd300857cf44080c38e19a98cb5a
2015-06-05Don't call isPlaying if not prepared.Andrew Lee
Bug: 21647046 Change-Id: Ib0f5c2d7cd973ba4732defeceb32fe956e8dbdb8
2015-06-03Move VM playback from details to call log.Andrew Lee
- Delete voicemail playback in the CallDetailActivity. + Add voicemail playback to the call log list items. + Move the VoicemailPlaybackPresenter to the CallLogFragment. + Fix some retaining state for both call log (expanded items), and preserve rotation/state functionality for voicemail playback. This included some changes to the Presenter logic. + Fix some tests. Bug: 21471763 Bug: 21170557 Change-Id: I30aae3a52c5bbf74a5075a9666343c337b1fc0df
2015-06-01Continue voicemail playback during rotation.Andrew Lee
Don't pause playback or release the media player during onPause or onDestroy. Bug: 21235334 Change-Id: I0eccd4e38e89c3416817d80aa25cc3bb529a9d6b
2015-06-01Fix CallDetailActivity tests.Andrew Lee
+ Reset the AsyncTaskExecutor's instance between calls in tests. I don't know why this is necessary, but it fixes a class of problems which were happening. + Don't try to release a media player if it has not been prepared. + Handle possible race conditions since MediaPlayer's async prepare may be buffering or finished when a test assert is executed. + Add asset file no longer provided by variablespeed library. - Cleanup some stream copy code. Change-Id: I0ae5fde00514c6dcdb1e9c063435a13eed6e8528
2015-05-27Refactor Voicemail Playback into standalone view.Andrew Lee
+ Substitutes the existing playback widget in CallDetailActivity, although the plan is to move this to the call log shortly. + Convert the widget from a fragment into a layout. This allows us to more easily create multiple instances of the voicemail widget in the same view, as we intend to do in the call log. + Shift UI-related logic from Presenter to the Layout. + Fix janky seeking, so that it now works correctly consistently rather than sporadically, and doesn't need to buffer again. - Remove the VariableSpeed player formerly used in the Presenter. We don't use this functionality anymore, and this allows us to directly used the framework MediaPlayer (instead of a custom legacy proxy). Bug: 21170557 Bug: 20693172 Change-Id: Ia34f459df10e43763b32fdb0954f83e882664231
2015-05-21Transfer VM fragment logic to presenter.Andrew Lee
We want the presenter to handle/manage resources pertinent to the activity lifecycle, so that we can convert the playback fragment into a component. My apologies to whoever has to disentangle this presenter logic later (though that could be me). Bug: 21170557 Change-Id: Icf65d3c23f1a12a7d63c2a281f96d2168a4a560f
2015-05-14Change VM playback fragment layout.Andrew Lee
- Remove increase/decrease playback rate functionality. - Flip button controls below the scrubber. - Delete TextController. Bug: 20433758 Change-Id: Id628bac0c9f8baed014079f2a89ce912fd2bb549
2015-05-07Grab audio focus when listening to voicemail.Nancy Chen
Music and other audio should be paused when listening to a voicemail. The voicemail player grabs transient focus so that when the voicemail is paused or finished, the focus returns to the music that was playing. Bug: 19589110 Change-Id: I9876cc2700139d0db787d0e370020d2a38d82cda
2015-02-26Fix voicemail playback during rotation.gilles le brun
Avoid restarting the visual voice mail media player from the beginning while rotating the device. Bug: 18254556 Change-Id: I967fbcd8dbe9427b521de2b1830de040cca674c7 Signed-off-by: gilles le brun <gilles.lebrun.pro@gmail.com>
2015-02-06Fix voicemail playback position controlJay Shrauner
Bug:19255194 Change-Id: I8eabe46ef6fff774291e3f943051c24eca8a00e0
2014-03-05Fix threading problems in voicemail codeJay Shrauner
Hold libvariablespeed handle in a reference counted singleton. Don't always reinitialize the engine twice in quick succession on startup. Catch and properly handle RejectedExecutionException exceptions thrown by the executor service. Bug:11511992 Change-Id: I6198dec303209445a0efd0f410a67332d75c7507
2013-10-21Remove private references from DialerYorke Lee
Remove MathUtils.constrain Use VisibleForTesting annotation in Guava Use Sets class in Guava Change-Id: Ib46e50ae2c0f278f6f588bb769b89ea37d8c5b30
2012-10-15Changing com.android.contacts.R to com.android.dialer.R.Chiao Cheng
Bug: 6993891 Change-Id: I921ec71fffbd4d4a058bab29ded8a6ac62adfb70
2012-08-30Moving more classes from contacts into dialer.Chiao Cheng
- These classes are only used by dialer code. - Fixed import order. Bug: 6993891 Change-Id: I7941a029989c4793b766fdc77a4666f9f99b750a
2012-08-21Initial move of dialer features from contacts app.Chiao Cheng
Bug: 6993891 Change-Id: I758ce359ca7e87a1d184303822979318be171921