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

Commit 27b89e66 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Rename bindService to bindServiceAsUser to follow convention.

This is for the multi-user version of bindService, not the original.

Change-Id: Ib2de35941196accf387b1a276a77e6f9af805ec0
parent 57b59e02
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1411,12 +1411,13 @@ class ContextImpl extends Context {
    public boolean bindService(Intent service, ServiceConnection conn,
            int flags) {
        warnIfCallingFromSystemProcess();
        return bindService(service, conn, flags, UserHandle.getUserId(Process.myUid()));
        return bindServiceAsUser(service, conn, flags, Process.myUserHandle());
    }

    /** @hide */
    @Override
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) {
    public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags,
            UserHandle user) {
        IServiceConnection sd;
        if (conn == null) {
            throw new IllegalArgumentException("connection is null");
@@ -1438,7 +1439,7 @@ class ContextImpl extends Context {
            int res = ActivityManagerNative.getDefault().bindService(
                mMainThread.getApplicationThread(), getActivityToken(),
                service, service.resolveTypeIfNeeded(getContentResolver()),
                sd, flags, userHandle);
                sd, flags, user.getIdentifier());
            if (res < 0) {
                throw new SecurityException(
                        "Not allowed to bind to service " + service);
+1 −1
Original line number Diff line number Diff line
@@ -1677,7 +1677,7 @@ public abstract class Context {
     * argument for use by system server and other multi-user aware code.
     * @hide
     */
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) {
    public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, UserHandle user) {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

+3 −2
Original line number Diff line number Diff line
@@ -475,8 +475,9 @@ public class ContextWrapper extends Context {

    /** @hide */
    @Override
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) {
        return mBase.bindService(service, conn, flags, userHandle);
    public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags,
            UserHandle user) {
        return mBase.bindServiceAsUser(service, conn, flags, user);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -3349,8 +3349,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                @Override
                public void onServiceDisconnected(ComponentName name) {}
            };
            if (mContext.bindService(
                    intent, conn, Context.BIND_AUTO_CREATE, UserHandle.USER_CURRENT)) {
            if (mContext.bindServiceAsUser(
                    intent, conn, Context.BIND_AUTO_CREATE, UserHandle.CURRENT)) {
                mScreenshotConnection = conn;
                mHandler.postDelayed(mScreenshotTimeout, 10000);
            }
+2 −2
Original line number Diff line number Diff line
@@ -128,10 +128,10 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
        if (!mBoundToService) {
            Log.d(TAG, "Binding to Face Unlock service for user="
                    + mLockPatternUtils.getCurrentUser());
            mContext.bindService(new Intent(IFaceLockInterface.class.getName()),
            mContext.bindServiceAsUser(new Intent(IFaceLockInterface.class.getName()),
                    mConnection,
                    Context.BIND_AUTO_CREATE,
                    mLockPatternUtils.getCurrentUser());
                    new UserHandle(mLockPatternUtils.getCurrentUser()));
            mBoundToService = true;
        } else {
            Log.w(TAG, "Attempt to bind to Face Unlock when already bound");
Loading