Commit Graph

12232 Commits

Author SHA1 Message Date
Andrii Kulian
018e216f67 Merge "Add transaction executor" 2017-12-07 20:31:45 +00:00
TreeHugger Robot
b2795710f3 Merge "DevicePolicyManager: Add key generation functionality." 2017-12-07 18:20:45 +00:00
Eran Messeri
852c8f121f DevicePolicyManager: Add key generation functionality.
This is the crux of the Verified Access feature implementation:
Adding the ability to generate KeyChain keys directly by the
secure hardware, rather than installing software-generated keys
into KeyChain.

Add generateKeyPair to the DevicePolicyManager, which delegates key
generation (via the DevicePolicyManagerService) to the KeyChainService.

Design highlights:
* The key generation is delegated via the DevicePolicyManagerService to
  check that only authorized callers request key generation in KeyChain.
* KeyChainService performs the actual key generation so it owns the key
  in Keystore outright.
* DevicePolicyManagerService then grants the calling app access to the
  Keystore key, so it can actually be used.
* Loading the public/private key pair, as well as attestation
  certificate chain, is done in the client code (DevicePolicyManager)
  to save parceling / unparceling those objects across process
  boundaries twice (for no good reason).

NOTE: The key attestation functionality (that includes Device ID) is
missing/untested. Will be added in a follow-up CL as this one is quite
big already.

HIGHLIGHT FOR REVIEWERS:
* API: New API in DevicePolicyManager.

Bug: 63388672
Test: cts-tradefed run commandAndExit cts-dev -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.DeviceOwnerTest#testKeyManagement -l DEBUG; adb shell am instrument 'android.security.tests/android.support.test.runner.AndroidJUnitRunner' (After building the KeystoreTests target and installing the apk)
Change-Id: I73762c9123f32a94d454ba4f8b533883b55c44cc
2017-12-07 15:12:30 +00:00
TreeHugger Robot
dac644cd4a Merge "Deprecate inKeyguardRestrictedInputMode" 2017-12-06 22:27:51 +00:00
TreeHugger Robot
a044c1d27e Merge "Introduce more user management APIs" 2017-12-06 19:10:34 +00:00
Chris Tate
f10f83d507 Merge "Introduce ServiceConnection#onNullBinding()" 2017-12-06 18:47:17 +00:00
TreeHugger Robot
2e24967956 Merge "Add system service for slices" 2017-12-06 15:58:46 +00:00
Alex Chau
af9bb8d99e Introduce more user management APIs
- boolean stopUser(ComponentName admin, UserHandle userHandle)
- boolean logoutUser(ComponentName admin)
- List<UserHandle> getManageableUsers(ComponentName admin)
- Introduced Injector.binderWithCleanCallingIdentity

Bug: 67580550
Test: manually try each added API with a DPC on both primary and non-prijmray user.
Test: CTS tracked in b/67581357
Change-Id: I9789b9b29978d47bc22be6ecad6c5577e0f8eb5b
2017-12-06 14:38:25 +00:00
Andrii Kulian
88e05cb844 Add transaction executor
This adds TransactionExecutor class, that takes care of executing
a multi-stage ActivityManager client transaction in correct order.

First it executes all callbacks, while also making sure to transition
to the right pre- and post-execution state if requested.
In the end it cycles to the final requested lifecycle state.

This also switches activity launch process to use lifecycler - it
initializes activity launch and sets final desired state in the same
transaction.

Bug: 64797980
Test: android.app.servertransaction.TransactionExecutorTests
Change-Id: I306f9396fab263682f580cc8c924a3cedb40ef89
2017-12-05 18:44:50 -08:00
TreeHugger Robot
8cb0cf0aa9 Merge "Allow caller to specify target to start in setQuietModeEnabled" 2017-12-06 01:18:52 +00:00
Alex Chau
1beccb0fc2 Merge "Introduce logout button and DevicePolicyManager API to enable it" 2017-12-05 20:16:24 +00:00
Dianne Hackborn
d5b9266f01 Merge "Add major version code to platform." 2017-12-05 20:12:17 +00:00
Calin Juravle
d3392daa3b Merge "Add SystemApis to expose runtime profile information" 2017-12-05 19:10:34 +00:00
Jason Monk
8f5f7ff5fa Add system service for slices
Will be used to manage permissions and possibly pinned state for slices.

Test: manual
Change-Id: Ie53f4988f817ac5b920087567dbac751e2857dbf
2017-12-05 13:37:37 -05:00
Tony Mak
64fd8c0bdd Allow caller to specify target to start in setQuietModeEnabled
So, UMS can start the target once user is unlocked.

