52 Commits

Author SHA1 Message Date
Alan Viverette
51efddbd3b Remove unnecessary casts on calls to findViewById
Just frameworks/ this time. More paths to come.

Bug: 24137209
Test: make -j32
Change-Id: Iff27abd26fa43296ac2fff8f534fc6742d2ae80c
2017-04-14 11:15:50 -04:00
Chris Wren
282cfefea0 standardize system notification IDs
All the trivial cases, plus some fixes to try to
mitigate collisions with the complex ones.

Complex services to follow in another CL,

Bug: 32584866
Test: make framework services
Change-Id: Ie9663600171d8ede11676e9d66f009dbb06def03
2017-03-31 11:44:05 -04:00
Fyodor Kupolov
d225f0bfd5 Support expiration of preloaded file cache
When device is provisioned, we delete all files from /data/preloads
except file_cache. We should do best effort to keep file_cache during
the first config_keepPreloadsMinDays. After that,
persist.sys.preloads.file_cache_expired is set to 1, which indicates
that cache can be deleted when additional storage space is requested.

Bug: 34690396
Test: Manual + RetailDemoModeServiceTest
Change-Id: Ie584a9dd6689bcc5e6b3cb448e95dfe5f73d2eeb
2017-03-21 16:51:25 -07:00
Geoffrey Pitsch
af759c52ce Channels for Frameworks notifications
Adapts all notifications used by system services to use channels.
Channels are initialized by SystemServer after the NotificationService
has started.

Test: runtest systemui-notification
Change-Id: I25c45293b786adb57787aeab4c2613c9d7c89dab
2017-03-01 10:17:15 -05:00
Todd Kennedy
be0b8896d1 Revert "Revert "Per user setting for instant app""
This reverts commit be9ffa15af9e1906e9ffb505768328d62d4a3793.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ib21321cf157a79890de487060a093840f7182047
2017-02-16 12:43:37 -08:00
Guang Zhu
be9ffa15af Revert "Per user setting for instant app"
Bug: 35390781

This reverts commit 2f5811dcfd840e149851a9333e27ef3cdddf7a46.

Change-Id: Ibb1c8dacbdc6908fc7fa2bc5dca664f2455162bf
2017-02-15 21:43:48 +00:00
Todd Kennedy
2f5811dcfd Per user setting for instant app
The same application can run as either an instant app or an installed
app. Store this setting per-user instead of based upon the install
location.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Iff565bb1ac10d631499f0bd0f69b401cb073c10e
2017-02-14 13:42:01 -08:00
Justin Klaassen
c07ec63c94 Set RetailDemoModeService#mDeviceInDemoMode to false
Reset mDeviceInDemoMode when the device exits demo mode. This isn't a
supported configuration in the production devices, but it's used for CTS
in order to run tests back-to-back without reprovisioning the device.

Fixes: 34938521
Test: RetailDemoModeServiceTest
Change-Id: I5a7134815b2817e7b02b1a2df71932faee967e8d
2017-02-06 08:42:25 -08:00
Justin Klaassen
6594a07c76 Enable SMS in carrier demo mode am: f8a10959d2
am: d9a1ed0cfb

Change-Id: I2ea950f526f3fbf4e4de7deae930de0a87180cc8
2017-02-01 05:26:37 +00:00
Justin Klaassen
f8a10959d2 Enable SMS in carrier demo mode
Fixes: 34861667
Test: manually verified default SMS app works in carrier demo mode.
Change-Id: Ic6f1065954e5bb54c6b78b3d604811333f6863e4
2017-01-31 19:40:40 -08:00
Fyodor Kupolov
6e68706f67 Do not remove file_cache when exiting demo mode
When clearing /data/preloads directory, keep files in file_cache directory.
The content there will only be removed if systems runs low on storage.

Test: manual + RetailDemoModeServiceTest
Bug: 31008665
Change-Id: Id335d84940ee829617986f5345f169271a333de1
2017-01-25 12:33:47 -08:00
Justin Klaassen
f05cf3ee40 Add support for carrier demo mode
Fixes: 33746309
Test: manually verified carrier demo mode and normal demo mode are setup
correctly

