├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── AuthenticatorApp ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── refresh.png │ │ │ │ ├── refresh_disabled.png │ │ │ │ ├── refresh_pressed.png │ │ │ │ ├── refresh_button.xml │ │ │ │ ├── btn_dir_next_holo_dark.xml │ │ │ │ └── btn_dir_prev_holo_dark.xml │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_btn_back.png │ │ │ │ ├── ic_btn_next.png │ │ │ │ ├── ic_action_lockpattern_dark.png │ │ │ │ ├── ic_action_lockpattern_light.png │ │ │ │ ├── aosp_dialog_full_holo_dark.9.png │ │ │ │ └── aosp_dialog_full_holo_light.9.png │ │ │ ├── drawable-mdpi-v11 │ │ │ │ ├── refresh.png │ │ │ │ ├── refresh_pressed.png │ │ │ │ ├── aosp_dialog_full_holo_dark.9.png │ │ │ │ ├── ic_action_lockpattern_dark.png │ │ │ │ ├── ic_action_lockpattern_light.png │ │ │ │ └── aosp_dialog_full_holo_light.9.png │ │ │ ├── drawable-mdpi-v14 │ │ │ │ └── refresh.png │ │ │ ├── drawable-ldpi-v11 │ │ │ │ └── ic_stat_notify_bt.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── howitworks_enter_code.png │ │ │ │ ├── howitworks_enter_password.png │ │ │ │ ├── howitworks_verify_device.png │ │ │ │ ├── ic_action_lockpattern_dark.png │ │ │ │ ├── ic_launcher_authenticator.png │ │ │ │ ├── aosp_dialog_full_holo_dark.9.png │ │ │ │ ├── ic_action_lockpattern_light.png │ │ │ │ ├── aosp_dialog_full_holo_light.9.png │ │ │ │ ├── btn_dir_next_normal_holo_dark.9.png │ │ │ │ ├── btn_dir_prev_normal_holo_dark.9.png │ │ │ │ ├── btn_dir_next_disabled_holo_dark.9.png │ │ │ │ ├── btn_dir_next_focused_holo_dark.9.png │ │ │ │ ├── btn_dir_next_pressed_holo_dark.9.png │ │ │ │ ├── btn_dir_prev_disabled_holo_dark.9.png │ │ │ │ ├── btn_dir_prev_focused_holo_dark.9.png │ │ │ │ ├── btn_dir_prev_pressed_holo_dark.9.png │ │ │ │ ├── btn_dir_next_disabled_focused_holo_dark.9.png │ │ │ │ └── btn_dir_prev_disabled_focused_holo_dark.9.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_action_lockpattern_dark.png │ │ │ │ ├── ic_action_lockpattern_light.png │ │ │ │ ├── aosp_dialog_full_holo_dark.9.png │ │ │ │ └── aosp_dialog_full_holo_light.9.png │ │ │ ├── menu │ │ │ │ ├── menu_export.xml │ │ │ │ └── main.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── values │ │ │ │ ├── drawables.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── enroll2sv_strings.xml │ │ │ │ ├── preferences.xml │ │ │ │ ├── attrs.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── layout │ │ │ │ ├── import_dialog.xml │ │ │ │ ├── rename.xml │ │ │ │ ├── remove_account_prompt.xml │ │ │ │ ├── view_group_progress_bar.xml │ │ │ │ ├── timesync_about.xml │ │ │ │ ├── add_other_account.xml │ │ │ │ ├── howitworks_enter_code.xml │ │ │ │ ├── howitworks_verify_device.xml │ │ │ │ ├── howitworks_enter_password.xml │ │ │ │ ├── enter_key.xml │ │ │ │ ├── activity_export.xml │ │ │ │ ├── export_dialog.xml │ │ │ │ ├── activity_lock_pattern.xml │ │ │ │ ├── user_row.xml │ │ │ │ ├── lock_pattern_activity.xml │ │ │ │ ├── check_code.xml │ │ │ │ ├── lock_pattern_activity_land.xml │ │ │ │ └── main.xml │ │ │ ├── values-v11 │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── themes.xml │ │ │ ├── values-land │ │ │ │ └── layouts.xml │ │ │ ├── values-v14 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── xml │ │ │ │ ├── preferences_time_correction.xml │ │ │ │ ├── preferences_about.xml │ │ │ │ └── preferences.xml │ │ │ ├── values-zh-rCN │ │ │ │ └── timesync_strings.xml │ │ │ ├── values-zh-rTW │ │ │ │ └── timesync_strings.xml │ │ │ ├── values-ja │ │ │ │ └── timesync_strings.xml │ │ │ ├── values-ko │ │ │ │ └── timesync_strings.xml │ │ │ ├── values-am │ │ │ │ └── timesync_strings.xml │ │ │ ├── values-iw │ │ │ │ └── timesync_strings.xml │ │ │ └── values-ar │ │ │ │ └── timesync_strings.xml │ │ ├── aidl │ │ │ └── com │ │ │ │ └── google │ │ │ │ └── android │ │ │ │ └── apps │ │ │ │ └── authenticator │ │ │ │ └── dataexport │ │ │ │ └── IExportServiceV2.aidl │ │ └── java │ │ │ ├── com │ │ │ └── google │ │ │ │ └── android │ │ │ │ └── apps │ │ │ │ └── authenticator │ │ │ │ ├── OtpGenerationNotPermittedException.java │ │ │ │ ├── OtpSourceException.java │ │ │ │ ├── dataimport │ │ │ │ └── ImportController.java │ │ │ │ ├── SettingsActivity.java │ │ │ │ ├── timesync │ │ │ │ ├── SettingsTimeCorrectionActivity.java │ │ │ │ ├── AboutActivity.java │ │ │ │ └── NetworkTimeProvider.java │ │ │ │ ├── testability │ │ │ │ ├── StartActivityListener.java │ │ │ │ ├── SharedPreferencesRenamingDelegatingContext.java │ │ │ │ ├── TestableActivity.java │ │ │ │ └── TestablePreferenceActivity.java │ │ │ │ ├── SettingsAboutActivity.java │ │ │ │ ├── RunOnThisLooperThreadExecutor.java │ │ │ │ ├── howitworks │ │ │ │ ├── IntroEnterCodeActivity.java │ │ │ │ ├── IntroEnterPasswordActivity.java │ │ │ │ └── IntroVerifyDeviceActivity.java │ │ │ │ ├── Utilities.java │ │ │ │ ├── AddOtherAccountActivity.java │ │ │ │ ├── UserRowView.java │ │ │ │ ├── OtpSource.java │ │ │ │ ├── AuthenticatorApplication.java │ │ │ │ ├── MarketBuildOptionalFeatures.java │ │ │ │ ├── Preconditions.java │ │ │ │ ├── HexEncoding.java │ │ │ │ ├── OptionalFeatures.java │ │ │ │ └── TotpClock.java │ │ │ └── org │ │ │ └── xdty │ │ │ └── authenticator │ │ │ ├── androidlockpattern │ │ │ ├── util │ │ │ │ ├── InvalidEncrypterException.java │ │ │ │ ├── Sys.java │ │ │ │ ├── IEncrypter.java │ │ │ │ ├── ResourceUtils.java │ │ │ │ └── Randoms.java │ │ │ └── collect │ │ │ │ └── Lists.java │ │ │ ├── security │ │ │ └── LPEncrypter.java │ │ │ └── LockPatternSettingActivity.java │ ├── androidTest │ │ ├── README │ │ └── java │ │ │ └── com │ │ │ └── google │ │ │ └── android │ │ │ └── apps │ │ │ └── authenticator │ │ │ ├── RunImmediatelyOnCallingThreadExecutor.java │ │ │ ├── UtilitiesTest.java │ │ │ ├── PreconditionsTest.java │ │ │ ├── howitworks │ │ │ ├── IntroEnterCodeActivityTest.java │ │ │ ├── IntroEnterPasswordActivityTest.java │ │ │ └── IntroVerifyDeviceActivityTest.java │ │ │ ├── HexEncodingTest.java │ │ │ ├── AddOtherAccountActivityTest.java │ │ │ ├── testability │ │ │ └── HttpClientFactoryTest.java │ │ │ ├── SettingsAboutActivityTest.java │ │ │ └── TotpClockTest.java │ ├── openSourceDev │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ └── openSource │ │ └── res │ │ └── values │ │ └── strings.xml └── build.gradle ├── .gitignore ├── README.md └── gradlew.bat /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':AuthenticatorApp' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable/refresh.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/ic_btn_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/ic_btn_back.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/ic_btn_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/ic_btn_next.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/refresh.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v14/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v14/refresh.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable/refresh_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable/refresh_disabled.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable/refresh_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable/refresh_pressed.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/refresh_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/refresh_pressed.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-ldpi-v11/ic_stat_notify_bt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-ldpi-v11/ic_stat_notify_bt.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_enter_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_enter_code.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/ic_action_lockpattern_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/ic_action_lockpattern_dark.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/ic_action_lockpattern_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/ic_action_lockpattern_light.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_enter_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_enter_password.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_verify_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/howitworks_verify_device.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/ic_action_lockpattern_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/ic_action_lockpattern_dark.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/ic_launcher_authenticator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/ic_launcher_authenticator.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/aosp_dialog_full_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/aosp_dialog_full_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-hdpi/aosp_dialog_full_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-hdpi/aosp_dialog_full_holo_light.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/aosp_dialog_full_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/aosp_dialog_full_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/ic_action_lockpattern_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/ic_action_lockpattern_light.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xxhdpi/ic_action_lockpattern_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xxhdpi/ic_action_lockpattern_dark.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xxhdpi/ic_action_lockpattern_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xxhdpi/ic_action_lockpattern_light.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/aosp_dialog_full_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/aosp_dialog_full_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/ic_action_lockpattern_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/ic_action_lockpattern_dark.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/ic_action_lockpattern_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/ic_action_lockpattern_light.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/aosp_dialog_full_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/aosp_dialog_full_holo_light.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_normal_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_normal_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_normal_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_normal_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xxhdpi/aosp_dialog_full_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xxhdpi/aosp_dialog_full_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xxhdpi/aosp_dialog_full_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xxhdpi/aosp_dialog_full_holo_light.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-mdpi-v11/aosp_dialog_full_holo_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-mdpi-v11/aosp_dialog_full_holo_light.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_disabled_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_disabled_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_focused_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_pressed_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_pressed_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_disabled_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_disabled_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_focused_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_pressed_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_pressed_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_disabled_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_next_disabled_focused_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_disabled_focused_holo_dark.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdtianyu/NeoAuthenticator/master/AuthenticatorApp/src/main/res/drawable-xhdpi/btn_dir_prev_disabled_focused_holo_dark.9.png -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/menu/menu_export.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/androidTest/README: -------------------------------------------------------------------------------- 1 | Some tests require Mockito and DexMaker to compile and run. 2 | The two libraries need to be included into the APK. 3 | 4 | * Mockito: http://code.google.com/p/mockito/ 5 | * DexMaker: http://code.google.com/p/dexmaker/ 6 | 7 | When importing this project into Eclipse, add mockito.jar 8 | ("all" JAR rather than the "core" JAR) and dexmaker.jar 9 | to the "libs" directory of this test project. 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Project Files 30 | *.iml 31 | .idea/ 32 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 7 | 8 | 350dp 9 | 1dp 10 | 11 | 12 | 13 | 3dp 14 | 12dp 15 | 28dp 16 | 17 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/layout/import_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 18 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values-v11/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | #ff5478c2 19 | 20 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values/enroll2sv_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values-land/layouts.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | @layout/lock_pattern_activity_land 21 | 22 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values-v14/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | @android:color/holo_blue_light 19 | 20 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/aidl/com/google/android/apps/authenticator/dataexport/IExportServiceV2.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator.dataexport; 18 | 19 | import android.os.Bundle; 20 | 21 | interface IExportServiceV2 { 22 | Bundle getData(); 23 | void onImportSucceeded(); 24 | } 25 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/openSourceDev/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | com.google.android.apps.authenticator2.osdev 22 | 23 | 24 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/drawable/refresh_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 |  21 | 24 | 26 | 27 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/layout/rename.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/openSource/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | org.xdty.authenticator 22 | com.google.android.apps.authenticator2.os 23 | 24 | 25 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/layout/remove_account_prompt.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 22 | 24 | 25 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/com/google/android/apps/authenticator/OtpGenerationNotPermittedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | /** 20 | * Indicates that {@link OtpSource} failed to generate an OTP because OTP generation is not 21 | * permitted for the specified account. 22 | * 23 | * @author klyubin@google.com (Alex Klyubin) 24 | */ 25 | public class OtpGenerationNotPermittedException extends OtpSourceException { 26 | public OtpGenerationNotPermittedException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | alp.pkey.sys.pattern 4 | alp.pkey.sys.auto_save_pattern 5 | alp.pkey.sys.encrypter_class 6 | alp.pkey.display.stealth_mode 7 | alp.pkey.display.min_wired_dots 8 | alp.pkey.display.max_retries 9 | alp.pkey.display.captcha_wired_dots 10 | 11 | false 12 | false 13 | 14 | 4 15 | 5 16 | 4 17 | 18 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/com/google/android/apps/authenticator/OtpSourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | /** 20 | * Indicates that {@link OtpSource} failed to performed the requested operation. 21 | * 22 | * @author klyubin@google.com (Alex Klyubin) 23 | */ 24 | public class OtpSourceException extends Exception { 25 | public OtpSourceException(String message) { 26 | super(message); 27 | } 28 | 29 | public OtpSourceException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/org/xdty/authenticator/androidlockpattern/util/InvalidEncrypterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Hai Bison 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.xdty.authenticator.androidlockpattern.util; 18 | 19 | /** 20 | * Used to throw exception if given class is not implemented from 21 | * {@link IEncrypter}. 22 | * 23 | * @author Hai Bison 24 | * @since v2 beta 25 | */ 26 | public class InvalidEncrypterException extends RuntimeException { 27 | 28 | /** 29 | * Auto-generated by Eclipse. 30 | */ 31 | private static final long serialVersionUID = -1709666714042537187L; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 26 | 27 | 33 | 34 | 40 | 41 | 47 | 48 | 54 | 55 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/org/xdty/authenticator/androidlockpattern/collect/Lists.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.xdty.authenticator.androidlockpattern.collect; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Collections; 21 | 22 | /** 23 | * Provides static methods for creating {@code List} instances easily, and other 24 | * utility methods for working with lists. 25 | */ 26 | public class Lists { 27 | 28 | /** 29 | * Creates an empty {@code ArrayList} instance. 30 | *