Test: No secure lock. Try turn off and on work mode by tapping work app.
Test: Have secure lock. Try turn off and on work mode by tapping work app.
Test: Turn off work mode. Reboot. Try to tap on any work app to turn on work mode.

BUG:69926710

Change-Id: Iaaccd5d763f7e36e5a43bad5261f1eb16060f9d6
2017-12-05 15:55:19 +00:00
Andreas Gampe
a2d0fc0012 Merge "Frameworks: Silently ignore InterruptedException" am: 7e717e09cd am: a6c6c4f5d3
am: d52c7c9206

Change-Id: Ia6588f13809132b705d372ba132ed3f7ef179bad
2017-12-05 02:57:35 +00:00
Andreas Gampe
d52c7c9206 Merge "Frameworks: Silently ignore InterruptedException" am: 7e717e09cd
am: a6c6c4f5d3

Change-Id: I737474738fa688d5bc651390409cbd792ffa7282
2017-12-05 02:43:53 +00:00
Andreas Gampe
a6c6c4f5d3 Merge "Frameworks: Silently ignore InterruptedException"
am: 7e717e09cd

Change-Id: I75da071918e7fc2e547df4e4d75121806c730ca2
2017-12-05 02:34:41 +00:00
Christopher Tate
5d73b6d7a9 Introduce ServiceConnection#onNullBinding()
Historically, if a service returns null from onBind(), the binding app
gets no information about the outcome:  the ServiceConnection is never
invoked.  We now introduce a new connection callback, onNullBinding(),
for apps that need to detect this situation.  When the service rejects
the binding by returning null, the onNullBinding() callback in the
associated ServiceConnection is invoked instead of onServiceConnected().

onNullBinding() has an empty default implementation, so there is no
binary-compatibility impact of this new interface method.

Bug: 67377345
Test: atest android.app.cts.ServiceTest

Change-Id: I224512c118f7d6e5c1c2bb69eca1902882e73594
2017-12-04 17:11:31 -08:00
Wale Ogunwale
36f46a8731 Merge "Don't send userLeaving hint when entering split-screen mode." 2017-12-05 00:21:20 +00:00
Andreas Gampe
c8d5fc8572 Frameworks: Silently ignore InterruptedException
Apps seem to rely on this undocumented behavior so that the
threaded sync adapter doesn't crash an app. That's really
bad on the app side, but we will have to live with it.

Bug: 67986472
Bug: 70122540
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I1ee4dfba4ad29c4f66fa60d3c8f8a99900b3447a
2017-12-04 15:00:24 -08:00
Calin Juravle
45f8b29ce0 Add SystemApis to expose runtime profile information
The API allows a system apps which acquired
{@code android.permission.READ_RUNTIME_PROFILE} to snapshot the runtime
profiles of installed packages.

The API is implemented in a new service class (AndroidRuntimeManager)
accessible from the context using
context().getPackageManager().getAndroidRuntimeManager().

The main functionality is exposed as a one way call into the
AndroidRuntimeManager with the result being posted on a callback. The
profile is available to the caller as a read-only ParcelFileDescriptor.

This CL only adds the API interfaces and validation. It does not fully
implement the functionality.

oneway void snapshotRuntimeProfile(in String packageName,
  in String codePath, in ISnapshotRuntimeProfileCallback callback)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

Change-Id: Iaa6be4715840f24508acba3162ea9c1ab725bd38
2017-12-04 14:26:46 -08:00
Yueming Wang
edb9535922 Merge "Implement DevicePolicyManager.setSystemSettings." 2017-12-04 21:57:28 +00:00
yuemingw
0de748d833 Implement DevicePolicyManager.setSystemSettings.
b/67627818
Bug: 67627818
Test: runtest -x services/tests/servicestests/src/
com/android/server/devicepolicy/DevicePolicyManagerTest.java

design doc: https://docs.google.com/document/d/
1rvEg5jE3lMhjH-OA0iTLBUY2opM96fg7BrP81MoPnmg/edit#

Change-Id: If5f5c280957085480872f2d59ed59309cf288145
2017-12-04 21:56:46 +00:00
Alex Chau
044588599c Introduce logout button and DevicePolicyManager API to enable it
Bug: 67843538
Test: Manual test with CloudDpc that logout button can be controlled by DevicePolicyManager API and only enabled in shared userse
Test: Logout button can actually exit the user and ActivityManager log shows that user is stopped
Test: CTS is tracked in b/67843605
Change-Id: I9f27050654958ce55f574dd05ff80609255ffeb4
2017-12-04 21:42:44 +00:00
Dianne Hackborn
3accca05dd Add major version code to platform.
It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.

