[Xposed Framework Modules] NonPokemonGoUsername:
import android.content.SharedPreferences.Editor;
class ChatHeadService
private void moveTo(int direction, boolean fromJoyStick) {
if (fromJoyStick && direction != 0) {
Editor editor = this.pref.edit();
editor.putInt("direction", direction);
editor.commit();
}
if (this.cbCompass.isChecked() && direction != 0) {
direction = (this.directionMask + direction) % 9;
}
float seekValue = this.pref.getFloat("SeekBar", 1.0E-5f);
double longitude;
double latitude;
switch (direction) {
case 1:
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (((double) seekValue) + longitude));
editor.commit();
return;
case 2:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (((double) (seekValue / 2.0f)) + latitude));
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (((double) (seekValue / 2.0f)) + longitude));
editor.commit();
return;
case 3:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (((double) seekValue) + latitude));
editor.commit();
return;
case 4:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (((double) (seekValue / 2.0f)) + latitude));
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (longitude - ((double) (seekValue / 2.0f))));
editor.commit();
return;
case 5:
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (longitude - ((double) seekValue)));
editor.commit();
return;
case 6:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (latitude - ((double) (seekValue / 2.0f))));
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (longitude - ((double) (seekValue / 2.0f))));
editor.commit();
return;
case 7:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (latitude - ((double) seekValue)));
editor.commit();
return;
case 8:
latitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LATITUDE, "0")).doubleValue();
longitude = Double.valueOf(this.pref.getString(DataBaseHelper.COLUMN_LONGITUDE, "0")).doubleValue();
editor = this.pref.edit();
editor.putString(DataBaseHelper.COLUMN_LATITUDE, (latitude - ((double) (seekValue / 2.0f))));
editor.putString(DataBaseHelper.COLUMN_LONGITUDE, (((double) (seekValue / 2.0f)) + longitude));
editor.commit();
return;
default:
return;
}
}

private View bindLayout() {
// Removed unrelated code
this.joystick.setOnJoystickMoveListener(new OnJoystickMoveListener() {
public void onValueChanged(int angle, int power, int direction) {
ChatHeadService.this.moveTo(direction, true);
}
}, 100);
return view;
}

class JoystickView
public void run() {
while (!Thread.interrupted()) {
post(new Runnable() {
public void run() {
if (JoystickView.this.onJoystickMoveListener != null) {
JoystickView.this.onJoystickMoveListener.onValueChanged(JoystickView.this.getAngle(),
JoystickView.this.getPower(),
JoystickView.this.getDirection());
}
}
});
try {
Thread.sleep(this.loopInterval);
} catch (InterruptedException e) {
return;
}
}
}

public void setOnJoystickMoveListener(OnJoystickMoveListener listener, long repeatInterval) {
this.onJoystickMoveListener = listener;
this.loopInterval = repeatInterval;
}

Why does the module save (commit) on every moveTo update? (Saves to /data/data/com.vivek.xposedpokemon/shared_prefs/user_settings.xml)

And on top of that it saves twice per update, one for the direction and the other for the latitude and/or longitude.

This happens every time you move your character with the joystick and for each update that it detects you still wanting to move.

Based on JoystickView Run(), loopInterval = 100 in combination with the Thread.Sleep function, it looks like a moveTo is called every 100ms when the joystick is being used.

If it is true that moveTo is being call every 100ms, then the module is rewriting to your device

20 times a second

. ( 1000ms / 100ms * 2commitsPerUpdate )

Note: This is decompiled code to human readable java. I also checked the smali code too and it confirms that commit is called two times per update.