Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.00 KB | None | 0 0
  1.     @Override
  2.     protected void onStart() {
  3.         super.onStart();
  4.         Logger.d(TAG, "onStart() called");
  5.  
  6.         // On Android Q the onStart() is called when user tries to turn off the radio from the
  7.         // notification, this triggers a new Radio start.
  8.         if (getIntent() != null && ACTION_CLOSE.equals(getIntent().getAction())) {
  9.             Logger.d(TAG, "onStart() called from ACTION_CLOSE intent");
  10.             return;
  11.         }
  12.  
  13.         mAudioState = mAudioDeviceController.getAudioState();
  14.         mCallStateIdle = mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE;
  15.  
  16.         final Function1<Boolean, Unit> modConnectedCallback = new Function1<Boolean, Unit>() {
  17.             @Override
  18.             public Unit invoke(Boolean isGamePadAttached) {
  19.                 Logger.d(TAG, "modConnectedCallback: [isGamePadAttached = " + isGamePadAttached + "]");
  20.                 mIsGamePadAttached = isGamePadAttached;
  21.                 presentUI(mAudioState, mCallStateIdle, mFmServiceBound, mHasAudioFocus, isGamePadAttached);
  22.  
  23.                 return Unit.INSTANCE;
  24.             }
  25.         };
  26.  
  27.         registerPhoneStateListener();
  28.         registerBroadcastReceiver();
  29.         registerAudioStateReceiver();
  30.         mModServiceController.addModListener(modConnectedCallback);
  31.  
  32.         if (mFmServiceBound) {
  33.             // 1. If we are in a call, update the UI to stop
  34.             // 2. If pause pressed from LockScreen, update the UI to stop
  35.             startFMRadioFlow();
  36.  
  37.             if (mService != null) {
  38.                 try {
  39.                     mService.updateTabInformation(mViewPager.getCurrentItem());
  40.                 } catch (RemoteException e) {
  41.                     Logger.e(TAG, e.getMessage());
  42.                 }
  43.             }
  44.         } else {
  45.             if (!mFMStarting) {
  46.                 startFMRadioFlow();
  47.             }
  48.         }
  49.  
  50.         mModServiceController.isGamePadConnected(modConnectedCallback);
  51.  
  52.         updateThemedFavoriteIcons();
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement