Commit Graph

34 Commits

Author SHA1 Message Date
Jeff Sharkey
77fe8c1e9e Consistent "low storage" behavior.
Fix several bugs related to storage accounting.  Since getDataBytes()
already includes cached data, we need to subtract it to avoid blaming
apps for it.

We also need to blame app code on someone, so we blame it on the
current user.  StorageStatsManager was fixed awhile back to only
return the app code size on the requested storage volume, so we can
remove the system app checks.

Subtract "appBytes" from external storage accounting, since it's
already been blamed elsewhere against specific apps.

Pass along storage results from all users on the device, and subtract
them all when estimating size of "system" data.  To avoid embarrassing
estimation bugs, make sure that "system" data is at least 1GB.

Bug: 38008706
Test: cts-tradefed run commandAndExit cts-dev -m CtsJobSchedulerTestCases -t android.jobscheduler.cts.StorageConstraintTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Change-Id: Ide1e6d0690e5ad4e751c87891f63ba1036434619
2017-05-30 23:51:06 -06:00
Daniel Nishi
7bb541b6ff Fix a bug where storage settings flickers.
The bug resulted from the fact that turning off loading while loading is
turned off causes the loading finishing animation to flicker. By only
turning it off when it is on, we ensure it works.

Change-Id: Ia31bf3e9aa90726e39b6bc7189d175c38fb51e5a
Fixes: 38045492
Test: Manual
2017-05-12 09:43:00 -07:00
Daniel Nishi
a16837769c Make the storage free/total sizes consistent.
We were using a different calculation in the top level view compared to
within the Storage settings. Technically, both are correct (one of them
is aware that we're considering cache as free, one does not). This patch
aligns us on the cache as free strategy.

Change-Id: I9ac26683a4d2a30b77a1da534aa2ddd3d4da6657
Fixes: 37175551
Test: Settings robotest
2017-04-26 09:58:58 -07:00
Daniel Nishi
0cd1f73b21 Change how we calculate system size.
As per storage discussions, the best way to calculate storage for the
System is to just take all known data and subtract it from the used
bytes. There is more to the system than just the /system partition and,
even if we ignore the partitions and use the underlying block device
method of calculating it, we run into the problem of it not adding up to
the actual device size.

Change-Id: I6e1f775ea3f3b8b2cc78d734623934651e2fb7b4
Fixes: 37166310
Test: Robotests
2017-04-19 11:42:34 -07:00
Daniel Nishi
4f2f6bcad9 Merge "Fix a bug where options menu was not showing." into oc-dev 2017-04-17 22:25:53 +00:00
Daniel Nishi
e6740f740e Fix a bug where options menu was not showing.
There were two issues that stopped the options menu from
showing properly. First, the SettingsPreferenceFragment did
not call its super class, causing the Lifecycle methods to
never be called. Second, the options menu was not being
invalidated which also stopped the Lifecycle methods from
being called.

Change-Id: I29f2fc105c7ecae7adaccb2e4643e48646398d8d
Fixes: 37255835
Test: Robotest
2017-04-14 14:25:37 -07:00
Daniel Nishi
95261b9239 Fix storage settings crash.
It may crash if opened during the uninstall of an app. By catching
the exception which may occur, we can just skip the uninstalled app
and avoid crashing.

Change-Id: I1b96b0697f4041be356260d6c675593affc1cb69
Merged-In: If556db7b5a299ba53a29baefbbe9709ba6d12190
Fixes: 36793223
Fixes: 36793372
Test: Settings unit test
2017-04-13 13:21:26 -07:00
Daniel Nishi
fe33c58a18 Add user icon to the other user preferences.
This icon is loaded in the background to avoid doing IO on
the main thread. Once we know there are more users and also
have the icon loaded, we add the category to the view.

Fixes: 36252572
Test: Robotest

Change-Id: Ib50287bb7ed323f22fbe407b56be1bf2fe98f121
2017-04-07 14:57:07 -07:00
Daniel Nishi
f6b12274f1 Re-add the option to migrate data back.
Currently, users can use an SD card or USB drive and adopt it as
internal storage using existing flows. They can manage this drive
perfectly fine using the old storage screen, which is still around.

One functionality that was lost was the ability to migrate data from
the adopted drive back to the private internal storage. This appeared
in a dropdown in the old storage settings.

By duplicating the code to create just that specific menu item and its
click behavior, we can restore this functionality to the new storage
view.

Change-Id: Id0e01c560e7249acccfe86c5da44466dd58fe5d4
Merged-In: I4b8c06912d2c0b2c5be5bce8b217d45accf34d4b
Fixes: 35926028
Test: Settings Robotest
2017-04-06 13:57:00 -07:00
Daniel Nishi
cf0e659a6c Re-add the progress bar for storage preferences.
This re-adds the progress bar and unifies the
StorageItemPreference and its alternate.

Change-Id: Iefc12b4b554306c706c83be232175dd2b84227b7
Fixes: 36223433
Test: Settings robotest
2017-03-20 11:42:46 -07:00
Daniel Nishi
abd92e0519 Update the Manage Storage preference.
Now, it is a master switch preference which can toggle the
automatic management on/off. This also removes the old
UI in the storage summary at the top.

Bug: 33199077
Test: SettingsRoboTests

Change-Id: I709fd2ca0687f760a5d97ad6bebe477b427b0464
2017-03-08 10:18:43 -08:00
Doris Ling
f2cf2aea37 Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code
and tests.

Bug: 35764802
Test: make RunSettingsRoboTests
Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
2017-03-07 11:15:03 -08:00
Fan Zhang
b00811da64 Let fragment and indexProvider share prefControllers
Bug: 35812240
Test: make RunSettingsRoboTests
Change-Id: Ifd96f935836a52e0a56f170f3cdf9b9ddf7c499a
2017-03-01 12:56:58 -08:00
Daniel Nishi
9f60f42a94 Add support for user profiles to the Storage Settings.
This adds new preferences for each profile (such as the work
profile) and defines a new view for viewing the storage
breakdown for the individual profile. The functionality closely
mimics the presentation on the main view, but without the system-wide
breakdown and without any additional users/profiles.

Bug: 34715777
Test: Settings Robotests

Change-Id: I19d449b648c6566331fd02e45c2e45f8c74ea7e7
2017-02-22 17:33:24 -08:00
Daniel Nishi
422e7c354d Update the loading of info for the secondary users.
Bug: 34715777, 34225103
Test: Settings Robotest
Change-Id: I32bb15ad8bc866c1fd41728e56faa8b09ae11eb6
2017-02-21 12:08:28 -08:00
Daniel Nishi
dfed8a2acb Add support for visualizing secondary users.
This functionality adds the secondary users to the screen, but
currently does not populate the information for them. Once the
external stats query works, I will add a loader which will
populate this information.

This also does not cover work profiles. Support for that is
forthcoming.

Bug: 34715777, 34225103
Test: Settings Robotest
Change-Id: Ib9b692b214f5ce5d303dfd64516381443d4acebd
2017-02-21 12:07:23 -08:00
Salvador Martinez
2f0bee5032 Replace footer with regular preference
Replaced the "Manage Storage" footer preference
with a regular preference because the footer type
is not meant to be a touch target. This should fix
the bug with not being able to click on specific
parts of the preference.

Test: run settings espresso tests
Bug: 34349518
Change-Id: I36ada2a6a537a68d9fcbe7e10773896225ecc6b2
2017-02-14 14:12:56 -08:00
Daniel Nishi
7cec1bc53c Use the "fast track" storage calculation for all categories.
Bug: 34204877
Test: Settings Robo
Change-Id: I4a3e26e6e96e9b697c1019160c053b079076d3a2
2017-02-02 13:02:32 -08:00
Daniel Nishi
0905600b7a Use the fast track calculation for apps.
This replaces the calculation of the apps category
and add in a calculation for the games category using
the faster GID calculation. This should result in app
sizes loading roughly 10 times after.

Bug: 34204877
Test: Settings unit & robo tests
Change-Id: I78044a8d50f695f8c0a7e04183030232a9719260
2017-02-01 14:02:03 -08:00
Daniel Nishi
f68bb3d78f Add an automated test for the null bundle crash.
Bug: 34633464
Test: Settings robotest .
Change-Id: I244e58c3660ea3376dbeb6293da54c99a98e3157
2017-01-25 09:59:25 -08:00
Fan Zhang
7e6df837ee Remove getCategoryKey() from DashboardFragment children.
Use the centralized registry to look up category key instead.

Bug: 32936784
Test: make RunSettingsRoboTests -j40
Change-Id: I0b8c72d70f93e4b5c58871ac90de41f69ad15653
2017-01-24 14:51:15 -08:00
Daniel Nishi
4d4142b6aa Fix a bug where Settings would crash from search into storage.
If the user entered the StorageDashboardFragment from search,
it would crash due to a precondition check added to the Storage
Manager. Because no volume id was set in the bundle for it to
check, it hits an assert that the volume id is not null causing
Settings to crash.

This sets a sensible default instead of null.

Bug: 34633464
Test: Manual. Entering through search does not crash now.
Change-Id: Ia6cd82929a0813eefcdad279436b9c2fe30b0146
2017-01-24 09:29:38 -08:00
Daniel Nishi
8a2ff52e61 Merge "Update StorageSettings to use StorageDashbordFragment." 2017-01-13 22:06:46 +00:00
Daniel Nishi
b465005c29 Update the storage summary header.
This changes it to now have a donut graph and reflects the new UI.
Finalized redlines are still pending, so there will be a follow
up patch to get everything aligned as per the mocks.

Bug: 33199077
Test: Settings Robo Tests
Change-Id: Ic12a77bd9be335af14f80886d1ecc24c82940e9b
2017-01-11 12:37:33 -08:00
Daniel Nishi
884809199f Hook up the storage item preferences to actual data.
This uses the same storage query implementation as the previous
iteration of the Storage Settings. In b/32206268, a new API for
querying this information will be added for querying this info.

Once the new API has landed, a future patch will swap out the
impl, but this should work for today.

Bug: 33199077
Test: Settings Robo Tests
Change-Id: I58763e8ee38aabbea533bc614268288e854ff8d4
2017-01-10 17:52:52 -08:00
Daniel Nishi
8cc6f9f718 Add click behavior to the storage item preferences.
This currently imitates the previous implementation behavior.
The new mocks have a new intermediate view for some of these
behaviors, but this view isn't ready yet.
This patch should bring parity for the click functionality
for the storage line item preferences.

Bug: 33199077
Test: Settings Robo Tests

Change-Id: I4f654d30add92e4eec721c36b2801f9af9824e78
2017-01-10 16:46:44 -08:00
Daniel Nishi
769d16ed65 Update StorageSettings to use StorageDashbordFragment.
It previously was set to use the PrivateVolumeSettings. By
swapping it with the new view, we can retain the existing
behavior for external storage (PublicVolumeSettings).

This also restores the summary text to the main Settings
screen.

Bug: 34197071, 34195303
Test: Verified locally that StorageDashboardFragment is started
      instead of the PrivateVolumeSettings.

Change-Id: I5de0ea8de799d758272a1406856ae7de9b6fcc8e
2017-01-10 14:22:12 -08:00
Daniel Nishi
ec89a3f57f Add first pass at a new Storage screen.
This patch begins setting up the structure for the screen.
The functionality for populating the data in the preferences
is coming in a later patch.

Bug: 33199077
Test: Settings Robo Tests
Change-Id: I9ebad9d3896501e31ac715704ca986eceb36877d
2017-01-05 11:54:56 -08:00
Fan Zhang
8f057ca3d4 Use MetricsEvent to log page views for new IA pages.
Bug: 33812754
Test: RunSettingsRoboTests
Change-Id: Ib49daa1078df44f50ecfa351c061d36849708fd7
2016-12-21 12:12:32 -08:00
Fan Zhang
66b573ad5a Add display settings dashboard to new IA.
- Added a activity-alias pointing to displaySettings as top level
  setting item.
- Refactored all preference logic in DisplaySettings into
  PreferenceControllers. During fragment onAttach it installs all
  controllers, and during onResume it updates preference state. Each
  controller listens to its own preference change event.

Bug: 31800242
Test: RunSettingsRoboTests
Change-Id: Ibc9bf200c5acce7c4ae9292340822afee27a3a28
2016-10-10 18:26:29 -07:00
Fan Zhang
fabbfb435e Refactor SummaryLoader to set summary on subsetting pages.
- Make a SummaryConsumer interface. Things that needs latest summary
  should implement this interface (DashboardAdapter for homepage,
  DashboardFragment for subsettings). This also decouples SummaryLoader
  from relying on SettingsDrawerActivity.
- Make DashboardFeatureProvider more generic to load DashboardCategory
  by key.

Bug: 31781480
Test: RunSettingsRoboTests
Change-Id: I9c65456fb433a74c352498251e0ccf65da0be1f0
2016-10-07 14:52:06 -07:00
Fan Zhang
36924659f5 Refactor DashboardFragment.
Merged refreshAllPreferences into DashboardFragment. This hopefully
makes it more modular to manage preference display logic in each
dashboardFragment, and makes it more efficient to monitor category
changes.

Now subclasses needs to implement 2 methods:
- displayResourceTiles(): for 'static' preferences from xml
- getDashboardTiles(): returns a list of dashboard tiles and superclass
  will wire it up to preference screen.

If getDashboardTiles() return null (aka no dashboardCategory available),
the fragment will not attempt to monitor category change. The edge case
is that if a package starts to provide a tile for this category, we will
not be notified. I have not seen this case coming up. If we indeed need
to handle this case, the category listener needs to have a way to
monitor specific category rather than globally.

Bug: 31781480
Test: make RunSettingsRoboTests -j40
Change-Id: Ia9f9541b95816214df0d0bb27e3e41078c36c5ca
2016-10-07 11:55:43 -07:00
Fan Zhang
31a285387d Add search provider for storage dashboard.
Bug: 31800690
Test: manual
Change-Id: Icb906bf3b3698c1379e10cf6e346d489675ad940
2016-10-04 17:52:05 -07:00
Fan Zhang
bb6d2608e9 Add storage dashborad page.
Refactor shared dashboard page display logic between storage and
system page.

Bug: 31800690
Test: RunSettingsRoboTests

Change-Id: I7eb86f590b79ab871bdb383fb2f5326790beb193
2016-10-04 14:06:57 -07:00