The ruling from SCOTUS hinges on the 1938 Fair Labor Standards Act, as well as a 1947 statute known as the “Portal-to-Portal Act.” Under the FLSA, workers have a right to compensation for their “principal activities.” But the Portal-to-Portal Act allows certain pre- and post-shift activities to be exempt. A typical example of this is that most places of employment will not allow you to clock in before you put on your uniform.
SCOTUS based their ruling in the Amazon case on a 1956 ruling which found that “workers must be paid for activities that are ‘integral and indispensable’ to the job itself.”