Commit Graph

589 Commits

Author SHA1 Message Date
Chaohui Wang
88fd45b1e6 Fix ANR in TelephonyStatusControlSession
Feature.get() blocks on the main thread, which cause the ANR.

Cancel the job instead to fix.

Fix: 287702163
Test: Manually with MobileNetworkSettings
Test: atest TelephonyStatusControlSessionTest
Change-Id: Id873e56359dbf198c31686c2280c979294c95c3d
2023-06-21 16:43:17 +08:00
Chaohui Wang
ed6d6c9e0f Migrate PlatformCompat App List to SPA
So hidden modules are not shown in the list.

This will also improve the developer experience.

Bug: 273913035
Test: Manually with App Compatibility Changes
Test: Unit test
Change-Id: Ic78a51819159a0f848db6173f751b1be8c6b1e70
2023-06-15 09:37:11 +00:00
Han Xu
e319c686e7 Add manufactured year into hardware info page am: b452bc9f9d am: 15da26329f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23629342

Change-Id: I29b80b692bc97132b5cc7eac3d3a153d0f93d238
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-12 18:08:24 +00:00
Han Xu
b452bc9f9d Add manufactured year into hardware info page
Bug: 285471557
Test: manual visually
Change-Id: Iaab254ac6ee77217e29d89524d782577f44119cb
2023-06-12 17:43:55 +08:00
Yi-Ling Chuang
f148baa372 Remove redundant methods and refactor
Remove the summary method and write the code in AOSP directly instead to
force string consistency. Also refactor a bit after the modification.

Fixes: 276399056
Test: robotests
Change-Id: I76ad740b694363a3cdfb3748e41c840fb678b93d
2023-06-12 16:11:49 +08:00
Chaohui Wang
3e35cff7ba Move unrestricted data summary to DataSaverController
DataSaverController currently used in 2 pages,
- Network & internet > Data Saver
- Apps > Special app access

This helps unify the logic, and instead of showing on "Special app
access", this summary shows on "Unrestricted data" is make more sense.

Bug: 280280596
Test: Manually on above pages
Test: Unit test
Change-Id: Ia151ed8179a250f8f20cc5041f9383fffebdab10
2023-05-26 13:05:48 +08:00
Chaohui Wang
b04b977cac Merge "Improve the loading time of DataSaverSummary" into udc-qpr-dev 2023-05-25 09:38:35 +00:00
Chaohui Wang
516503df0a Merge "Fix crash of PictureInPicture" into udc-dev am: 5b042e2feb am: a9a229665b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23408018

Change-Id: Ia5aaf1c116abef625c43a63619636b18cfe6515f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-25 07:31:52 +00:00
Chaohui Wang
ce56dcc30b Fix crash of PictureInPicture
This follows change I3115cf1b99a305efef192a0dcf3e809eb7903d0a

PackageManager.getPackageInfoAsUser() will throw exceptions when the
package is too large which is a known issue to PackageManager but very
low priority given resourcing constraints. As per the PackageManager
team suggestion, catch the exception on the app side to alleviate the
impact to the PictureInPicture & App info page.

Fix: 283076353
Fix: 283354211
Test: Unit test
Change-Id: Iad2bf9fbfca6ee7f604fec1c4afa1b9382f6ec7e
2023-05-24 19:41:20 +08:00
Chaohui Wang
cb9374e294 Improve the loading time of DataSaverSummary
Use AppListRepository instead of ApplicationsState can achieve better
performance.

Fix: 280280596
Test: Manually on Data Saver page
Test: Unit test
Change-Id: I98cbae50500b90e7e7f6101fb064003339b082c1
2023-05-24 17:23:24 +08:00
Yi-Ling Chuang
75af9aa3f5 Merge "Refactor battery related feature provider" into udc-qpr-dev 2023-05-24 06:55:17 +00:00
Yi-Ling Chuang
ee97eaf2d9 Refactor battery related feature provider
Merge BatteryInfoFeatureProvider to BatterySettingsFeatureProvider. Also
add a new string to indicate the unavailability when there's error
fetching the cycle count value.