Change-Id: Ia38790599f672a9d1999274276156b5328c9f75a
(cherry picked from commit b632c5546968bc20e60e5b86ded4c41612a47c52)
2017-01-24 21:18:07 +00:00
Christine Franks
b189aa6cf8 DO NOT MERGE - Fix demo mode reset notification
Bug: 34358856
Test: manually verified that tapping the Reset notification
triggers a reset after initial provisioning.

Change-Id: I7cf4db729384630a85b22ca9b4947198974a8fbf
2017-01-18 09:43:40 -08:00
Justin Klaassen
b632c55469 Add support for carrier demo mode
Fixes: 33746309
Test: manually verified carrier demo mode and normal demo mode are setup
correctly

Change-Id: Ia38790599f672a9d1999274276156b5328c9f75a
2017-01-13 09:26:58 -08:00
Bartosz Fabianowski
a34f53f61b Add install reason
This CL allows a reason to be specified when installing a package. The
install reason is a sticky piece of metadata: When a package is e.g.
installed via enterprise policy and an update is then manually
installed or sideloaded, the install reason will remain "policy."
The install reason is tracked separately for each user.

With this CL, two install reasons exist: "policy" and "unknown." Other
install reasons will likely be supported in the future.

Bug: 32692748
Bug: 33415829
Test: Tested manually with "adb install" / "adb uninstall"

Change-Id: I0c9b9e1b8eb666bb6962564f6efd97e41703cd86
2017-01-13 16:51:28 +01:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
Sudheer Shanka
28537b6ae9 Don't limit RetailDemoModeService to start only during demo mode.
- Update RetailDemoModeService to not do anything outside demo mode.
- Add am command get-started-user-state which is needed for cts tests.
- Update unit tests for RetailDemoModeService.

Bug: 31342350
Test: adb shell am instrument -e class com.android.server.retaildemo.RetailDemoModeServiceTest -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Idf50512facd27d47d7111e75cbc2f7b260f49740
2016-09-30 10:29:26 -07:00
Suprabh Shukla
cd47cec57d Added test for enabling wifi for demo user
Earlier change to resolve merge conflicts was breaking the current test
because mocked context was used to get wifi manager. Mocking wifi
manager to fix the test and added a check that setWifiEnabled is called
when wifi is not already on.

Test: adb shell am instrument -e class
com.android.server.retaildemo.RetailDemoModeServiceTest -w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Bug: 31833031
Change-Id: Idd123d50df6ee6db51417645fc877abebe555dc0
2016-09-29 19:06:31 -07:00
Suprabh Shukla
d912d9357d resolve merge conflicts of eb0ac0b to master
Change-Id: Icf47e79b8635c17554957678626ceef6539e3ad7
2016-09-26 16:08:29 -07:00
Suprabh Shukla
7f6a7bc75a Enabling wifi on new demo session
A customer may switch off wifi in a retail environment, which will lead
to no internet connectivity in the following sessions, which is not
desirable. Fixing it by enabling wifi at the beginning of every new demo
session.

Bug: 31689469
Change-Id: Ie7eb17bfe8fbee185d5bfe6ac7a590ca5dabdc29
2016-09-23 14:14:41 -07:00
Sudheer Shanka
d9fcb69b81 Add unit tests for RetailDemoModeService.
Bug: 30571518
Change-Id: I33b1ae9f22a609088c0ad0cd247fe91ccc23bdaa
2016-08-18 18:49:29 -07:00
Suprabh Shukla
925a30e82b Changing user inactivity and warning dialog timeouts
am: cafdc2e50d

