Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf14d0e2 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Provide extra seinfo for SandboxedDetectionService"

parents b88a05ad 40345598
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ import android.os.TransactionTooLargeException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.voice.HotwordDetectionService;
import android.service.voice.VisualQueryDetectionService;
import android.stats.devicepolicy.DevicePolicyEnums;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -3808,6 +3810,17 @@ public final class ActiveServices {
                inSharedIsolatedProcess);
    }

    // TODO(b/265746493): Special case for HotwordDetectionService and
    // VisualQueryDetectionService. Need a cleaner way to append this seInfo.
    private String generateAdditionalSeInfoFromService(Intent service) {
        if (service != null && service.getAction() != null
                && (service.getAction().equals(HotwordDetectionService.SERVICE_INTERFACE)
                || service.getAction().equals(VisualQueryDetectionService.SERVICE_INTERFACE))) {
            return ":isolatedComputeApp";
        }
        return "";
    }

    private ServiceLookupResult retrieveServiceLocked(Intent service,
            String instanceName, boolean isSdkSandboxService, int sdkSandboxClientAppUid,
            String sdkSandboxClientAppPackage, String resolvedType,
@@ -3925,6 +3938,7 @@ public final class ActiveServices {
                r.mRecentCallingPackage = callingPackage;
                r.mRecentCallingUid = callingUid;
            }
            r.appInfo.seInfo += generateAdditionalSeInfoFromService(service);
            return new ServiceLookupResult(r, resolution.getAlias());
        }

@@ -4150,6 +4164,7 @@ public final class ActiveServices {
                    return null;
                }
            }
            r.appInfo.seInfo += generateAdditionalSeInfoFromService(service);
            return new ServiceLookupResult(r, resolution.getAlias());
        }
        return null;