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

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

Merge "Modify AbstractRemoteService#mBindInstantServiceAllowed to...

Merge "Modify AbstractRemoteService#mBindInstantServiceAllowed to #mBindingFlags in order to support multiple binding flags"
parents e4329dc3 322df0bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public class RoleControllerManager {
        RemoteService(@NonNull Context context, @NonNull ComponentName componentName,
                @NonNull Handler handler, @UserIdInt int userId) {
            super(context, RoleControllerService.SERVICE_INTERFACE, componentName, userId,
                    service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, false,
                    service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, 0,
                    false, 1);
        }

+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ public final class PermissionControllerManager {
                @NonNull UserHandle user) {
            super(context, SERVICE_INTERFACE, componentName, user.getIdentifier(),
                    service -> Log.e(TAG, "RemoteService " + service + " died"),
                    context.getMainThreadHandler(), false, false, 1);
                    context.getMainThreadHandler(), 0, false, 1);
        }

        /**
+3 −3
Original line number Diff line number Diff line
@@ -45,9 +45,9 @@ public abstract class AbstractMultiplePendingRequestsRemoteService<S
    public AbstractMultiplePendingRequestsRemoteService(@NonNull Context context,
            @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
            @NonNull VultureCallback<S> callback, @NonNull Handler handler,
            boolean bindInstantServiceAllowed, boolean verbose, int initialCapacity) {
        super(context, serviceInterface, componentName, userId, callback, handler,
                bindInstantServiceAllowed, verbose);
            int bindingFlags, boolean verbose, int initialCapacity) {
        super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags,
                verbose);
        mInitialCapacity = initialCapacity;
    }

+6 −8
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
    private final VultureCallback<S> mVultureCallback;
    private final int mUserId;
    private final ServiceConnection mServiceConnection = new RemoteServiceConnection();
    private final boolean mBindInstantServiceAllowed;
    private final int mBindingFlags;
    protected I mService;

    private boolean mBinding;
@@ -113,7 +113,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
    // NOTE: must be package-protected so this class is not extended outside
    AbstractRemoteService(@NonNull Context context, @NonNull String serviceInterface,
            @NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback,
            @NonNull Handler handler, boolean bindInstantServiceAllowed, boolean verbose) {
            @NonNull Handler handler, int bindingFlags, boolean verbose) {
        mContext = context;
        mVultureCallback = callback;
        mVerbose = verbose;
@@ -121,7 +121,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
        mIntent = new Intent(serviceInterface).setComponent(mComponentName);
        mUserId = userId;
        mHandler = new Handler(handler.getLooper());
        mBindInstantServiceAllowed = bindInstantServiceAllowed;
        mBindingFlags = bindingFlags;
    }

    /**
@@ -264,7 +264,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
            }
        }
        pw.println();
        pw.append(prefix).append("mBindInstantServiceAllowed=").println(mBindInstantServiceAllowed);
        pw.append(prefix).append("mBindingFlags=").println(mBindingFlags);
        pw.append(prefix).append("idleTimeout=")
            .append(Long.toString(idleTimeout / 1000)).append("s\n");
        pw.append(prefix).append("requestTimeout=");
@@ -407,10 +407,8 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
        if (mVerbose) Slog.v(mTag, "ensureBound()");
        mBinding = true;

        int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE;
        if (mBindInstantServiceAllowed) {
            flags |= Context.BIND_ALLOW_INSTANT;
        }
        final int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
                | mBindingFlags;

        final boolean willBind = mContext.bindServiceAsUser(mIntent, mServiceConnection, flags,
                mHandler, new UserHandle(mUserId));
+3 −3
Original line number Diff line number Diff line
@@ -44,9 +44,9 @@ public abstract class AbstractSinglePendingRequestRemoteService<S
    public AbstractSinglePendingRequestRemoteService(@NonNull Context context,
            @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
            @NonNull VultureCallback<S> callback, @NonNull Handler handler,
            boolean bindInstantServiceAllowed, boolean verbose) {
        super(context, serviceInterface, componentName, userId, callback, handler,
                bindInstantServiceAllowed, verbose);
            int bindingFlags, boolean verbose) {
        super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags,
                verbose);
    }

    @Override // from AbstractRemoteService
Loading