Commit Graph

64 Commits

Author SHA1 Message Date
Chaohui Wang
6ef678f19d Add some null annotation for data usage code
Also do some clean up.

Bug: 296357959
Test: manual - on DataUsageList page
Change-Id: Id7548e1d58d946810c844b9559bb00d65306f441
2023-08-28 17:47:06 +08:00
Chaohui Wang
6c2d713226 Fix NullPointerException of DataUsageList
Fix: 296357959
Test: manual - on DataUsageList page
Change-Id: I303aa8ae1ba5db8f23dbc3b68b9ff4e05a0936a0
2023-08-28 17:29:26 +08:00
Chaohui Wang
3cd47c1448 Clean up unused operator_warning
Usage is removed in Change I9781af3a53fe7050b414f0574abb7618f8d71707.

Bug: 285231003
Test: m Settings
Change-Id: I89fb8630cc6bea4828b14936d5e2234de9f232ea
2023-08-07 10:46:01 +08:00
Weng Su
f65c4530e4 Hide carrier service package in Wi-Fi data usage settings
- When there is no specified SubscriptionInfo, Wi-Fi data usage will be displayed. In this case, the carrier service package also needs to be hidden.

- Fix failing test cases in DataUsageListTest

Bug: 273167633
Bug: 280021214
Test: manual test

Change-Id: I66ff8a28d9e7f7db77c8a210cb36676a07fc2c7d
2023-05-10 17:30:01 +08:00
Chaohui Wang
8397287f87 Fix flicker for Data Usage page
Both "Mobile data usage" & "Non-carrier data usage".

By,
1. Use summary placeholder for usage amount to avoid shift
2. Before fix CycleListener's onItemSelected() is called multiple times,
   cause the app list to flash, let DataUsageList to handle the dedup
   logic to better handling.
3. Before fix if return from App Usage page, no loading view is
   displayed (only first enter has it), move this to onResume() to fix.
4. Before fix the cycles passed to App Usage page is cached (even when
   the cycles are changed), clear the cache when onResume() to fix.
5. Listener in SpinnerPreference could be null, add safety guard to it.

Cherry-pick from Change-Id: I95e544c46333496f4f30ed77dafa4779b4d66019

Fix: 277162513
Test: manual visual test
Test: Unit test
Change-Id: I50fb79aa3c888651a79fd1d030da554bebb6a660
2023-04-22 08:47:22 +08:00
Chaohui Wang
f46b33bbc4 Revert "[DataUsage] Adjusting the control of display sequence"
This reverts commit b8491032d7.

Bug: 277162513
Test: Manual
Test: Unit test
Change-Id: I5a84a9b1a99b1da4c18d786a6dff062b53cd46c6
2023-04-22 08:47:21 +08:00
Chaohui Wang
52b723beef Revert "[Settings] Adjusting the control of display sequence (part 2)"
This reverts commit 6b379cd7cf.

Bug: 277162513
Test: Manual
Change-Id: Iea61c06d328626a96c13c4c9f8a11f8329401b35
2023-04-22 08:47:20 +08:00
TreeHugger Robot
17e504f6a8 Merge "Restrict DataUsageList for guest user" into tm-qpr-dev am: 5bde972e4e am: f02d69dd4f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22323478

Change-Id: Ibfe01c87ea15467a736ccaf7d812c8eaffaefa76
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-30 20:39:38 +00:00
Weng Su
6e79778d3c Restrict DataUsageList for guest user
- Don't show DataUsageList if the user is a guest

Bug: 262741858
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageListTest

Change-Id: Id877c2235c6a65683f2d0a0ba381dffba4dd95b8
2023-03-29 21:44:55 +08:00
Zoey Chen
7beb190e9c [Settings] Hide package name if needed
Bug: 273167633
Test: local test
Change-Id: I237d8f5821080283465a6cf72ad7505a55a6bb81
2023-03-24 14:00:31 +00:00
Arc Wang
5cb2a1fa8d Put mobile NetworkTemplate in Intent for SearchResultTeampoline
BillingCycleSettings and Settings.ACTION_MOBILE_DATA_USAGE needs
mobile NetworkTemplate to work correctly.

