Use correct user id for permission check for instant foreground service

Test: cts-tradefed run cts-dev -m CtsAppSecurityHostTestCases
          -t android.appsecurity.cts.EphemeralTest#testStartForegrondService

bug:68275646

Change-Id: I196522c49ae8a7e0ec07bf631f04bae51e96db5b
This commit is contained in:
Svet Ganov
2017-12-06 23:45:38 -08:00
parent 0e8440632a
commit 9e0d3de2ef

View File

@@ -1043,8 +1043,8 @@ public final class ActiveServices {
try {
if (AppGlobals.getPackageManager().checkPermission(
android.Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE,
r.appInfo.packageName,
r.appInfo.uid) != PackageManager.PERMISSION_GRANTED) {
r.appInfo.packageName, UserHandle.getUserId(r.appInfo.uid))
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Instant app " + r.appInfo.packageName
+ " does not have permission to create foreground"
+ "services");