Allow package names to be retrieved for HotwordDetectionService

There are some system service we wish to provide to isolated_compute_app
to enable more efficient calculation in the isolated UID context.
HotwordDetectionService is currently one and the only one requiring this
capability. Some AGSA implemetions performs whitelisting on the package name thus we need to get the correct mapping of the uids.

Bug: 274535894
Test: sample app in isolated process can retrieve package name
Change-Id: Ieffa687c5bf6b2c8db5fbcf5761bc20676c7f1cf
This commit is contained in:
Charles Chen
2023-03-22 23:10:21 +00:00
parent 053e5a319c
commit 2066ebde19

View File

@@ -4298,6 +4298,11 @@ public class ComputerEngine implements Computer {
if (Process.isSdkSandboxUid(uid)) {
uid = getBaseSdkSandboxUid();
}
if (Process.isIsolatedUid(uid)
&& mPermissionManager.getHotwordDetectionServiceProvider() != null
&& uid == mPermissionManager.getHotwordDetectionServiceProvider().getUid()) {
uid = getIsolatedOwner(uid);
}
final int callingUserId = UserHandle.getUserId(callingUid);
final int appId = UserHandle.getAppId(uid);
final Object obj = mSettings.getSettingBase(appId);
@@ -4334,6 +4339,11 @@ public class ComputerEngine implements Computer {
if (Process.isSdkSandboxUid(uid)) {
uid = getBaseSdkSandboxUid();
}
if (Process.isIsolatedUid(uid)
&& mPermissionManager.getHotwordDetectionServiceProvider() != null
&& uid == mPermissionManager.getHotwordDetectionServiceProvider().getUid()) {
uid = getIsolatedOwner(uid);
}
final int appId = UserHandle.getAppId(uid);
final Object obj = mSettings.getSettingBase(appId);
if (obj instanceof SharedUserSetting) {