Add protection for the setUidPolicy() failed case to avoid invalid UIDs to crash the caller process, and avoid storing the invalid UIDs to SharedPreferences if it is failed to setUidPolicy() Bug: 306329984 Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge" Change-Id: I5c14434708b82ba3c238c2338d47085c2ce244e0