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

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

Merge "Restrict bindIsolatedService instanceName to just letters, digits, '_', and '.'" into qt-dev

parents 777d6a93 e3a5bc6e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3015,7 +3015,8 @@ public abstract class Context {
     *      specify an explicit component name.
     * @param flags Operation options for the binding as per {@link #bindService}.
     * @param instanceName Unique identifier for the service instance.  Each unique
     *      name here will result in a different service instance being created.
     *      name here will result in a different service instance being created.  Identifiers
     *      must only contain ASCII letters, digits, underscores, and periods.
     * @return Returns success of binding as per {@link #bindService}.
     * @param executor Callbacks on ServiceConnection will be called on executor.
     *      Must use same instance for the same instance of ServiceConnection.
@@ -3023,6 +3024,7 @@ public abstract class Context {
     *      This must be a valid ServiceConnection object; it must not be null.
     *
     * @throws SecurityException If the caller does not have permission to access the service
     * @throws IllegalArgumentException If the instanceName is invalid.
     *
     * @see #bindService
     */
+12 −0
Original line number Diff line number Diff line
@@ -13853,6 +13853,18 @@ public class ActivityManagerService extends IActivityManager.Stub
            throw new IllegalArgumentException("callingPackage cannot be null");
        }
        // Ensure that instanceName, which is caller provided, does not contain
        // unusual characters.
        if (instanceName != null) {
            for (int i = 0; i < instanceName.length(); ++i) {
                char c = instanceName.charAt(i);
                if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
                            || (c >= '0' && c <= '9') || c == '_' || c == '.')) {
                    throw new IllegalArgumentException("Illegal instanceName");
                }
            }
        }
        synchronized(this) {
            return mServices.bindServiceLocked(caller, token, service,
                    resolvedType, connection, flags, instanceName, callingPackage, userId);