Commit Graph

67 Commits

Author SHA1 Message Date
Chaohui Wang
15ca95a31b Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference.

Using TwoStatePreference in Java will helps migration in the future.

Bug: 306771414
Test: manual - check Settings pages
Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
2023-10-23 09:28:57 +00:00
Chaohui Wang
6395cf8d30 Unify the default template and title
On AppDataUsage page, using single source of truth to calculate the
default template, and set title base on the current template.

Fix: 213266028
Fix: 234104784
Test: visual - on AppDataUsage
Test: unit test
Change-Id: I80facca0b000964e901905af51a344a4bc9f498b
2023-10-09 18:40:03 +08:00
Chaohui Wang
a95d62a4a8 Fix the bytes displayed unit
This used to by MByte and GByte, not used in other places in Settings,
and not align with the data summary on the same page.

Unify to MB and GB to align with other places in Settings and the data
summary on the same page.

Fix: 277900792
Test: Visual
Test: Unit test
Change-Id: I9f8ceac470aede135b7921c391c063ba87da661e
2023-05-23 14:21:03 +08: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
Bonian Chen
5e1c4d15a9 [Settings] User with restriction should avoid from having entries
through Settings search

1. Avoid from generating search report when user been restricted.
2. Guest user should have this restriction but not available, add
   additional rule as a conpensation from UI's perspective.

Bug: 260860114
Test: local

Change-Id: I63ba7f3b10fc812dd1498f17826a15e822879613
2023-02-09 16:42:56 +00:00
Bonian Chen
0952e39d7a [Settings] Hide data usage when SIM support is turn OFF
Enable the UI control through configuration.

Bug: 240515161
Test: local, auto test
Change-Id: I4e0db5688dc1b074d43f9d77dd2f6d4cc53a353c
2022-11-08 08:54:36 +00:00
Roozbeh Pournader
ad389346c8 Reland "Don't use framework strings for formatting file sizes"
Reland http://ag/2529020 because the over-translation issue should be
resolved now.

Modify various formatters to avoid using framework strings for
formatting file sizes.

Also update README instructions for running unit tests.

Bug: 36994779
Bug: 71580745
Bug: 217592956
Test: no new test failures from RunSettingsRoboTests
Test: manual opening the settings page.
Change-Id: Ic4689ab1b76622028004d05e69858228bdc441cf
2022-05-17 16:06:55 +01:00
Bonian Chen
7dff8c7210 [Settings] Avoid from dialog disappear when click outside
Avoid dialog from unexpected close when click out of dialog area.
This create better user experience since user might not click to the
correct area all the time.

Bug: 204020202
Test: local
Change-Id: Ice5cde73eb849f3e5722ab778be41615746210c0
(cherry picked from commit 3cb6a7a705)
2021-11-17 02:01:42 +00:00
Bonian Chen
a66cf69f1f [DataUsage] UX enhancement
Some of the field didn't take eu languages into consideration.
Enhance it through changing the:
1. Format of display
2. Parser after user input
3. IME support for comma in eu language

Bug: 141536928
Test: Manual input and check for results
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=BillingCycleSettingsTest
Change-Id: Ia7afc88c9043e924f205f966c4091248261b0aee
2020-04-20 12:54:43 +08:00
Jason Chiu
2d609759cd Add preference click metric logs for some special cases
Bug: 137559984
Test: visual, robotest
Change-Id: If8624b49abcd0000487065160ce4a7ba861f234c
2020-01-02 17:45:23 +08:00
Raff Tsai
966fa01423 Use SettingsLib Indexable
- Use SettingsLib Indexable
- Directly use resource id in getPreferenceScreenResId

Bug: 135053028
Test: roboletric
Change-Id: I05f493b55e8b6e2091301e9231ba5615215618e6
2019-09-25 18:24:56 +08:00
Raff Tsai
ac3e0d0988 Directly use BaseIndexableProvider
- Add function getXmlResourceId, Fragments don't need to write
xml resource id twice.
- Remove getPreferenceControllers from Indexable.java. Because it will
move to SettingsLib later for other apps which don't need this function

Bug: 135053028
Test: robolectric
Change-Id: I1e74519aecdea3dde64a5aea79f08d766dbc0003
2019-09-24 00:35:52 +08:00
Neil Fuller
64eccbf9af Merge "Remove use of deprecated Time class" am: b3f8696c4d am: b83ddefb5c am: 42b55bc6f6
am: ac3d9d8641

Change-Id: I71bc0a1411abc6433016554e073da5868df3b952
2019-09-17 10:24:31 -07:00
Neil Fuller
4c77d00e34 Remove use of deprecated Time class
Remove a use of the deprecated Time class.

