Commit Graph

308 Commits

Author SHA1 Message Date
TreeHugger Robot
e3f187a4a9 Merge "Revert "Migrate to use instrumentation classes from settingslib."" 2018-01-23 01:58:18 +00:00
Fan Zhang
b7270a5aeb conditionally add FLAG_ACTIVITY_NEW_TASK when starting page
Subsettings must be started from Activity context, apparently.

Add a flag when it's not started from Activity context. This might not
be catching all cases but should at lesat cover most of them.

Change-Id: I8157ec0cb3d032bb44a0e7dec36637906fc8f1a0
Fixes: 72314527
Test: monkey
2018-01-22 14:07:52 -08:00
Leif Wilden
cab0ee611d Revert "Migrate to use instrumentation classes from settingslib."
This reverts commit 1546cca529.

Reason for revert: Broke fingerprint setup flow. b/72267201

Change-Id: I8321265ae64732c526325882ddea51080decddf5
2018-01-22 20:57:36 +00:00
Leif Hendrik Wilden
1546cca529 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: Ie5515bb0fe3e621fc7723a9b04ba23e4bfa9c401
2018-01-18 11:13:24 -08:00
jackqdyulei
fde637ff60 Add BatteryTipDialogFragment.
This DialogFragment handles all the tip related dialogs. This cl makes:
1. All the tips parcelable.
2. Add dialog for HighUsageTip. It also need adapter to populate app
list in dialog.
3. Add and update tests

Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: Ie4c986172cfc73d8746abc7457d966c8600c6145
2018-01-09 17:33:19 -08:00
Fan Zhang
cf97f0b643 Add tests for some security setting controllers
Bug: 32953042
Test: robotests
Change-Id: Ieab4e6434bbb80313f6d1b25ff1cdea5713038f0
2018-01-05 15:45:53 -08:00
Jeff Sharkey
219ec91e1a Unlock all users before moving or migrating.
When moving apps or shared storage between storage media on FBE
devices, we need all users to be unlocked to successfully move
the data.  This change asks the user to enter the credentials for
any locked users as part of the moving/migration wizard flows.

To do this we relax Utils.enforceSameOwner() to let us prompt for the
credentials of unrelated users, but we carefully only extend this
capability to callers interacting with the "internal" activities,
which require the MANAGE_USERS permission.

Test: builds, boots, users are unlocked before moving
Bug: 29923055, 25861755
Change-Id: Ifaeb2557c4f8c4354e1d380eaa0e413768ee239f
2017-12-19 15:07:05 -07:00
Fan Zhang
5c1e686d3f Merge "Update app icon for ManageDomainUrls setting" 2017-11-09 20:52:57 +00:00
Fan Zhang
4e540db06d Update app icon for ManageDomainUrls setting
Change-Id: I6c26a055983ea72049d1633336d6da8736a78fa0
Fixes: 69057114
Test: robotests
2017-11-09 11:02:23 -08:00
Ajay Nadathur
d473e38c74 Forward wallpaper activity results to the caller.
- Added Activity.FLAG_ACTIVITY_FORWARD_RESULT to the intent that
launches the wallpaper activities.
- WallpaperSuggestionActivity also finishes itself after launching
intent.

Bug: 65691577
Test: Added robolectric test. Also verified manually that result code is
being forwarded
Change-Id: I2f8b0fac7a35c38e14c4a733b7552fd2e58dd0db
2017-11-08 11:03:04 -08:00
Tony Mantler
d9af0b839d Move SimStatus and ImeiInfo Pref Controllers to SettingsLib
Bug: 67410808
Test: RunSettingsRoboTests
Change-Id: Ib55d2365814b5882f7fcae6bb7f1b62cc3d6ad4e
2017-10-23 15:42:43 -07:00
Felipe Leme
bd88450183 Adds a Util.setSafeIcon() function used to avoid crashes.
There are many places on Settings that loads an icon provided by an application,
and if the icon is too big it crashes Settings.

This CL creates a helper method used to set an icon in a safe way, and
uses it in a few places (but most likely not all of them).

Bug: 65739885
Test: manual verification with an app providing a 2MB png

Change-Id: Iae2becb6d0ec8893328d9ef1de618f9bd12fa4a0
2017-10-10 08:56:56 -07:00
PMS22
63a0560a6c Settings: Correctly align cursor in Settings
Steps to Reproduce:
- Click on Density Settings (DPI Settings) / Renaming BT Device / Renaming SIM Settings
- EditText Dialog pops up
- The cursor is at the leftmost side of the text
- Logically Cursor should be at rightmost side which can be aligned grabbing text length

Screenshots:
Before:
http://imgur.com/a/o4vkr
http://imgur.com/a/6Qext

