@Override public void onInvitationReceived(ContactId contact, MmContent content, long timestamp) { if (sLogger.isActivated()) { sLogger.debug("Invited to video sharing session"); } synchronized (mLock) { mPersistentStorage.addVideoSharing( contact, Direction.INCOMING, (VideoContent) content, State.INVITED, ReasonCode.UNSPECIFIED, timestamp); } mBroadcaster.broadcastInvitation(mSharingId); }
private void setStateAndReasonCode(ContactId contact, State state, ReasonCode reasonCode) { long duration = 0; switch (state) { case STARTED: mStartTime = System.currentTimeMillis(); break; case ABORTED: case FAILED: duration = mStartTime > 0 ? System.currentTimeMillis() - mStartTime : 0; // $FALL-THROUGH$ default: break; } if (mPersistentStorage.setStateReasonCodeAndDuration(state, reasonCode, duration)) { mBroadcaster.broadcastStateChanged(contact, mSharingId, state, reasonCode); } }