OSDN Git Service

Don't crash when primary volume is null in AppCollector.
authorDaniel Nishi <dhnishi@google.com>
Wed, 22 Feb 2017 00:04:20 +0000 (16:04 -0800)
committergitbuildkicker <android-build@google.com>
Thu, 23 Feb 2017 18:22:53 +0000 (10:22 -0800)
commit6422e8fb4429936477f2cac82c472e5e4684f26d
tree4eb2586b6f686a50de8f1852b879a801d5432e1a
parent951233a0e8a3ff2e03b641702373afb816be5a04
Don't crash when primary volume is null in AppCollector.

getPrimaryStorageCurrentVolume() may return a null value. I did
not plan for this case in the AppCollector. This case occurs when
the primary storage is not mounted when the function is called.

By adding in a null check after getPrimaryStorageCurrentVolume()
and adding in preconditions to verify the non-nullness of the
volume as it propagates through the AppCollector, we ensure that
there should be no more NPE crashes for this reason.

Bug: 35636901
Test: FrameworkServicesTests
Change-Id: I4009e55502f71b8f14dd917ddd00caef3551aafd
(cherry picked from commit d54f3a487bba1dc5008e2e1482ef451a59500752)
services/core/java/com/android/server/storage/AppCollector.java
services/core/java/com/android/server/storage/DiskStatsLoggingService.java
services/tests/servicestests/src/com/android/server/storage/AppCollectorTest.java