After:
http://imgur.com/a/fuxqT
http://imgur.com/a/vm2WX

Bug: 65185652
Test: RunSettingsRoboTests: OK (47 tests)

Change-Id: Id00308e7e019434edad4afab56cf4719be0d0d54
Signed-off-by: PMS22 <prathams99@rediff.com>
2017-09-27 14:12:32 -07: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
Roozbeh Pournader
4de9df2943 Define Utils.formatRelativeTime() and use it
Previously, relative times were formatted using formatElapsedTime()
(appending translations of "ago" to them), sometimes resulting in
grammatically hard-to-understand or unnatural localizations. Now we
use ICU's RelativeDateTimeFormatter, which uses grammatically correct
and natural localizations from CLDR data.

Bug: 64507689
Bug: 64605781
Bug: 64556849
Bug: 64550172
Test: make -j RunSettingsRoboTests
Change-Id: Ia2d098b190ab99e7748ef6f03b919f5c6174ba7d
2017-09-12 20:48:00 +00:00
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
Justin Klaassen
3025727e16 Ask device owner for master clear in demo mode
Bug: 62712426
Test: make RunSettingsRoboTests -j19
Change-Id: I29f92ff1062590f2c5eb7713e5969da7870fc582
2017-08-09 10:44:19 -07:00
Christine Franks
a1f56b5faa Merge "Restrict changing wi-fi networks" into oc-dr1-dev
am: a7e10e0316

Change-Id: Ifcb15f741c4bcb72c32789870bc50027d2fc4cbb
2017-07-26 02:52:52 +00:00
Christine Franks
a0dd987d20 Restrict changing wi-fi networks
Bug: 31852835
Test: manual - verify unrestricted as regular user, but that a password
is required in demo mode.
Change-Id: I60f95ccbb10ba728b384b9c8c2ae723934fb2928
2017-07-25 13:31:12 -07:00
Kevin Chyn
2a2dcb52cb Fingerprint swipe settings and suggestions should not show if hardware unavailable
Fixes: 63589121

Test: remove FP driver, make sure swipe setting and suggestions
don't show anymore && make -j RunSettingsRoboTests

Merged-In: I2539128daff8df52d040606141f772fc9edffa57
Change-Id: I2539128daff8df52d040606141f772fc9edffa57
2017-07-25 02:33:30 +00:00
Kevin Chyn
82792cc5b3 Fingerprint swipe settings and suggestions should not show if hardware unavailable
Fixes: 63589121

Test: remove FP driver, make sure swipe setting and suggestions
don't show anymore && make -j RunSettingsRoboTests

Change-Id: I2539128daff8df52d040606141f772fc9edffa57
2017-07-24 13:40:34 -07:00
Christine Franks
c6890ab6c5 Move logic for FR in demo mode out of Settings
Bug: 62712426
Test: make \
ROBOTEST_FILTER="(MasterClearTest|FactoryResetPreferenceControllerTest
|UtilsTest)" \
RunSettingsRoboTests -j100
Change-Id: I5e287c3d4a6a7050bda78187c52aec19e90b50bc
2017-07-21 19:19:19 +00:00
Christine Franks
a09eb383d9 Move logic for FR in demo mode out of Settings
Bug: 62712426
Test: make \
ROBOTEST_FILTER="(MasterClearTest|FactoryResetPreferenceControllerTest
|UtilsTest)" \
RunSettingsRoboTests -j100
Change-Id: I5e287c3d4a6a7050bda78187c52aec19e90b50bc
2017-07-20 17:44:18 -07:00
Phil Weaver
633c9be21c Migrate to new overlay-stopping flag
Bug: 62196835
Test: Started an accessibility service that displays an app
overlay and verified that it disappears when approving an
accessibility service's capabilities.

Change-Id: I7c8d8b4143a5dd1cb684c31c4503608c8d5be0e3
2017-07-05 10:41:18 -07:00
Fan Zhang
896f1b363c Reduce jank around loading view when opening data usage UI
Change-Id: I3d23d8160b046de8fe125ba0697b7b3d7786453c
Fix: 28181319
Test: robotests
2017-06-26 15:15:30 -07:00
TreeHugger Robot
03849d1484 Merge "Switch Utils.formatElapsedTime to use ICU's MeasureFormat" 2017-06-22 19:49:35 +00:00
Roozbeh Pournader
1587224193 Switch Utils.formatElapsedTime to use ICU's MeasureFormat
Previously, localizable strings were used instead, causing various
difficulties and inconsistencies.

Now we use ICU's MeasureFormat. The results for English are almost
identical to the previous results (see below), and we also get higher
quality and better-vetted results for other locales.

