Skip to content

Instantly share code, notes, and snippets.

@knightfall
Created November 12, 2018 10:37
Show Gist options
  • Save knightfall/f75ad2c7831494c7f27b60433e280555 to your computer and use it in GitHub Desktop.
Save knightfall/f75ad2c7831494c7f27b60433e280555 to your computer and use it in GitHub Desktop.
Decompiled Pathao app. Snippet from com.pathao.user.services.SyncDeviceInfoService
protected void onHandleIntent(Intent intent) {
try {
String str = VERSION.RELEASE;
String str2 = BuildConfig.VERSION_NAME;
String string = Secure.getString(getContentResolver(), "android_id");
String str3 = Build.BRAND;
String str4 = Build.MODEL;
Object token = InstanceID.getInstance(this).getToken(getString(C1702R.string.gcm_api_id), "GCM", null);
ArrayList arrayList = (ArrayList) getPackageManager().getInstalledPackages(0);
StringBuilder stringBuilder = new StringBuilder();
StringBuilder stringBuilder2 = new StringBuilder();
int i = 0;
while (i < arrayList.size()) {
PackageInfo packageInfo = (PackageInfo) arrayList.get(i);
if ((packageInfo.applicationInfo.flags & 1) == 0) {
stringBuilder.append(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());
stringBuilder.append(",");
stringBuilder2.append(packageInfo.packageName);
stringBuilder2.append(",");
} else {
arrayList.remove(i);
i--;
}
i++;
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("_method", HttpPatch.METHOD_NAME);
jSONObject.putOpt("app_names", stringBuilder.substring(0, stringBuilder.length() - 1));
jSONObject.putOpt("package_names", stringBuilder2.substring(0, stringBuilder2.length() - 1));
jSONObject.put("os_version", str);
jSONObject.put("app_version", str2);
jSONObject.put("android_id", string);
jSONObject.put("device_brand", str3);
jSONObject.put("device_model", str4);
str = "gcm_token";
if (TextUtils.isEmpty(token)) {
token = "";
}
jSONObject.put(str, token);
jSONObject.put("fcm_token", "");
sendToServer(jSONObject);
} catch (Throwable e) {
PathaoApplication.getInstance().getTracker().trackCrash(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment