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

Commit 9860e4e2 authored by Lynn Yeh's avatar Lynn Yeh Committed by Android (Google) Code Review
Browse files

Merge "Revert "[Autofill Framework] Add in intent filter check after au..."" into 24D1-dev

parents 99db69ac 2060ac6b
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -33,10 +33,8 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManagerInternal;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.graphics.Rect;
import android.metrics.LogMaker;
@@ -253,26 +251,6 @@ final class AutofillManagerServiceImpl
    @Override // from PerUserSystemService
    protected ServiceInfo newServiceInfoLocked(@NonNull ComponentName serviceComponent)
            throws NameNotFoundException {
        final List<ResolveInfo> resolveInfos =
                getContext().getPackageManager().queryIntentServicesAsUser(
                        new Intent(AutofillService.SERVICE_INTERFACE),
                        PackageManager.GET_META_DATA,
                        mUserId);
        boolean currentPackageStillHasAutofillIntentFilter = false;
        for (ResolveInfo resolveInfo : resolveInfos) {
            final ServiceInfo serviceInfo = resolveInfo.serviceInfo;
            if (serviceInfo.getComponentName().equals(serviceComponent)) {
                currentPackageStillHasAutofillIntentFilter = true;
                break;
            }
        }
        if (!currentPackageStillHasAutofillIntentFilter) {
            Slog.w(TAG,
                    "Autofill service from '" + serviceComponent.getPackageName() + "' does"
                            + "not have intent filter " + AutofillService.SERVICE_INTERFACE);
            throw new SecurityException("Service does not declare intent filter "
                            + AutofillService.SERVICE_INTERFACE);
        }
        mInfo = new AutofillServiceInfo(getContext(), serviceComponent, mUserId);
        return mInfo.getServiceInfo();
    }