Commit Graph

26 Commits

Author SHA1 Message Date
jackqdyulei
00015fbf50 Add device/profile app check in background check
If app is device or profile app, we disable the background check
toggle. This cl also create an util method for this check and
remove duplicate code

Bug: 64665807
Test: RunSettingsRoboTests
Change-Id: Id8336eadaac8832327bc3653aaa7dfbacde352ac
2017-08-29 16:10:36 -07:00
Daniel Nishi
739b0eef10 Move the Robolectric shadow config up.
In my testing, this reduces the runtime of the Robolectric Settings test
suite on my Z840 workstation from 440 seconds to 402 seconds on average.
By avoiding having a method-level Robolectric shadow import, we avoid
going down a code path which needs to add more shadows later in the
Robolectric execution.

Bug: 64808827
Test: Settings robotests still pass
Change-Id: I7b40d73b30306ae3f9759281afbd7f7266579e24
2017-08-17 14:37:27 -07:00
jackqdyulei
bfc2b11b93 Update Anomaly detection framework
This cl make it could have multiple actions for each anomaly type.

This includes:
1. Add field "targetSdkVersion", "bgRestrictionEnabled" in Anomaly
2. Add new action which includes "force stop" and "background check"
3. Add "sdkVersion" and "bgRestrictionEnabled" method in BatteryUtils
4. Update BackgroundCheckAction to check sdkVersion first
5. Update serveral tests and add new test

Bug: 63037765
Test: RunSettingsRoboTests
Change-Id: Iea7a131ee57d501f7737ae4a3ba672d948d05cd8
2017-07-06 15:53:28 -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
jackqdyulei
210110f4ed Restart loader in onResume
We need to refresh batterystatsHelper in onResume, so we need to
call restartLoader instead of initLoader

Bug: 62237848
Test: RunSettingsRoboTests
Change-Id: I6f7e1b57b945c92d34587ca24db192600e7f797f
2017-06-01 15:57:08 -07:00
Fan Zhang
a45f3d2f33 Add method to disable "disable" button in installed app UI
OEMs can now force grey out the "disable" button for important apps on
device.

Change-Id: Ic075a07ad12592bd60238c7b1c9ab84932c8db3c
Fix: 38250742
Test: make RunSettingsRoboTests
2017-05-31 11:53:29 -07:00
Maurice Lam
046400c2c4 Migrate settings robolectric tests to mockito 2
- Migrated ArgumentMatcher subclasses to lambdas
- Replaced any() with nullable() where tests were failing

Test: cd tests/robotests && mma
Bug: 38456058
Change-Id: Ice8c39b435c45b87f82dbbd9860e68f235314cf8
2017-05-24 15:14:31 -07:00
jackqdyulei
2a95a63466 Make "Battery usage" accessible at any time
Before this cl, user could go to "Battery usage" page only if
related app has battery usage. This cl breaks this rule so we
could open "Battery usage" without battery data.

Bug: 38497822
Test: RunSettingsRoboTests
Change-Id: Ic53c33b7dcbac82de58f31cf96e0bd8fa54e53ea
2017-05-23 13:30:15 -07:00
jackqdyulei
013d3f6342 Use BatteryStatsLoader in InstalledAppDetails
InstalledAppDetails uses AsyncTask to update foreground mBatteryStatsHelper
in background thread, which is dangerous. This cl make
InstalledAppDetails use BatteryStatsLoader to update batteryStatsHelper
and only assign it once in UI thread.

Bug: 38497555
Test: RunSettingsRoboTests
Change-Id: I3078b60a2dae36995ae5f925b4d49e36e79bddfd
2017-05-22 17:39:19 -07:00
Doris Ling
93be46ce5e Refresh the App Info option menu after unintalling app updates.
When we are done uninstalling app updates, invalidate the options menu
so that it will be rebuilt and the correct available menu items will be
shown.

Change-Id: I485fe9ff129ac0b2d75094c3b899bf6553e54c74
Fix: 36407258
Test: make RunSettingsRoboTests
2017-04-26 16:35:38 -07:00
Fan Zhang
f6126e7a00 Fix ANR in installed app details.
InstalledAppDetails tries to refreshUi whenever something about a
package changes. It does not need to refresh when the changing package
is different from what's being displayed.

Change-Id: Ib45289c39ee402cf8974bf52c881f44d225b8be5
Fix: 37424866
Test: make RunSettingsRoboTests
2017-04-24 21:51:32 -07:00
jackqdyulei
f4c1cef322 Add TtsSpan for formatted time.
Talk back will read "Used for 3m" as "Used for 3 meters", but
it will read "Used for 3h 3m" correctly.

This cl add specific Ttsspan if the time only contains "minute"

Bug: 36379530
Test: Run SettingsRoboTests

