Refine the BatteryUsageStats close() method invoke timing

Refine invoke batteryUsageStats.close() timing to 1) avoid closing it before the UI is ready to ignore showing the battery usage app list data for AOSP version, and 2) avoid close the BatteryUsageStats which is passed from caller components in the BatteryInfo with unexpected behavior.

Bug: 220717612
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I0f75580ac68d72b41fa9a7f43aa6ea694f0992ff
2 files changed