Commit Graph

37 Commits

Author SHA1 Message Date
Sorin Basca
93c143ed0a Use Mockito 4.6.1 API
Bug: 236636175
Test: m RunSettingsRoboTests
Change-Id: I2cfda684059520f6ddd1e72c55f1ab1ec9c99e8b
Merged-In: I2cfda684059520f6ddd1e72c55f1ab1ec9c99e8b
2022-12-19 22:24:45 +00:00
Bonian Chen
d3b35f24f0 [Settings] Hide data usage when SIM support is turn OFF
Enable the UI control through configuration.

Bug: 240515161
Test: local, auto test
Merged-In: I5e49a2b0f2b563b426354f4d2e6e650dcc02c98b
Merged-In: I4e0db5688dc1b074d43f9d77dd2f6d4cc53a353c
Change-Id: I4e0db5688dc1b074d43f9d77dd2f6d4cc53a353c
2022-11-09 10:52:35 +00:00
Chaohui Wang
c2dacf1b75 Fix flicker for AppDataUsage when zero usage
When the page is entered from the AppInfoDashboardFragment, there is no
way to know whether the cycle data is available before finished the
async loading. If it's zero usage, the cycle spinner will be removed,
which cause a flicker.

Temporarily disable the preference list's animator before initial
page updates can solve this issue.

This also fix another flicker on this page when the background data is
off.

Fix: 233963355
Test: manual visual test
Change-Id: I795ed95e15bb3216fa17adfd4f57faf5fd92fa00
2022-05-27 10:21:17 +08:00
Martijn Coenen
63db54c290 Merge "Add SDK sandbox network usage to corresponding apps." into tm-dev 2022-05-10 09:18:52 +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
Chaohui Wang
ddedb31f6e Fix flicker for Mobile data & Wi-Fi page
Both "Mobile data usage" & "Non-carrier data usage".

By,
1. Add header in onCreate() instead of onViewCreated()
2. Keep the space for Spinner, and preload initial cycles
3. Keep the space for 3 usage summaries

Bug: 191730864
Test: manual
Change-Id: I8c309c5f51ce6290383a2d10f75e41d0f207d61a
2022-04-28 23:00:57 +08:00
Remi NGUYEN VAN
0dd1b46fcf Remove dependencies on hidden network stats APIs
Replace usage with equivalent stable APIs.

Bug: 197717846
Test: atest SettingsRoboTests
Change-Id: I4151b831fc83dee9b36292cd7991f9b294ed4ff2
2022-02-03 18:02:17 +09: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
Junyu Lai
123f2e1581 [MS50] Remove NetworkTemplate#buildTemplate* usages
This is a no-op refactoring.
These functions are deprecated and replaced by
NetworkTemplate#Builder, use public API instead.

Test: make RunSettingsLibRoboTests
Bug: 204830222
Change-Id: Idc2a09d8e3789ca2c7a97691cfad4b2e2b417f0d
2022-01-11 02:53:03 +00:00
lesl
fd41cce94b wifi: Use new API for wifi data usage function
For wifi, a old API: buildTemplateWifiWildcard will includes the merged
wifi which is included to mobile usage. It should not double count
again. Call new API: buildTemplateWifi with
NetworkId: NetworkTemplate.WIFI_NETWORKID_ALL
and null subscriberId to get non-merged wifi usage.

Test: make RunSettingsRoboTests ROBOTEST_FILTER=AppDataUsageTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AppDataUsagePreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageSummaryTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageSummaryPreferenceTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageSummaryPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageUtilsTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=NetworkProviderSettingsTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SettingsDumpServiceTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiSettingsTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageInfoControllerTest
Test: Manual Test, wifi data usage count correctly.
Bug: 176396812
Merged-In: Ia4d8fa67ea3cb75c2d35be9ab60e5c5ffa391ffb
Change-Id: Ia4d8fa67ea3cb75c2d35be9ab60e5c5ffa391ffb
2021-05-06 09:37:09 +08:00
Sunny Shao
5da24591ea Update testcases which failed due to the SupportLibrary changed
Fragment.oncreate() causes an IllegalStateException. We use a
ShadowFragment to stop the calling sequence.

Fixes: 135086559
Test: robotest
Change-Id: I601e0f2513f826b0b7749cb2c013b7e4c0a94a33
2019-06-13 10:02:50 +00: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
dddeb5f25e Use correct default subscription id to get default network template.
- when launching the app info page and no network template is defined in
the launch arguments, use the correct default data subscription id to
check whether mobile network template should be used or not.

Change-Id: If9341abf3416c775a2b7407c1d6d0b33f4aad67f
Fixes: 120098637
Test: make RunSettingsRoboTests
2019-02-07 14:41:45 -08:00
Doris Ling
97866f0b50 Use correct uid when querying usage data for specific user.
- the data usage list shows usage data for each app, and also the
aggregated data for work apps and other user. When user clicks on the
app item, we will shows the detail usage data for that item using the
app item key. However, if the app item is not for app but for user, the
key will not be the app uid, but a key built from the user id. So,
querying using the key will not get any data.
- for app item corresponding for user, need to sum up all usage data
for the uids associated with the user.

Change-Id: I1a185ee6b4d59e477f3a03cade97d85d6982e416
Fixes: 122200400
Test: make RunSettingsRoboTests
2019-01-30 13:51:28 -08:00
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -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
Philip P. Moltmann
e3f721132a RestrictedLockUtils was split into ...Internal
This means that in some cases RestrictedLockUtils has to be used and in
some RestrictedLockUtilsInternal.

