Source:
<code>protected void onDraw(Canvas canvas) { PasscodeManager passcodeManager = SalesforceSDKManager.getInstance().getPasscodeManager(); boolean passcodeLengthKnown = passcodeManager.getPasscodeLengthKnown(); int passcodeLength = passcodeManager.getPasscodeLength(); float density = getResources().getDisplayMetrics().density; float diameter = CIRCLE_DIAMETER * density; float lineWidth = LINE_WIDTH * density; float padding = DEFAULT_PADDING * density; float spacing = CIRCLE_SPACING * density; <START> Paint openCirclePaint = new Paint(); <END> Paint typedCirclePaint = new Paint(); openCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); openCirclePaint.setStyle(Paint.Style.STROKE); openCirclePaint.setStrokeWidth(lineWidth); typedCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); int circleSpacing = 0; int lengthForSpacing = passcodeLengthKnown ? passcodeLength : MAX_PASSCODE_LENGTH; float yPosition = getHeight()/2f; float startX = (getWidth() - (diameter * lengthForSpacing) - (padding * (lengthForSpacing - 1)) + (lineWidth * lengthForSpacing * 2)) / 2; if (passcodeLengthKnown) { for (int count = 0; count < passcodeLength; count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, openCirclePaint); circleSpacing += diameter + spacing; } } else { startX = (startX > padding) ? padding : startX; } circleSpacing = 0; for (int count = 0; count < getText().length(); count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, typedCirclePaint); circleSpacing += diameter + spacing; } }</code><technical_language><table data-meta="generated_by_SalesforceSDK"> <tbody> <tr> <td>:warning:</td> <td width="100%" data-sticky="false"><span data-href="<LINK_0>"></span>Avoid object allocations draw/layout operations (preallocate reuse instead)</td> </tr> </tbody> </table></technical_language>

Target:
protected void onDraw(Canvas canvas) { PasscodeManager passcodeManager = SalesforceSDKManager.getInstance().getPasscodeManager(); boolean passcodeLengthKnown = passcodeManager.getPasscodeLengthKnown(); int passcodeLength = passcodeManager.getPasscodeLength(); float density = getResources().getDisplayMetrics().density; float diameter = CIRCLE_DIAMETER * density; float lineWidth = LINE_WIDTH * density; float padding = DEFAULT_PADDING * density; float spacing = CIRCLE_SPACING * density; Paint openCirclePaint = new Paint(); Paint typedCirclePaint = new Paint(); openCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); openCirclePaint.setStyle(Paint.Style.STROKE); openCirclePaint.setStrokeWidth(lineWidth); typedCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); int circleSpacing = 0; int lengthForSpacing = passcodeLengthKnown ? passcodeLength : MAX_PASSCODE_LENGTH; float yPosition = getHeight()/2f; float startX = (getWidth() - (diameter * lengthForSpacing) - (spacing * (lengthForSpacing - 1)) + (lineWidth * lengthForSpacing * 2)) / 2; if (passcodeLengthKnown) { for (int count = 0; count < passcodeLength; count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, openCirclePaint); circleSpacing += diameter + spacing; } } else { startX = (startX > padding) ? padding : startX; } circleSpacing = 0; for (int count = 0; count < getText().length(); count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, typedCirclePaint); circleSpacing += diameter + spacing; } }