The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets.  This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading.  Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.

Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
2017-12-04 13:02:10 -08:00
Wale Ogunwale
c59b4f6f8d Don't send userLeaving hint when entering split-screen mode.
If the current activity stack we are resuming is in multi-window mode
and the last resumed activity stack should still be visible, then don't
send userLeaving hint as the activity will still be visible to the user
after onPause is called.
Also, added option to say if recents activity should be shown when
split-screen is activated. starting the recents activity during
CTS testing can cause timing issues since the recents activity might
be started after the activity we are trying to launch adjacent to
split-screen.

Change-Id: Iba1d0749062e7365a207ba1172705b5ab70cb869
Fixes: 69419620
Test: ActivityManagerSplitScreenTests.testNoUserLeaveHintOnMultiWindowModeChanged
2017-12-04 09:50:55 -08:00
Chavi Weingarten
29fdbc67fc Merge changes from topic "hw_bitmap"
* changes:
  Update screenshot requests to render proper crop and rotation.
  Revert "Revert "Updated screenshot code to reflect native changes.""
2017-12-04 17:10:30 +00:00
TreeHugger Robot
70de9728d2 Merge changes from topic "priv_vendor_app"
* changes:
  BIND_IMS_SERVICE is exposed to vendors
  Support privileged vendor apps
2017-12-04 03:20:34 +00:00
TreeHugger Robot
f156c04912 Merge "Expose App Standby APIs for apps and system" 2017-12-03 15:09:33 +00:00
Andreas Gampe
01a70b2e22 Merge "Frameworks: Move SharedPreferencesImpl to Future" am: aa3e9d351e am: bd4b1bad48
am: 06bc6945df

Change-Id: I6f646b3e6b9fb9d47b44e3d35321202bbb3c502d
2017-12-03 00:05:04 +00:00
Andreas Gampe
06bc6945df Merge "Frameworks: Move SharedPreferencesImpl to Future" am: aa3e9d351e
am: bd4b1bad48

Change-Id: I43c8231293f5e4349eaab6f4a8242892b3b2c726
2017-12-02 23:54:49 +00:00
Andreas Gampe
bd4b1bad48 Merge "Frameworks: Move SharedPreferencesImpl to Future"
am: aa3e9d351e

Change-Id: I2a47400d1e584aef1a16e05840ab964ca5735110
2017-12-02 23:45:54 +00:00
Amith Yamasani
afbccb7d37 Expose App Standby APIs for apps and system
Allow apps to query their own standby bucket.
Allow privileged apps with PACKAGE_USAGE_STATS permission to
query apps.
Allow privileged apps with CHANGE_APP_IDLE_STATE to set the
standby state for apps, but not for themselves.
Removed AppStandby class and moved constants into UsageStatsManager.

Bug: 63527785
Test: cts-tradefed run cts-dev -m CtsAppUsageHostTestCases
Change-Id: I3c1c20f6ecb6d54e248233696039286b243d663c
2017-12-01 14:00:37 -08:00
Bernardo Rufino
d6ba912bb9 Merge "Binding on-demand #3: updateTransportAttributes() API" 2017-12-01 12:06:23 +00:00
Felipe Leme
3f3fa1b558 Make sure apps cannot forge package name on AssistStructure used for Autofill.
Test: atest CtsAutoFillServiceTestCases:VirtualContainerActivityTest#testAppCannotFakePackageName
Test: atest CtsAutoFillServiceTestCases
Fixes: 69981710

Change-Id: Id6036cddb51dd8dd0c9128b7212d573f630d693f
2017-11-30 17:43:13 -08:00
chaviw
a69e0a7d7c Update screenshot requests to render proper crop and rotation.
The previous screenshot requests in SystemUI would generate a bitmap
and then adjust crop and rotation afterwards. Bitmaps from screenshots
are now hw Bitmaps so they can't be updated in software. Instead request
the proper crop and rotation from the native code to generate a Bitmap
with the correct configurations.

Change-Id: I4591c468b055c784460e5ddf2f9163ffa943c2ee
Fixes: 69898957
Test: Manual screenshots work and bugreport screenshots work in landscape.
2017-11-30 13:02:14 -08:00
TreeHugger Robot
3dd076b065 Merge "Allow secondary user POs on affiliated devices more DPM APIs" 2017-11-30 20:26:49 +00:00
Kweku Adams
598e9a277d incidentd: dumping native process mem info to proto.
Bug: 65750823
Test: flash device and check proto dump output.
Change-Id: Ic584f78153fbbb507cdd41e699a541e3351467bb
2017-11-30 11:48:38 -08:00
Benjamin Franz
dabae88659 Allow secondary user POs on affiliated devices more DPM APIs
- DevicePolicyManager.setKeyguardDisabled
- DevicePolicyManager.setStatusBarDisabled
- DevicePolicyManager.setDeviceOwnerLockScreenInfo
- PackageInstaller install and uninstall apps

