Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onStart() {
- super.onStart();
- Logger.d(TAG, "onStart() called");
- // On Android Q the onStart() is called when user tries to turn off the radio from the
- // notification, this triggers a new Radio start.
- if (getIntent() != null && ACTION_CLOSE.equals(getIntent().getAction())) {
- Logger.d(TAG, "onStart() called from ACTION_CLOSE intent");
- return;
- }
- mAudioState = mAudioDeviceController.getAudioState();
- mCallStateIdle = mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE;
- final Function1<Boolean, Unit> modConnectedCallback = new Function1<Boolean, Unit>() {
- @Override
- public Unit invoke(Boolean isGamePadAttached) {
- Logger.d(TAG, "modConnectedCallback: [isGamePadAttached = " + isGamePadAttached + "]");
- mIsGamePadAttached = isGamePadAttached;
- presentUI(mAudioState, mCallStateIdle, mFmServiceBound, mHasAudioFocus, isGamePadAttached);
- return Unit.INSTANCE;
- }
- };
- registerPhoneStateListener();
- registerBroadcastReceiver();
- registerAudioStateReceiver();
- mModServiceController.addModListener(modConnectedCallback);
- if (mFmServiceBound) {
- // 1. If we are in a call, update the UI to stop
- // 2. If pause pressed from LockScreen, update the UI to stop
- startFMRadioFlow();
- if (mService != null) {
- try {
- mService.updateTabInformation(mViewPager.getCurrentItem());
- } catch (RemoteException e) {
- Logger.e(TAG, e.getMessage());
- }
- }
- } else {
- if (!mFMStarting) {
- startFMRadioFlow();
- }
- }
- mModServiceController.isGamePadConnected(modConnectedCallback);
- updateThemedFavoriteIcons();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement