Merge "RESTRICT AUTOMERGE: Set mAllowWhileInUsePermissionInFgs correctly when bindService() from background." into rvc-dev
This commit is contained in:
@@ -1836,11 +1836,13 @@ public final class ActiveServices {
|
|||||||
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "bindService: " + service
|
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "bindService: " + service
|
||||||
+ " type=" + resolvedType + " conn=" + connection.asBinder()
|
+ " type=" + resolvedType + " conn=" + connection.asBinder()
|
||||||
+ " flags=0x" + Integer.toHexString(flags));
|
+ " flags=0x" + Integer.toHexString(flags));
|
||||||
|
final int callingPid = Binder.getCallingPid();
|
||||||
|
final int callingUid = Binder.getCallingUid();
|
||||||
final ProcessRecord callerApp = mAm.getRecordForAppLocked(caller);
|
final ProcessRecord callerApp = mAm.getRecordForAppLocked(caller);
|
||||||
if (callerApp == null) {
|
if (callerApp == null) {
|
||||||
throw new SecurityException(
|
throw new SecurityException(
|
||||||
"Unable to find app for caller " + caller
|
"Unable to find app for caller " + caller
|
||||||
+ " (pid=" + Binder.getCallingPid()
|
+ " (pid=" + callingPid
|
||||||
+ ") when binding service " + service);
|
+ ") when binding service " + service);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1880,19 +1882,19 @@ public final class ActiveServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & Context.BIND_SCHEDULE_LIKE_TOP_APP) != 0 && !isCallerSystem) {
|
if ((flags & Context.BIND_SCHEDULE_LIKE_TOP_APP) != 0 && !isCallerSystem) {
|
||||||
throw new SecurityException("Non-system caller (pid=" + Binder.getCallingPid()
|
throw new SecurityException("Non-system caller (pid=" + callingPid
|
||||||
+ ") set BIND_SCHEDULE_LIKE_TOP_APP when binding service " + service);
|
+ ") set BIND_SCHEDULE_LIKE_TOP_APP when binding service " + service);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & Context.BIND_ALLOW_WHITELIST_MANAGEMENT) != 0 && !isCallerSystem) {
|
if ((flags & Context.BIND_ALLOW_WHITELIST_MANAGEMENT) != 0 && !isCallerSystem) {
|
||||||
throw new SecurityException(
|
throw new SecurityException(
|
||||||
"Non-system caller " + caller + " (pid=" + Binder.getCallingPid()
|
"Non-system caller " + caller + " (pid=" + callingPid
|
||||||
+ ") set BIND_ALLOW_WHITELIST_MANAGEMENT when binding service " + service);
|
+ ") set BIND_ALLOW_WHITELIST_MANAGEMENT when binding service " + service);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & Context.BIND_ALLOW_INSTANT) != 0 && !isCallerSystem) {
|
if ((flags & Context.BIND_ALLOW_INSTANT) != 0 && !isCallerSystem) {
|
||||||
throw new SecurityException(
|
throw new SecurityException(
|
||||||
"Non-system caller " + caller + " (pid=" + Binder.getCallingPid()
|
"Non-system caller " + caller + " (pid=" + callingPid
|
||||||
+ ") set BIND_ALLOW_INSTANT when binding service " + service);
|
+ ") set BIND_ALLOW_INSTANT when binding service " + service);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1908,7 +1910,7 @@ public final class ActiveServices {
|
|||||||
|
|
||||||
ServiceLookupResult res =
|
ServiceLookupResult res =
|
||||||
retrieveServiceLocked(service, instanceName, resolvedType, callingPackage,
|
retrieveServiceLocked(service, instanceName, resolvedType, callingPackage,
|
||||||
Binder.getCallingPid(), Binder.getCallingUid(), userId, true,
|
callingPid, callingUid, userId, true,
|
||||||
callerFg, isBindExternal, allowInstant);
|
callerFg, isBindExternal, allowInstant);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2068,7 +2070,7 @@ public final class ActiveServices {
|
|||||||
if (!s.mAllowWhileInUsePermissionInFgs) {
|
if (!s.mAllowWhileInUsePermissionInFgs) {
|
||||||
s.mAllowWhileInUsePermissionInFgs =
|
s.mAllowWhileInUsePermissionInFgs =
|
||||||
shouldAllowWhileInUsePermissionInFgsLocked(callingPackage,
|
shouldAllowWhileInUsePermissionInFgsLocked(callingPackage,
|
||||||
Binder.getCallingPid(), Binder.getCallingUid(),
|
callingPid, callingUid,
|
||||||
service, s, false);
|
service, s, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user