@Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
     String reason = intent.getStringExtra(PhoneWindowManager.SYSTEM_DIALOG_REASON_KEY);
     if (!PhoneWindowManager.SYSTEM_DIALOG_REASON_RECENT_APPS.equals(reason)) {
       dismiss();
     }
   }
 }
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)
       || Intent.ACTION_SCREEN_OFF.equals(action)) {
     String reason = intent.getStringExtra("reason");
     if (!"globalactions".equals(reason)) {
       mHandler.sendEmptyMessage(0);
     }
   } else if ("android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED".equals(action)) {
     // Airplane mode can be changed after ECM exits if airplane
     // toggle button
     // is pressed during ECM mode
     if (!(intent.getBooleanExtra("PHONE_IN_ECM_STATE", false)) && mIsWaitingForEcmExit) {
       mIsWaitingForEcmExit = false;
       changeAirplaneModeSystemSetting(true);
     }
   }
 }