Fix conflict between swap and privileged merges

Also avoid possible NPE in the package name comparison.
This commit is contained in:
Daniel Martí 2015-09-09 21:35:38 -07:00
parent faecbd03a0
commit 5bb5e3a96b
2 changed files with 4 additions and 4 deletions

View File

@ -155,7 +155,7 @@ abstract public class Installer {
} }
// special case: Install F-Droid Privileged // special case: Install F-Droid Privileged
if (packageName.equals(PrivilegedInstaller.PRIVILEGED_PACKAGE_NAME)) { if (packageName != null && packageName.equals(PrivilegedInstaller.PRIVILEGED_PACKAGE_NAME)) {
Activity activity; Activity activity;
try { try {
activity = (Activity) mContext; activity = (Activity) mContext;

View File

@ -791,7 +791,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
public void onProgress(Event event) { public void onProgress(Event event) {
switch (event.type) { switch (event.type) {
case ApkDownloader.EVENT_APK_DOWNLOAD_COMPLETE: case ApkDownloader.EVENT_APK_DOWNLOAD_COMPLETE:
handleDownloadComplete(downloader.localFile()); handleDownloadComplete(downloader.localFile(), app.id);
break; break;
case ApkDownloader.EVENT_ERROR: case ApkDownloader.EVENT_ERROR:
break; break;
@ -801,7 +801,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
downloader.download(); downloader.download();
} }
private void handleDownloadComplete(File apkFile) { private void handleDownloadComplete(File apkFile, String packageName) {
try { try {
Installer.getActivityInstaller(SwapWorkflowActivity.this, new Installer.InstallerCallback() { Installer.getActivityInstaller(SwapWorkflowActivity.this, new Installer.InstallerCallback() {
@ -816,7 +816,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
public void onError(int operation, int errorCode) { public void onError(int operation, int errorCode) {
// TODO: Boo! // TODO: Boo!
} }
}).installPackage(apkFile); }).installPackage(apkFile, packageName);
} catch (Installer.AndroidNotCompatibleException e) { } catch (Installer.AndroidNotCompatibleException e) {
// TODO: Handle exception properly // TODO: Handle exception properly
} }