SmartLock extends Lock implements CredentialStore, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { @Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { switch (requestCode) { case SMART_LOCK_READ: if (resultCode == Activity.RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); onCredentialsRetrieved(activity, credential); } else { startLockFromActivity(activity); } break; case SMART_LOCK_SAVE: final CredentialStoreCallback callback = getCallback(); if (resultCode == Activity.RESULT_OK) { callback.onSuccess(); } else { callback.onError(CredentialStoreCallback.CREDENTIAL_STORE_SAVE_CANCELLED, null); } clearCredentialStoreCallback(); break; } } SmartLock(Context context, APIClient apiClient);   SmartLock(GoogleApiClient credentialClient, APIClient client); void onStart(); void onStop(); @Override void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data); @Override void saveFromActivity(Activity activity, String username, String email, String password, String pictureUrl, CredentialStoreCallback callback); @Override void loginFromActivity(Activity activity); void disableAutoSignIn(); @Override void onConnected(Bundle bundle); @Override void onConnectionSuspended(int i); @Override void onConnectionFailed(ConnectionResult connectionResult); @Override CredentialStore getCredentialStore(); static SmartLock getSmartLock(Activity activity); static final int SMART_LOCK_READ; static final int SMART_LOCK_SAVE; }
@Test public void shouldIgnoreUnknownRequestCodes() throws Exception { smartLock.onActivityResult(activity, -1, -1, null); verifyZeroInteractions(googleApiClient, apiClient, activity, callback); }