Commit Graph

22 Commits

Author SHA1 Message Date
Bonian Chen
6b379cd7cf [Settings] Adjusting the control of display sequence (part 2)
1. Add missing lines within file DataUsageList. (Which might lead to
   crash in some cases)
2. Change the naming based on comments within ag/17226775

Bug: 227266811
Test: robotest ChartDataUsagePreferenceTest DataUsageListTest
Change-Id: I4cde5a04befd058c2a1a3aa30826caa5b479b69f
2022-03-29 11:16:45 +08:00
Bonian Chen
b8491032d7 [DataUsage] Adjusting the control of display sequence
Showing a usage graph before end of statistic would lead to incorrect
height of usage graph, and another update would lead to layout moved a
little bit.

This change tries to improve it through:
1. Start the loading animation earlier, and stop animation when
   statistics loaded.
   (Only effective when UI re-create.)
2. Update the UI only when statistics are ready.

Bug: 187019210
Test: robotest ChartDataUsagePreferenceTest DataUsageListTest
Change-Id: Ic83f2422b6c6d55948110d652ee24234f43b6445
2022-03-16 20:29:53 +08:00
Junyu Lai
25e26ea7af [MS49] Remove NetworkStats hidden Api usages
This includes:
1. Remove unused INetworkStatsService and NetworkStatsHistory.
2. Replace NetworkTemplate usages with builder.
3. Replace TrafficStats references to DataUnit.
4. Reimplement NetworkTemplate#normalize.

Test: make RunSettingsRoboTests
Bug: 204830222
Change-Id: I8efecda5df403e9ed588daecd169cb3498d213a2
2022-01-26 11:05:57 +00:00
Bonian Chen
0880675414 [Settings] Fix divide by zero in data usage UI
Data usage UI got divide by zero exception when zero data usage.

Bug: 182822862
Test: local
Change-Id: Ibe57034e7d441e94c0529cb76f1a16665aaacff6
2021-03-22 17:10:00 +00:00
Arc Wang
351ee3a882 [A11Y] Improve data usage chart TalkBack content
1. Set null content description for all labels of the chart.
2. Set 2 parts in the content description of the chart:
  I.  Brief description of the chart.
  II. Stats of the data usage.

Bug: 141093026
Test: ChartDataUsagePreferenceTest
      Manually listen to TalkBack speaking
Change-Id: I82cefd9987793f40a5bba5bf3ea5f4017da37640
2019-10-09 10:20:15 +08:00
Doris Ling
8727a40893 Don't plot usage data beyond current date.
- the new data usage api returns buckets for future date with 0 usage.
When we plot the data usage chart, need to check the bucket date to make
sure we only plot points up to the current date.

Change-Id: I50e161ca9cdbb30c8fda8f6cdd24c993b546ad0d
Fixes: 120490567
Test: make RunSettingsRoboTests
2018-12-06 17:12:05 -08:00
Doris Ling
c11666cc00 Remove data usage v1 code.
- remove all v1 code and the corresponding feature flag switch.

Bug: 117420679
Test: make RunSettingsRoboTests
Change-Id: Ib062c03c671b0f860698f5e5e153ab46d963175a
2018-12-03 11:12:50 -08:00
Doris Ling
4a99c36572 Rename NetworkCycleData to NetworkCycleChartData.
Bug: 111751694
Test: make RunSettingsRoboTests
Change-Id: I47c1bbe09f11f4d0bd0d41c1f9d4c3e5a3773f05
2018-09-28 16:40:38 -07:00
Doris Ling
654adf9c9e Use the loader to get usage data for each billing cycle.
Bug: 111751694
Test: make RunSettingsRoboTests
Change-Id: I4242687b404a290e81d43c505b9afbd2a07aafdb
2018-09-26 13:33:10 -07:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Fan Zhang
670ce333ae Misc clean up. move widgets from graph to widget package.
Bug: n/a
Test: robotests, rebuild
Change-Id: I910f355312d52e81a0bf57b46a3f267e1eb9882a
2018-06-11 16:05:12 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
TreeHugger Robot
287f84d1ed Merge "Switch from SI to IEC unit when formatting data usage bytes" 2018-04-12 22:28:25 +00:00
Fan Zhang
289677f97f Switch from SI to IEC unit when formatting data usage bytes
- Created a new helper method DataUsageUtils.formatDataUsage() to
  format data usage bytes using IEC formatting.
