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

Commit c2f02181 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix VDM intent interception matching." into main

parents 4ef18e05 e60cdb0d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -64,3 +64,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "virtual_devices"
    name: "intent_interception_action_matching_fix"
    description: "Do not match intents without actions if the filter has actions"
    bug: "343805037"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.companion.virtual.VirtualDeviceParams.POLICY_TYPE_CLIPBOAR
import static android.companion.virtual.VirtualDeviceParams.POLICY_TYPE_RECENTS;
import static android.content.pm.PackageManager.ACTION_REQUEST_PERMISSIONS;
import static android.companion.virtualdevice.flags.Flags.virtualCameraServiceDiscovery;
import static android.companion.virtualdevice.flags.Flags.intentInterceptionActionMatchingFix;

import android.annotation.EnforcePermission;
import android.annotation.NonNull;
@@ -1478,7 +1479,13 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
        synchronized (mVirtualDeviceLock) {
            boolean hasInterceptedIntent = false;
            for (Map.Entry<IBinder, IntentFilter> interceptor : mIntentInterceptors.entrySet()) {
                if (interceptor.getValue().match(
                IntentFilter intentFilter = interceptor.getValue();
                // Explicitly match the actions because the intent filter will match any intent
                // without an explicit action. If the intent has no action, then require that there
                // are no actions specified in the filter either.
                boolean explicitActionMatch = !intentInterceptionActionMatchingFix()
                        || intent.getAction() != null || intentFilter.countActions() == 0;
                if (explicitActionMatch && intentFilter.match(
                        intent.getAction(), intent.getType(), intent.getScheme(), intent.getData(),
                        intent.getCategories(), TAG) >= 0) {
                    try {