code: public void drawCornerShadow(
              Canvas canvas,
              Matrix matrix,
              RectF bounds,
              int elevation,
              float startAngle,
              float sweepAngle) {
  
          Path arcBounds = scratch;
  
          // Calculate the arc bounds to prevent drawing shadow in the same part of the arc.
          arcBounds.rewind();
          arcBounds.moveTo(bounds.centerX(), bounds.centerY());
          arcBounds.arcTo(bounds, startAngle, sweepAngle);
          arcBounds.close();
  
          bounds.inset(-elevation, -elevation);
          cornerColors[0] = 0;
          cornerColors[1] = shadowStartColor;
          cornerColors[2] = shadowMiddleColor;
          cornerColors[3] = shadowEndColor;
  
          float startRatio = 1f - (elevation / (bounds.width() / 2f));
          float midRatio = startRatio + ((1f - startRatio) / 2f);
          cornerPositions[1] = startRatio;
          cornerPositions[2] = midRatio;
  
          cornerShadowPaint.setShader(
                  new RadialGradient(
                          bounds.centerX(),
                          bounds.centerY(),
                          bounds.width() / 2,
                          cornerColors,
                          cornerPositions,
                          Shader.TileMode.CLAMP));
  
          // TODO: handle oval bounds by scaling the canvas.
  
          canvas.save();
          canvas.concat(matrix);
          cornerShadowPaint.setStyle(Paint.Style.STROKE);
          cornerShadowPaint.setStrokeWidth(elevation * 2);
          canvas.drawArc(bounds, startAngle, sweepAngle, false, cornerShadowPaint);
          canvas.restore();
      }
docs: Draws a corner shadow on the canvas in the current bounds with the matrix transform applied.