Resolve bad interaction with app verify
This commit is contained in:
parent
2834a8966e
commit
56295726bd
@ -25,7 +25,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import org.fdroid.fdroid.compat.MenuManager;
|
||||
import org.fdroid.fdroid.DB.CommaSeparatedList;
|
||||
@ -207,7 +206,6 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
}
|
||||
|
||||
private boolean pref_cacheDownloaded;
|
||||
private boolean pref_expert;
|
||||
private boolean pref_permissions;
|
||||
private boolean resetRequired;
|
||||
@ -223,7 +221,6 @@ public class AppDetails extends ListActivity {
|
||||
// Get the preferences we're going to use in this Activity...
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
pref_cacheDownloaded = prefs.getBoolean("cacheDownloaded", false);
|
||||
pref_expert = prefs.getBoolean("expert", false);
|
||||
pref_permissions = prefs.getBoolean("showPermissions", false);
|
||||
AppDetails old = (AppDetails) getLastNonConfigurationInstance();
|
||||
@ -728,7 +725,6 @@ public class AppDetails extends ListActivity {
|
||||
private Downloader download;
|
||||
private ProgressDialog pd;
|
||||
private boolean updating;
|
||||
private File localFile;
|
||||
|
||||
public DownloadHandler(DB.Apk apk, String repoaddress) {
|
||||
download = new Downloader(apk, repoaddress);
|
||||
@ -739,7 +735,6 @@ public class AppDetails extends ListActivity {
|
||||
public DownloadHandler(DownloadHandler oldHandler) {
|
||||
if (oldHandler != null) {
|
||||
download = oldHandler.download;
|
||||
localFile = oldHandler.localFile;
|
||||
}
|
||||
startUpdates();
|
||||
}
|
||||
@ -769,7 +764,7 @@ public class AppDetails extends ListActivity {
|
||||
case DONE:
|
||||
if (pd != null)
|
||||
pd.dismiss();
|
||||
installApk(localFile = download.localFile());
|
||||
installApk(download.localFile());
|
||||
finished = true;
|
||||
break;
|
||||
case CANCELLED:
|
||||
@ -801,21 +796,6 @@ public class AppDetails extends ListActivity {
|
||||
download.interrupt();
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
if (localFile == null) {
|
||||
Log.w("FDroid", "No APK to clean up!");
|
||||
return;
|
||||
}
|
||||
// If we're not meant to be caching, delete the apk file we just
|
||||
// installed (or maybe the user cancelled the install - doesn't
|
||||
// matter) from the SD card...
|
||||
if (!pref_cacheDownloaded) {
|
||||
Log.d("FDroid", "Cleaning up: " + localFile.getPath());
|
||||
localFile.delete();
|
||||
localFile = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
// The dialog can't be dismissed when it's not displayed,
|
||||
// so do it when the activity is being destroyed.
|
||||
@ -846,7 +826,6 @@ public class AppDetails extends ListActivity {
|
||||
switch (requestCode) {
|
||||
case REQUEST_INSTALL:
|
||||
if (downloadHandler != null) {
|
||||
downloadHandler.cleanUp();
|
||||
downloadHandler = null;
|
||||
}
|
||||
resetRequired = true;
|
||||
|
@ -19,13 +19,16 @@
|
||||
package org.fdroid.fdroid;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import android.app.Application;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class FDroidApp extends Application {
|
||||
|
||||
@ -37,6 +40,19 @@ public class FDroidApp extends Application {
|
||||
Log.d("FDroid", "Data path is " + local_path.getPath());
|
||||
if (!local_path.exists())
|
||||
local_path.mkdir();
|
||||
// Clear cached apk files. We used to just remove them after they'd
|
||||
// been installed, but this causes problems for proprietary gapps
|
||||
// users since the introduction of verification (on pre-4.2 Android),
|
||||
// because the install intent says it's finished when it hasn't.
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
if(!prefs.getBoolean("cacheDownloaded", false)) {
|
||||
for(File f : local_path.listFiles()) {
|
||||
if(f.getName().endsWith(".apk")) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File icon_path = DB.getIconsPath();
|
||||
Log.d("FDroid", "Icon path is " + icon_path.getPath());
|
||||
|
Loading…
x
Reference in New Issue
Block a user