Remove isMonkeyRunnerCheck

This commit is contained in:
serso 2016-03-02 09:37:05 +01:00
parent 3cac3b4cb3
commit e108ed1b3b
4 changed files with 1 additions and 25 deletions

View File

@ -193,11 +193,6 @@ public final class App {
return spannable; 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 @NonNull
public static String unspan(@Nonnull CharSequence spannable) { public static String unspan(@Nonnull CharSequence spannable) {
return spannable.toString(); return spannable.toString();

View File

@ -130,7 +130,6 @@ public class BaseActivity extends AppCompatActivity {
inject(cast(getApplication()).getComponent()); inject(cast(getApplication()).getComponent());
disableKeyguard();
languages.updateContextLocale(this, false); languages.updateContextLocale(this, false);
createView(); createView();
@ -164,15 +163,6 @@ public class BaseActivity extends AppCompatActivity {
actionBar.setDisplayHomeAsUpEnabled(true); 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() { private void onPreCreate() {
cast(getApplication()).getComponent().inject(this); cast(getApplication()).getComponent().inject(this);

View File

@ -117,12 +117,6 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
preferences.registerOnSharedPreferenceChangeListener(this); preferences.registerOnSharedPreferenceChangeListener(this);
preferredPreferences.check(this, false); preferredPreferences.check(this, false);
if (App.isMonkeyRunner(this)) {
keyboard.buttonPressed("123");
keyboard.buttonPressed("+");
keyboard.buttonPressed("321");
}
} }
@Override @Override

View File

@ -37,10 +37,7 @@ public class StartupHelper {
final SharedPreferences.Editor editor = uiPreferences.edit(); final SharedPreferences.Editor editor = uiPreferences.edit();
final Integer opened = UiPreferences.opened.getPreference(uiPreferences); final Integer opened = UiPreferences.opened.getPreference(uiPreferences);
UiPreferences.opened.putPreference(editor, opened == null ? 1 : opened + 1); 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)); UiPreferences.appVersion.putPreference(editor, App.getAppVersionCode(activity));
editor.apply(); editor.apply();
} }