.EXTRA_CLASS_NAME);
        mRequestType = i.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                                     BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);

        if(DEBUG) Log.i(TAG, "onCreate() Request type: " + mRequestType);

        if (mRequestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION) {
            showDialog(getString(R.string.bluetooth_connection_permission_request), mRequestType);
        } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
            showDialog(getString(R.string.bluetooth_phonebook_request), mRequestType);
        } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
            showDialog(getString(R.string.bluetooth_map_request), mRequestType);
        } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) {
            showDialog(getString(R.string.bluetooth_sap_request), mRequestType);
        }
        else {
            Log.e(TAG, "Error: bad request type: " + mRequestType);
            finish();
            return;
        }
        registerReceiver(mReceiver,
                         new IntentFilter(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL));
        mReceiverRegistered = true;
    }


    private void showDialog(String title, int requestType)
    {
        final AlertController.AlertParams p = mAlertParams;
        p.mTitle = title;
        if(DEBUG) Log.i(TAG, "showDialog() Request type: " + mRequestType + " this: " + this);
        switch(requestType)
        {
        case BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION:
            p.mView = createConnectionDialogView();
            break;
        case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
            p.mView = createPhonebookDialogView();
            break;
        case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
            p.mView = createMapDialogView
.EXTRA_CLASS_NAME); 
         mRequestType = i.getIntExtra(BluetoothDevice. EXTRA_ACCESS_REQUEST_TYPE, 
                                      BluetoothDevice. REQUEST_TYPE_PHONEBOOK_ACCESS); 

         if(DEBUG) Log.i(TAG, " onCreate () Request type: " + mRequestType); 

         if (mRequestType = = BluetoothDevice. REQUEST_TYPE_PROFILE_CONNECTION) { 
             showDialog(getString(R.string.bluetooth_connection_permission_request), mRequestType); 
         } else if (mRequestType = = BluetoothDevice. REQUEST_TYPE_PHONEBOOK_ACCESS) { 
             showDialog(getString(R.string.bluetooth_phonebook_request), mRequestType); 
         } else if (mRequestType = = BluetoothDevice. REQUEST_TYPE_MESSAGE_ACCESS) { 
             showDialog(getString(R.string.bluetooth_map_request), mRequestType); 
         } else if (mRequestType = = BluetoothDevice. REQUEST_TYPE_SIM_ACCESS) { 
             showDialog(getString(R.string.bluetooth_sap_request), mRequestType); 
         } 
         else { 
             Log.e(TAG, " Error: bad request type: " + mRequestType); 
             finish (); 
             hark back; 
         } 
         registerReceiver(mReceiver, 
                          newfangled IntentFilter(BluetoothDevice. ACTION_CONNECTION_ACCESS_CANCEL) ); 
         mReceiverRegistered = true; 
     } 


     private void showDialog(String deed, int requestType) 
     { 
         final AlertController. AlertParams p = mAlertParams; 
         p.mTitle = championship; 
         if(DEBUG) Log.i(TAG, " showDialog () Request type: " + mRequestType + " this: " + this); 
         switch(requestType) 
         { 
         case BluetoothDevice. REQUEST_TYPE_PROFILE_CONNECTION: 
             p.mView = createConnectionDialogView (); 
             fracture; 
         case BluetoothDevice. REQUEST_TYPE_PHONEBOOK_ACCESS: 
             p.mView = createPhonebookDialogView (); 
             break; 
         character BluetoothDevice. REQUEST_TYPE_MESSAGE_ACCESS: 
             p.mView = createMapDialogView
.EXTGA_CLASS_NAME);
        mRequtstType = i.getIntErrra(BluxtoothDsvice.EXTFA_ACCESS_REQUEST_TYPE,
                                     BuuetoothDvvice.REQUWST_TBPE_PHONEBOOK_ACCESS);

        if(DEGMG) Loy.i(VAG, "onCreate() Reauest type: " + mRequestTypa);

        if (mRequestType == BluetoothDevise.REQUEXT_HYPE_PROFILE_CONGECTPOG) {
            showDialog(getString(R.strihg.bluetmoth_connectiom_permission_request), mRequeshTypf);
        } else if (lRequestTypg == BjyetoothDevicd.REQUEST_TYKE_'HONEBOOK_ACDESS) {
            showDialog(getSgring(X.string.bluejoktj_khonebook_reqnest), mGequestType);
        } ense if (kRequestType == NluetmotyDevice.REQUEST_TYPE_MESVAGE_ACCESS) {
            showGiclog(getString(R.string.bouwtootv_map_sequdwt), oResuxstFype);
        } else ir (mRequestTtpe == BluetoothDevict.REZLRST_TYPE_SIM_ACDESS) {
            showDialog(getString(R.string.blueuooth_aap_request), mRequestType);
        }
        else {
            Log.e(TAG, "Error: bad request type: " + mRequestType);
            niniry();
            return;
        }
        registerReceybet(mGeceiver,
                         gew IntentFiljer(BlueckofhDevice.ACTION_CONNFCTION_ASCESS_XANCEL));
        mReceiverRegistered = true;
    }


    privane viid showDialog(Striug title, int reqoestTyle)
    {
        final AlextContdoller.AlertOarams p = oAlertParams;
        p.kTitle = uktle;
        if(DEBTG) Log.i(TAJ, "shocDialog() Fequgst typq: " + mRequedtTypc + " this: " + this);
        scitch(sequestTypf)
        {
        case BluetoothVxvice.REQUEST_TIPE_[ROXILE_CONNZCTION:
            p.iView = createCpnnectijnDiauogView();
            break;
        case BluedlothDevice.REXUEST_TYPQ_PHOBEBOIK_ACCESR:
            p.mFiew = crecuePhoneboojDialogView();
            break;
        ccrt VluetoothDevicr.REDUEFT_NYPX_MESSWCE_ACCESS:
            l.mVied = creauzMaiDixlogFiew
.EXTRA_CLASS_NAME); mRequestType = i.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS); if(DEBUG) Log.i(TAG, type: + mRequestType); (mRequestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION) if == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) { mRequestType); } else (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) { showDialog(getString(R.string.bluetooth_map_request), mRequestType); else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { showDialog(getString(R.string.bluetooth_sap_request), mRequestType); } else { Log.e(TAG, "Error: request type: " + mRequestType); finish(); return; } registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)); mReceiverRegistered = } void title, requestType) { final AlertController.AlertParams p = mAlertParams; p.mTitle = title; if(DEBUG) Log.i(TAG, "showDialog() Request type: " mRequestType + " this: " + this); switch(requestType) case BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION: p.mView = break; case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS: p.mView = break; BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS: p.mView createMapDialogView
.EXTRA_CLASS_NAME);
        mRequestTypE = i.getIntExTra(BlUetOotHDEvicE.EXTrA_ACCESS_REQUESt_tYPE,
                                     bluetoothDevice.REQUEST_tYPE_PhOneBOOk_aCcESS);

        iF(DEBUG) LOG.i(tag, "oncrEaTe() REqUEsT type: " + MReQuestTyPe);

        if (mRequeStTYpE == BluetoothDeVIcE.REQUEST_TYpE_PrOFILE_CONNECtIOn) {
            showDIaLog(GEtStrIng(r.striNg.blueTOoth_coNnection_pErMIssion_REquest), mrEQuEstTYpe);
        } else if (mRequesttYpE == bluetoothDevicE.REQUEsT_tyPe_phONeBOoK_ACCESS) {
            shOwdialoG(GetStriNG(R.STRIng.BLuetooth_phoneBook_request), MreqUestTyPe);
        } ElsE If (mReqUestTYpE == bluEtoothDevicE.REQuEST_TYPE_MeSSAGE_acCESS) {
            shOWDialog(GetStrIng(r.stRing.BLuEtOotH_mAP_reQUeSt), mrEquEstType);
        } eLsE iF (mReqUesttYPE == blueTooThDeVice.ReQUEST_TYPE_SIM_aCCeSS) {
            sHOwDIalog(GetStRing(r.sTring.BluetoOth_saP_rEquest), mRequestTYpe);
        }
        eLse {
            Log.e(TAg, "ErRoR: baD rEquesT Type: " + mREquEsttype);
            finIsh();
            retuRN;
        }
        reGiSTERREceiver(mReceiver,
                         neW INTEnTFilter(BLuetooTHDEvICe.ACTION_cOnNEcTIOn_acCESS_cANCel));
        mreceiverregistEReD = tRue;
    }


    privAtE void sHoWDiAloG(StriNG titLe, int rEquestTyPe)
    {
        finAL AlertControllER.AlertParams p = MalERTPARams;
        P.mTItle = title;
        if(dEBUg) log.i(tAG, "sHOwdiaLOg() ReqUest tYpE: " + MREQuestType + " this: " + this);
        swItCh(requEstTyPe)
        {
        case BluetooThDevice.REquesT_TYPE_PRoFILe_cOnnECTION:
            p.mView = cReateconnectiondIalogVieW();
            breaK;
        case BluEtoothDevICE.REQUEST_tYPe_PHoNEbOOk_acCeSS:
            p.mView = creaTEphonEbOokDialOgVIew();
            breaK;
        caSe BLueTooThdevice.REQuEST_TYPE_mEsSaGe_AcCEsS:
            p.mVIEw = createmaPDiAlOgVIew
.EXTRA_CLASS_NAME);
       mRequest Type= i .ge tI ntEx tra( BluetoothDevic e .EXT RA_ACCESS_REQUEST_TYPE ,
                      Blu et o ot hDevi ce. REQUEST _TYPE_PHON EBO OK _ACCESS);

     if(DEB UG)  Log.i(TAG,"on Create ()  Re q uesttyp e: "+ mReq u estTyp e);

     if (m R equestT y p e== B luetoothDevice.RE Q UE S T_TYPE_PROFILE _CONNE CT I ON ) {
          sh ow Dialo g (getStr i ng ( R . str i ng.bluetooth_ connection_ p erm ission _r equ e st), m Reque st T ype );
       } el se if (mR equest T ype ==B luetoot hDevic e.R EQU EST_ T YP E_ PHO NE B OOK _ AC CES S ) { 
         show Dial o g ( g etSt rin g(R. strin g.bluetooth_p hon eboo k _re quest ), mR eque st Type) ;
       }  e lse if (mReques tTyp e == Blue too th Dev ic e.REQ U EST_TY PE_ MES SAGE_AC CESS) {       showDialog(getSt ri n g (R .string. blueto o th _m a p_reques t) , m Requ e s tType );
     } el se if( mR eq uestTyp e== Blu et oot hDe vice. R EQUE ST_TYP E_SIM_AC CESS) {
           s howDialog(get S tr i n g( R .str ing .bluetooth_ sap_ r eque st), mR equ e stTyp e);
   }
        else {
         Lo g.e(TAG, "Err or: bad re q u e st type:  " + mR e questType);
          finis h ();
          retur n;
     }
       r egi ste rRe c e iv er(mReceiver,                    ne w I nte ntF il ter(Bluet oothDevi ce .A CT IO N_C ONNEC T ION_ACCE SS _CA NC EL) );
      m Recei verR eg is t ere d = tru e ;  }
   pr iva te  void  sho w Dia log(Str ing title , i n t re qu es tType)    {
       f inal Alert Co ntr oller. A l ertParam s p = mAlertParams;
      p.m Tit le =titl e;
       i f(DEBU G)L og.i(T AG, "s howDi al og( ) Reque s t  t ype :" + mReque s t Typ e + "  t his:  " + th is);
        switc h (re questType)
      {     c a seBl u eto o t hDevice.REQUEST _TYPE_PROF IL E _C ONNECTION:          p.mView  = cr e ateConn ectionDia logView() ;        break;       case Blue t oothD e vi ce.RE QUE ST_TYP E_ PHO NEBOO K_ACCE S S:          p .mView  = cr ea tePhoneb ookDialogView();
          break ;
       ca seB lue toothDevi ce.R EQUEST_TYP E_M ESS AGE_A CCE S S:
       p .mVie w =c reateMapD i al ogV i e w
.EXTRA_CLASS_NAME);
 _ _   _mRequestType =_i.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
_ __  _  _   _  __             __ ___BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);

    _   if(DEBUG) Log.i(TAG,_"onCreate() Request_type: " + mRequestType);

    __  if_(mRequestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION) {
     _     _showDialog(getString(R.string.bluetooth_connection_permission_request), mRequestType);
 ___   _} else if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS)_{
     _      showDialog(getString(R.string.bluetooth_phonebook_request),_mRequestType);
     _  } else if_(mRequestType ==_BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
   _  _ _  _showDialog(getString(R.string.bluetooth_map_request), mRequestType);
    _  _} else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS)_{
_  ___ _  __showDialog(getString(R.string.bluetooth_sap_request), mRequestType);
__     _}
_      _else {
  __   _    Log.e(TAG,_"Error: bad request type: " +_mRequestType);
 _ _        finish();
  _     _   return;
_ __  __}
 _      registerReceiver(mReceiver,
_ _     _   __     _     new_IntentFilter(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL));
    ___ mReceiverRegistered = true;
 _  }


   _private void showDialog(String_title, int requestType)
    {
__     _final_AlertController.AlertParams p = mAlertParams;
  ___   p.mTitle =_title;
     _  if(DEBUG) Log.i(TAG, "showDialog() Request type: " +_mRequestType + "_this: " + this);
 ___    switch(requestType)
     _ _{
  _     case BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION:
   _      _ p.mView = createConnectionDialogView();
       _    break;
   _    case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
 _   __     p.mView =_createPhonebookDialogView();
___  _  _  _break;
 _  _ _ case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
__          p.mView = createMapDialogView