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)
committerDaniel Nishi <dhnishi@google.com>
Wed, 22 Feb 2017 01:14:35 +0000 (01:14 +0000)
commitd54f3a487bba1dc5008e2e1482ef451a59500752
tree1231efcf7fd43a6b409748e039c1a4dc4a669778
parent1ddddee33f51551c9ddf0a94be8e7734b4643ff6
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
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