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

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

Merge "Re-added support for deprecated BIND_AUTOFILL permission."

parents f0ca5890 87b7f8f1
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -25,16 +25,20 @@ import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.metrics.LogMaker;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;

import com.android.internal.R;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;


import java.io.IOException;

/**
@@ -91,11 +95,21 @@ public final class AutofillServiceInfo {
    private static TypedArray getMetaDataArray(PackageManager pm, ServiceInfo si) {
        // Check for permissions.
        if (!Manifest.permission.BIND_AUTOFILL_SERVICE.equals(si.permission)) {
            Log.w(TAG, "AutofillService from '" + si.packageName + "' does not require permission "
            if (Manifest.permission.BIND_AUTOFILL.equals(si.permission)) {
                // Let it go for now...
                Log.w(TAG, "AutofillService from '" + si.packageName + "' uses unsupported "
                        + "permission " + Manifest.permission.BIND_AUTOFILL + ". It works for "
                        + "now, but might not be supported on future releases");
                new MetricsLogger().write(new LogMaker(MetricsEvent.AUTOFILL_INVALID_PERMISSION)
                        .setPackageName(si.packageName));
            } else {
                Log.w(TAG, "AutofillService from '" + si.packageName
                        + "' does not require permission "
                        + Manifest.permission.BIND_AUTOFILL_SERVICE);
                throw new SecurityException("Service does not require permission "
                        + Manifest.permission.BIND_AUTOFILL_SERVICE);
            }
        }

        // Get the AutoFill metadata, if declared.
        XmlResourceParser parser = si.loadXmlMetaData(pm, AutofillService.SERVICE_META_DATA);
+9 −0
Original line number Diff line number Diff line
@@ -2723,6 +2723,15 @@
    <permission android:name="android.permission.BIND_AUTOFILL_SERVICE"
        android:protectionLevel="signature" />

   <!-- Alternative version of android.permission.BIND_AUTOFILL_FIELD_CLASSIFICATION_SERVICE.
        This permission was renamed during the O previews but it was supported on the final O
        release, so we need to carry it over.
        <p>Protection level: signature
        @hide
    -->
    <permission android:name="android.permission.BIND_AUTOFILL"
        android:protectionLevel="signature" />

    <!-- Must be required by an {@link android.service.autofill.AutofillFieldClassificationService}
         to ensure that only the system can bind to it.
         @hide This is not a third-party API (intended for OEMs and system apps).
+5 −0
Original line number Diff line number Diff line
@@ -5168,6 +5168,11 @@ message MetricsEvent {
    // OS: P
    ROTATION_SUGGESTION_SHOWN = 1288;

    // An autofill service was bound using an unofficial(but still supported) permission.
    // Package: Package of the autofill service
    // OS: P
    AUTOFILL_INVALID_PERMISSION = 1289;

    // ---- End P Constants, all P constants go above this line ----
    // Add new aosp constants above this line.
    // END OF AOSP CONSTANTS