code: public void setLevel(int level) {
          if (level >= 0 && mLevel != level && level < mLevelInfo.size()) {
              Log.d(Log.SUBSYSTEM.WIDGET, TAG, "setLevel(%d): clearing level: %d", level, mLevel);
              if (mLevel >= 0) {
                  mLevelInfo.get(mLevel).setState(null);
              }
  
              mLevel = level;
  
              updateState();
          }
      }
docs: Set the current "level" of the {@link Widget}. This is useful for
  indicating different states that reflect a change in quantity (e.g.,
  battery charge, WiFi signal strength, etc.). The visual change for each
  level can be a change in material, an animation, or showing a sub-object.
  
  @param level
  The new level value. Values will be clamped to the range
  [0,num_levels).