  We compute the average luminosity of X-ray flares as a function of time, for
a sample of 10 long-duration gamma-ray burst afterglows. The mean luminosity,
averaged over a timescale longer than the duration of the individual flares,
declines as a power-law in time with index ~-1.5. We elaborate on the
properties of the central engine that can produce such a decline. Assuming that
the engine is an accreting compact object, and for a standard conversion factor
between accretion rate and jet luminosity, the switch between a neutrino-cooled
thin disk and a non-cooled thick disk takes place at the transition from the
prompt to the flaring phase. We discuss the implications of this coincidence
under different scenarios for the powering of the GRB outflow. We also show
that the interaction of the outflow with the envelope of the progenitor star
cannot produce flares out of a continuous relativistic flow, and conclude that
it is the dynamics of the disk or the jet-launching mechanism that generates an
intrinsically unsteady outflow on timescales much longer than the dynamical
timescale of the system. This is consistent with the fact that X-ray flares are
observed in short-duration GRBs as well as in long-duration ones.
