Java 类android.accounts.IAccountManagerResponse 实例源码

项目:container    文件:VAccountManagerService.java   
@Override
public void onError(int errorCode, String errorMessage) {
    mNumErrors++;
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        Log.v(TAG, getClass().getSimpleName()
                      + " calling onError() on response " + response);
        try {
            response.onError(errorCode, errorMessage);
        } catch (RemoteException e) {
            Log.v(TAG, "Session.onError: caught RemoteException while responding", e);
        }
    } else {
        Log.v(TAG, "Session.onError: already closed");
    }
}
项目:container    文件:VAccountManagerService.java   
Session(IAccountManagerResponse response, int userId, AuthenticatorInfo info, boolean expectActivityLaunch, boolean stripAuthTokenFromResult, String accountName, boolean authDetailsRequired, boolean updateLastAuthenticatedTime) {
    if (info == null) throw new IllegalArgumentException("accountType is null");
    this.mStripAuthTokenFromResult = stripAuthTokenFromResult;
    this.mResponse = response;
    this.mUserId = userId;
    this.mAuthenticatorInfo = info;
    this.mExpectActivityLaunch = expectActivityLaunch;
    this.mCreationTime = SystemClock.elapsedRealtime();
    this.mAccountName = accountName;
    this.mAuthDetailsRequired = authDetailsRequired;
    this.mUpdateLastAuthenticatedTime = updateLastAuthenticatedTime;
    synchronized (mSessions) {
        mSessions.put(toString(), this);
    }
    if (response != null) {
        try {
            response.asBinder().linkToDeath(this, 0 /* flags */);
        } catch (RemoteException e) {
            mResponse = null;
            binderDied();
        }
    }
}
项目:VirtualHook    文件:VAccountManagerService.java   
public void confirmCredentials(int userId, IAccountManagerResponse response, final Account account, final Bundle options, final boolean expectActivityLaunch) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (account == null) throw new IllegalArgumentException("account is null");
    AuthenticatorInfo info = getAuthenticatorInfo(account.type);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, account.name, true, true) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.confirmCredentials(this, account, options);
        }

    }.bind();

}
项目:container    文件:VAccountManagerService.java   
public void confirmCredentials(int userId, IAccountManagerResponse response, final Account account, final Bundle options, final boolean expectActivityLaunch) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (account == null) throw new IllegalArgumentException("account is null");
    AuthenticatorInfo info = getAuthenticatorInfo(account.type);
    if(info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch(RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, account.name, true, true) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.confirmCredentials(this, account, options);
        }

    }.bind();

}
项目:VirtualHook    文件:VAccountManagerService.java   
Session(IAccountManagerResponse response, int userId, AuthenticatorInfo info, boolean expectActivityLaunch, boolean stripAuthTokenFromResult, String accountName, boolean authDetailsRequired, boolean updateLastAuthenticatedTime) {
    if (info == null) throw new IllegalArgumentException("accountType is null");
    this.mStripAuthTokenFromResult = stripAuthTokenFromResult;
    this.mResponse = response;
    this.mUserId = userId;
    this.mAuthenticatorInfo = info;
    this.mExpectActivityLaunch = expectActivityLaunch;
    this.mCreationTime = SystemClock.elapsedRealtime();
    this.mAccountName = accountName;
    this.mAuthDetailsRequired = authDetailsRequired;
    this.mUpdateLastAuthenticatedTime = updateLastAuthenticatedTime;
    synchronized (mSessions) {
        mSessions.put(toString(), this);
    }
    if (response != null) {
        try {
            response.asBinder().linkToDeath(this, 0 /* flags */);
        } catch (RemoteException e) {
            mResponse = null;
            binderDied();
        }
    }
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void onError(int errorCode, String errorMessage) {
    mNumErrors++;
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        Log.v(TAG, getClass().getSimpleName()
                + " calling onError() on response " + response);
        try {
            response.onError(errorCode, errorMessage);
        } catch (RemoteException e) {
            Log.v(TAG, "Session.onError: caught RemoteException while responding", e);
        }
    } else {
        Log.v(TAG, "Session.onError: already closed");
    }
}
项目:container    文件:VAccountManagerService.java   
public void sendResult() {
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        try {
            Account[] accounts = new Account[mAccountsWithFeatures.size()];
            for (int i = 0; i < accounts.length; i++) {
                accounts[i] = mAccountsWithFeatures.get(i);
            }
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response "
                        + response);
            }
            Bundle result = new Bundle();
            result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
            response.onResult(result);
        } catch (RemoteException e) {
            // if the caller is dead then there is no one to care about remote exceptions
            Log.v(TAG, "failure while notifying response", e);
        }
    }
}
项目:TPlayer    文件:VAccountManagerService.java   
public void confirmCredentials(int userId, IAccountManagerResponse response, final Account account, final Bundle options, final boolean expectActivityLaunch) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (account == null) throw new IllegalArgumentException("account is null");
    AuthenticatorInfo info = getAuthenticatorInfo(account.type);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, account.name, true, true) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.confirmCredentials(this, account, options);
        }

    }.bind();

}
项目:TPlayer    文件:VAccountManagerService.java   
Session(IAccountManagerResponse response, int userId, AuthenticatorInfo info, boolean expectActivityLaunch, boolean stripAuthTokenFromResult, String accountName, boolean authDetailsRequired, boolean updateLastAuthenticatedTime) {
    if (info == null) throw new IllegalArgumentException("accountType is null");
    this.mStripAuthTokenFromResult = stripAuthTokenFromResult;
    this.mResponse = response;
    this.mUserId = userId;
    this.mAuthenticatorInfo = info;
    this.mExpectActivityLaunch = expectActivityLaunch;
    this.mCreationTime = SystemClock.elapsedRealtime();
    this.mAccountName = accountName;
    this.mAuthDetailsRequired = authDetailsRequired;
    this.mUpdateLastAuthenticatedTime = updateLastAuthenticatedTime;
    synchronized (mSessions) {
        mSessions.put(toString(), this);
    }
    if (response != null) {
        try {
            response.asBinder().linkToDeath(this, 0 /* flags */);
        } catch (RemoteException e) {
            mResponse = null;
            binderDied();
        }
    }
}
项目:TPlayer    文件:VAccountManagerService.java   
@Override
public void onError(int errorCode, String errorMessage) {
    mNumErrors++;
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        Log.v(TAG, getClass().getSimpleName()
                + " calling onError() on response " + response);
        try {
            response.onError(errorCode, errorMessage);
        } catch (RemoteException e) {
            Log.v(TAG, "Session.onError: caught RemoteException while responding", e);
        }
    } else {
        Log.v(TAG, "Session.onError: already closed");
    }
}
项目:TPlayer    文件:VAccountManagerService.java   
public void sendResult() {
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        try {
            Account[] accounts = new Account[mAccountsWithFeatures.size()];
            for (int i = 0; i < accounts.length; i++) {
                accounts[i] = mAccountsWithFeatures.get(i);
            }
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response "
                        + response);
            }
            Bundle result = new Bundle();
            result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
            response.onResult(result);
        } catch (RemoteException e) {
            // if the caller is dead then there is no one to care about remote exceptions
            Log.v(TAG, "failure while notifying response", e);
        }
    }
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    String[] features = (String[]) args[2];
    Mgr.hasFeatures(response, account, features);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    String accountType = (String) args[1];
    String[] features = (String[]) args[2];
    Mgr.getAccountsByFeatures(response, accountType, features);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    boolean expectActivityLaunch = (boolean) args[2];
    Mgr.removeAccount(response, account, expectActivityLaunch);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    boolean expectActivityLaunch = (boolean) args[2];
    Mgr.removeAccount(response, account, expectActivityLaunch);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    int userFrom = (int) args[2];
    int userTo = (int) args[3];
    method.invoke(who, args);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    String authTokenType = (String) args[2];
    boolean notifyOnAuthFailure = (boolean) args[3];
    boolean expectActivityLaunch = (boolean) args[4];
    Bundle options = (Bundle) args[5];
    Mgr.getAuthToken(response, account, authTokenType, notifyOnAuthFailure, expectActivityLaunch, options);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    String accountType = (String) args[1];
    String authTokenType = (String) args[2];
    String[] requiredFeatures = (String[]) args[3];
    boolean expectActivityLaunch = (boolean) args[4];
    Bundle options = (Bundle) args[5];
    Mgr.addAccount(response, accountType, authTokenType, requiredFeatures, expectActivityLaunch, options);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    String authTokenType = (String) args[2];
    boolean expectActivityLaunch = (boolean) args[3];
    Bundle options = (Bundle) args[4];
    Mgr.updateCredentials(response, account, authTokenType, expectActivityLaunch, options);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    Bundle options = (Bundle) args[2];
    boolean expectActivityLaunch = (boolean) args[3];
    Mgr.confirmCredentials(response, account, options, expectActivityLaunch);
    return 0;

}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    String accountType = (String) args[1];
    String authTokenType = (String) args[2];
    Mgr.getAuthTokenLabel(response, accountType, authTokenType);
    return 0;
}
项目:VirtualHook    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account accountToRename = (Account) args[1];
    String newName = (String) args[2];
    Mgr.renameAccount(response, accountToRename, newName);
    return 0;
}
项目:VirtualHook    文件:VAccountManager.java   
public void removeAccount(IAccountManagerResponse response, Account account, boolean expectActivityLaunch) {
    try {
        getRemote().removeAccount(VUserHandle.myUserId(), response, account, expectActivityLaunch);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void getAuthToken(IAccountManagerResponse response, Account account, String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, Bundle loginOptions) {
    try {
        getRemote().getAuthToken(VUserHandle.myUserId(), response, account, authTokenType, notifyOnAuthFailure, expectActivityLaunch, loginOptions);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void hasFeatures(IAccountManagerResponse response, Account account, String[] features) {
    try {
        getRemote().hasFeatures(VUserHandle.myUserId(), response, account, features);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void addAccount(IAccountManagerResponse response, String accountType, String authTokenType, String[] requiredFeatures, boolean expectActivityLaunch, Bundle optionsIn) {
    try {
        getRemote().addAccount(VUserHandle.myUserId(), response, accountType, authTokenType, requiredFeatures, expectActivityLaunch, optionsIn);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void updateCredentials(IAccountManagerResponse response, Account account, String authTokenType, boolean expectActivityLaunch, Bundle loginOptions) {
    try {
        getRemote().updateCredentials(VUserHandle.myUserId(), response, account, authTokenType, expectActivityLaunch, loginOptions);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void editProperties(IAccountManagerResponse response, String accountType, boolean expectActivityLaunch) {
    try {
        getRemote().editProperties(VUserHandle.myUserId(), response, accountType, expectActivityLaunch);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void getAuthTokenLabel(IAccountManagerResponse response, String accountType, String authTokenType) {
    try {
        getRemote().getAuthTokenLabel(VUserHandle.myUserId(), response, accountType, authTokenType);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void confirmCredentials(IAccountManagerResponse response, Account account, Bundle options, boolean expectActivityLaunch) {
    try {
        getRemote().confirmCredentials(VUserHandle.myUserId(), response, account, options, expectActivityLaunch);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManager.java   
public void getAccountsByFeatures(IAccountManagerResponse response, String type, String[] features) {
    try {
        getRemote().getAccountsByFeatures(VUserHandle.myUserId(), response, type, features);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void updateCredentials(int userId, final IAccountManagerResponse response, final Account account,
                              final String authTokenType, final boolean expectActivityLaunch,
                              final Bundle loginOptions) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (account == null) throw new IllegalArgumentException("account is null");
    if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
    AuthenticatorInfo info = this.getAuthenticatorInfo(account.type);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, false, account.name) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
        }

        @Override
        protected String toDebugString(long now) {
            if (loginOptions != null) loginOptions.keySet();
            return super.toDebugString(now) + ", updateCredentials"
                    + ", " + account
                    + ", authTokenType " + authTokenType
                    + ", loginOptions " + loginOptions;
        }

    }.bind();
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void editProperties(int userId, IAccountManagerResponse response, final String accountType,
                           final boolean expectActivityLaunch) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (accountType == null) throw new IllegalArgumentException("accountType is null");
    AuthenticatorInfo info = this.getAuthenticatorInfo(accountType);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, null) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.editProperties(this, mAuthenticatorInfo.desc.type);
        }

        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", editProperties"
                    + ", accountType " + accountType;
        }

    }.bind();

}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void getAuthTokenLabel(int userId, IAccountManagerResponse response, final String accountType,
                              final String authTokenType) {
    if (accountType == null) throw new IllegalArgumentException("accountType is null");
    if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
    AuthenticatorInfo info = getAuthenticatorInfo(accountType);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, false, false, null) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.getAuthTokenLabel(this, authTokenType);
        }

        @Override
        public void onResult(Bundle result) throws RemoteException {
            if (result != null) {
                String label = result.getString(AccountManager.KEY_AUTH_TOKEN_LABEL);
                Bundle bundle = new Bundle();
                bundle.putString(AccountManager.KEY_AUTH_TOKEN_LABEL, label);
                super.onResult(bundle);
            } else {
                super.onResult(null);
            }
        }
    }.bind();
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void addAccount(int userId, final IAccountManagerResponse response, final String accountType,
                       final String authTokenType, final String[] requiredFeatures,
                       final boolean expectActivityLaunch, final Bundle optionsIn) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (accountType == null) throw new IllegalArgumentException("accountType is null");
    AuthenticatorInfo info = getAuthenticatorInfo(accountType);
    if (info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, null, false, true) {

        @Override
        public void run() throws RemoteException {
            mAuthenticator.addAccount(this, mAuthenticatorInfo.desc.type, authTokenType, requiredFeatures,
                    optionsIn);
        }

        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", addAccount"
                    + ", accountType " + accountType
                    + ", requiredFeatures "
                    + (requiredFeatures != null
                    ? TextUtils.join(",", requiredFeatures)
                    : null);
        }

    }.bind();

}
项目:VirtualHook    文件:VAccountManagerService.java   
private void onResult(IAccountManagerResponse response, Bundle result) {
    try {
        response.onResult(result);
    } catch (RemoteException e) {
        // if the caller is dead then there is no one to care about remote
        // exceptions
        e.printStackTrace();
    }
}
项目:container    文件:VAccountManagerService.java   
@Override
public void addAccount(int userId, final IAccountManagerResponse response, final String accountType,
                       final String authTokenType, final String[] requiredFeatures,
                       final boolean expectActivityLaunch, final Bundle optionsIn) {
    if (response == null) throw new IllegalArgumentException("response is null");
    if (accountType == null) throw new IllegalArgumentException("accountType is null");
    AuthenticatorInfo info = getAuthenticatorInfo(accountType);
    if(info == null) {
        try {
            response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
        } catch(RemoteException e) {
            e.printStackTrace();
        }
        return;
    }
    new Session(response, userId, info, expectActivityLaunch, true, null, false, true){

        @Override
        public void run() throws RemoteException {
            mAuthenticator.addAccount(this, mAuthenticatorInfo.desc.type, authTokenType, requiredFeatures,
                    optionsIn);
        }

        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", addAccount"
                    + ", accountType " + accountType
                    + ", requiredFeatures "
                    + (requiredFeatures != null
                    ? TextUtils.join(",", requiredFeatures)
                    : null);
        }

    }.bind();

}
项目:VirtualHook    文件:VAccountManagerService.java   
IAccountManagerResponse getResponseAndClose() {
    if (mResponse == null) {
        // this session has already been closed
        return null;
    }
    IAccountManagerResponse response = mResponse;
    close(); // this clears mResponse so we need to save the response before this call
    return response;
}
项目:VirtualHook    文件:VAccountManagerService.java   
@Override
public void onServiceDisconnected(ComponentName name) {
    mAuthenticator = null;
    IAccountManagerResponse response = getResponseAndClose();
    if (response != null) {
        try {
            response.onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
                    "disconnected");
        } catch (RemoteException e) {
            Log.v(TAG, "Session.onServiceDisconnected: "
                    + "caught RemoteException while responding", e);
        }
    }
}
项目:TPlayer    文件:AccountManagerStub.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IAccountManagerResponse response = (IAccountManagerResponse) args[0];
    Account account = (Account) args[1];
    String[] features = (String[]) args[2];
    Mgr.hasFeatures(response, account, features);
    return 0;
}