Bug: 268411305
Test: manual
Change-Id: I7e2eafff39f1bffeb8adbe4d7c3567b7a4ea7dda
2023-02-20 15:04:26 +08:00
Chaohui Wang
5a2f5ecff5 [DO NOT MERGE] Fix flicker for Data Usage page
Both "Mobile data usage" & "Non-carrier data usage".

By,
1. Use summary placeholder for usage amount to avoid shift
2. Before fix CycleListener's onItemSelected() is called multiple times,
   cause the app list to flash, let DataUsageList to handle the dedup
   logic to better handling.
3. Before fix if return from App Usage page, no loading view is
   displayed (only first enter has it), move this to onResume() to fix.
4. Before fix the cycles passed to App Usage page is cached (even when
   the cycles are changed), clear the cache when onResume() to fix.
5. Listener in SpinnerPreference could be null, add safety guard to it.

Fix: 187019210
Test: manual visual test
Change-Id: I95e544c46333496f4f30ed77dafa4779b4d66019
2022-05-11 17:02:54 +08:00
Martijn Coenen
00f0947107 Merge "Add SDK sandbox network usage to corresponding apps." into tm-dev am: 63db54c290 am: d27247a86f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17944004

Change-Id: Ibdcad10aaab868f23266d134a7fd7ea298a568d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-10 21:19:21 +00:00
Martijn Coenen
63db54c290 Merge "Add SDK sandbox network usage to corresponding apps." into tm-dev 2022-05-10 09:18:52 +00:00
Bonian Chen
389874e996 Merge "[Settings] Avoid from crash UI when querying data usage" into tm-dev am: 5ef52de6b2 am: 3444d7a8c2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17950069

Change-Id: Icdde7b07efbdbeeb80c917c03ac0dc073d2fce8c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 08:32:32 +00:00
Martijn Coenen
bc9856104d Add SDK sandbox network usage to corresponding apps.
SDK sandboxes run in a separate UID range. Their network usage should be
attributed to the corresponding app.

Make sure we collapse the usage collection of sandboxes to the
corresponding app UID in DataUsageList.

For AppDataUsage, make sure we add in the sandbox UID when being asked
to calculate data usage for a regular app UID. Invoke
DataUsageCycleLoader with all UIDs in AppItem, because there can now be
multiple UIDs associated with a regular app, too. Also make sure that
all new instances of AppItem for regular applications have their own
application UID.

Bug: 225319220
Test: manual
Change-Id: Id101a96ee4e3ba02376fa2ac64a9f9c2581acb61
2022-04-29 13:35:17 +00:00
Bonian Chen
0f68faf996 [Settings] Avoid from crash UI when querying data usage
Screen update been requested while querying data usage and response not
yet available.
This change tried to avoid from updating the UI in this case.

Bug: 210664126
Test: local
Change-Id: Id055fbd441936a9842b4acc978a894a855165bb7
2022-04-29 14:28:19 +08:00
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
Zoey Chen
ad79a1819f [Provider Model] Internal cleanup - remove Provider Model flag and deprecated legacy UI part.4
Test: atest NetworkDashboardFragmentTest
Bug: 197066557
Change-Id: I9781af3a53fe7050b414f0574abb7618f8d71707
2021-12-15 10:19:49 +00:00
Weng Su
890d3e039b [Provider Model] Non-carrier data usage settings UI change
- Change the title from “Wi-Fi data usage” to “Non-carrier data usage”
- Change the warning message from “Carrier data accounting may differ
from device accounting” to “Excludes data that is used by carrier
networks”
- Screenshot:
  https://screenshot.googleplex.com/3bicWHu7g5StH8R
  https://screenshot.googleplex.com/AqceQBtY4AqnuGH

