Reset identity context in STService
Middleware service uses binder identity to validate permissions. For now, clear the binder identity before calling downwards. In the future, remove this behavior in middleware service. Test: AGSA starts recognition successfully Bug: 269765333 Change-Id: Ie33ffbbb6d2aa84d3da9ec6f5f8af0ab3a12af75
This commit is contained in:
@@ -1647,13 +1647,16 @@ public class SoundTriggerService extends SystemService {
|
||||
|
||||
@Override
|
||||
public List<ModuleProperties> listModuleProperties(Identity originatorIdentity) {
|
||||
Identity identity = new Identity();
|
||||
identity.packageName = ActivityThread.currentOpPackageName();
|
||||
ArrayList<ModuleProperties> moduleList = new ArrayList<>();
|
||||
// Overwrite with our own identity to fix permission issues.
|
||||
// VIMService always does its own validation, so this is fine.
|
||||
// TODO(b/269765333)
|
||||
SoundTrigger.listModulesAsOriginator(moduleList, identity);
|
||||
try (SafeCloseable ignored = PermissionUtil.establishIdentityDirect(
|
||||
originatorIdentity)) {
|
||||
Identity middlemanIdentity = new Identity();
|
||||
middlemanIdentity.uid = Binder.getCallingUid();
|
||||
middlemanIdentity.pid = Binder.getCallingPid();
|
||||
middlemanIdentity.packageName = ActivityThread.currentOpPackageName();
|
||||
SoundTrigger.listModulesAsMiddleman(moduleList, middlemanIdentity,
|
||||
originatorIdentity);
|
||||
}
|
||||
return moduleList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user