Skip to content

Commit

Permalink
[VXP]: add yalp store.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Jun 16, 2018
1 parent 09e6e03 commit 12f5cf7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions VirtualApp/app/src/main/java/io/virtualapp/gms/FakeGms.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,21 @@ private static String installGmsInternal(Activity activity, ProgressDialog dialo
return "Download gms config failed, please check your network, error: 9";
}

String yalpStoreUrl = null;
try {
yalpStoreUrl = jsonObject.getString("yalp");
} catch (JSONException e) {
// ignore.
Log.i(TAG, "Download gms config failed, please check your network");
}

updateMessage(activity, dialog, "config parse success!");

File gmsCoreFile = new File(cacheDir, "gms.apk");
File gmsServiceFile = new File(cacheDir, "gsf.apk");
File storeFile = new File(cacheDir, "store.apk");
File fakeGappsFile = new File(cacheDir, "fakegapps.apk");
File yalpStoreFile = new File(cacheDir, "yalpStore.apk");

// clear old files.
if (gmsCoreFile.exists()) {
Expand Down Expand Up @@ -303,6 +312,11 @@ private static String installGmsInternal(Activity activity, ProgressDialog dialo
return "Download gms config failed, please check your network, error: 13";
}

if (yalpStoreUrl != null) {
downloadFile(yalpStoreUrl,yalpStoreFile,
(progress -> updateMessage(activity, dialog, "download yalp store.." + progress + "%")));
}

updateMessage(activity, dialog, "installing gms core");
InstallResult installResult = VirtualCore.get().installPackage(gmsCoreFile.getAbsolutePath(), InstallStrategy.UPDATE_IF_EXIST);

Expand All @@ -328,6 +342,11 @@ private static String installGmsInternal(Activity activity, ProgressDialog dialo
return "install gms xposed module failed: " + installResult.error;
}

if (yalpStoreFile.exists()) {
updateMessage(activity, dialog, "installing yalp store...");
VirtualCore.get().installPackage(yalpStoreFile.getAbsolutePath(), InstallStrategy.UPDATE_IF_EXIST);
}

// Enable the Xposed module.
File dataDir = VEnvironment.getDataUserPackageDirectory(0, "de.robv.android.xposed.installer");
File modulePath = VEnvironment.getPackageResourcePath(FAKE_GAPPS_PKG);
Expand Down

0 comments on commit 12f5cf7

Please sign in to comment.