From e108ed1b3b56031e3f9142f9da1d2b5012112e18 Mon Sep 17 00:00:00 2001 From: serso Date: Wed, 2 Mar 2016 09:37:05 +0100 Subject: [PATCH] Remove isMonkeyRunnerCheck --- .../main/java/org/solovyev/android/calculator/App.java | 5 ----- .../org/solovyev/android/calculator/BaseActivity.java | 10 ---------- .../android/calculator/CalculatorActivity.java | 6 ------ .../org/solovyev/android/calculator/StartupHelper.java | 5 +---- 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/App.java b/app/src/main/java/org/solovyev/android/calculator/App.java index 0e7f2707..b7a16ca4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/App.java +++ b/app/src/main/java/org/solovyev/android/calculator/App.java @@ -193,11 +193,6 @@ public final class App { return spannable; } - public static boolean isMonkeyRunner(@Nonnull Context context) { - // NOTE: this code is only for monkeyrunner - return context.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) == PackageManager.PERMISSION_GRANTED; - } - @NonNull public static String unspan(@Nonnull CharSequence spannable) { return spannable.toString(); diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java index 2585ad64..c631cb9b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java @@ -130,7 +130,6 @@ public class BaseActivity extends AppCompatActivity { inject(cast(getApplication()).getComponent()); - disableKeyguard(); languages.updateContextLocale(this, false); createView(); @@ -164,15 +163,6 @@ public class BaseActivity extends AppCompatActivity { actionBar.setDisplayHomeAsUpEnabled(true); } - - @SuppressWarnings({"ResourceType", "deprecation"}) - private void disableKeyguard() { - if (App.isMonkeyRunner(this)) { - final KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); - km.newKeyguardLock(getClass().getName()).disableKeyguard(); - } - } - private void onPreCreate() { cast(getApplication()).getComponent().inject(this); diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 3eb8ba6f..ef08817f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -117,12 +117,6 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference preferences.registerOnSharedPreferenceChangeListener(this); preferredPreferences.check(this, false); - - if (App.isMonkeyRunner(this)) { - keyboard.buttonPressed("123"); - keyboard.buttonPressed("+"); - keyboard.buttonPressed("321"); - } } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java b/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java index 6c12e545..9a8d20fa 100644 --- a/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java +++ b/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java @@ -37,10 +37,7 @@ public class StartupHelper { final SharedPreferences.Editor editor = uiPreferences.edit(); final Integer opened = UiPreferences.opened.getPreference(uiPreferences); UiPreferences.opened.putPreference(editor, opened == null ? 1 : opened + 1); - - if (!App.isMonkeyRunner(activity)) { - handleOnMainActivityOpened(activity, editor, opened == null ? 0 : opened); - } + handleOnMainActivityOpened(activity, editor, opened == null ? 0 : opened); UiPreferences.appVersion.putPreference(editor, App.getAppVersionCode(activity)); editor.apply(); }