Avoid potential failure to boot with bad storage
Discovered by inspection: It is possible in the
event of file system issues to throw an exception
on boot.
This change moves logic previously done in the
PackageStatusStorage constructor to an initialize()
method that can be called on service start up and
handled more gracefully: if there is a storage problem
a warning will be logged and time zone updates
feature will just not be enabled.
Also:
Commit a7d21f8c321ae7149b68625a5c8502abe005ed7b
switched to FileUtils.createDir() but the mkdir()
(implied by createDir()) wasn't removed along with
it but was redundant.
Units tests run with:
atest FrameworksServiceTestsCases:PackageStatusStorageTest \
FrameworksServiceTestsCases:PackageTrackerTest
Test: See above
Test: PTS: run pts -m PtsTimeZoneTestCases
Test: Manual test: deleted /data/system/timezone and rebooted, dir
recreated
Change-Id: I84ab3152d0a9d6781e5665e8615b3ab92b6c7a40
diff --git a/services/core/java/com/android/server/timezone/RulesManagerService.java b/services/core/java/com/android/server/timezone/RulesManagerService.java
index 52b49ba..30fc63c 100644
--- a/services/core/java/com/android/server/timezone/RulesManagerService.java
+++ b/services/core/java/com/android/server/timezone/RulesManagerService.java
@@ -121,6 +121,7 @@
}
public void start() {
+ // Return value deliberately ignored: no action required on failure to start.
mPackageTracker.start();
}