/**
   * Callback from EmailBroadcastProcessorService. This provides the workers for the
   * DeviceAdminReceiver calls. These should perform the work directly and not use async threads for
   * completion.
   */
  public static void onDeviceAdminReceiverMessage(Context context, int message) {
    SecurityPolicy instance = SecurityPolicy.getInstance(context);
    switch (message) {
      case DEVICE_ADMIN_MESSAGE_ENABLED:
        instance.onAdminEnabled(true);
        break;
      case DEVICE_ADMIN_MESSAGE_DISABLED:
        instance.onAdminEnabled(false);
        break;
      case DEVICE_ADMIN_MESSAGE_PASSWORD_CHANGED:
        // TODO make a small helper for this
        // Clear security holds (if any)
        Account.clearSecurityHoldOnAllAccounts(context);
        // Cancel any active notifications (if any are posted)
        final NotificationController nc = NotificationControllerCreatorHolder.getInstance(context);

        nc.cancelPasswordExpirationNotifications();
        break;
      case DEVICE_ADMIN_MESSAGE_PASSWORD_EXPIRING:
        instance.onPasswordExpiring(instance.mContext);
        break;
    }
  }