void pressedButton(int button) {
    if (Preferences.logging) Log.d(MetaWatch.TAG, "button code: " + Integer.toString(button));

    wakeLock.acquire(10000);

    try {

      if (button > 0 && Preferences.hapticFeedback) Protocol.vibrate(5, 5, 2);

      if (Preferences.logging)
        Log.d(MetaWatch.TAG, "MetaWatchService.pressedButton(): watchState=" + watchState);
      switch (watchState) {
        case WatchStates.IDLE:
          {
            int idleAppButton = Idle.appButtonPressed(this, button);
            if (idleAppButton == ApplicationBase.BUTTON_NOT_USED) {

              switch (button) {
                case Idle.QUICK_BUTTON:
                  Idle.quickButtonAction(this);
                  break;

                case Idle.IDLE_NEXT_PAGE:
                  if (MetaWatchService.watchType == MetaWatchService.WatchType.DIGITAL) {
                    Idle.nextPage(this);
                    Idle.updateIdle(this, true);
                  }
                  break;

                case Idle.TOGGLE_SILENT:
                  MetaWatchService.setSilentMode(!silentMode);
                  Protocol.vibrate(500, 500, 2);
                  break;

                case Idle.IDLE_OLED_DISPLAY:
                  long time = System.currentTimeMillis();

                  if (time - lastOledCrownPress < 1000 * 5) {
                    Idle.nextPage(this);
                    Idle.updateIdle(this, true);
                  }

                  lastOledCrownPress = time;
                  Idle.sendOledIdle(this);
                  break;

                case Application.TOGGLE_APP:
                  Application.toggleApp(context, Idle.getCurrentApp());
                  break;
              }
            } else if (idleAppButton != ApplicationBase.BUTTON_USED_DONT_UPDATE) {
              Idle.updateIdle(this, false);
              if (MetaWatchService.watchType == MetaWatchService.WatchType.ANALOG)
                Idle.sendOledIdle(this);
            }
            break;
          }

        case WatchStates.APPLICATION:
          Application.buttonPressed(this, button);
          break;

        case WatchStates.NOTIFICATION:
          switch (button) {
            case Call.CALL_ANSWER:
              MediaControl.answerCall(this);
              break;
            case Call.CALL_DISMISS:
              MediaControl.ignoreCall(this);
              break;
            case Call.CALL_MENU:
              ActionManager.displayCallActions(this);
              break;
            default:
              Notification.buttonPressed(button);
              break;
          }
          break;
      }

    } finally {
      if (wakeLock != null && wakeLock.isHeld()) {
        wakeLock.release();
      }
    }
  }