Change-Id: Iba74fd833ba00cbae39e09cf404f1877efd7a4d8
2016-08-16 00:32:55 +00:00
TreeHugger Robot
f5e51cf7a9 Merge "Changing user inactivity and warning dialog timeouts" into nyc-mr1-dev 2016-08-16 00:21:35 +00:00
Suprabh Shukla
cafdc2e50d Changing user inactivity and warning dialog timeouts
Increasing the inactivity timeout to 90 seconds to accomodate the longest
app. demo video for retail. Also, removing the warning dialog by setting
the countdown timeout to 0, so it can be re-enabled by overriding the value
through gservices if needed.

Bug: 30426773
Bug: 30866394
Change-Id: I6735943adfaf3d210ed9eb9163b5c7ce8dcf53ec
2016-08-15 15:48:48 -07:00
Fyodor Kupolov
4f4780f023 Count failed install as finished
Otherwise DEMO_USER_SETUP_COMPLETE will not be set.

Bug: 30445353
Change-Id: Id2a0c1b1643dd9846328a20f4c67e11e69b3bc84
2016-08-15 15:29:47 -07:00
TreeHugger Robot
a4b89c054c Merge "Correctly handle a case when there are no preloaded apps" into nyc-mr1-dev 2016-08-04 20:53:59 +00:00
Fyodor Kupolov
49726b1115 Use Settings.Global.putInt for PACKAGE_VERIFIER_ENABLE
Bug: 30644237
Change-Id: I891cd3b73e47c851cc512a8e768ebd7061c950d9
2016-08-03 19:05:25 -07:00
Fyodor Kupolov
28ba2898ce Correctly handle a case when there are no preloaded apps
Bug: 30415696
Change-Id: Ia1cff342ff7000da3fba580083116441f478491e
2016-08-03 13:50:37 -07:00
TreeHugger Robot
77faae7282 Merge "Cache package names after reboot" into nyc-mr1-dev 2016-07-29 20:23:44 +00:00
Fyodor Kupolov
773e997432 Cache package names after reboot
In case of a reboot mApkToPackageMap becomes empty, but packages can still
be installed in user 0. We need to repopulate the cache again.

Bug: 30280710
Change-Id: Ia18e93c351b5af80de434e8c5311b961b314a9fb
2016-07-28 19:53:19 -07:00
Suprabh Shukla
323d2bbc34 Ensuring KeyguardService has the correct user when it starts
Because RetailDemoModeService was switching user before KeyguardService
was started, KeyguardViewMediator was missing the call to setCurrentUser
on user switch. Setting the current user from keyguardState in
onServiceConnected, if there was a user switch that happened earlier.
Also changed RetailDemoModeService to switch user after it receives boot
phase BOOT_COMPLETE.

Bug: 30038980
Change-Id: I142570529097199ccc50849297ae67ca49d35534
2016-07-28 16:16:53 -07:00
Fyodor Kupolov
51ce8ee3b1 Set secure setting when all preloaded apps are installed
Bug: 30280710
Change-Id: Id87b51c53b1e553a6ab0a257be93baf7d31b6fe5
2016-07-28 13:22:26 -07:00
Amith Yamasani
8c8d752851 Merge "Allow calling in demo mode" into nyc-mr1-dev 2016-07-21 00:21:13 +00:00
Suprabh Shukla
707a9fc002 Setting a system property when device goes into demo mode
Need a system property so that init can listen to changes to
it and restrict the battery driver from charging the battery beyond
an optimal charge level when the device is in retail demo mode

Bug: 30230924
Change-Id: I277acf27a442ec8f37aac2b01a1a8e0164947a45
2016-07-19 18:30:29 -07:00
Amith Yamasani
bc26f5fb6a Allow calling in demo mode
Allow outgoing calls, but clear the call log when
the next demo session starts so that the next
customer doesn't see any residue.