Note: This also makes formatted strings shorter by eliminating zeros.
For example, what was previously shown as "2d 0h 15m" is now shown as
"2d 15m".

Bug: 36994779
Bug: 37701311
Test: make -j RunSettingsRoboTests
Change-Id: I78fd09e4e7f63f41ef88d3d3fc4ba2be15e1d812
2017-06-21 21:04:37 -07:00
Doris Ling
e9060a3cb6 Delay showing the loading progress spinner in Managed App.
In warm load, the app list is populated much faster, and we should not
show the spinner if we can show the app list immediately.

Adding 100ms delay in showing the loading container. If the app list is
ready, show the list container directly without first showing the
loading container.

Change-Id: I8b3ea88d2382ece9226d5c7734fd1aa406160cf2
Fix: 36375109
Test: make RunSettingsRoboTests
2017-06-19 10:57:11 -07:00
Esteban Talavera
c62ce670c3 Merge "Include disabled managed profiles in Accounts page" into oc-dev am: 92f78354f9
am: 42d97f86c2

Change-Id: If2708bc27673b50dfdf7faa3300944d8bdb47b60
2017-06-02 08:42:50 +00:00
Esteban Talavera
92f78354f9 Merge "Include disabled managed profiles in Accounts page" into oc-dev 2017-06-02 08:33:17 +00:00
Esteban Talavera
9b86e9c822 Include disabled managed profiles in Accounts page
At the moment we include disabled profiles when deciding
whether the Work section needs to be added, and then only
include enabled ones when searching for the managed profile's
user handle

Change-Id: I96b0c36aad6b9326abc2992fa3309716f5cd1e74
Fix: 62021410
Test: m RunSettingsRoboTests
2017-06-01 09:52:45 +01:00
Adrian Roos
5a9a3cde62 Credential FRP: Add ACTION_CONFIRM_FRP_CREDENTIAL to ConfirmCredential
Bug: 36814845
Test: adb shell settings put global device_provisioned 0 && adb shell am start -a android.app.action.CONFIRM_FRP_CREDENTIAL
Change-Id: Id6ce6bc5ebd9c9e2a88790cc800678aff50e580f
2017-05-30 18:25:18 -07:00
Phil Weaver
ed0866ebfd Fix clickjacking again for accessibility services
Turns out that the flag for the window being obscured
does not imply that it is also partially obscured.

Also blocking system alerts and toast windows over the
accessibility service preference screen (and its associated
warning dialog) as well as the warning dialog shown when
a service is made available with the accessibiity shortcut.

Bug: 62104030
Test: Manually verified that I can't enable Select to Speak
when switch access is highlighting the button. I am able to
do that without this fix. Also started a service that
displayed a system overlay and confirmed that the overlay
disappears on a11y service preference screens and when a
new service is configured for the a11y shortcut.
Merged-In: Ie00bafa736c837881a258c9de10891b27c5baefd

Change-Id: Iabbded1a12dbc33d76e51c0bac710280a88080f3
2017-05-30 10:45:23 -07:00
Phil Weaver
2e2dbfe549 Manual merge of ag/2319717
Bug: 62104030
Test: Manually tested as described in original commit msg.
Change-Id: Ie00bafa736c837881a258c9de10891b27c5baefd
2017-05-30 10:41:52 -07:00
Maurice Lam
e1976ac302 Check for sidecar null-ness before removing
Test: cd tests/robotests && mma
Bug: 36681116
Change-Id: Id48113502c538b607d92700d3e58943614cfc150
2017-05-10 17:17:44 -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
Daniel Nishi
fe33c58a18 Add user icon to the other user preferences.
This icon is loaded in the background to avoid doing IO on
the main thread. Once we know there are more users and also
have the icon loaded, we add the category to the view.

Fixes: 36252572
Test: Robotest

Change-Id: Ib50287bb7ed323f22fbe407b56be1bf2fe98f121
2017-04-07 14:57:07 -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
11d2d68e23 Move developer options related class to development package
Bug: 34203528
Test: none, purely moving classes around
Change-Id: I3cd1d257f948729fda5c04632e7ce9114c40bd0c
2017-03-17 16:51:21 -07:00
Fan Zhang
1447da277b Fix layout for time zone picker
Change-Id: I2f1dedac7d747901978ef5d4a1a58bae2fa02921
Fix: 35856915
Test: make RunSettingsRoboTests
2017-03-08 16:28:02 -08:00
Daniel Nishi
9f60f42a94 Add support for user profiles to the Storage Settings.
This adds new preferences for each profile (such as the work
profile) and defines a new view for viewing the storage
breakdown for the individual profile. The functionality closely
mimics the presentation on the main view, but without the system-wide
breakdown and without any additional users/profiles.

