code: int addLayer(ChildDrawable layer) {
          final LayerState st = mLayerState;
          final int N = st.mChildren != null ? st.mChildren.length : 0;
          final int i = st.mNum;
          if (i >= N) {
              final ChildDrawable[] nu = new ChildDrawable[N + 10];
              if (i > 0) {
                  System.arraycopy(st.mChildren, 0, nu, 0, i);
              }
  
              st.mChildren = nu;
          }
  
          st.mChildren[i] = layer;
          st.mNum++;
          st.invalidateCache();
          return i;
      }
docs: Adds a new layer at the end of list of layers and returns its index.
  
  @param layer The layer to add.
  @return The index of the layer.