diff --git a/.gitignore b/.gitignore
index ccf2efe..80a6566 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,14 @@
*.apk
*.ap_
+# Exclusion to allow committing the game apk
+!∞ Loop_v3_0.apk
+
+# AndroidStudio files
+*.iml
+.idea
+/captures
+
# Files for the Dalvik VM
*.dex
@@ -25,3 +33,6 @@ proguard/
# Log Files
*.log
+
+# Dreaded DS_Store
+.DS_Store
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..7f55b4b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "19.1.0"
+
+ defaultConfig {
+ applicationId "efokschaner.infinityloopsolver"
+ minSdkVersion 23
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.android.support:support-v4:23.1.1'
+ compile 'com.android.support:design:23.1.1'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..91f6bd9
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/efokschaner/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/efokschaner/infinityloopsolver/ApplicationTest.java b/app/src/androidTest/java/efokschaner/infinityloopsolver/ApplicationTest.java
new file mode 100644
index 0000000..a24d864
--- /dev/null
+++ b/app/src/androidTest/java/efokschaner/infinityloopsolver/ApplicationTest.java
@@ -0,0 +1,13 @@
+package efokschaner.infinityloopsolver;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
diff --git a/app/src/androidTest/java/efokschaner/infinityloopsolver/UiAutomationTest.java b/app/src/androidTest/java/efokschaner/infinityloopsolver/UiAutomationTest.java
new file mode 100644
index 0000000..f7ec5e5
--- /dev/null
+++ b/app/src/androidTest/java/efokschaner/infinityloopsolver/UiAutomationTest.java
@@ -0,0 +1,136 @@
+package efokschaner.infinityloopsolver;
+
+
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.Instrumentation;
+import android.app.UiAutomation;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.test.InstrumentationTestCase;
+import android.util.Log;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityWindowInfo;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+
+// Try using Context.startInstrumentation to move this functionality back into app
+// Need to derive from Instrumentation class itself and implement onStart (see InstrumentationTestRunner)
+public class UiAutomationTest extends InstrumentationTestCase {
+ private static final String TAG = UiAutomationTest.class.getSimpleName();
+
+ private static final Runnable NOOP = new Runnable() { public void run() {} };
+
+ private void sendBitmap(Bitmap bitmap) {
+ try {
+ String timestamp = new SimpleDateFormat("HH_mm_ss").format(new Date());
+ URL url = new URL("http://10.0.2.2:8888/" + timestamp + ".png");
+ try {
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ try {
+ conn.setDoOutput(true);
+ conn.setChunkedStreamingMode(0);
+ conn.setRequestMethod("POST");
+ conn.setRequestProperty("Content-Type", "application/octet-stream");
+ try (OutputStream ostream = conn.getOutputStream()) {
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, ostream);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ final int responseCode = conn.getResponseCode();
+ if (!(responseCode >= 200 && responseCode < 300)) {
+ throw new AssertionError(String.format("Http response was: %d", responseCode));
+ }
+ conn.getResponseMessage();
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ while (in.readLine() != null){
+ // ignore contents
+ }
+ in.close();
+ } catch (ProtocolException e) {
+ e.printStackTrace();
+ } finally {
+ conn.disconnect();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static AccessibilityNodeInfo findInfinityLoopView(AccessibilityNodeInfo node) {
+ final String viewIdResourceName = node.getViewIdResourceName();
+ if(viewIdResourceName != null && viewIdResourceName.equals("com.balysv.loop:id/game_scene_view_light")) {
+ return node;
+ }
+ final int numChildren = node.getChildCount();
+ for(int i = 0; i < numChildren; ++i) {
+ AccessibilityNodeInfo childNode;
+ if((childNode = findInfinityLoopView(node.getChild(i))) != null) {
+ return childNode;
+ }
+ }
+ return null;
+ }
+
+ private static boolean isInfinityLoopReady(List windows) {
+ // Determine if InfinityLoop (and only InfinityLoop) is on screen
+ return (windows.size() == 1 &&
+ (findInfinityLoopView(windows.get(0).getRoot())) != null);
+ }
+
+ private static boolean isInfinityLoopReady(UiAutomation uiAutomation, AccessibilityEvent event) {
+ if(event.getEventType() == AccessibilityEvent.TYPE_WINDOWS_CHANGED) {
+ final List windows = uiAutomation.getWindows();
+ return isInfinityLoopReady(windows);
+ } else {
+ return false;
+ }
+ }
+
+ public void test() throws TimeoutException {
+ Log.d(TAG, "test()");
+ final Instrumentation instrumentation = getInstrumentation();
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final AccessibilityServiceInfo serviceInfo = uiAutomation.getServiceInfo();
+ serviceInfo.flags |= AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS;
+ uiAutomation.setServiceInfo(serviceInfo);
+ Log.d(TAG, uiAutomation.getServiceInfo().toString());
+ final Context context = instrumentation.getContext();
+ final PackageManager packageManager = context.getPackageManager();
+ final Intent launchIntent = packageManager.getLaunchIntentForPackage("com.balysv.loop");
+ if(launchIntent != null) {
+ context.startActivity(launchIntent);
+ }
+ if(!isInfinityLoopReady(uiAutomation.getWindows())) {
+ uiAutomation.executeAndWaitForEvent(NOOP, new UiAutomation.AccessibilityEventFilter() {
+ @Override
+ public boolean accept(AccessibilityEvent event) {
+ return isInfinityLoopReady(uiAutomation, event);
+ }
+ }, 10000);
+ }
+ Bitmap b = uiAutomation.takeScreenshot();
+ try{
+ sendBitmap(b);
+ } finally {
+ b.recycle();
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..5752426
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/AccessibilityService.java b/app/src/main/java/efokschaner/infinityloopsolver/AccessibilityService.java
new file mode 100644
index 0000000..2c211fc
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/AccessibilityService.java
@@ -0,0 +1,82 @@
+package efokschaner.infinityloopsolver;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+import android.util.Log;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityWindowInfo;
+
+import java.util.List;
+
+
+public class AccessibilityService extends android.accessibilityservice.AccessibilityService {
+ private static final String TAG = AccessibilityService.class.getSimpleName();
+
+ private AccessibilityNodeInfo mGameView;
+ private SolverService mSolverService;
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mSolverService = ((SolverService.SolverServiceBinder)service).getService();
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mSolverService = null;
+ }
+ };
+
+ @Override
+ protected void onServiceConnected() {
+ Log.d(TAG, "onServiceConnected");
+ super.onServiceConnected();
+ bindService(new Intent(this, SolverService.class), mConnection, Context.BIND_AUTO_CREATE);
+ }
+
+ private AccessibilityNodeInfo findInfinityLoopView(AccessibilityNodeInfo node) {
+ final String viewIdResourceName = node.getViewIdResourceName();
+ if(viewIdResourceName != null && viewIdResourceName.equals("com.balysv.loop:id/game_scene_view_light")) {
+ return node;
+ }
+ final int numChildren = node.getChildCount();
+ for(int i = 0; i < numChildren; ++i) {
+ AccessibilityNodeInfo childNode;
+ if((childNode = findInfinityLoopView(node.getChild(i))) != null) {
+ return childNode;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void onAccessibilityEvent(AccessibilityEvent event) {
+ if(mSolverService == null) {
+ // Ignore all events until we're connected to the solver service
+ return;
+ }
+ if(event.getEventType() == AccessibilityEvent.TYPE_WINDOWS_CHANGED) {
+ final List windows = getWindows();
+ // Determine if InfinityLoop (and only InfinityLoop) is on screen
+ if(windows.size() == 1 && (mGameView = findInfinityLoopView(windows.get(0).getRoot())) != null) {
+ mSolverService.SetInfinityLoopIsFocused(true);
+ } else {
+ mSolverService.SetInfinityLoopIsFocused(false);
+ }
+ }
+ }
+
+ @Override
+ public void onInterrupt() {
+ }
+
+ @Override
+ public boolean onUnbind(Intent i) {
+ Log.d(TAG, "onUnbind");
+ unbindService(mConnection);
+ return false;
+ }
+}
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/AppCompatPreferenceActivity.java b/app/src/main/java/efokschaner/infinityloopsolver/AppCompatPreferenceActivity.java
new file mode 100644
index 0000000..5f5f8e1
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/AppCompatPreferenceActivity.java
@@ -0,0 +1,109 @@
+package efokschaner.infinityloopsolver;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.support.annotation.LayoutRes;
+import android.support.annotation.Nullable;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatDelegate;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
+ * to be used with AppCompat.
+ */
+public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
+
+ private AppCompatDelegate mDelegate;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ getDelegate().installViewFactory();
+ getDelegate().onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ getDelegate().onPostCreate(savedInstanceState);
+ }
+
+ public ActionBar getSupportActionBar() {
+ return getDelegate().getSupportActionBar();
+ }
+
+ public void setSupportActionBar(@Nullable Toolbar toolbar) {
+ getDelegate().setSupportActionBar(toolbar);
+ }
+
+ @Override
+ public MenuInflater getMenuInflater() {
+ return getDelegate().getMenuInflater();
+ }
+
+ @Override
+ public void setContentView(@LayoutRes int layoutResID) {
+ getDelegate().setContentView(layoutResID);
+ }
+
+ @Override
+ public void setContentView(View view) {
+ getDelegate().setContentView(view);
+ }
+
+ @Override
+ public void setContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().setContentView(view, params);
+ }
+
+ @Override
+ public void addContentView(View view, ViewGroup.LayoutParams params) {
+ getDelegate().addContentView(view, params);
+ }
+
+ @Override
+ protected void onPostResume() {
+ super.onPostResume();
+ getDelegate().onPostResume();
+ }
+
+ @Override
+ protected void onTitleChanged(CharSequence title, int color) {
+ super.onTitleChanged(title, color);
+ getDelegate().setTitle(title);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ getDelegate().onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ getDelegate().onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ getDelegate().onDestroy();
+ }
+
+ public void invalidateOptionsMenu() {
+ getDelegate().invalidateOptionsMenu();
+ }
+
+ private AppCompatDelegate getDelegate() {
+ if (mDelegate == null) {
+ mDelegate = AppCompatDelegate.create(this, null);
+ }
+ return mDelegate;
+ }
+}
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/MainActivity.java b/app/src/main/java/efokschaner/infinityloopsolver/MainActivity.java
new file mode 100644
index 0000000..cf15640
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/MainActivity.java
@@ -0,0 +1,26 @@
+package efokschaner.infinityloopsolver;
+
+import android.content.Intent;
+import android.provider.Settings;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ final Button button = (Button) findViewById(R.id.button);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent settingsActivityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+ settingsActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(settingsActivityIntent);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/MediaProjectionRequest.java b/app/src/main/java/efokschaner/infinityloopsolver/MediaProjectionRequest.java
new file mode 100644
index 0000000..097b29c
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/MediaProjectionRequest.java
@@ -0,0 +1,62 @@
+package efokschaner.infinityloopsolver;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.media.projection.MediaProjection;
+import android.media.projection.MediaProjectionManager;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.DisplayMetrics;
+import android.util.Log;
+
+public class MediaProjectionRequest extends Activity {
+ private static final String TAG = MediaProjectionRequest.class.getSimpleName();
+
+ private MediaProjectionManager mMediaProjectionManager;
+ private SolverService mSolverService;
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mSolverService = ((SolverService.SolverServiceBinder)service).getService();
+ startActivityForResult(mMediaProjectionManager.createScreenCaptureIntent(), 0);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mSolverService = null;
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mMediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
+ bindService(new Intent(this, SolverService.class), mConnection, Context.BIND_AUTO_CREATE);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ MediaProjection mp = mMediaProjectionManager.getMediaProjection(resultCode, data);
+ if(mp != null) {
+ Log.d(TAG, "Accepted");
+ DisplayMetrics metrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ mSolverService.SetMediaHandles(new SolverService.MediaHandles(metrics, mp));
+ } else {
+ Log.d(TAG, "Declined");
+ }
+
+ super.onActivityResult(requestCode, resultCode, data);
+ finish();
+ }
+
+ @Override
+ protected void onDestroy() {
+ unbindService(mConnection);
+ super.onDestroy();
+ }
+}
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/SettingsActivity.java b/app/src/main/java/efokschaner/infinityloopsolver/SettingsActivity.java
new file mode 100644
index 0000000..14ce4d2
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/SettingsActivity.java
@@ -0,0 +1,154 @@
+package efokschaner.infinityloopsolver;
+
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.SwitchPreference;
+import android.support.v7.app.ActionBar;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.view.MenuItem;
+
+import java.util.List;
+
+/**
+ * A {@link PreferenceActivity} that presents a set of application settings. On
+ * handset devices, settings are presented as a single list. On tablets,
+ * settings are split by category, with category headers shown to the left of
+ * the list of settings.
+ *
+ * See
+ * Android Design: Settings for design guidelines and the Settings
+ * API Guide for more information on developing a Settings UI.
+ */
+public class SettingsActivity extends AppCompatPreferenceActivity {
+ /**
+ * A preference value change listener that updates the preference's summary
+ * to reflect its new value.
+ */
+ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ String stringValue = value.toString();
+ // For all other preferences, set the summary to the value's
+ // simple string representation.
+ preference.setSummary(stringValue);
+ return true;
+ }
+ };
+
+ /**
+ * Helper method to determine if the device has an extra-large screen. For
+ * example, 10" tablets are extra-large.
+ */
+ private static boolean isXLargeTablet(Context context) {
+ return (context.getResources().getConfiguration().screenLayout
+ & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
+ }
+
+ /**
+ * Binds a preference's summary to its value. More specifically, when the
+ * preference's value is changed, its summary (line of text below the
+ * preference title) is updated to reflect the value. The summary is also
+ * immediately updated upon calling this method. The exact display format is
+ * dependent on the type of preference.
+ *
+ * @see #sBindPreferenceSummaryToValueListener
+ */
+ private static void bindPreferenceSummaryToValue(Preference preference) {
+ // Set the listener to watch for value changes.
+ preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
+
+ // Trigger the listener immediately with the preference's
+ // current value.
+ Object currentValue;
+ SharedPreferences defaultSharedPreferences =
+ PreferenceManager.getDefaultSharedPreferences(preference.getContext());
+ if(preference instanceof SwitchPreference) {
+ currentValue =
+ defaultSharedPreferences.getBoolean(preference.getKey(), false);
+ } else {
+ currentValue =
+ defaultSharedPreferences.getString(preference.getKey(), "");
+ }
+ sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, currentValue);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setupActionBar();
+ }
+
+ /**
+ * Set up the {@link android.app.ActionBar}, if the API is available.
+ */
+ private void setupActionBar() {
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ // Show the Up button in the action bar.
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onIsMultiPane() {
+ return isXLargeTablet(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public void onBuildHeaders(List target) {
+ loadHeadersFromResource(R.xml.pref_headers, target);
+ }
+
+ /**
+ * This method stops fragment injection in malicious applications.
+ * Make sure to deny any unknown fragments here.
+ */
+ protected boolean isValidFragment(String fragmentName) {
+ return PreferenceFragment.class.getName().equals(fragmentName)
+ || GeneralPreferenceFragment.class.getName().equals(fragmentName);
+ }
+
+ /**
+ * This fragment shows general preferences only. It is used when the
+ * activity is showing a two-pane settings UI.
+ */
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public static class GeneralPreferenceFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.pref_general);
+ setHasOptionsMenu(true);
+
+ bindPreferenceSummaryToValue(findPreference("solver_enabled_switch"));
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+ if (id == android.R.id.home) {
+ startActivity(new Intent(getActivity(), SettingsActivity.class));
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+}
diff --git a/app/src/main/java/efokschaner/infinityloopsolver/SolverService.java b/app/src/main/java/efokschaner/infinityloopsolver/SolverService.java
new file mode 100644
index 0000000..0452f75
--- /dev/null
+++ b/app/src/main/java/efokschaner/infinityloopsolver/SolverService.java
@@ -0,0 +1,221 @@
+package efokschaner.infinityloopsolver;
+
+import android.app.Service;
+import android.app.UiAutomation;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.PixelFormat;
+import android.hardware.display.DisplayManager;
+import android.hardware.display.VirtualDisplay;
+import android.media.Image;
+import android.media.ImageReader;
+import android.media.projection.MediaProjection;
+import android.os.Binder;
+import android.os.IBinder;
+import android.util.DisplayMetrics;
+import android.util.Log;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.nio.Buffer;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class SolverService extends Service {
+ private static final String TAG = SolverService.class.getSimpleName();
+
+ public static class MediaHandles {
+ public DisplayMetrics metrics;
+ public MediaProjection mediaProjection;
+
+ public MediaHandles(DisplayMetrics metrics, MediaProjection mediaProjection) {
+ this.metrics = metrics;
+ this.mediaProjection = mediaProjection;
+ }
+ }
+
+ public void SetMediaHandles(MediaHandles mh) {
+ Log.d(TAG, "mMediaHandles set");
+ mMediaHandles = mh;
+ StartOrStopSolver();
+ }
+
+ public void SetInfinityLoopIsFocused(boolean b) {
+ Log.d(TAG, String.format("mInfinityLoopIsFocused set to %s", b));
+ mInfinityLoopIsFocused = b;
+ StartOrStopSolver();
+ }
+
+ private void SetServiceEnabled(boolean b) {
+ Log.d(TAG, String.format("mServiceEnabled set to %s", b));
+ mServiceEnabled = b;
+ StartOrStopSolver();
+ }
+
+ public class SolverServiceBinder extends Binder {
+ SolverService getService() {
+ return SolverService.this;
+ }
+ }
+
+ private final SolverServiceBinder mBinder = new SolverServiceBinder();
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ SetServiceEnabled(true);
+ RequestMediaHandles();
+ return mBinder;
+ }
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ SetServiceEnabled(false);
+ return false;
+ }
+
+ private Thread mSolverThread;
+ private boolean mServiceEnabled = false;
+ private boolean mInfinityLoopIsFocused = false;
+ private MediaHandles mMediaHandles;
+
+ private void StartOrStopSolver() {
+ if(mServiceEnabled && mMediaHandles != null && mInfinityLoopIsFocused) {
+ StartSolver();
+ } else {
+ ShutdownSolver();
+ }
+ }
+
+ private void RequestMediaHandles() {
+ Intent intent = new Intent(this, MediaProjectionRequest.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ startActivity(intent);
+ }
+
+ private void StartSolver() {
+ if(mSolverThread == null) {
+ mSolverThread = new Thread(mRunnableSolver);
+ mSolverThread.start();
+ }
+ }
+
+ private void ShutdownSolver() {
+ Log.d(TAG, "Shutting down");
+ if(mSolverThread != null) {
+ Thread t = mSolverThread;
+ mSolverThread = null;
+ t.interrupt();
+ try {
+ t.join();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ }
+
+ public SolverService() {
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ }
+
+ private static void TryAcquireImage(ImageReader imageReader) {
+ try (Image image = imageReader.acquireLatestImage()) {
+ if(image != null) {
+ try {
+ String timestamp = new SimpleDateFormat("HH_mm_ss").format(new Date());
+ URL url = new URL("http://10.0.2.2:8888/" + timestamp + ".png");
+ try {
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ try {
+ conn.setDoOutput(true);
+ conn.setChunkedStreamingMode(0);
+ conn.setRequestMethod("POST");
+ conn.setRequestProperty("Content-Type", "application/octet-stream");
+ try (OutputStream ostream = conn.getOutputStream()) {
+ final Image.Plane[] planes = image.getPlanes();
+ final Buffer buffer = planes[0].getBuffer();
+ final int pixelStride = planes[0].getPixelStride();
+ final int rowStride = planes[0].getRowStride();
+ Bitmap bitmap = Bitmap.createBitmap(rowStride / pixelStride, image.getHeight(), Bitmap.Config.ARGB_8888);
+ try {
+ bitmap.copyPixelsFromBuffer(buffer);
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, ostream);
+ } finally {
+ bitmap.recycle();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ final int responseCode = conn.getResponseCode();
+ if (!(responseCode >= 200 && responseCode < 300)) {
+ throw new AssertionError(String.format("Http response was: %d", responseCode));
+ }
+ conn.getResponseMessage();
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ while (in.readLine() != null){
+ // ignore contents
+ }
+ in.close();
+ } catch (ProtocolException e) {
+ e.printStackTrace();
+ } finally {
+ conn.disconnect();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private Runnable mRunnableSolver = new Runnable() {
+ @Override
+ public void run() {
+ try (ImageReader imageReader = ImageReader.newInstance(
+ mMediaHandles.metrics.widthPixels,
+ mMediaHandles.metrics.heightPixels,
+ PixelFormat.RGBA_8888,
+ 2)) {
+ VirtualDisplay virtualDisplay = mMediaHandles.mediaProjection.createVirtualDisplay(
+ "ScreenCapture",
+ mMediaHandles.metrics.widthPixels,
+ mMediaHandles.metrics.heightPixels,
+ mMediaHandles.metrics.densityDpi,
+ DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
+ imageReader.getSurface(),
+ null,
+ null);
+ try {
+ while(true) {
+ Log.d(TAG, "Running");
+ TryAcquireImage(imageReader);
+ Thread.sleep(5000);
+ }
+ } finally {
+ virtualDisplay.release();
+ }
+ }
+ catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ };
+}
diff --git a/app/src/main/res/drawable/ic_info_black_24dp.xml b/app/src/main/res/drawable/ic_info_black_24dp.xml
new file mode 100644
index 0000000..34b8202
--- /dev/null
+++ b/app/src/main/res/drawable/ic_info_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
new file mode 100644
index 0000000..e3400cf
--- /dev/null
+++ b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_sync_black_24dp.xml b/app/src/main/res/drawable/ic_sync_black_24dp.xml
new file mode 100644
index 0000000..3f0ac1c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_sync_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..b14c316
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..251fb9f
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,9 @@
+>
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d785d0b
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,17 @@
+
+ Infinity Loop Solver
+ Helps solve InfinityLoop
+
+ Settings
+
+
+
+
+ General
+
+ Enable
+ Automatically plays InfinityLoop when enabled
+ Launching the solver service
+ Accessibility Settings
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..545b9c6
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/xml/accessibility_service_config.xml b/app/src/main/res/xml/accessibility_service_config.xml
new file mode 100644
index 0000000..610225f
--- /dev/null
+++ b/app/src/main/res/xml/accessibility_service_config.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml
new file mode 100644
index 0000000..d75ba6e
--- /dev/null
+++ b/app/src/main/res/xml/pref_general.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/app/src/main/res/xml/pref_headers.xml b/app/src/main/res/xml/pref_headers.xml
new file mode 100644
index 0000000..06d6779
--- /dev/null
+++ b/app/src/main/res/xml/pref_headers.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/app/src/test/java/efokschaner/infinityloopsolver/ExampleUnitTest.java b/app/src/test/java/efokschaner/infinityloopsolver/ExampleUnitTest.java
new file mode 100644
index 0000000..f210064
--- /dev/null
+++ b/app/src/test/java/efokschaner/infinityloopsolver/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package efokschaner.infinityloopsolver;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..e0b366a
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..05ef575
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..f23df6e
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Oct 21 11:34:03 PDT 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git "a/\342\210\236 Loop_v3_0.apk" "b/\342\210\236 Loop_v3_0.apk"
new file mode 100644
index 0000000..9e93728
Binary files /dev/null and "b/\342\210\236 Loop_v3_0.apk" differ