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

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

Merge "Adds android.permission.BIND_CONTENT_SUGGESTIONS_SERVICE."

parents cf9c3ef0 969d39d4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ package android {
    field public static final String BIND_AUGMENTED_AUTOFILL_SERVICE = "android.permission.BIND_AUGMENTED_AUTOFILL_SERVICE";
    field @Deprecated public static final String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE";
    field public static final String BIND_CONTENT_CAPTURE_SERVICE = "android.permission.BIND_CONTENT_CAPTURE_SERVICE";
    field public static final String BIND_CONTENT_SUGGESTIONS_SERVICE = "android.permission.BIND_CONTENT_SUGGESTIONS_SERVICE";
    field public static final String BIND_DIRECTORY_SEARCH = "android.permission.BIND_DIRECTORY_SEARCH";
    field public static final String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
    field public static final String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE";
+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,10 @@ public abstract class ContentSuggestionsService extends Service {

    /**
     * The action for the intent used to define the content suggestions service.
     *
     * <p>To be supported, the service must also require the
     *      * {@link android.Manifest.permission#BIND_CONTENT_SUGGESTIONS_SERVICE} permission so
     *      * that other applications can not abuse it.
     */
    public static final String SERVICE_INTERFACE =
            "android.service.contentsuggestions.ContentSuggestionsService";
+8 −0
Original line number Diff line number Diff line
@@ -3139,6 +3139,14 @@
    <permission android:name="android.permission.BIND_CONTENT_CAPTURE_SERVICE"
                android:protectionLevel="signature" />

    <!-- Must be required by a android.service.contentsuggestions.ContentSuggestionsService,
         to ensure that only the system can bind to it.
         @SystemApi @hide This is not a third-party API (intended for OEMs and system apps).
         <p>Protection level: signature
    -->
    <permission android:name="android.permission.BIND_CONTENT_SUGGESTIONS_SERVICE"
                android:protectionLevel="signature" />

    <!-- Must be required by a android.service.autofill.augmented.AugmentedAutofillService,
         to ensure that only the system can bind to it.
         @SystemApi @hide This is not a third-party API (intended for OEMs and system apps).
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.contentsuggestions;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -73,6 +74,13 @@ public final class ContentSuggestionsPerUserService extends
            throw new PackageManager.NameNotFoundException(
                    "Could not get service for " + serviceComponent);
        }
        if (!Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE.equals(si.permission)) {
            Slog.w(TAG, "ContentSuggestionsService from '" + si.packageName
                    + "' does not require permission "
                    + Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE);
            throw new SecurityException("Service does not require permission "
                    + Manifest.permission.BIND_CONTENT_SUGGESTIONS_SERVICE);
        }
        return si;
    }