Bug: 16550209
Test: treehugger only
Change-Id: If97b0d8ea78a76d613652ab623c3a48f5aa9aabb
2019-09-17 13:53:17 +01:00
Raff Tsai
1f30b1cd67 Merge similar BaseSearchIndexProvider code together
Bug: 135053028
Test: robolectric, check search_index.db contains the same items
Change-Id: If3c18a170b0e671690df1fdf26e59a421d2c48cd
2019-09-12 11:09:09 +08:00
Sunny Shao
fb695782c5 Use FooterPreference in xml explicitly
Removed the FooterPreferenceMixin from the BillingCycleSettings page.

Fixes: 139099367
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.datausage
Change-Id: I408e433b3366a617b6c5a6fdb18f4830de4b8287
2019-08-08 16:25:14 +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
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
c4b40b0669 Use default network template in billing cycle settings.
- if the network template is not set in the bundle arguments, use the
default network template for getting the billing data.
- change to use ConnectivityManager.from(context) in DataUsageUtils to
be consistent with the usage in other methods.

Change-Id: I25eb27f8f26d9ecafc66aa2c69806e94c6b63499
Fixes: 117452991
Test: make RunSettingsRoboTests
2018-10-10 12:50:34 -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
tmfang
41ab6b4bf8 Migrate all AlertDialogs to AndroidX version
This CL only changed AlertDialog imports.
So, reviewer can review it easily.

Change-Id: I097bc44394195b14287f4f920c570ac8653f356a
Fixes: 111413092
Test: This CL can't pass Robo test.
2018-07-20 11:32:13 +08:00
Fan Zhang
176ccd0c35 Clean up: fix incorrect @VisibleForTesting imports
Test: rebuild and robotests
Change-Id: I33d7ee1c0622c01f592920baaf01d44ad19d9a13
2018-07-13 13:08:53 -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
af1552251f Add some pages to search index.
* Notification access page
* VR Listener page
* Feature flags in dev options
* QS Tile developer options
* User dictionary
* Billing cycle
* Some accessibilty pages

Bug: 70720645
Test: robotests
Change-Id: I4f7d3d65b2803cebf178ac345a79721232df707c
2018-07-11 16:39:29 -07:00
Fan Zhang
cd21cb8def Remove DataSummaryUsageLegacy.
Change-Id: I8da039530cafe547008b434b6016add5f9383e94
Fixes: 109943959
Test: robotest/atest
2018-06-11 11:05:54 -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
Doris Ling
689bb2c27c Fix limit data usage dialog body not being translated.
- need to pass the resource id instead of the text when building the
dialog in order for it to react to language change.
- also remove the unnecessary set/get the body message in the dialog
creation since the msg id can be used directly.

Change-Id: I399dcda54961fac457fc5f0fad9082f2c1e1a2b2
Fixes: 77897157
Test: run i18nscreenshots
2018-04-19 16:35:28 -07:00
Fan Zhang
be30190362 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
Merged-In: I9323beed8bf5126b153fc9a3cdd9591c97ca6fd2
Fixes: 76159924
Test: robotests
2018-04-11 18:22:55 -07:00
Andreas Terzis
903a92535a "Data Warn & Limits" pref. summary should be empty.
The "Data Warning & Limits" preference in the Data Usage screen
should not have a summary.

Bug: 77300376

Test: manual
Test: make RunSettingsRoboTests
Change-Id: Ic567e7451ac3ea102577ab96ccef3ce7de05d4ad
2018-04-05 15:22:31 -07:00
Sundeep Ghuman
5fc38ecae9 Add Data warning and limit footer text.
Bug: 70550124
Test: XML only change, visual inspection.
Change-Id: Iaea3f100051bb908b13ca6809463db7f01f8d92d
2018-03-13 14:21:36 -07:00
Victor Chang
03358c0cdf Revert "Don't use framework strings for formatting file sizes"
The previous revert ag/3403198/ is incomplete.

I just learned that "git revert" has memory.
"git revert" re-applied my previous incorrect merge conflict resolution
when I reverted the same change again.

Test: adb shell am instrument -w -e class
com.android.settings.utils.FileSizeFormatterTest
com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner
Test: make -j RunSettingsRoboTests
Test: manual. GB is shown in Settings > Network > data usage > tap at top
Bug: 70050030
Bug: 70005649
Bug: 36994779
Change-Id: Ia56f8aaf9b5048c102b4e480da0e84e90ee51360
2018-01-05 12:32:51 +00:00
Doris Ling
de603ea469 Add space around the data usage warning spinner.
Use a custom item layout for the data usage warning unit selection
spinner to make the touch target bigger.

