Replace getVisibity and getAlpha function in getSizePercentage

1. Replace the getVisibity and getAlpha functions with the logic directly
to avoid NullPointerException.
2. Move the flag to cover the entire getSizePercentage function

Bug: 316852908
Test: atest ViewTest & atest ViewRootImplTest
Change-Id: I979302ce9830027d8d0e5d9e47820584f9ba1ef8
1 file changed