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
if (packageName.equals(PrivilegedInstaller.PRIVILEGED_PACKAGE_NAME)) {
if (packageName != null && packageName.equals(PrivilegedInstaller.PRIVILEGED_PACKAGE_NAME)) {
Activity activity;
try {
activity = (Activity) mContext;

View File

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