Fixes: 30220132
Change-Id: Ice71ba750f43fb31bf657d6ae31da62abbd72cfc
2016-07-19 18:20:12 -07:00
TreeHugger Robot
f61eb922f9 Merge "Disallow safe boot when in demo mode" into nyc-mr1-dev 2016-07-13 23:45:39 +00:00
TreeHugger Robot
55c7c9c2d4 Merge "Fix disabling lockscreen for demo users." into nyc-mr1-dev 2016-07-13 22:00:38 +00:00
Fyodor Kupolov
4e416e9f0c Disallow safe boot when in demo mode
Bug: 30038636
Change-Id: I70624bff85f5fb012772422f0fff523dab6e9be1
2016-07-13 14:08:30 -07:00
TreeHugger Robot
0ce03e77bc Merge "Disallowing bluetooth config for demo users" into nyc-mr1-dev 2016-07-13 20:15:31 +00:00
Sudheer Shanka
b6ed667f04 Fix disabling lockscreen for demo users.
LockSettingsService cleans up data for an user on receiving
ACTION_USER_ADDED. As a result, the value set by the
RetailDemoModeService was getting lost.

Bug: 29912660
Change-Id: I2414a5586ab0187bc003cd6ee8b9f1645406235f
2016-07-13 11:58:37 -07:00
Suprabh Shukla
db8c1dbc5e Disallowing bluetooth config for demo users
Bluetooth is currently not multi-user aware, so bluetooth pairings are
carrying across demo users. Have to disable bluetooth config to prevent
security risks in retail environments.

Bug: 30039481
Change-Id: I28ad0d9585a4e6e22af8772132d585c01b33abc9
2016-07-12 15:35:47 -07:00
Fyodor Kupolov
33dc61f50e Cleanup whole preloads directory
When leaving SUW, cleanup preloads directory, not just demo dir.

Bug: 29908713
Change-Id: Id94e6df619f5ca6585b2a0edb0f1028364431f95
2016-07-11 14:40:29 -07:00
TreeHugger Robot
33fa5dfa1d Merge "Making timeouts configurable through Settings" into nyc-mr1-dev 2016-07-08 14:36:34 +00:00
Suprabh Shukla
dbbc7af063 Making timeouts configurable through Settings
Adding a global setting for timeouts used in retail demo mode.
Also renaming the protected intent ACTION_RESET_DEMO to reflect proper
owner package.

Bug: 29917613
Change-Id: I9a174503626ab28cceb5024a8e63d27612439b92
2016-07-07 14:12:14 -07:00
Fyodor Kupolov
56d32190e0 Install preloaded apps into the demo user
Apks preloaded in /data/preloads/apps are now automatically installed when
device is running in demo mode.

Apps are also installed into system user, so that they can be cached for
the next demo user session.

Bug: 29908713
Change-Id: If0fb45bb31c169a1e3020621a173867b8530532d
2016-07-06 18:36:31 -07:00
Amith Yamasani
0f6c2bfe30 Merge "Log as histogram instead of counter" into nyc-mr1-dev 2016-07-06 18:09:55 +00:00
Sudheer Shanka
c46098b243 Grant location permission to camera app.
Change-Id: I9c73a0232e9fdc7043321b35a2721603dced8789
Fixes: 29911953
2016-07-01 18:19:00 -07:00
Amith Yamasani
48e819bfd8 Log as histogram instead of counter
Log the demo session duration as a histogram.

Bug: 29540372
Change-Id: Ie4b1bd5586316213d0ae9167f30d6d551e3e0fe8
2016-06-30 16:42:09 -07:00
Suprabh Shukla
408e0d50bd Disabling account modification on demo users
Added user restriction DISALLOW_MODIFY_ACCOUNTS on demo users

Bug: 29910166
Change-Id: I21c9534a3ae66dc3ab650e2d1a45a65cc8ffbd2a
2016-06-30 16:38:08 -07:00
Suprabh Shukla
0271fd661d Improving the Reset Demo Warning dialog
Removing explicit call to setView which was distorting the layout
of a standard AlertDialog. Used the correct unicode characted for
apostrophe. Also removed calls to enable demo mode launcher for user 0.

Bug: 29520255
Change-Id: Id876f01f8e51c02634c03fce1ea93a15b111fc27
2016-06-28 16:48:34 -07:00