Change-Id: I2d73dc3ab4c99cea8f8c791c8c1346240456d6aa
Fixes: 66414539
Test: visual
2017-10-05 00:12:43 +00:00
Steven Timotius
4ccfa7c163 Fix to show correct value for data limit setting
Bug: 64901297
Test: Manually set a value for data limit in Settings, verify text is correct
Change-Id: Ieec3ce39b55754b54caefd2be923afe9883682b1
(cherry picked from commit 72ebf8fe35)
2017-08-29 16:55:05 +00:00
Pengfei Zhao
7c52e51a9b Merge "Fix Settings crash when setting only decimal point to data usage warning" am: 3a2e327741 am: dfe237f2cf am: d1dbc81145
am: 76b1817685

Change-Id: If62e23d750b55a292852b2bda8ab46299a7e8aea
2017-07-18 20:42:02 +00:00
Pengfei Zhao
76b1817685 Merge "Fix Settings crash when setting only decimal point to data usage warning" am: 3a2e327741 am: dfe237f2cf
am: d1dbc81145

Change-Id: Ia9ac501c7d67bec0465f6019a1ba52ad863b6da0
2017-07-18 20:36:56 +00:00
Pengfei Zhao
dfe237f2cf Merge "Fix Settings crash when setting only decimal point to data usage warning"
am: 3a2e327741

Change-Id: Ic25c64da40b1accb9dce63a63462acd01664e054
2017-07-18 20:31:57 +00:00
Pengfei Zhao
c05a3a0227 Fix Settings crash when setting only decimal point to data usage warning
Settings app crashes when only decimal point (".") is set to
data usage warning because it is not a valid number.
To fix this issue, the decimal point should be converted to 0.

Fixes: 63787824
Test: manual - go to Settings > Data usage > Mobile data usage and then
               set only decimal point to data usage warning.

Change-Id: Iefb6a035ba6f17b8e0c89f79dbd397e2356fb19c
2017-07-18 06:50:18 +00:00
TreeHugger Robot
8a5a1b7419 Merge "Iterate NetworkPolicy towards SubscriptionPlan." 2017-07-15 19:57:01 +00:00
Jeff Sharkey
47f51fac35 Iterate NetworkPolicy towards SubscriptionPlan.
As part of getting Settings ready to roll towards SubscriptionPlan,
reduce references to NetworkPolicy internal fields.  All usage cycle
details are now obtained from an Iterator which converts to
SubscriptionPlan under the hood.

Bug: 63391323
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I0e1357eef092a328c05f6a709aba0f106554631e
2017-07-14 15:17:42 -06:00
Roozbeh Pournader
ded99003c4 Don't use framework strings for formatting file sizes
Modify various formatters to avoid using framework strings for
formatting file sizes.

Also update README instructions for running unit tests.

Bug: 36994779
Test: adb shell am instrument -w -e class com.android.settings.utils.FileSizeFormatterTest com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner
Test: make -j RunSettingsRoboTests
Change-Id: I4035f26d29408b64389892a4a2379b4823f8ac96
2017-07-12 15:58:21 -07:00
Fan Zhang
b2b6f7d20e Misc string updates
- Use BidiFormat wrap dp number
- Update billing cycle starting day string

Change-Id: Ifb57e3bb18ced72f91f30599a2ff7bcfa329630f
Fix: 37353209
Fix: 37657115
Fix: 38005987
Test: visual
2017-05-05 09:31:22 -07:00
Fan Zhang
293556d6b8 Revert "Display and parse numbers properly in all locales"
Bug: 37311645

This reverts commit 8648c5ed3d.

Change-Id: If26d07a59dd9e71813a2b48f3bee25516bfb0b75
2017-04-28 21:06:28 +00:00
Fan Zhang
8648c5ed3d Display and parse numbers properly in all locales
Change-Id: Iddf74fd6ed3139eede27733b69a31ce2fa7d1a92
Fix: 37311645
Test: make RunSettingsRoboTests
2017-04-19 14:30:19 -07:00
Fan Zhang
762c9f2488 Use consistent formatter to convert byte->MB->GB.
In data usage screen, displaying and setting data warning/limit should
use the same value to convert units.

Change-Id: Ic237203dbaf23cb0c99165d0055f259a30fd8cf9
Fix: 34204773
Test: RunSettingsRoboTests
2017-01-24 11:50:27 -08:00
Tamas Berghammer
5a638a6ad1 DO NOT MERGE: Revert "Update package names to work with the proto3 compiler"
This reverts commit fbd5f5fdce.

Change-Id: I769f7a0f509996ccc39fd1c628cad7e5ec1202bf
2017-01-18 19:28:11 +00:00
Tamas Berghammer
fbd5f5fdce Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
(cherry picked from commit 265d3c2a0c)
2017-01-11 11:28:10 +00:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00
Stephen Chen
a88733aed8 Fix cancel button behavior when setting data limit.
Bug: 28563526
Change-Id: I574c4051bb19710409ca4cf4eeffef7be1a7d0ec
Fixes: 28563526
Test: make RunSettingsRoboTests
2016-09-27 13:11:46 -07:00