Bug: 64383519
Test: Can set keyguard disabled, status bar disabled and lock screen message in
      affliated PO
Test: Can install and uninstall apps in affiliated PO
Test: CTS tracked in b/68925683

Change-Id: I71be25098436ba0b42050478c049850c2b21f6f4
2017-11-30 16:38:19 +00:00
Bernardo Rufino
ab953332bc Binding on-demand #3: updateTransportAttributes() API
This CL introduces the updateTransportAttributes() API to be used by the
transport hosts. It doesn't actually use the description attributes yet,
this will go in another CL. This is because I want to test that CL
together with transport usage. Tests are lacking for TransportManager
and BMS, I'll still add them, but I'm trying to migrate Robolectric
first.

Ref: http://go/br-binding-on-demand
Bug: 17140907
Test: make RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupTestCases
Test: gts-tradefed run commandAndExit gts-dev -m GtsBackupHostTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBackupTestCases
Change-Id: I56f7b5a5026d21d8f11afb371d5560d4913c5f2a
2017-11-30 14:26:13 +00:00
Jiyong Park
002fdbdb95 Support privileged vendor apps
Privileged apps can now be located in the vendor partition. This is
mainly to move SoC-dependent apks to the vendor partition so that the
system partition becomes more generic.

Like existing privileged apps in the system partition, the list of
privileged apps in the vendor partition and the permissions they are
using must be white-listed. The whitelist can be specified via
<privapp-permissions> tags in one of /vendor/etc/permissions/*.xml
files. Note: vendors can only white-list the apps in vendor partition,
but not the apps in system partition.

This change also introduces a new flag 'vendor-privileged' to the
permission protection level. It is used to expose platform-defined
permissions to the privileged vendor apps. If a platform permission does
not have this flag, it is not granted to vendor apps even when the app
is privileged and white-listed.

Bug: 35301609
Test: `mm` under frameworks/base/tests/privapp-permissions
adb sync && adb reboot
adb shell cmd package \
com.android.framework.permission.privapp.tests.vendor
shows that the app is installed.
android.permission.BIND_IMS_SERVICE is in the installed permissions list
android.permission.MANAGE_USE is not in the installed permissions list,
but is in the requested permissions list.

Change-Id: I196375aaaa9ea3a2ba15686ef08cf3f70ade7046
2017-11-30 14:41:55 +09:00
Siarhei Vishniakou
5f13cf0586 Deprecate inKeyguardRestrictedInputMode
The api inKeyguardRestrictedInputMode is no longer needed,
deprecate it. Redirect output to isKeyguardLocked().
Remove inKeyguardRestrictedKeyInputMode.

Test: make, flash, use system ui
Bug: 65998293
Change-Id: Ie2609758fc013aab10530a1be087c983c51d86b0
2017-11-29 15:25:35 -08:00
TreeHugger Robot
aae9f84ce8 Merge "Fix crash in slices" 2017-11-29 21:25:59 +00:00
Andreas Gampe
11b7b645ed Merge "Frameworks: Clean up SharedPreferencesImpl" am: 572f46a3ef am: 70da38960c
am: 9a612c734e

Change-Id: Iaa9ac8d03ac0f235bbff7bf4b17ef7de6b90c24a
2017-11-29 19:50:54 +00:00
Andreas Gampe
9a612c734e Merge "Frameworks: Clean up SharedPreferencesImpl" am: 572f46a3ef
am: 70da38960c

Change-Id: Ia4c24c8cd6fbeb58a90d56319558fc3c78474c2b
2017-11-29 19:38:11 +00:00
Andreas Gampe
70da38960c Merge "Frameworks: Clean up SharedPreferencesImpl"
am: 572f46a3ef

Change-Id: I7b922f795283cefabf661e999e5a9897889fa287
2017-11-29 19:25:13 +00:00
TreeHugger Robot
f86d375437 Merge "Fix user color overlay is not applied" 2017-11-29 11:13:15 +00:00
Andrii Kulian
4d26c21a82 Merge changes from topic "lifecycle_transaction_base"
* changes:
  Add transaction unit tests
  Add basic lifecycle transaction containers
2017-11-28 20:47:34 +00:00
Makoto Onuki
3c1d0caedb Merge "Extreme battery saver: Tweak to file saver" 2017-11-28 20:02:54 +00:00