Bug: 172788855
Test: manual test
Change-Id: Ic4d6e5dbb0b7d1d851f6cf033d400a7f780261ac
2020-11-12 08:04:35 +00:00
Arc Wang
aa6b25e137 [A11Y][Wi-Fi] Prevent data usage header spinner speak at onResume
Ignore AccessibilityEvent.TYPE_VIEW_SELECTED for the Spinner.

Bug: 146818854
Test: manual
      Should not speak for header spinner right after entering
      'Wi-Fi data usage'
Change-Id: I289d9a781242f8bfec56c59b7be2ac0688c5e485
2020-04-09 16:51:10 +08:00
Arc Wang
9b69fd17bf [Wi-Fi] Fix data usage screen flash 1~2 times problem
Data loaders should be destroyed at onPause or
the APP list will be updated twice.

Bug: 146841747
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageListTest
Change-Id: Ic1b8ef443dd8e50777f1e3a16977add654748c54
2020-02-27 16:18:04 +08:00
Bonian Chen
90cb45e31c [Settings] Code refactor
1. Fix comments
2. Split test case

Bug: 147338143
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageListTest
Change-Id: I017a3ac8a716e69eb4d9c3e30e20363a215563a2
2020-01-08 14:30:13 +00:00
Bonian Chen
5e65da0c2f [Settings] Apply proxy design to data usage
Enable proxy to subscription manager in data usage UI.

Bug: 141833767
Test: manual
make RunSettingsRoboTests -j ROBOTEST_FILTER=BillingCyclePreferenceTest
make RunSettingsRoboTests -j ROBOTEST_FILTER=CellDataPreferenceTest
make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageListTest
make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageSummaryTest
make RunSettingsRoboTests -j ROBOTEST_FILTER=DataUsageUtilsTest
make RunSettingsRoboTests -j ROBOTEST_FILTER=MobileDataEnabledListenerTest

Change-Id: Id119738dc16ece8767c088b9a0794997e4b0334f
2019-11-11 13:03:03 +08:00
Lei Yu
22a9f539e9 Use NetworkTemplate to query data
So virtual carrier can get correct data with merged subscriberIds

Bug: 120566366
Test: RunSettingsLibRoboTests
Change-Id: I02abed77dffb55ef49fe0c4142f6f5b4a42ebe52
2019-05-13 13:04:46 -07:00
Yi-Ling Chuang
9a7ead8962 Hide filter spinner when data is loading.
When the filter spinner is initialized, set GONE to its visibility.
Only make it visible after network cycle data finishes loading to
avoid presenting an empty filter spinner.

Fixes: 130397929
Test: robotests
Change-Id: I740fdad35ec82bc0be386c24e53348917bf6bfba
2019-04-16 16:53:32 +08:00
Doris Ling
3d238da4b5 Show app usage data for the correct cycle.
- when launching the app data usage from the data usage list, pass the
info about the current cycle that the user is looking at, and select
the same cycle by default when the page is first launched to match the
data on the previous page.

Change-Id: Ic91bd8ee78db4d76551dff4b132c1b74d4b3c19d
Fixes: 123192721
Test: make RunSettingsRoboTests
2019-02-12 16:53:35 -08:00
Andrew Sapperstein
5efb70ac18 Separate OTA data usage from SYSTEM_UID.
Prior to this CL, Process.OTA_UPDATE_UID was included with SYSTEM_UID
for the purposes of per-app data usage in the DataUsageList. With this
change, it is now separated into its own category.

This change also deletes the duplicate ic_system_update* icons and
moves the one implementation into SettingsLib.

Fixes: 70640191
Test: manually verified locally that there is an item in the list
with the proper title. Required setting up a custom OTA for my
test device.