Bug: 276399056
Test: robotests
Change-Id: Ic6a641d72d5bb295f2a0766dcebdcbe855d91125
2023-05-24 11:26:07 +08:00
Chaohui Wang
3168137798 Merge "Fix the bytes displayed unit" into udc-qpr-dev 2023-05-23 11:03:59 +00: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
Yi-Ling Chuang
7a32e871dc Add a new feature provider for Battery info page
This feature provider contains the APIs to query certain battery info.

Bug: 276399056
Test: robotests
Change-Id: I8f8503f42a6ad1460b4601e44e8b720b91dd13d1
2023-05-19 21:21:46 +08:00
danielwbhuang
6189f9fcbd Use FeatureProvider to provide the firmware update category.
1. Add KeyboardSettingsFeatureProvider in FeatureFactory.
2. Use KeyboardSettingsFeatureProvider to add firmware update UI.

Bug: 270114180
Test: manual, atest KeyboardSettingsFeatureProviderImplTest
Change-Id: I62ec7aff71dd5c0d496860363f2c5b3e992503ff
2023-05-18 17:24:43 +08:00
Chaohui Wang
80462c370b FRP bypass defense in the Settings App for SPA
Over the last few years, there have been a number of
Factory Reset Protection bypass bugs in the SUW flow.
It's unlikely to defense all points from individual apps.

Therefore, we decide to block some critical pages when
user doesn't complete the SUW flow.

Fix: 280154358
Test: Unit test
Change-Id: I06e73386711d5ad13c89d033cf0fe3164781c0ef
2023-05-03 10:53:27 +08:00
Chaohui Wang
ca615997ea Use string notifications_disabled instead of off
notifications_disabled was changed to off in
Change: I5f84d09f223efd478461ded93aeac82bf7b128d8

And reverted from off to notifications_disabled in
Change: Iaad301c5513478fb95e40987ea3ccb4f923d71fa

This usage is branched from AppNotificationPreferenceController.java,
and missed in revert.

Bug: 272603842
Test: Visual
Test: Unit test
Change-Id: I5b8466134c1342e10de7a2ead8c52931e0c19377
2023-04-29 15:42:09 +08:00
Yanting Yang
3be454f967 Update the proper App battery usage string on App info page
Bug: 278045681
Test: visual
Change-Id: I4da671615f11554e2cd64f3a801252df5c0ba6f4
2023-04-19 17:00:46 +08:00
Chaohui Wang
f6caf24369 Migrate latest changes in "Alarms and Reminders"
To the new spa version.

Fix: 278113001
Test: Follows the instruction in bug
Test: Unit test
Change-Id: Iff38f01cd34c7b56ff23f4a17cb6ec1b78fba1ee
2023-04-14 13:46:24 +08:00
Chaohui Wang
c688f93ed9 Display App installed in other user in All Apps
Only for admin user.

Also clean up unused getInstallationStatus().

Fix: 277299765
Test: Manually with All Apps when multiple users is on
Test: Unit test
Change-Id: I4de681c101a605e3517dcd8765bf7a95d1b76417
2023-04-10 03:06:01 +08:00
Chaohui Wang
ecd8ffb08b Fix App battery usage crash
userContext.getApplicationContext() returns null, which cause crash.

Use context instead to fix.

userContext was used to support multiple profiles, since the app's user
id is also passed to getAppBatteryUsageData(), userContext is not need.

Fix: 269545838
Fix: 275957358
Test: Manually check the battery usage is still correct if an app is
      installed on two profiles
Change-Id: I41a80e4c6edc338affb6eec0cf12da3c438cd7fd
2023-04-04 00:15:29 +09:00
Chaohui Wang
90983daa41 Fix not displaying "Allow restricted settings"
"Allow restricted settings" is missed from SPA, added to SPA to fix this
issue.

Also make the system call in app info more options async to improve
performance.

Fix: 273678047
Test: Unit test
Test: By the following steps,
1. Install an app with accessibility feature from Chrome
2. Go Accessibility page and click on the disabled grey app
3. Go to the app info page, click more options
4. Make sure "Allow restricted settings" is displayed

Change-Id: I4adbe2335a32e6a7c4ebe155715684d768e5d1ef
2023-03-20 19:40:06 +08:00
Sunny Shao
de797e1198 Add the SPA page enter/leave logging metrcis.
- Add the SpaLogProvider and SpaLogData for logging writing.
- Write the SPA page enter/leave logging.