- Switch from Formatter.formatFileSize() to DataUsageUtils.formatDataUsage()
  everywhere in datausage package.

Change-Id: I9323beed8bf5126b153fc9a3cdd9591c97ca6fd2
Bug: 76159924
Test: robotests
2018-04-12 09:52:35 -07:00
Jason Chang
c44097d345 [SettingsLib] Update Utils APIs usage
Update Utils.getColorAttr and similar methods in Utils to return a ColorStateList instead of a color

Bug: 74872054
Test: Force to display different color items then manually test
Change-Id: If002f9a578558e6254220c36ef556e8378d4522a
2018-04-10 21:09:39 +08:00
Doris Ling
02b4cf2aca Report unavailable data usage.
- when showing the data usage graph, if the first data point is equal to
the first available data, insert a 0 usage point on the first day of
available data, so that it will show a flat line for the days that do
not have available data instead of showing a non-zero slope.

Change-Id: Ibf305e292a65ab3310ea12efbb575e3a7e1b6012
Fixes: 76155147
Test: make RunSettingsRoboTests
2018-03-29 10:54:54 -07:00
Alex Kulesza
c57ceaaa8c Implement general projection curve support for UsageGraph.
Previously, projections were hard-coded in UsageGraph as lines from the
last known point to the corner of the graph. This change replaces that
with support for arbitrary projection curves. Logic for hiding/showing
the projection is now gone; if the client does not want a projection,
it simply does not supply one.

There are two active clients of this code: the data usage graph and the
battery usage graph. The data graph does not use projections and is
essentially unchanged. The battery graph now implements its linear
extrapolation directly in BatteryInfo.

Bug: 38400320
Test: make SettingsUnitTests SettingsGoogleUnitTests
Test: manual (screenshots in comments)
Change-Id: I754e66f6b18ecb8b936143399f8e9e3368fc1ce4
2017-06-08 16:59:14 +00:00
Alex Kulesza
c661098ab8 Move UsageGraph from SettingsLib to Settings.
In preparation for modifying the graph code to show detailed projections
(see bug), this change moves it into Settings along with related tests
and resources.

Bug: 38400320
Test: manual, make SettingsUnitTests, make SettingsGoogleUnitTests
Change-Id: I88e5336c15827727b3427e29b10954bba9cfba7d
2017-06-05 15:43:18 -04:00
Jason Monk
6fca98f905 Switch references to colorError
Test: make
Change-Id: I0ed10d78763642cecc5ba8e8e15a097d51280946
2017-02-24 14:57:31 -05:00
Jason Monk
5ce4345dff Fix data usage
- Fix int conversion (evidently a month doesn't fit in an int
 - Remove gaps because they don't make sense for data usage

Bug: 27632250
Change-Id: I87c2c05960b6ee489289e94eb12de9d52de1f3aa
2016-03-15 11:36:06 -04:00
Jason Monk
9dc9a0ebb3 Update data usage graph to use new graph ui
Bug: 27278313
Change-Id: Ia9e8598dcb970540877f7dac7061cfc55ed99d4d
2016-03-09 10:39:57 -05:00
Jason Monk
b37e2887d3 Update data usage UX
Update the UX and dig the data usage screen out of a huge whole of
technical debt.  Switch every to use Preferences rather than standard
layouts and ListViews.

Split data usage into several fragments, all separated.

DataUsageSummary:
 - Shows a summary of the 'default' usage at the top, this will be
   the default sim on phones, or wifi if it has it, or ethernet
   as last attempt to show something.
 - Also has individual categories for each network type that has
   data, cell, wifi, and ethernet. Maybe should look into bt though?

DataUsageList:
- Takes a NetworkTemplate as an input, and can only be reached from
  the network specific categories in DataUsageSummary
- Shows a graph of current usage for that network and links to
  app detail page for any app.
- Has gear link to quick get to billing cycle screen if available

BillingCycleSettings:
 - Just a screen with the cycle day and warning/limits separated
   out from the data usage.

AppDataUsage:
 - App specific data usage details
 - May need some UX iteration given lack of clarity in the spec

Bug: 22459566
Change-Id: I0222d8d7ea7b75a9775207a6026ebbdcce8f5e46
2016-01-19 13:55:26 -05:00