This causes a lot of trivial code changes.

I also updated the ordering of the imports in all affected files.

Bug: 110953302
Test: Built
      make -j RunSettingsRoboTests
Change-Id: I9bdf8b89134f853bae4f38c81af436715c73e924
2018-08-30 08:11:39 -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
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
HJ ChangLiao
5693be2863 Replace PackageManagerWrapper with PackageManager
Replace all SettingsLib/PackageManagerWrapper in Settings,
by PackageManager,
Remove ShadowPackageManagerWrapper.

Bug: 62067063
Test: make RunSettingsRoboTests
Change-Id: I6d1af55c13d80c1907b98b21e0207cc903cd9b1f
2018-04-24 15:12:31 +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
James Lemieux
22a39c2b93 Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
2018-03-04 03:50:08 -08:00
Sudheer Shanka
b8b2e51e8d Add policy transparency for metered data related settings.
With API Dpm.setMeteredDataDisabled, admins can restrict some
packages from accessing metered data and when admin does restrict
packages, user settings to enable usage of mobile data in background or
allow unrestricted access during data saver mode are not relevant. Add
policy transparency to these settings so that user knows that admin
disabled them.

Bug: 63700027
Test: make RunSettingsRoboTests
Test: manual
Change-Id: I450f7a91356ed8fb33f464620c73fa9407a1ff83
2018-01-26 10:57:11 -08:00
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
Fan Zhang
dff6dd687e Move away from deprecated FakeFeatureFactory.setupForTest()
Test: rerun
Change-Id: I896ba414315ddb1664c0499264f4992f0554ef98
2017-12-05 10:12:10 -08:00
jeffreyhuang
d816465bb3 Move datausage test package to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: I10d2d0eb9abafe8a81adab3ce3f5db2f1f3337b8
2017-11-27 16:46:52 -08:00
Doris Ling
dee1a22c45 Consolidate all wrappers used for testing.
- Add the wrapper package and move all wrappers to the wrapper package.
- Get rid of some wrapper interface/impl implementation and have a
wrapper class directly.

Bug: 65634579
Test: make RunSettingsRoboTests
Change-Id: Ic757d8f7bacfa7a034c7e692205bc1dc4b0e1de1
2017-09-14 18:24:49 -07:00
Fan Zhang
816efc02fc Refresh preferences when background data switch is toggled
Change-Id: Id58f565645fc3c668b516dbd05049559afa9535e
Fixes: 64466310
Test: robotests
2017-08-08 17:38:28 -07:00
Fan Zhang
75bee9bf98 App header cleanup
- Refactor the entity header layout to use LinearLayout and add id to
  content area
- Remove now unused AppHeader class
- Make entire icon+text area clickable and link to app info page
  Refactor the binding logic from bindButton to its own method.
- Remove unused MultiLinePreference

Fix: 62705377
Test: make RunSettingsRoboTests

Change-Id: I6db554695410e71b669f6fdba29d98fedc3364b9
2017-07-06 13:23:38 -07:00
Andrew Sapperstein
9f1e911759 Refactor test runner to use static list of resource paths
Previously everything lived in an inner class method of
SettingsRobolectricTestRunner. That method has now been turned into
a static method so that it can be called by other runners.

Bug: 62460102
Test: robotests
Change-Id: I6612b1f26404587301c534c8ba60e39d59d6c840
2017-06-09 09:21:26 -07:00
Fan Zhang
17d63964c7 Set correct uid when loading app icon in data usage UI.
work profile apps belongs to a different user. Set the correct uid when
loading the icon so the work profile badge is displayed.

Change-Id: I2ed27d6b83c1b42961500dc8d63475bf1f7eabcd
Fix: 38372681
Test: make RunSettingsRoboTests
2017-05-24 16:04:23 -07:00
Fan Zhang
841d1d5aab Show shadow when entity header starts scrolling.
- Add a controller to manage add/remove onScrollChangedListener to
  recyclerviews.
- When recyclerview on each screen is scrolled to top, set actionbar
  elevation to 0, otherwise set it to non-zero.
- When screen is moved to background, detach the listener.
- Use the controller in entity header.

Change-Id: Iecf194d885098c98c392810f62893ae9189f3936
Fix: 37670670
Test: make RunSettingsRoboTests
2017-05-22 17:16:24 -07:00
Fan Zhang
d7414259d0 Move entity header controller out of application package.
Bug: 37669238
Test: rerun robotests
Change-Id: I54eb30f28fa0a88a6f0b97b53f9f1408320b5ce0
2017-05-18 16:36:32 -07:00
Fan Zhang
f5bd885a1d Clean up settings_entity_header layout.
update layout view IDs, and controller variable names to be more
generic.

Fix: 36734470
Bug: 37669238
Test: make RunSettingsRoboTests
Change-Id: Ib80827ae3eae6d01a600068b4a8a44b239c32511
2017-05-18 16:35:27 -07:00
Fan Zhang
470caeaa80 Hide app info link for "All work apps" data usage detail
We should hide the link because "All work apps" is a meta app, it
doesn't point to any specific app, so app info link does not make sense.

Change-Id: I768786f2df5d05bbde0723e5585abcdbe875c652
Fix: 36542896
Test: make RunSettingsRoboTests
2017-05-12 10:21:33 -07:00