Fixes: 271793388
Bug: 253979024
Test: atest SpaActivityTest SpaLogDataTest MetricsDataModelTest
Change-Id: I0ad5af39ba207ac00d58f6392496effa3adc42f4
2023-03-07 16:10:56 +08:00
Weng Su
d078d1f00a Merge "Refer to the last Hotspot password when generating the password" into udc-dev 2023-02-25 02:33:55 +00:00
Zaiyue Xue
6d939b34dc Fix b/265387286: The total percentage of all apps is not 100%
Bug: 265387286
Fix: 265387286
Test: manual
Change-Id: I654f8211a45c818f9a2d4867ac679e72c9ce6eb1
2023-02-24 19:19:28 +08:00
Weng Su
d7bbd4505c Refer to the last Hotspot password when generating the password
- Query the last Hotspot password when security type is SECURITY_TYPE_OPEN and it will be used when the user changes to another security type

- If the last hotspot password is an empty string, then generate random password

Bug: 201789473
Test: manual test
atest -c WifiHotspotRepositoryTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherPasswordPreferenceControllerTest

Change-Id: Id3a846099238433e7b6c8b934fa26a74df0dcb61
2023-02-24 11:22:40 +08:00
Chaohui Wang
d67bd3b575 Fix calculateSizeBytes
dataBytes including cacheBytes, so not adding cacheBytes separately.

Bug: 236346018
Test: Manually with Settings
Change-Id: I92ecad3d9ec7a29d690e8ceba2614dd11b561ad3
2023-02-08 16:17:28 +08:00
Chaohui Wang
e4c9959fd7 Add AppPermissionPreferenceTest
Unit test for AppPermissionPreference.

Bug: 236346018
Test: Unit test
Change-Id: I83e19bd8d4d667fb6cb2be8aed85ba7f0a8f149e
2023-02-02 13:34:09 +08:00
Chaohui Wang
750c6072b9 Use SettingsAlertDialog for app button dialogs
Use the spa standard widget SettingsAlertDialog to unify the dialog
style.

Bug: 236346018
Test: Manually with Settings
Test: Unit test
Change-Id: Idb231600e38ec7b0244baa5101da912ed2b9fd3c
2023-01-31 17:42:39 +08:00
Chaohui Wang
c1726d07e5 Launch the correct profile for the App Info items
Use the app user handle when SubSettingLauncher launch the new page, to
make sure the new page is opened for the correct profile.

Bug: 236346018
Test: Unit test
Test: Manually with App Info Setting page
Change-Id: Idd6eb183e967b1ced10fcf46b9e74bdff3953280
2023-01-29 01:10:47 +08:00
Chaohui Wang
1732c22706 Add unit test for Picture In Picture
Bug: 260660819
Test: Unit test
Change-Id: I64917bf58082b49ffcfbb4926e8ccd26d2e7c5f4
2023-01-19 17:37:13 +08:00
Kuan Wang
96aee4896b Not show time information in battery optimization page when opened from
Settings -> Apps

Test: make RunSettingsRoboTests + manual
Bug: 265130434
Change-Id: Ie7ae6a97041f490e81adbe8e0c530799e09a7c66
2023-01-16 12:07:07 +08:00
Chaohui Wang
4525cfb462 Merge "Remove EXTRA_USER_HANDLE from startSpaActivityForApp" 2023-01-05 11:06:08 +00:00
Chaohui Wang
875cbba0af Merge "Add spinner options to "All apps"" 2023-01-05 11:05:23 +00:00
Chaohui Wang
c14729295e Merge "Move common startUninstallActivity to AppUtil" 2023-01-05 03:50:28 +00:00
Chaohui Wang
74b3bfc066 Add spinner options to "All apps"
Spinner options only shows when there is any disabled or instant apps.

Fix: 264228237
Test: Manually with Settings
Test: Unit test
Change-Id: I9f916c1076b2d754b8c5f30244eac5d5c0bc78f4
2023-01-04 17:06:12 +08:00
Chaohui Wang
4710cfc7ed Move common startUninstallActivity to AppUtil
And also suppress the warnings.