Change-Id: Iecc45648f68a12c9f8e2370577ab017863e7fcb2
2019-02-08 10:39:46 -08:00
Doris Ling
9c2556da09 Query correct subscription id for mobile data.
- On the Data usage settings page, we check for valid subscription id to
determine if we should show the mobile section. However, we are querying
the default subscription id, which will return the 1st id for any
subscription if there's no data subscription. Since this is for mobile
section, we should query the default data subscription id explicitly.

Change-Id: I08c80639d07477e486a2d9a10761e11df4c73b28
Fixes: 119881046
Test: make RunSettingsRoboTests
2019-01-24 14:21:18 -08:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
Edgar Wang
0fc557bbc9 Fix App data usage screen header title changing after device orientation
- Chageed the title "App data usage" to "Mobile data & Wi-Fi"

Change-Id: I0fa00180eedda6be6189f871f9984ac164f9fb67
Fixes: 118770561
Test: visual & robotests
2018-12-27 20:07:31 +08:00
Doris Ling
282a0d9222 Remove "v2" from the data usage version 2 code.
Change-Id: I8ede82029194d1a9a43d00a3de7ec1a8dd77d978
Fixes: 117420679
Test: make RunSettingsRoboTests
2018-12-04 18:24:37 +00: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
d13b50b39e Remove the 2 seconds wait time to sync app data usage list.
- in v2, completely remove the asyn task to force update the network
stats since the network stats apis is actually not used.
- in v1, remove the 2s delay and only update the list when the asyn task
is done.

Change-Id: I10e887022d07fe38504036cbf3f12362eec939b3
Fixes: 119562454
Test: manual
2018-11-29 13:18:21 -08:00
tmfang
6e16b69887 Sync style of filter component in data usage
Settings have new filter component with settings style.
This CL replaced Spinner to SettingsSpinner in data usage page.

Change-Id: I212b6b6ed203f8bffd094c0180873060b93c39cb
Fixes: 117568930
Test: robotests, visual
2018-10-17 05:14:46 +08:00
Doris Ling
8e208c6516 Remove obsolete chart view widgets.
ChartDataUsageView and ChartNetworkSeriesView are no longer being used.
Remove them to avoid the need to maintain obsolete codes.

Bug: 117433810
Test: rebuild and make RunSettingsRoboTests
Change-Id: I0c99725500926083bee693c102a323d563647c3a
2018-10-08 14:18:50 -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
Doris Ling
f7b8505948 Move hasReadyMobileRadio() to DataUsageUtils.
- move the method from DataUsageList to DataUsageUtils where other
utility methods are.

Bug: 111751694
Test: make RunSettingsRoboTests
Change-Id: If7176cb4278d568f890a0c94437c4483bbd472f9
2018-09-18 11:21:59 -07:00
Doris Ling
6127d9de4c Add DataUsageListV2 for showing network stats detail.
Initial step: simply duplicate the existing DataUsageList class.

Bug: 111751694
Test: make RunSettingsRoboTests
Change-Id: I4d48405cd127cccb041ba0457638337f6918ce2e
2018-09-17 10:19:39 -07:00
Doris Ling
22c078c8de Remove the deprecated class DataUsageBase.
- and update all its subclass to extend DataUsageBaseFragment instead.

Bug: 111751694
Test: make RunSettingsRoboTests
Change-Id: Ic5720af43082d8b39642b6a539515f3f20d32694
2018-08-30 14:16:13 -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
Stanley Wang
6fe0330bf7 Icon color of spinner updated
Change-Id: Iea7f5d5ec43360cf6114caf368fa8c93ce4cf95c
Fixes: 109843982
Test: manual
2018-08-02 15:20:51 +08:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
hjchangliao
e86eec0c07 Rename SubSettingLauncher.setTitle, add java doc
For make this method usage more clear,
setTitle(charSequence) rename as setTitleText,
add java doc: it is only for user generated string
setTitle(int) rename as setTitleRes.

Change-Id: I972cb6a8ff90873dfdc25c23f6dc3d68103c8e4e
Fixes: 78347436
Test: make RunSettingsRoboTests
2018-05-09 10:00:05 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07: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