code: def update(self, get_running_apps=True):
          
          # The `screen_on`, `awake`, `wake_lock_size`, `current_app`, and `running_apps` properties.
          screen_on, awake, wake_lock_size, _current_app, running_apps = self.get_properties(get_running_apps=get_running_apps, lazy=True)
  
          # Check if device is off.
          if not screen_on:
              state = STATE_OFF
              current_app = None
              running_apps = None
  
          # Check if screen saver is on.
          elif not awake:
              state = STATE_IDLE
              current_app = None
              running_apps = None
  
          else:
              # Get the current app.
              if isinstance(_current_app, dict) and 'package' in _current_app:
                  current_app = _current_app['package']
              else:
                  current_app = None
  
              # Get the running apps.
              if running_apps is None and current_app:
                  running_apps = [current_app]
  
              # Get the state.
              # TODO: determine the state differently based on the `current_app`.
              if current_app in [PACKAGE_LAUNCHER, PACKAGE_SETTINGS]:
                  state = STATE_STANDBY
  
              # Amazon Video
              elif current_app == AMAZON_VIDEO:
                  if wake_lock_size == 5:
                      state = STATE_PLAYING
                  else:
                      # wake_lock_size == 2
                      state = STATE_PAUSED
  
              # Netflix
              elif current_app == NETFLIX:
                  if wake_lock_size > 3:
                      state = STATE_PLAYING
                  else:
                      state = STATE_PAUSED
  
              # Check if `wake_lock_size` is 1 (device is playing).
              elif wake_lock_size == 1:
                  state = STATE_PLAYING
  
              # Otherwise, device is paused.
              else:
                  state = STATE_PAUSED
  
          return state, current_app, running_apps
docs: Get the state of the device, the current app, and the running apps.
  
          :param get_running_apps: whether or not to get the ``running_apps`` property
          :return state: the state of the device
          :return current_app: the current app
          :return running_apps: the running apps