Bug: 236346018
Test: Unit test
Change-Id: I469e563fdeea0bec0587a255b15fddcaaab7f2c3
2023-01-04 16:58:39 +08:00
Chaohui Wang
afeb7496bb Remove EXTRA_USER_HANDLE from startSpaActivityForApp
Bug: 263553430
Test: Unit test
Change-Id: I6739d4518eac00cfe22905c1a6589b6e9f91a1d3
2023-01-04 16:26:04 +08:00
Yilin Cai
fa93f941ef Fork the Wi-Fi control setting page to SPA.
The page is located at "Apps > Special app access > Wi-Fi control".

Test: atest SettingsSpaUnitTests:com.android.settings.spa.app.specialaccess.WifiControlAppListModelTest
Test: local device (http://screen/3a4mkuAwPJoY6rf, http://screen/4fzttXjBqcEKcXA)
Bug: 262206181
Change-Id: Ibef029e6d83849a0eb0d779e5ed6dedfc2fe4b43
2023-01-04 10:56:44 +08:00
Chaohui Wang
36903136af Fix AppDataUsagePreferenceTest#whenHasDataUsage
Fix: 264141691
Test: Unit test
Change-Id: I208f6f8f04d0ed59e31b795f5c90a64e0f76cfa3
2023-01-03 11:47:25 +08:00
Chaohui Wang
a9c624b0d3 Add SpaAppBridgeActivity for application usage
This requires the user to pass into the package name, which enabling
the feature of navigating to app info pages.

Bug: 263553430
Test: Manually with Settings
Change-Id: I9405e3732d99f78cd87e62d73b0c9519a8e2d71f
2022-12-26 20:22:38 +08:00
Chaohui Wang
366649ed1c Merge "Set setModeByUid to align with current behavior" 2022-12-22 14:14:17 +00:00
Chaohui Wang
35e0ff2fb7 Merge "Add AppNotificationPreference to App Info Settings" 2022-12-21 04:51:04 +00:00
Chaohui Wang
dcd965b816 Add AppNotificationPreference to App Info Settings
This is only for the App Info Settings page, which is planed to be
migrated to SPA in Android U.

Currently protected by flag settings_enable_spa, default false.

This will not impacted the AppNotificationSettings, which has no plan
to be migrated.

Bug: 236346018
Test: Unit test
Test: Manual with Settings App
Change-Id: I4ae669ce36eb6ab73f1adf99585f424e03bf90fb
2022-12-21 04:50:12 +00:00
George Chan
d18b422c51 Added Background install control UI code.
Change-Id: I1b629fdc04d1df1b08998c9aaae3df3446fab3fe
Bug: 238451991
Test: Manually with settings, atest
2022-12-20 22:38:01 +00:00
Chaohui Wang
d735f9a1a8 Set setModeByUid to align with current behavior
For the following App Lists,
- All Files Access
- Media Management Apps

Default false, if true, use AppOpsManager#setUidMode instead of #setMode

This follows Change: I261953ff88bc049cf0a2f04f8caac00b8cc6f704
Reason:
Security related app-ops should be set with AppOpsManager#setUidMode
instead of AppOpsManager#setMode.

Bug: 235727273
Test: Unit test
Change-Id: I953b63c2bf6f3bd94aacc935c8c3579bc8aed199
2022-12-19 16:09:19 +08:00
Chaohui Wang
b760ffdc1a Refactor AppNotificationRepository
Also add unit tests.

Bug: 236346018
Test: Manual with Settings App
Change-Id: Idf3fbcb3dff2cbee9039ff67b5c0f09133f9ff86
2022-12-18 19:47:32 +08:00
Chaohui Wang
1445d985bb Move AppItem into AppListModel
Follows the api changes in Spa privileged lib.

Bug: 260660819
Test: Unit test
Test: Manually with Settings
Change-Id: Ieec1035070cc532eedcd1511c5b347e04099a9fb
2022-12-15 12:32:54 +08:00
Chaohui Wang
b4a8e4b314 Reduce flaky of whenCanDisplayLocalUi_displayed
Bug: 246877208
Test: Unit test
Change-Id: I0b2554521b55fcfacc24e59a81ddc08b2eb9d70c
2022-12-07 12:03:47 +08:00