Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a2f013da authored by Shibin George's avatar Shibin George Committed by Fan Zhang
Browse files

Gracefully handle the case where private volume may be unmountable

If sdcard was removed while format(as phone storage) was
under progress, blkid can fail to identify the UUID of the
private volume. The PrivateStorageInfo.getTotalSize() API
assumes UUID to be always valid which could simply be not the case.
Avoid calling getTotalSize() on private volume when its state
is unmountable.

Bug: 130203877

Test: 1) Insert sdcard as "portable" storage.
      2) Format it as "phone" storage.
      3) Remove the sdcard while format is in progress.
      4) Insert sdcard again -> blkid may fail to id the sdcard.
         In such case, the fsUuid of the private-volume will be reported as "".
      5) Open "Storage Settings". Settings app crashes:

       FATAL EXCEPTION: main
       Process: com.android.settings, PID: 3700
       ...
       Caused by: java.lang.IllegalArgumentException: Invalid UUID string:
       at java.util.UUID.fromString(UUID.java:194)
       at android.os.storage.StorageManager.convert(StorageManager.java:2139)
       at android.app.usage.StorageStatsManager.getTotalBytes(StorageStatsManager.java:121)
       at com.android.settingslib.deviceinfo.PrivateStorageInfo.getTotalSize(PrivateStorageInfo.java:64)

         However, with this CL, "Storage Settings" can be opened
         and the private volume's state is correctly reflected as "Corrupted".
         User can choose to format the volume again.

Copyright (c) 2019 Qualcomm Innovation Center, Inc. All Rights Reserved.

Change-Id: I764603b5806f43f0c6d398f9d6803646774cd912
parent 8b3cde0f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment