privileged mode means auto-downloads are actually installs
When the Privileged Extension is working, then enabling the preference "Automatically download updates" will actually install those updates in the background. So the preference should communicate that to the user. So now it serves as a global "allow background updates" #16 closes #106
This commit is contained in:
parent
530144bec6
commit
973174cc7b
@ -45,7 +45,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
|
||||
public static final String PREF_UPD_INTERVAL = "updateInterval";
|
||||
public static final String PREF_UPD_WIFI_ONLY = "updateOnWifiOnly";
|
||||
public static final String PREF_UPD_AUTO_DOWNLOAD = "updateAutoDownload";
|
||||
public static final String PREF_AUTO_DOWNLOAD_INSTALL_UPDATES = "updateAutoDownload";
|
||||
public static final String PREF_UPD_NOTIFY = "updateNotify";
|
||||
public static final String PREF_UPD_HISTORY = "updateHistoryDays";
|
||||
public static final String PREF_ROOTED = "rooted";
|
||||
@ -222,7 +222,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
}
|
||||
|
||||
public boolean isAutoDownloadEnabled() {
|
||||
return preferences.getBoolean(PREF_UPD_AUTO_DOWNLOAD, false);
|
||||
return preferences.getBoolean(PREF_AUTO_DOWNLOAD_INSTALL_UPDATES, false);
|
||||
}
|
||||
|
||||
public boolean isUpdateOnlyOnWifi() {
|
||||
|
@ -21,7 +21,6 @@ package org.fdroid.fdroid.installer;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
|
||||
@ -46,9 +45,7 @@ public class InstallerFactory {
|
||||
&& apk.packageName.equals(PrivilegedInstaller.PRIVILEGED_EXTENSION_PACKAGE_NAME)) {
|
||||
// special case for "F-Droid Privileged Extension"
|
||||
installer = new ExtensionInstaller(context);
|
||||
} else if (isPrivilegedInstallerEnabled()
|
||||
&& PrivilegedInstaller.isExtensionInstalledCorrectly(context)
|
||||
== PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES) {
|
||||
} else if (PrivilegedInstaller.isDefault(context)) {
|
||||
Utils.debugLog(TAG, "privileged extension correctly installed -> PrivilegedInstaller");
|
||||
installer = new PrivilegedInstaller(context);
|
||||
} else {
|
||||
@ -57,12 +54,4 @@ public class InstallerFactory {
|
||||
|
||||
return installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension has privileged permissions and preference is enabled?
|
||||
*/
|
||||
private static boolean isPrivilegedInstallerEnabled() {
|
||||
return Preferences.get().isPrivilegedInstallerEnabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.privileged.IPrivilegedCallback;
|
||||
@ -296,6 +297,14 @@ public class PrivilegedInstaller extends Installer {
|
||||
return IS_EXTENSION_INSTALLED_YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension has privileged permissions and preference is enabled?
|
||||
*/
|
||||
public static boolean isDefault(Context context) {
|
||||
return Preferences.get().isPrivilegedInstallerEnabled()
|
||||
&& isExtensionInstalledCorrectly(context) == IS_EXTENSION_INSTALLED_YES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installPackageInternal(final Uri localApkUri, final Uri downloadUri, Apk apk) {
|
||||
sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_STARTED);
|
||||
|
@ -50,6 +50,7 @@ public class PreferencesFragment extends PreferenceFragment
|
||||
private static final int REQUEST_INSTALL_ORBOT = 0x1234;
|
||||
private CheckBoxPreference enableProxyCheckPref;
|
||||
private CheckBoxPreference useTorCheckPref;
|
||||
private Preference updateAutoDownloadPref;
|
||||
private Preference updatePrivilegedExtensionPref;
|
||||
private long currentKeepCacheTime;
|
||||
|
||||
@ -59,6 +60,7 @@ public class PreferencesFragment extends PreferenceFragment
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
useTorCheckPref = (CheckBoxPreference) findPreference(Preferences.PREF_USE_TOR);
|
||||
enableProxyCheckPref = (CheckBoxPreference) findPreference(Preferences.PREF_ENABLE_PROXY);
|
||||
updateAutoDownloadPref = findPreference(Preferences.PREF_AUTO_DOWNLOAD_INSTALL_UPDATES);
|
||||
updatePrivilegedExtensionPref = findPreference(Preferences.PREF_UNINSTALL_PRIVILEGED_APP);
|
||||
}
|
||||
|
||||
@ -282,6 +284,11 @@ public class PreferencesFragment extends PreferenceFragment
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (PrivilegedInstaller.isDefault(getContext())) {
|
||||
updateAutoDownloadPref.setTitle(R.string.update_auto_install);
|
||||
updateAutoDownloadPref.setSummary(R.string.update_auto_install_summary);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,8 @@
|
||||
<string name="automatic_scan_wifi_on">Update app lists automatically only on Wi-Fi</string>
|
||||
<string name="update_auto_download">Automatically download updates</string>
|
||||
<string name="update_auto_download_summary">Download the update files in the background</string>
|
||||
<string name="update_auto_install">Automatically install updates</string>
|
||||
<string name="update_auto_install_summary">Download and install update apps in the background</string>
|
||||
<string name="notify">Update notifications</string>
|
||||
<string name="notify_on">Show a notification when updates are available</string>
|
||||
<string name="update_history">Update history</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user