31 | *

32 | * Note: if you only need an immutable empty List, use 33 | * {@link Collections#emptyList} instead. 34 | * 35 | * @return a newly-created, initially-empty {@code ArrayList} 36 | */ 37 | public static ArrayList newArrayList() { 38 | return new ArrayList(); 39 | } 40 | 41 | /** 42 | * Creates a resizable {@code ArrayList} instance containing the given 43 | * elements. 44 | *

45 | *

46 | * Note: due to a bug in javac 1.5.0_06, we cannot support the 47 | * following: 48 | *

49 | *

50 | * {@code List list = Lists.newArrayList(sub1, sub2);} 51 | *

52 | *

53 | * where {@code sub1} and {@code sub2} are references to subtypes of 54 | * {@code Base}, not of {@code Base} itself. To get around this, you must 55 | * use: 56 | *

57 | *

58 | * {@code List list = Lists.newArrayList(sub1, sub2);} 59 | * 60 | * @param elements 61 | * the elements that the list should contain, in order 62 | * @return a newly-created {@code ArrayList} containing those elements 63 | */ 64 | public static ArrayList newArrayList(E... elements) { 65 | int capacity = (elements.length * 110) / 100 + 5; 66 | ArrayList list = new ArrayList(capacity); 67 | Collections.addAll(list, elements); 68 | return list; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/com/google/android/apps/authenticator/OtpSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | import java.util.Collection; 20 | 21 | /** 22 | * Abstraction for collection of OTP tokens. 23 | * 24 | * @author cemp@google.com (Cem Paya) 25 | */ 26 | public interface OtpSource { 27 | 28 | /** 29 | * Enumerate list of accounts that this OTP token supports. 30 | * 31 | * @param result Collection to append usernames. This object is NOT cleared on 32 | * entry; if there are existing items, they will not be removed. 33 | * @return Number of accounts added to the collection. 34 | */ 35 | int enumerateAccounts(Collection result); 36 | 37 | /** 38 | * Return the next OTP code for specified username. 39 | * Invoking this function may change internal state of the OTP generator, 40 | * for example advancing the counter. 41 | * 42 | * @param accountName Username, email address or other unique identifier for the account. 43 | * @return OTP as string code. 44 | */ 45 | String getNextCode(String accountName) throws OtpSourceException; 46 | 47 | /** 48 | * Generate response to a given challenge based on next OTP code. 49 | * Subclasses are not required to implement this method. 50 | * 51 | * @param accountName Username, email address or other unique identifier for the account. 52 | * @param challenge Server specified challenge as UTF8 string. 53 | * @return Response to the challenge. 54 | * @throws UnsupportedOperationException if the token does not support 55 | * challenge-response extension for this account. 56 | */ 57 | String respondToChallenge(String accountName, String challenge) throws OtpSourceException; 58 | 59 | /** 60 | * Gets the counter for generating or verifying TOTP codes. 61 | */ 62 | TotpCounter getTotpCounter(); 63 | 64 | /** 65 | * Gets the clock for generating or verifying TOTP codes. 66 | */ 67 | TotpClock getTotpClock(); 68 | } 69 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/org/xdty/authenticator/androidlockpattern/util/ResourceUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Hai Bison 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.xdty.authenticator.androidlockpattern.util; 18 | 19 | import android.content.Context; 20 | import android.content.res.Resources; 21 | import android.util.TypedValue; 22 | 23 | /** 24 | * Resources' utilities. 25 | * 26 | * @author Hai Bison 27 | */ 28 | public class ResourceUtils { 29 | 30 | /** 31 | * This is singleton class. 32 | */ 33 | private ResourceUtils() { 34 | }// ResourceUtils() 35 | 36 | /** 37 | * Convenient method for {@link Context#getTheme()} and 38 | * {@link Resources.Theme#resolveAttribute(int, TypedValue, boolean)}. 39 | * 40 | * @param context the context. 41 | * @param resId The resource identifier of the desired theme attribute. 42 | * @return the resource ID that {@link TypedValue#resourceId} points to, or 43 | * {@code 0} if not found. 44 | */ 45 | public static int resolveAttribute(Context context, int resId) { 46 | return resolveAttribute(context, resId, 0); 47 | }// resolveAttribute() 48 | 49 | /** 50 | * Convenient method for {@link Context#getTheme()} and 51 | * {@link Resources.Theme#resolveAttribute(int, TypedValue, boolean)}. 52 | * 53 | * @param context the context. 54 | * @param resId The resource identifier of the desired theme attribute. 55 | * @param defaultValue the default value if cannot resolve {@code resId}. 56 | * @return the resource ID that {@link TypedValue#resourceId} points to, or 57 | * {@code defaultValue} if not found. 58 | */ 59 | public static int resolveAttribute(Context context, int resId, 60 | int defaultValue) { 61 | TypedValue typedValue = new TypedValue(); 62 | if (context.getTheme().resolveAttribute(resId, typedValue, true)) 63 | return typedValue.resourceId; 64 | return defaultValue; 65 | }// resolveAttribute() 66 | 67 | } 68 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/com/google/android/apps/authenticator/AuthenticatorApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | import com.google.android.apps.authenticator.testability.DependencyInjector; 20 | 21 | import android.app.Application; 22 | 23 | /** 24 | * Authenticator application which is one of the first things instantiated when our process starts. 25 | * At the moment the only reason for the existence of this class is to initialize 26 | * {@link DependencyInjector} with the application context so that the class can (later) instantiate 27 | * the various objects it owns. 28 | * 29 | * Also restrict UNIX file permissions on application's persistent data directory to owner 30 | * (this app's UID) only. 31 | * 32 | * @author klyubin@google.com (Alex Klyubin) 33 | */ 34 | public class AuthenticatorApplication extends Application { 35 | 36 | @Override 37 | public void onCreate() { 38 | super.onCreate(); 39 | 40 | // Try to restrict data dir file permissions to owner (this app's UID) only. This mitigates the 41 | // security vulnerability where SQLite database transaction journals are world-readable. 42 | // NOTE: This also prevents all files in the data dir from being world-accessible, which is fine 43 | // because this application does not need world-accessible files. 44 | try { 45 | FileUtilities.restrictAccessToOwnerOnly( 46 | getApplicationContext().getApplicationInfo().dataDir); 47 | } catch (Throwable e) { 48 | // Ignore this exception and don't log anything to avoid attracting attention to this fix 49 | } 50 | 51 | // During test runs the injector may have been configured already. Thus we take care to avoid 52 | // overwriting any existing configuration here. 53 | DependencyInjector.configureForProductionIfNotConfigured(getApplicationContext()); 54 | } 55 | 56 | @Override 57 | public void onTerminate() { 58 | DependencyInjector.close(); 59 | 60 | super.onTerminate(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/java/com/google/android/apps/authenticator/MarketBuildOptionalFeatures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | import android.app.Dialog; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.content.SharedPreferences; 23 | import android.net.Uri; 24 | 25 | /** 26 | * {@link OptionalFeatures} implementation used in Market builds. 27 | * 28 | * @author klyubin@google.com (Alex Klyubin) 29 | */ 30 | public class MarketBuildOptionalFeatures implements OptionalFeatures { 31 | 32 | @Override 33 | public void onAuthenticatorActivityCreated(AuthenticatorActivity activity) {} 34 | 35 | @Override 36 | public void onAuthenticatorActivityAccountSaved(Context context, String account) {} 37 | 38 | @Override 39 | public boolean interpretScanResult(Context context, Uri scanResult) { 40 | return false; 41 | } 42 | 43 | @Override 44 | public void onDataImportedFromOldApp(Context context) {} 45 | 46 | @Override 47 | public SharedPreferences getSharedPreferencesForDataImportFromOldApp(Context context) { 48 | return null; 49 | } 50 | 51 | @Override 52 | public String appendDataImportLearnMoreLink(Context context, String text) { 53 | return text; 54 | } 55 | 56 | @Override 57 | public OtpSource createOtpSource(AccountDb accountDb, TotpClock totpClock) { 58 | return new OtpProvider(accountDb, totpClock); 59 | } 60 | 61 | @Override 62 | public void onAuthenticatorActivityGetNextOtpFailed( 63 | AuthenticatorActivity activity, String accountName, OtpSourceException exception) { 64 | throw new RuntimeException("Failed to generate OTP for account", exception); 65 | } 66 | 67 | @Override 68 | public Dialog onAuthenticatorActivityCreateDialog(AuthenticatorActivity activity, int id) { 69 | return null; 70 | } 71 | 72 | @Override 73 | public void onAuthenticatorActivityAddAccount(AuthenticatorActivity activity) { 74 | activity.startActivity(new Intent(activity, AddOtherAccountActivity.class)); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/androidTest/java/com/google/android/apps/authenticator/HexEncodingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | import android.test.MoreAsserts; 20 | 21 | import junit.framework.TestCase; 22 | 23 | /** 24 | * Unit tests for {@link HexEncoding}. 25 | * 26 | * @author klyubin@google.com (Alex Klyubin) 27 | */ 28 | public class HexEncodingTest extends TestCase { 29 | 30 | public void testEncodeNull() { 31 | try { 32 | HexEncoding.encode(null); 33 | fail(); 34 | } catch (NullPointerException expected) {} 35 | } 36 | 37 | public void testEncodeEmpty() { 38 | assertEquals("", HexEncoding.encode(new byte[0])); 39 | } 40 | 41 | public void testEncodeAllDigits() { 42 | assertEquals("0123456789abcdef", HexEncoding.encode( 43 | new byte[] {0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, (byte) 0xcd, (byte) 0xef})); 44 | } 45 | 46 | public void testDecodeNull() { 47 | try { 48 | HexEncoding.decode(null); 49 | fail(); 50 | } catch (NullPointerException expected) {} 51 | } 52 | 53 | public void testDecodeEmpty() { 54 | MoreAsserts.assertEquals(new byte[0], HexEncoding.decode("")); 55 | } 56 | 57 | public void testDecodeAllDigits() { 58 | MoreAsserts.assertEquals( 59 | new byte[] {0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, (byte) 0xcd, (byte) 0xef}, 60 | HexEncoding.decode("0123456789abcdef")); 61 | } 62 | 63 | public void testDecodeOddNumberOfDigits() { 64 | MoreAsserts.assertEquals( 65 | new byte[] {0x0f, 0x23, 0x45}, 66 | HexEncoding.decode("f2345")); 67 | } 68 | 69 | public void testDecodeOneDigit() { 70 | MoreAsserts.assertEquals( 71 | new byte[] {0x03}, 72 | HexEncoding.decode("3")); 73 | } 74 | 75 | public void testDecode_withSpaces() { 76 | try { 77 | HexEncoding.decode("01 23"); 78 | fail(); 79 | } catch (IllegalArgumentException expected) {} 80 | } 81 | 82 | public void testDecode_withUpperCaseDigits() { 83 | MoreAsserts.assertEquals( 84 | new byte[] {(byte) 0xab, (byte) 0xcd, (byte) 0xef}, 85 | HexEncoding.decode("ABCDEF")); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/layout/user_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 23 | 24 | 30 | 31 | 36 | 39 | 40 | 44 | 49 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/androidTest/java/com/google/android/apps/authenticator/AddOtherAccountActivityTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.android.apps.authenticator; 18 | 19 | import com.google.android.apps.authenticator.testability.DependencyInjector; 20 | import com.google.android.apps.authenticator2.R; 21 | 22 | import android.content.ComponentName; 23 | import android.content.Intent; 24 | import android.test.ActivityInstrumentationTestCase2; 25 | 26 | /** 27 | * Unit tests for {@link AddOtherAccountActivity}. 28 | * 29 | * @author klyubin@google.com (Alex Klyubin) 30 | */ 31 | public class AddOtherAccountActivityTest 32 | extends ActivityInstrumentationTestCase2 { 33 | 34 | public AddOtherAccountActivityTest() { 35 | super(TestUtilities.APP_PACKAGE_NAME, AddOtherAccountActivity.class); 36 | } 37 | 38 | @Override 39 | protected void setUp() throws Exception { 40 | super.setUp(); 41 | 42 | DependencyInjector.resetForIntegrationTesting(getInstrumentation().getTargetContext()); 43 | TestUtilities.withLaunchPreventingStartActivityListenerInDependencyResolver(); 44 | } 45 | 46 | @Override 47 | protected void tearDown() throws Exception { 48 | DependencyInjector.close(); 49 | 50 | super.tearDown(); 51 | } 52 | 53 | public void testScanBarcode() throws Exception { 54 | TestUtilities.clickView(getInstrumentation(), getActivity().findViewById(R.id.scan_barcode)); 55 | 56 | Intent actualIntent = TestUtilities.verifyWithTimeoutThatStartActivityAttemptedExactlyOnce(); 57 | Intent expectedIntent = AuthenticatorActivity.getLaunchIntentActionScanBarcode(getActivity()); 58 | assertEquals(expectedIntent.getAction(), actualIntent.getAction()); 59 | assertEquals(expectedIntent.getComponent(), actualIntent.getComponent()); 60 | } 61 | 62 | public void testManuallyAddAccount() throws Exception { 63 | TestUtilities.clickView( 64 | getInstrumentation(), getActivity().findViewById(R.id.manually_add_account)); 65 | 66 | Intent actualIntent = TestUtilities.verifyWithTimeoutThatStartActivityAttemptedExactlyOnce(); 67 | assertEquals( 68 | new ComponentName(getActivity(), EnterKeyActivity.class), 69 | actualIntent.getComponent()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AuthenticatorApp/src/main/res/layout/lock_pattern_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 21 | 22 | 27 | 28 | 29 | 37 | 38 | 39 | 40 | 43 | 44 | 49 | 50 |