Bug: 34715777
Test: Settings Robotests

Change-Id: I19d449b648c6566331fd02e45c2e45f8c74ea7e7
2017-02-22 17:33:24 -08:00
Daniel Nishi
422e7c354d Update the loading of info for the secondary users.
Bug: 34715777, 34225103
Test: Settings Robotest
Change-Id: I32bb15ad8bc866c1fd41728e56faa8b09ae11eb6
2017-02-21 12:08:28 -08:00
Daniel Nishi
dfed8a2acb Add support for visualizing secondary users.
This functionality adds the secondary users to the screen, but
currently does not populate the information for them. Once the
external stats query works, I will add a loader which will
populate this information.

This also does not cover work profiles. Support for that is
forthcoming.

Bug: 34715777, 34225103
Test: Settings Robotest
Change-Id: Ib9b692b214f5ce5d303dfd64516381443d4acebd
2017-02-21 12:07:23 -08:00
Fan Zhang
c6ca314c0b Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
2017-02-15 17:17:19 -08:00
Robin Lee
cccf3244b6 Prompt credentials for installing/deleting sounds
Actually we probably want to confirm credentials in all locked cases
not just when starting the user -- fewer corners to special case.

Fix: 34734809
Test: manual. set a work profile lock, screen off/on, open sound settings, try to set a work ringtone. first attempt should prompt for credentials, second attempt should not until next screen-off.
Change-Id: I1fea94f3b0d1b768b22741b887d9891f5e318549
2017-02-10 15:34:53 +00:00
Christine Franks
1478222cd2 Allow factory reset in carrier demo mode
Bug: 34341567
Test: manual - in carrier demo mode, go to Settings > Backup and
Reset > Factory data reset > Reset phone > Erase everything and
this entire path is viewable.

Change-Id: Ia5491765241adad97ecdb0a5bfd86a8371b8e4fe
2017-02-06 11:42:54 -08:00
Daniel Nishi
31027dae93 Add a music apps view to the Storage Settings.
When you tap the Music & Audio preference, it takes you a
hybridized applications view. In this view, there also is
a line item which defines the amount of storage used by
audio files on the device. Using the new storage query, we
can add this information very quickly to the view.

Bug: 33199077
Test: Settings robo tests
Change-Id: If51cba0b3de20805543a39049367eb13613081e7
2017-01-25 11:56:02 -08:00
jackqdyulei
8164c64edc Add NPE check for method assignDefaultPhoto in Utils.java
When user press back button while adding user, app may crash because
of null context. In this cl, I add NPE check for context in method
assignDefaultPhoto and change this method to return boolean value.
If the return value is false, then stop the following steps(e.g.
creating a dialog after pressing button may also cause crash.)

Bug: 33829308
Test: make -j40 RunSettingsRoboTests
Change-Id: I811b92c268fb20f8c43ab3b0a9ceebe76f5d83be
2016-12-28 11:30:54 -08:00
Amith Yamasani
21556cdba1 Adapt to behavior change in MATCH_UNINSTALLED_PACKAGES
Don't use the PM flag to reach across users.
If retrieving labels, etc., use MATCH_ANY_USER, since
several Settings screens show work profile apps as well.

Bug: 31000380
Test: Manual test of affected screens
Change-Id: Ib6f981ae8443f640276d395c37247c8c0b610894
2016-11-30 13:24:54 -08:00
Tony Mak
8f41b9b665 Fix DPM.ACTION_SET_NEW_PASSWORD
Problem:
SetNewPasswordActivity is the new entrance for
ACTION_SET_NEW_PASSWORD. And it starts ChooseLockGeneric with the
fingerprint extras. ChooseLockGeneric infers which user is starting it
and determine which user is setting password. However, it now always
think that it is current user as it is always SetNewPasswordActivity
in current user starting it.

Solution: Resolve the user id in SetNewPasswordActivity and forward it
to ChooseLockGeneric. SetNewPasswordActivity needs to know the user id
anyway in order to have the fingerprint checking in the correct user id.

Test: 1. make RunSettingsRoboTests
      2. Manual Test
      	a. Start SET_NEW_PASSWORD intent in user 0, set password.
         	User 0 password is set.
      	b. Start SET_NEW_PASSWORD intent in work profile, set password.
         	work profile password is set.
        c. SET_PROFILE_PARENT_NEW_PASSWORD is always setting parent
           password.
        d. If fingerprint is disabled, both intent should not show
           fingerprint option
        e. DO sync auth flow with google.com account, fingerprint option
           is shown.

Change-Id: I2f73d01ab11e91b337beb90c05bbcb857dfd40dc
Fix: 32959373
2016-11-23 11:36:18 +00:00