frameworks/base: Fix aliasing violations

Fix violations of strict aliasing rules

Change-Id: Ia4adcc2ab0f05afff8a8d59d01bf604a94f2aa31
Signed-off-by: zwliew <zhaoweiliew@gmail.com>