Change-Id: I033575938cce24221980dddd9d66be4e18804541
2017-04-21 14:42:42 -07:00
Jesse Evans
edc5099e89 Instant apps show supported links not open default
On the app info page, instant apps show only the supported links
dialog rather than Open by default which opens in a secondary page
where the user can control things that aren't relevant to instant
apps.
Test: make RunSettingsRoboTests
Bug: 36497697
Change-Id: If4eba7c11c5490cbda1ef617002121fe108c4085
2017-04-13 15:17:41 -07:00
jackqdyulei
5d2918a675 Add log for BatteryUtils
This cl add logs to get more data for app usage time.

Also refactor BatteryUtils to singleton pattern because we need
to extract package name from uid.

Bug: 36909166
Test: RunSettingsRoboTests
Change-Id: I6ede354035c46e46cb856b7cf57bd1b7ccbd6d4f
2017-04-07 11:18:39 -07:00
TreeHugger Robot
418e5bffda Merge "Fix crash when opening battery page" into oc-dev 2017-04-05 22:45:46 +00:00
Daniel Nishi
4c52af621a Merge "Lower case the first letter of storage type." into oc-dev 2017-04-05 22:06:55 +00:00
jackqdyulei
cdbc114376 Fix crash when opening battery page
The settings crashes when opening battery usage detail page from
installed app page. Main reason is that it trying to open obsolete
page. This cl directs it to open AdvancedPowerUsageDetail instead.

Following cl will make InstalledAppDetail show calibrated percentage,
which is trakced in b/36816681

Bug: 36792973
Test: RunSettingsRoboTests
Change-Id: Ie63e64e543ed3b28974ffdda8b42c97e7749a0f7
(cherry picked from commit fac713318c)
2017-04-05 14:12:26 -07:00
Jesse Evans
5c9f7a88b4 Adds the Clear App dialog for Instant Apps
Adds a confirmation dialog for the user when tapping clear app.

From this dialog the user can either cancel, or confirm they
want to clear the app.

Test: make RunSettingsRoboTests

Bug: 36536695
Change-Id: Idffcf5ef318578ae2e075ea2cbb35323d41acade
2017-04-04 08:30:38 -07:00
Daniel Nishi
45c42b2c70 Lower case the first letter of storage type.
In the app details, the first letter of the storage type was
capitalized, causing an odd string of "X used in Internal storage."

Change-Id: Ibcac54259403f6d0f39df8fa2d3af10304a46057
Merged-In: I2b4f23ea1799dc1730fdab596e4a87a0cb673c68
Fixes: 36001265
Test: Settings robotest
2017-03-30 13:31:57 -07:00
TreeHugger Robot
f85ebb24bb Merge "Changes to installed app details screen for instant apps" 2017-03-28 01:22:47 +00:00
Antony Sargent
09955c3865 Changes to installed app details screen for instant apps
Bug: 35098444
Test: make RunSettingsRoboTests

This implements the following changes to the app details screen:

-Suppresses the "Uninstall" and "Force Stop" buttons
-Adds "Install app" and "Clear app" buttons
-Adds a mechanism for showing a link to the store's app details
 page that can be different from the default for installed apps.

Change-Id: Icea83f7d1fde62d4101cb0c8a6d03849f6c56bca
2017-03-27 14:34:56 -07:00
jackqdyulei
ddba966700 Revamp the battery usage details page.
This cl adds AdvancedPowerUsageDetail to show the usage details page.
The AdvancedPowerUsageDetail contains all the needed ui components:
1. App Header
2. Two buttons
3. Usage breakdown preference category
4. Power management preference category

This cl also adds preference controller for two buttons but the
detail implementation will be added in the following cl.

Following cl will also remove previous detail page.

Bug: 35810915
Test: RunSettingsRoboTests
Change-Id: I17f95d1288762094671c0f148fa73367e51f175e
2017-03-24 20:58:44 -07:00
Fan Zhang
1f81d10dc5 Fix a crash when opening uninstalled app detail page
Change-Id: I417e7eb6f9c857ace4e8047b226abe03a7c8248d
Fix: 36027848
Fix: 34392538
Test: make RunSettingsRoboTests
2017-03-07 13:24:31 -08:00
Daniel Nishi
ad7aa871e7 Fast track the installed app details storage.
Change-Id: Ic96a7b4bea6d92a32669887dacbc1f4e54e25ea9
Fixes: 35805032
Test: Settings robotest
2017-03-06 13:55:00 -08:00
Doris Ling
2508ed56ca Show uninstall for all users option menu in app info.
- when there is only 1 user installed the app, also check if it is
installed by the current user or by other user to determine whether or
not to show the uninstall for all button.

Change-Id: I1eecb13a7748c92159cb0626e2b6fe1ed6987d15
Fix: 34760157
Test: make RunSettingsRoboTests
2017-03-02 13:30:59 -08:00
Doris Ling
015a50bef9 Modify text in Apps & notifications settings.
- in Settings->Apps & notifications->Apps->[select app], update the
  header summary to installation status, and move the version text to
  the bottom of the page.
- updatd preference title from Apps to App info
- update preference title from Notifications to App notifications

Bug: 34977561
Test: make RunSettingsRoboTests
Change-Id: I97e9b81c739fb99eaca2cf45fb11f208ad6cd9ca
2017-02-15 19:02:33 -08:00