Merge branch 'class-renames' into 'master'
Class renames See merge request fdroid/fdroidclient!767
This commit is contained in:
commit
083e3ead75
@ -16,8 +16,8 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.Hasher;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
@ -104,7 +104,7 @@ public final class LocalRepoManager {
|
||||
repoDir = new SanitizedFile(fdroidDir, "repo");
|
||||
repoDirCaps = new SanitizedFile(fdroidDirCaps, "REPO");
|
||||
iconsDir = new SanitizedFile(repoDir, "icons");
|
||||
xmlIndexJar = new SanitizedFile(repoDir, RepoUpdater.SIGNED_FILE_NAME);
|
||||
xmlIndexJar = new SanitizedFile(repoDir, IndexUpdater.SIGNED_FILE_NAME);
|
||||
xmlIndexJarUnsigned = new SanitizedFile(repoDir, "index.unsigned.jar");
|
||||
|
||||
if (!fdroidDir.exists() && !fdroidDir.mkdir()) {
|
||||
@ -496,7 +496,7 @@ public final class LocalRepoManager {
|
||||
public void writeIndexJar() throws IOException, XmlPullParserException, LocalRepoKeyStore.InitException {
|
||||
BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(xmlIndexJarUnsigned));
|
||||
JarOutputStream jo = new JarOutputStream(bo);
|
||||
JarEntry je = new JarEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
JarEntry je = new JarEntry(IndexUpdater.DATA_FILE_NAME);
|
||||
jo.putNextEntry(je);
|
||||
new IndexXmlBuilder().build(context, apps, jo);
|
||||
jo.close();
|
||||
|
@ -173,7 +173,7 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".AppDetails2"
|
||||
android:name=".views.AppDetailsActivity"
|
||||
android:label="@string/app_details"
|
||||
android:exported="true"
|
||||
android:parentActivityName=".views.main.MainActivity"
|
||||
|
@ -19,6 +19,7 @@ import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
import org.fdroid.fdroid.installer.ErrorDialogActivity;
|
||||
import org.fdroid.fdroid.installer.InstallManagerService;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -532,16 +533,16 @@ public final class AppUpdateStatusManager {
|
||||
|
||||
/**
|
||||
* Get a {@link PendingIntent} for a {@link Notification} to send when it
|
||||
* is clicked. {@link AppDetails2} handles {@code Intent}s that are missing
|
||||
* or bad {@link AppDetails2#EXTRA_APPID}, so it does not need to be checked
|
||||
* is clicked. {@link AppDetailsActivity} handles {@code Intent}s that are missing
|
||||
* or bad {@link AppDetailsActivity#EXTRA_APPID}, so it does not need to be checked
|
||||
* here.
|
||||
*/
|
||||
private PendingIntent getAppDetailsIntent(Apk apk) {
|
||||
Intent notifyIntent = new Intent(context, AppDetails2.class)
|
||||
.putExtra(AppDetails2.EXTRA_APPID, apk.packageName);
|
||||
Intent notifyIntent = new Intent(context, AppDetailsActivity.class)
|
||||
.putExtra(AppDetailsActivity.EXTRA_APPID, apk.packageName);
|
||||
|
||||
return TaskStackBuilder.create(context)
|
||||
.addParentStack(AppDetails2.class)
|
||||
.addParentStack(AppDetailsActivity.class)
|
||||
.addNextIntent(notifyIntent)
|
||||
.getPendingIntent(apk.packageName.hashCode(), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
@ -27,8 +27,6 @@ import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
import android.app.Application;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -132,9 +130,6 @@ public class FDroidApp extends Application {
|
||||
// Leaving the fully qualified class name here to help clarify the difference between spongy/bouncy castle.
|
||||
private static final org.bouncycastle.jce.provider.BouncyCastleProvider BOUNCYCASTLE_PROVIDER;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
BluetoothAdapter bluetoothAdapter;
|
||||
|
||||
/**
|
||||
* The construction of this notification helper has side effects including listening and
|
||||
* responding to local broadcasts. It is kept as a reference on the app object here so that
|
||||
@ -393,7 +388,6 @@ public class FDroidApp extends Application {
|
||||
CleanCacheService.schedule(this);
|
||||
|
||||
notificationHelper = new NotificationHelper(getApplicationContext());
|
||||
bluetoothAdapter = getBluetoothAdapter();
|
||||
|
||||
// There are a couple things to pay attention to with this config: memory usage,
|
||||
// especially on small devices; and, image processing vulns, since images are
|
||||
@ -559,16 +553,6 @@ public class FDroidApp extends Application {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@TargetApi(18)
|
||||
private BluetoothAdapter getBluetoothAdapter() {
|
||||
// to use the new, recommended way of getting the adapter
|
||||
// http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
return BluetoothAdapter.getDefaultAdapter();
|
||||
}
|
||||
return ((BluetoothManager) getSystemService(BLUETOOTH_SERVICE)).getAdapter();
|
||||
}
|
||||
|
||||
private SharedPreferences getAtStartTimeSharedPreferences() {
|
||||
return getSharedPreferences("at-start-time", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ import java.util.jar.JarFile;
|
||||
* FDroid! Avoid modifying it when possible, if you absolutely must, be very,
|
||||
* very careful with the changes that you are making!
|
||||
*/
|
||||
public class RepoUpdater {
|
||||
private static final String TAG = "RepoUpdater";
|
||||
public class IndexUpdater {
|
||||
private static final String TAG = "IndexUpdater";
|
||||
|
||||
public static final String SIGNED_FILE_NAME = "index.jar";
|
||||
public static final String DATA_FILE_NAME = "index.xml";
|
||||
@ -106,7 +106,7 @@ public class RepoUpdater {
|
||||
*
|
||||
* @param repo A {@link Repo} read out of the local database
|
||||
*/
|
||||
public RepoUpdater(@NonNull Context context, @NonNull Repo repo) {
|
||||
public IndexUpdater(@NonNull Context context, @NonNull Repo repo) {
|
||||
this.context = context;
|
||||
this.repo = repo;
|
||||
this.persister = new RepoPersister(context, repo);
|
||||
@ -208,7 +208,7 @@ public class RepoUpdater {
|
||||
FDroidApp.disableBouncyCastleOnLollipop();
|
||||
|
||||
JarFile jarFile = new JarFile(downloadedFile, true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(IndexUpdater.DATA_FILE_NAME);
|
||||
indexInputStream = new ProgressBufferedInputStream(jarFile.getInputStream(indexEntry),
|
||||
processIndexListener, repo.address, (int) indexEntry.getSize());
|
||||
|
||||
@ -249,14 +249,14 @@ public class RepoUpdater {
|
||||
protected final ProgressListener downloadListener = new ProgressListener() {
|
||||
@Override
|
||||
public void onProgress(String urlString, long bytesRead, long totalBytes) {
|
||||
UpdateService.reportDownloadProgress(context, RepoUpdater.this, bytesRead, totalBytes);
|
||||
UpdateService.reportDownloadProgress(context, IndexUpdater.this, bytesRead, totalBytes);
|
||||
}
|
||||
};
|
||||
|
||||
protected final ProgressListener processIndexListener = new ProgressListener() {
|
||||
@Override
|
||||
public void onProgress(String urlString, long bytesRead, long totalBytes) {
|
||||
UpdateService.reportProcessIndexProgress(context, RepoUpdater.this, bytesRead, totalBytes);
|
||||
UpdateService.reportProcessIndexProgress(context, IndexUpdater.this, bytesRead, totalBytes);
|
||||
}
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ import java.util.jar.JarFile;
|
||||
* App/Apk classes, resulting in malicious servers being able to populate those
|
||||
* variables.
|
||||
*/
|
||||
public class IndexV1Updater extends RepoUpdater {
|
||||
public class IndexV1Updater extends IndexUpdater {
|
||||
public static final String TAG = "IndexV1Updater";
|
||||
|
||||
private static final String SIGNED_FILE_NAME = "index-v1.jar";
|
||||
@ -101,11 +101,11 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
|
||||
/**
|
||||
* @return whether this successfully found an index of this version
|
||||
* @throws RepoUpdater.UpdateException
|
||||
* @throws IndexUpdater.UpdateException
|
||||
* @see org.fdroid.fdroid.net.DownloaderService#handleIntent(android.content.Intent)
|
||||
*/
|
||||
@Override
|
||||
public boolean update() throws RepoUpdater.UpdateException {
|
||||
public boolean update() throws IndexUpdater.UpdateException {
|
||||
|
||||
if (repo.isSwap) {
|
||||
// swap repos do not support index-v1
|
||||
@ -167,7 +167,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
if (downloader != null) {
|
||||
FileUtils.deleteQuietly(downloader.outputFile);
|
||||
}
|
||||
throw new RepoUpdater.UpdateException("Error getting index file", e2);
|
||||
throw new IndexUpdater.UpdateException("Error getting index file", e2);
|
||||
} catch (InterruptedException e2) {
|
||||
// ignored if canceled, the local database just won't be updated
|
||||
}
|
||||
@ -176,7 +176,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
if (downloader != null) {
|
||||
FileUtils.deleteQuietly(downloader.outputFile);
|
||||
}
|
||||
throw new RepoUpdater.UpdateException("Error getting index file", e);
|
||||
throw new IndexUpdater.UpdateException("Error getting index file", e);
|
||||
} catch (InterruptedException e) {
|
||||
// ignored if canceled, the local database just won't be updated
|
||||
}
|
||||
@ -185,7 +185,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
}
|
||||
|
||||
private void processDownloadedIndex(File outputFile, String cacheTag)
|
||||
throws IOException, RepoUpdater.UpdateException {
|
||||
throws IOException, IndexUpdater.UpdateException {
|
||||
JarFile jarFile = new JarFile(outputFile, true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(DATA_FILE_NAME);
|
||||
InputStream indexInputStream = new ProgressBufferedInputStream(jarFile.getInputStream(indexEntry),
|
||||
@ -268,7 +268,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
long timestamp = (Long) repoMap.get("timestamp") / 1000;
|
||||
|
||||
if (repo.timestamp > timestamp) {
|
||||
throw new RepoUpdater.UpdateException("index.jar is older that current index! "
|
||||
throw new IndexUpdater.UpdateException("index.jar is older that current index! "
|
||||
+ timestamp + " < " + repo.timestamp);
|
||||
}
|
||||
|
||||
@ -429,15 +429,15 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
* This is also responsible for adding the {@link Repo} instance to the
|
||||
* database for the first time.
|
||||
* <p>
|
||||
* This is the same as {@link RepoUpdater#verifyCerts(String, X509Certificate)},
|
||||
* {@link RepoUpdater#verifyAndStoreTOFUCerts(String, X509Certificate)}, and
|
||||
* {@link RepoUpdater#assertSigningCertFromXmlCorrect()} except there is no
|
||||
* This is the same as {@link IndexUpdater#verifyCerts(String, X509Certificate)},
|
||||
* {@link IndexUpdater#verifyAndStoreTOFUCerts(String, X509Certificate)}, and
|
||||
* {@link IndexUpdater#assertSigningCertFromXmlCorrect()} except there is no
|
||||
* embedded copy of the signing certificate in the index data.
|
||||
*
|
||||
* @param rawCertFromJar the {@link X509Certificate} embedded in the downloaded jar
|
||||
* @see RepoUpdater#verifyAndStoreTOFUCerts(String, X509Certificate)
|
||||
* @see RepoUpdater#verifyCerts(String, X509Certificate)
|
||||
* @see RepoUpdater#assertSigningCertFromXmlCorrect()
|
||||
* @see IndexUpdater#verifyAndStoreTOFUCerts(String, X509Certificate)
|
||||
* @see IndexUpdater#verifyCerts(String, X509Certificate)
|
||||
* @see IndexUpdater#assertSigningCertFromXmlCorrect()
|
||||
*/
|
||||
private void verifySigningCertificate(X509Certificate rawCertFromJar) throws SigningException {
|
||||
String certFromJar = Hasher.hex(rawCertFromJar);
|
||||
@ -473,7 +473,7 @@ public class IndexV1Updater extends RepoUpdater {
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@code index-v1} version of {@link RepoUpdater#processRepoPushRequests(List)}
|
||||
* The {@code index-v1} version of {@link IndexUpdater#processRepoPushRequests(List)}
|
||||
*/
|
||||
private void processRepoPushRequests(Map<String, String[]> requests) {
|
||||
if (requests == null) {
|
||||
|
@ -53,7 +53,7 @@ public class NfcHelper {
|
||||
}
|
||||
|
||||
@TargetApi(16)
|
||||
static void disableAndroidBeam(Activity activity) {
|
||||
public static void disableAndroidBeam(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
return;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import com.nostra13.universalimageloader.core.assist.ImageSize;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
import com.nostra13.universalimageloader.utils.DiskCacheUtils;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.views.main.MainActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -154,7 +155,7 @@ class NotificationHelper {
|
||||
} else if ((entry.status == AppUpdateStatusManager.Status.Downloading ||
|
||||
entry.status == AppUpdateStatusManager.Status.ReadyToInstall ||
|
||||
entry.status == AppUpdateStatusManager.Status.InstallError) &&
|
||||
AppDetails2.isAppVisible(entry.app.packageName)) {
|
||||
AppDetailsActivity.isAppVisible(entry.app.packageName)) {
|
||||
// Ignore downloading, readyToInstall and installError if we are showing the details screen for this app
|
||||
return true;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
* Whether push requests are globally enabled or disabled.
|
||||
*
|
||||
* @see org.fdroid.fdroid.data.RepoPushRequest
|
||||
* @see RepoUpdater#processRepoPushRequests(List)
|
||||
* @see IndexUpdater#processRepoPushRequests(List)
|
||||
*/
|
||||
public boolean allowPushRequests() {
|
||||
return preferences.getBoolean(PREF_ALLOW_PUSH_REQUESTS, IGNORED_B);
|
||||
|
@ -467,9 +467,9 @@ public class UpdateService extends JobIntentService {
|
||||
sendStatus(this, STATUS_INFO, getString(R.string.status_connecting_to_repo, repo.address));
|
||||
|
||||
try {
|
||||
RepoUpdater updater = new IndexV1Updater(this, repo);
|
||||
IndexUpdater updater = new IndexV1Updater(this, repo);
|
||||
if (Preferences.get().isForceOldIndexEnabled() || !updater.update()) {
|
||||
updater = new RepoUpdater(getBaseContext(), repo);
|
||||
updater = new IndexUpdater(getBaseContext(), repo);
|
||||
updater.update();
|
||||
}
|
||||
|
||||
@ -479,7 +479,7 @@ public class UpdateService extends JobIntentService {
|
||||
} else {
|
||||
unchangedRepos++;
|
||||
}
|
||||
} catch (RepoUpdater.UpdateException e) {
|
||||
} catch (IndexUpdater.UpdateException e) {
|
||||
errorRepos++;
|
||||
repoErrors.add(e.getMessage());
|
||||
Log.e(TAG, "Error updating repository " + repo.address, e);
|
||||
@ -555,7 +555,7 @@ public class UpdateService extends JobIntentService {
|
||||
}
|
||||
}
|
||||
|
||||
public static void reportDownloadProgress(Context context, RepoUpdater updater,
|
||||
public static void reportDownloadProgress(Context context, IndexUpdater updater,
|
||||
long bytesRead, long totalBytes) {
|
||||
Utils.debugLog(TAG, "Downloading " + updater.indexUrl + "(" + bytesRead + "/" + totalBytes + ")");
|
||||
String downloadedSizeFriendly = Utils.getFriendlySize(bytesRead);
|
||||
@ -576,7 +576,7 @@ public class UpdateService extends JobIntentService {
|
||||
sendStatus(context, STATUS_INFO, message, percent);
|
||||
}
|
||||
|
||||
public static void reportProcessIndexProgress(Context context, RepoUpdater updater,
|
||||
public static void reportProcessIndexProgress(Context context, IndexUpdater updater,
|
||||
long bytesRead, long totalBytes) {
|
||||
Utils.debugLog(TAG, "Processing " + updater.indexUrl + "(" + bytesRead + "/" + totalBytes + ")");
|
||||
String downloadedSize = Utils.getFriendlySize(bytesRead);
|
||||
@ -598,7 +598,7 @@ public class UpdateService extends JobIntentService {
|
||||
* "Saving app details" sent to the user. If you know how many apps you have
|
||||
* processed, then a message of "Saving app details (x/total)" is displayed.
|
||||
*/
|
||||
public static void reportProcessingAppsProgress(Context context, RepoUpdater updater,
|
||||
public static void reportProcessingAppsProgress(Context context, IndexUpdater updater,
|
||||
int appsSaved, int totalApps) {
|
||||
Utils.debugLog(TAG, "Committing " + updater.indexUrl + "(" + appsSaved + "/" + totalApps + ")");
|
||||
if (totalApps > 0) {
|
||||
|
@ -9,7 +9,7 @@ import android.os.RemoteException;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.fdroid.fdroid.CompatibilityChecker;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -55,7 +55,7 @@ public class RepoPersister {
|
||||
checker = new CompatibilityChecker(context);
|
||||
}
|
||||
|
||||
public void saveToDb(App app, List<Apk> packages) throws RepoUpdater.UpdateException {
|
||||
public void saveToDb(App app, List<Apk> packages) throws IndexUpdater.UpdateException {
|
||||
appsToSave.add(app);
|
||||
apksToSave.put(app.packageName, packages);
|
||||
|
||||
@ -64,13 +64,13 @@ public class RepoPersister {
|
||||
}
|
||||
}
|
||||
|
||||
public void commit(ContentValues repoDetailsToSave, long repoIdToCommit) throws RepoUpdater.UpdateException {
|
||||
public void commit(ContentValues repoDetailsToSave, long repoIdToCommit) throws IndexUpdater.UpdateException {
|
||||
flushBufferToDb();
|
||||
TempAppProvider.Helper.commitAppsAndApks(context, repoIdToCommit);
|
||||
RepoProvider.Helper.update(context, repo, repoDetailsToSave);
|
||||
}
|
||||
|
||||
private void flushBufferToDb() throws RepoUpdater.UpdateException {
|
||||
private void flushBufferToDb() throws IndexUpdater.UpdateException {
|
||||
if (!hasBeenInitialized) {
|
||||
// This is where we will store all of the metadata before commiting at the
|
||||
// end of the process. This is due to the fact that we can't verify the cert
|
||||
@ -90,7 +90,7 @@ public class RepoPersister {
|
||||
}
|
||||
}
|
||||
|
||||
private void flushApksToDbInBatch(Map<String, Long> appIds) throws RepoUpdater.UpdateException {
|
||||
private void flushApksToDbInBatch(Map<String, Long> appIds) throws IndexUpdater.UpdateException {
|
||||
List<Apk> apksToSaveList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<Apk>> entries : apksToSave.entrySet()) {
|
||||
for (Apk apk : entries.getValue()) {
|
||||
@ -106,7 +106,7 @@ public class RepoPersister {
|
||||
try {
|
||||
context.getContentResolver().applyBatch(TempApkProvider.getAuthority(), apkOperations);
|
||||
} catch (RemoteException | OperationApplicationException e) {
|
||||
throw new RepoUpdater.UpdateException("An internal error occurred while updating the database", e);
|
||||
throw new IndexUpdater.UpdateException("An internal error occurred while updating the database", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,14 +115,14 @@ public class RepoPersister {
|
||||
* Then, will query the database for the ID + packageName for each of these apps, so that they
|
||||
* can be returned and the relevant apks can be joined to the app table correctly.
|
||||
*/
|
||||
private Map<String, Long> flushAppsToDbInBatch() throws RepoUpdater.UpdateException {
|
||||
private Map<String, Long> flushAppsToDbInBatch() throws IndexUpdater.UpdateException {
|
||||
ArrayList<ContentProviderOperation> appOperations = insertApps(appsToSave);
|
||||
|
||||
try {
|
||||
context.getContentResolver().applyBatch(TempAppProvider.getAuthority(), appOperations);
|
||||
return getIdsForPackages(appsToSave);
|
||||
} catch (RemoteException | OperationApplicationException e) {
|
||||
throw new RepoUpdater.UpdateException("An internal error occurred while updating the database", e);
|
||||
throw new IndexUpdater.UpdateException("An internal error occurred while updating the database", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.JobIntentService;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
||||
import org.fdroid.fdroid.AppDetails2;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
@ -135,7 +135,7 @@ public class InstallerService extends JobIntentService {
|
||||
* <p>
|
||||
* If you quickly cycle between installing an app and uninstalling it, then
|
||||
* {@link App#installedApk} will still be null when
|
||||
* {@link AppDetails2#startUninstall()} calls
|
||||
* {@link AppDetailsActivity#startUninstall()} calls
|
||||
* this method. It is better to crash earlier here, before the {@link Intent}
|
||||
* is sent with a null {@link Apk} instance since this service is set to
|
||||
* receive Sticky Intents. That means they will automatically be resent
|
||||
|
@ -434,7 +434,7 @@ public class AppSecurityPermissions {
|
||||
|| ((pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_PRE23) != 0);
|
||||
|
||||
// Dangerous and normal permissions are always shown to the user
|
||||
// this is matches the permission list in AppDetails2
|
||||
// this is matches the permission list in AppDetailsActivity
|
||||
if (isNormal || isDangerous) {
|
||||
return true;
|
||||
}
|
||||
|
@ -19,11 +19,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.fdroid.fdroid;
|
||||
package org.fdroid.fdroid.views;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.PendingIntent;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -31,6 +33,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -49,6 +52,11 @@ import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.NfcHelper;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
@ -59,23 +67,24 @@ import org.fdroid.fdroid.installer.InstallManagerService;
|
||||
import org.fdroid.fdroid.installer.Installer;
|
||||
import org.fdroid.fdroid.installer.InstallerFactory;
|
||||
import org.fdroid.fdroid.installer.InstallerService;
|
||||
import org.fdroid.fdroid.views.AppDetailsRecyclerViewAdapter;
|
||||
import org.fdroid.fdroid.views.ShareChooserDialog;
|
||||
import org.fdroid.fdroid.views.apps.FeatureImage;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class AppDetails2 extends AppCompatActivity
|
||||
public class AppDetailsActivity extends AppCompatActivity
|
||||
implements ShareChooserDialog.ShareChooserDialogListener,
|
||||
AppDetailsRecyclerViewAdapter.AppDetailsRecyclerViewAdapterCallbacks {
|
||||
|
||||
public static final String EXTRA_APPID = "appid";
|
||||
private static final String TAG = "AppDetails2";
|
||||
private static final String TAG = "AppDetailsActivity";
|
||||
|
||||
private static final int REQUEST_ENABLE_BLUETOOTH = 2;
|
||||
private static final int REQUEST_PERMISSION_DIALOG = 3;
|
||||
private static final int REQUEST_UNINSTALL_DIALOG = 4;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
protected BluetoothAdapter bluetoothAdapter;
|
||||
|
||||
private FDroidApp fdroidApp;
|
||||
private App app;
|
||||
private RecyclerView recyclerView;
|
||||
@ -111,6 +120,8 @@ public class AppDetails2 extends AppCompatActivity
|
||||
return;
|
||||
}
|
||||
|
||||
bluetoothAdapter = getBluetoothAdapter();
|
||||
|
||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.rvDetails);
|
||||
@ -254,7 +265,7 @@ public class AppDetails2 extends AppCompatActivity
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, app.name + " (" + app.summary
|
||||
+ ") - https://f-droid.org/app/" + app.packageName);
|
||||
|
||||
boolean showNearbyItem = app.isInstalled(getApplicationContext()) && fdroidApp.bluetoothAdapter != null;
|
||||
boolean showNearbyItem = app.isInstalled(getApplicationContext()) && bluetoothAdapter != null;
|
||||
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.rootCoordinator);
|
||||
ShareChooserDialog.createChooser(coordinatorLayout, this, this, shareIntent, showNearbyItem);
|
||||
return true;
|
||||
@ -531,7 +542,7 @@ public class AppDetails2 extends AppCompatActivity
|
||||
getString(R.string.install_error_notify_title),
|
||||
app.name);
|
||||
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails2.this);
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetailsActivity.this);
|
||||
alertBuilder.setTitle(title);
|
||||
alertBuilder.setMessage(errorMessage);
|
||||
alertBuilder.setNeutralButton(android.R.string.ok, null);
|
||||
@ -584,7 +595,7 @@ public class AppDetails2 extends AppCompatActivity
|
||||
if (!TextUtils.isEmpty(errorMessage)) {
|
||||
Log.e(TAG, "uninstall aborted with errorMessage: " + errorMessage);
|
||||
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails2.this);
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetailsActivity.this);
|
||||
Uri uri = intent.getData();
|
||||
if (uri == null) {
|
||||
alertBuilder.setTitle(getString(R.string.uninstall_error_notify_title, ""));
|
||||
@ -656,7 +667,7 @@ public class AppDetails2 extends AppCompatActivity
|
||||
public void run() {
|
||||
String packageName = app != null ? app.packageName : null;
|
||||
if (!resetCurrentApp(packageName)) {
|
||||
AppDetails2.this.finish();
|
||||
AppDetailsActivity.this.finish();
|
||||
return;
|
||||
}
|
||||
AppDetailsRecyclerViewAdapter adapter = (AppDetailsRecyclerViewAdapter) recyclerView.getAdapter();
|
||||
@ -684,6 +695,16 @@ public class AppDetails2 extends AppCompatActivity
|
||||
NfcHelper.disableAndroidBeam(this);
|
||||
}
|
||||
|
||||
@TargetApi(18)
|
||||
private BluetoothAdapter getBluetoothAdapter() {
|
||||
// to use the new, recommended way of getting the adapter
|
||||
// http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
return BluetoothAdapter.getDefaultAdapter();
|
||||
}
|
||||
return ((BluetoothManager) getSystemService(BLUETOOTH_SERVICE)).getAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openUrl(String url) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
@ -54,8 +54,8 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.UpdateService;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.compat.CursorAdapterCompat;
|
||||
@ -568,7 +568,7 @@ public class ManageReposActivity extends AppCompatActivity
|
||||
return addressWithoutIndex;
|
||||
}
|
||||
|
||||
final Uri uri = builder.appendPath(RepoUpdater.SIGNED_FILE_NAME).build();
|
||||
final Uri uri = builder.appendPath(IndexUpdater.SIGNED_FILE_NAME).build();
|
||||
|
||||
try {
|
||||
if (checkForRepository(uri)) {
|
||||
|
@ -157,7 +157,7 @@ public class RepoDetailsActivity extends AppCompatActivity {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver,
|
||||
new IntentFilter(UpdateService.LOCAL_ACTION_STATUS));
|
||||
|
||||
// FDroid.java and AppDetails2 set different NFC actions, so reset here
|
||||
// FDroid.java and AppDetailsActivity set different NFC actions, so reset here
|
||||
setNfc();
|
||||
processIntent(getIntent());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import org.fdroid.fdroid.data.AppProvider;
|
||||
* Full screen view of an apps screenshots to swipe through. This will always
|
||||
* download the image, even if the user has said not to use "unmetered" networks,
|
||||
* e.g. WiFi. That is because the user has to click on the thumbnail in
|
||||
* {@link org.fdroid.fdroid.AppDetails2} in order to bring up this activity.
|
||||
* {@link AppDetailsActivity} in order to bring up this activity.
|
||||
* That makes it a specific request for that image, rather than regular
|
||||
* background loading.
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
|
||||
/**
|
||||
* Loads and displays the small screenshots that are inline in {@link org.fdroid.fdroid.AppDetails2}
|
||||
* Loads and displays the small screenshots that are inline in {@link AppDetailsActivity}
|
||||
*/
|
||||
class ScreenShotsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private final String[] screenshots;
|
||||
|
@ -27,7 +27,7 @@ import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import org.fdroid.fdroid.AppDetails2;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager.AppUpdateStatus;
|
||||
import org.fdroid.fdroid.R;
|
||||
@ -422,8 +422,8 @@ public abstract class AppListItemController extends RecyclerView.ViewHolder {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(activity, AppDetails2.class);
|
||||
intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
|
||||
Intent intent = new Intent(activity, AppDetailsActivity.class);
|
||||
intent.putExtra(AppDetailsActivity.EXTRA_APPID, currentApp.packageName);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
String transitionAppIcon = activity.getString(R.string.transition_app_item_icon);
|
||||
Pair<View, String> iconTransitionPair = Pair.create((View) icon, transitionAppIcon);
|
||||
|
@ -21,7 +21,7 @@ import android.widget.TextView;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
import org.fdroid.fdroid.AppDetails2;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
@ -144,7 +144,7 @@ public class AppCardController extends RecyclerView.ViewHolder
|
||||
}
|
||||
|
||||
/**
|
||||
* When the user clicks/touches an app card, we launch the {@link AppDetails2} activity in response.
|
||||
* When the user clicks/touches an app card, we launch the {@link AppDetailsActivity} activity in response.
|
||||
*/
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -152,8 +152,8 @@ public class AppCardController extends RecyclerView.ViewHolder
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(activity, AppDetails2.class);
|
||||
intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
|
||||
Intent intent = new Intent(activity, AppDetailsActivity.class);
|
||||
intent.putExtra(AppDetailsActivity.EXTRA_APPID, currentApp.packageName);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Pair<View, String> iconTransitionPair = Pair.create((View) icon,
|
||||
activity.getString(R.string.transition_app_item_icon));
|
||||
|
@ -41,7 +41,7 @@ import android.widget.Toast;
|
||||
import com.ashokvarma.bottomnavigation.BottomNavigationBar;
|
||||
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
|
||||
import com.ashokvarma.bottomnavigation.TextBadgeItem;
|
||||
import org.fdroid.fdroid.AppDetails2;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager.AppUpdateStatus;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
@ -184,7 +184,7 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
|
||||
setSelectedMenuInNav();
|
||||
}
|
||||
|
||||
// AppDetails2 and RepoDetailsActivity set different NFC actions, so reset here
|
||||
// AppDetailsActivity and RepoDetailsActivity set different NFC actions, so reset here
|
||||
NfcHelper.setAndroidBeam(this, getApplication().getPackageName());
|
||||
checkForAddRepoIntent(getIntent());
|
||||
}
|
||||
@ -309,8 +309,8 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
|
||||
|
||||
if (!TextUtils.isEmpty(packageName)) {
|
||||
Utils.debugLog(TAG, "FDroid launched via app link for '" + packageName + "'");
|
||||
Intent intentToInvoke = new Intent(this, AppDetails2.class);
|
||||
intentToInvoke.putExtra(AppDetails2.EXTRA_APPID, packageName);
|
||||
Intent intentToInvoke = new Intent(this, AppDetailsActivity.class);
|
||||
intentToInvoke.putExtra(AppDetailsActivity.EXTRA_APPID, packageName);
|
||||
startActivity(intentToInvoke);
|
||||
finish();
|
||||
} else if (!TextUtils.isEmpty(query)) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="org.fdroid.fdroid.AppDetails2"
|
||||
tools:context="org.fdroid.fdroid.views.AppDetailsActivity"
|
||||
android:background="?attr/appDetailsBackground"
|
||||
android:id="@+id/rootCoordinator">
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:context="org.fdroid.fdroid.AppDetails2"
|
||||
tools:context="org.fdroid.fdroid.views.AppDetailsActivity"
|
||||
tools:showIn="@layout/app_details2" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
@ -5,7 +5,7 @@ import android.content.ContentValues;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.RepoUpdater.UpdateException;
|
||||
import org.fdroid.fdroid.IndexUpdater.UpdateException;
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
import org.fdroid.fdroid.data.RepoProvider;
|
||||
import org.fdroid.fdroid.data.Schema.RepoTable.Cols;
|
||||
@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@Config(constants = BuildConfig.class)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AcceptableMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
public class AcceptableMultiIndexUpdaterTest extends MultiIndexUpdaterTest {
|
||||
private static final String TAG = "AcceptableMultiRepoTest";
|
||||
|
||||
private void assertSomewhatAcceptable() {
|
@ -2,7 +2,7 @@
|
||||
package org.fdroid.fdroid.updater;
|
||||
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -16,7 +16,7 @@ import org.robolectric.annotation.Config;
|
||||
*/
|
||||
@Config(constants = BuildConfig.class)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class FDroidRepoUpdateTest extends MultiRepoUpdaterTest {
|
||||
public class FDroidRepoUpdateTest extends MultiIndexUpdaterTest {
|
||||
|
||||
private static final String TAG = "FDroidRepoUpdateTest";
|
||||
|
||||
@ -25,26 +25,26 @@ public class FDroidRepoUpdateTest extends MultiRepoUpdaterTest {
|
||||
private static final String REPO_FDROID_PUB_KEY = "3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef"; // NOCHECKSTYLE LineLength
|
||||
|
||||
@Test
|
||||
public void doesntCrash() throws RepoUpdater.UpdateException {
|
||||
public void doesntCrash() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
updateEarlier();
|
||||
updateLater();
|
||||
updateV1Later();
|
||||
}
|
||||
|
||||
protected void updateEarlier() throws RepoUpdater.UpdateException {
|
||||
protected void updateEarlier() throws IndexUpdater.UpdateException {
|
||||
Utils.debugLog(TAG, "Updating earlier version of F-Droid repo");
|
||||
updateRepo(createRepoUpdater(REPO_FDROID, REPO_FDROID_URI, context, REPO_FDROID_PUB_KEY),
|
||||
"index.fdroid.2016-10-30.jar");
|
||||
}
|
||||
|
||||
protected void updateLater() throws RepoUpdater.UpdateException {
|
||||
protected void updateLater() throws IndexUpdater.UpdateException {
|
||||
Utils.debugLog(TAG, "Updating later version of F-Droid repo");
|
||||
updateRepo(createRepoUpdater(REPO_FDROID, REPO_FDROID_URI, context, REPO_FDROID_PUB_KEY),
|
||||
"index.fdroid.2016-11-10.jar");
|
||||
}
|
||||
|
||||
protected void updateV1Later() throws RepoUpdater.UpdateException {
|
||||
protected void updateV1Later() throws IndexUpdater.UpdateException {
|
||||
Utils.debugLog(TAG, "Updating later version of F-Droid index-v1");
|
||||
updateRepo(createIndexV1Updater(REPO_FDROID, REPO_FDROID_URI, context, REPO_FDROID_PUB_KEY),
|
||||
"index-v1.fdroid.2017-07-07.jar");
|
||||
|
@ -12,9 +12,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectReader;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.IndexV1Updater;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.TestUtils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
@ -71,14 +71,14 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndexV1Processing() throws IOException, RepoUpdater.UpdateException {
|
||||
public void testIndexV1Processing() throws IOException, IndexUpdater.UpdateException {
|
||||
List<Repo> repos = RepoProvider.Helper.all(context);
|
||||
for (Repo repo : repos) {
|
||||
RepoProvider.Helper.remove(context, repo.getId());
|
||||
}
|
||||
assertEquals("No repos present", 0, RepoProvider.Helper.all(context).size());
|
||||
assertEquals("No apps present", 0, AppProvider.Helper.all(context.getContentResolver()).size());
|
||||
Repo repo = MultiRepoUpdaterTest.createRepo("Testy", TESTY_JAR, context, TESTY_CERT);
|
||||
Repo repo = MultiIndexUpdaterTest.createRepo("Testy", TESTY_JAR, context, TESTY_CERT);
|
||||
repo.timestamp = 1481222110;
|
||||
IndexV1Updater updater = new IndexV1Updater(context, repo);
|
||||
JarFile jarFile = new JarFile(TestUtils.copyResourceToTempFile(TESTY_JAR), true);
|
||||
@ -131,10 +131,10 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
assertEquals(1, AppProvider.Helper.findInstalledAppsWithKnownVulns(context).size());
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.SigningException.class)
|
||||
public void testIndexV1WithWrongCert() throws IOException, RepoUpdater.UpdateException {
|
||||
@Test(expected = IndexUpdater.SigningException.class)
|
||||
public void testIndexV1WithWrongCert() throws IOException, IndexUpdater.UpdateException {
|
||||
String badCert = "308202ed308201d5a003020102020426ffa009300d06092a864886f70d01010b05003027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a656374301e170d3132313030363132303533325a170d3337303933303132303533325a3027310b300906035504061302444531183016060355040a130f4e4f47415050532050726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a02820101009a8d2a5336b0eaaad89ce447828c7753b157459b79e3215dc962ca48f58c2cd7650df67d2dd7bda0880c682791f32b35c504e43e77b43c3e4e541f86e35a8293a54fb46e6b16af54d3a4eda458f1a7c8bc1b7479861ca7043337180e40079d9cdccb7e051ada9b6c88c9ec635541e2ebf0842521c3024c826f6fd6db6fd117c74e859d5af4db04448965ab5469b71ce719939a06ef30580f50febf96c474a7d265bb63f86a822ff7b643de6b76e966a18553c2858416cf3309dd24278374bdd82b4404ef6f7f122cec93859351fc6e5ea947e3ceb9d67374fe970e593e5cd05c905e1d24f5a5484f4aadef766e498adf64f7cf04bddd602ae8137b6eea40722d0203010001a321301f301d0603551d0e04160414110b7aa9ebc840b20399f69a431f4dba6ac42a64300d06092a864886f70d01010b0500038201010007c32ad893349cf86952fb5a49cfdc9b13f5e3c800aece77b2e7e0e9c83e34052f140f357ec7e6f4b432dc1ed542218a14835acd2df2deea7efd3fd5e8f1c34e1fb39ec6a427c6e6f4178b609b369040ac1f8844b789f3694dc640de06e44b247afed11637173f36f5886170fafd74954049858c6096308fc93c1bc4dd5685fa7a1f982a422f2a3b36baa8c9500474cf2af91c39cbec1bc898d10194d368aa5e91f1137ec115087c31962d8f76cd120d28c249cf76f4c70f5baa08c70a7234ce4123be080cee789477401965cfe537b924ef36747e8caca62dfefdd1a6288dcb1c4fd2aaa6131a7ad254e9742022cfd597d2ca5c660ce9e41ff537e5a4041e37"; // NOCHECKSTYLE LineLength
|
||||
Repo repo = MultiRepoUpdaterTest.createRepo("Testy", TESTY_JAR, context, badCert);
|
||||
Repo repo = MultiIndexUpdaterTest.createRepo("Testy", TESTY_JAR, context, badCert);
|
||||
IndexV1Updater updater = new IndexV1Updater(context, repo);
|
||||
JarFile jarFile = new JarFile(TestUtils.copyResourceToTempFile(TESTY_JAR), true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(IndexV1Updater.DATA_FILE_NAME);
|
||||
@ -144,9 +144,9 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
getClass().getResourceAsStream("foo");
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.UpdateException.class)
|
||||
public void testIndexV1WithOldTimestamp() throws IOException, RepoUpdater.UpdateException {
|
||||
Repo repo = MultiRepoUpdaterTest.createRepo("Testy", TESTY_JAR, context, TESTY_CERT);
|
||||
@Test(expected = IndexUpdater.UpdateException.class)
|
||||
public void testIndexV1WithOldTimestamp() throws IOException, IndexUpdater.UpdateException {
|
||||
Repo repo = MultiIndexUpdaterTest.createRepo("Testy", TESTY_JAR, context, TESTY_CERT);
|
||||
repo.timestamp = System.currentTimeMillis() / 1000;
|
||||
IndexV1Updater updater = new IndexV1Updater(context, repo);
|
||||
JarFile jarFile = new JarFile(TestUtils.copyResourceToTempFile(TESTY_JAR), true);
|
||||
@ -157,28 +157,28 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
getClass().getResourceAsStream("foo");
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoManifest() throws IOException, RepoUpdater.UpdateException {
|
||||
@Test(expected = IndexUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoManifest() throws IOException, IndexUpdater.UpdateException {
|
||||
testBadTestyJar("testy.at.or.at_no-MANIFEST.MF_index-v1.jar");
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSigningCert() throws IOException, RepoUpdater.UpdateException {
|
||||
@Test(expected = IndexUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSigningCert() throws IOException, IndexUpdater.UpdateException {
|
||||
testBadTestyJar("testy.at.or.at_no-.RSA_index-v1.jar");
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSignature() throws IOException, RepoUpdater.UpdateException {
|
||||
@Test(expected = IndexUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSignature() throws IOException, IndexUpdater.UpdateException {
|
||||
testBadTestyJar("testy.at.or.at_no-.SF_index-v1.jar");
|
||||
}
|
||||
|
||||
@Test(expected = RepoUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSignatureFiles() throws IOException, RepoUpdater.UpdateException {
|
||||
@Test(expected = IndexUpdater.SigningException.class)
|
||||
public void testIndexV1WithBadTestyJarNoSignatureFiles() throws IOException, IndexUpdater.UpdateException {
|
||||
testBadTestyJar("testy.at.or.at_no-signature_index-v1.jar");
|
||||
}
|
||||
|
||||
private void testBadTestyJar(String jar) throws IOException, RepoUpdater.UpdateException {
|
||||
Repo repo = MultiRepoUpdaterTest.createRepo("Testy", jar, context, TESTY_CERT);
|
||||
private void testBadTestyJar(String jar) throws IOException, IndexUpdater.UpdateException {
|
||||
Repo repo = MultiIndexUpdaterTest.createRepo("Testy", jar, context, TESTY_CERT);
|
||||
IndexV1Updater updater = new IndexV1Updater(context, repo);
|
||||
JarFile jarFile = new JarFile(TestUtils.copyResourceToTempFile(jar), true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(IndexV1Updater.DATA_FILE_NAME);
|
||||
|
@ -2,7 +2,7 @@ package org.fdroid.fdroid.updater;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
import org.fdroid.fdroid.data.Repo;
|
||||
@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals;
|
||||
@Config(constants = BuildConfig.class)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@SuppressWarnings("LineLength")
|
||||
public class Issue763MultiRepo extends MultiRepoUpdaterTest {
|
||||
public class Issue763MultiRepo extends MultiIndexUpdaterTest {
|
||||
|
||||
private Repo microGRepo;
|
||||
private Repo antoxRepo;
|
||||
@ -42,31 +42,31 @@ public class Issue763MultiRepo extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void antoxRepo() throws RepoUpdater.UpdateException {
|
||||
public void antoxRepo() throws IndexUpdater.UpdateException {
|
||||
assertAntoxEmpty();
|
||||
setEnabled(microGRepo, true);
|
||||
updateAntox();
|
||||
assertAntoxExists();
|
||||
}
|
||||
|
||||
private void updateAntox() throws RepoUpdater.UpdateException {
|
||||
updateRepo(new RepoUpdater(context, antoxRepo), "index.antox.jar");
|
||||
private void updateAntox() throws IndexUpdater.UpdateException {
|
||||
updateRepo(new IndexUpdater(context, antoxRepo), "index.antox.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void microGRepo() throws RepoUpdater.UpdateException {
|
||||
public void microGRepo() throws IndexUpdater.UpdateException {
|
||||
assertMicroGEmpty();
|
||||
setEnabled(microGRepo, true);
|
||||
updateMicroG();
|
||||
assertMicroGExists();
|
||||
}
|
||||
|
||||
private void updateMicroG() throws RepoUpdater.UpdateException {
|
||||
updateRepo(new RepoUpdater(context, microGRepo), "index.microg.jar");
|
||||
private void updateMicroG() throws IndexUpdater.UpdateException {
|
||||
updateRepo(new IndexUpdater(context, microGRepo), "index.microg.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void antoxAndMicroG() throws RepoUpdater.UpdateException {
|
||||
public void antoxAndMicroG() throws IndexUpdater.UpdateException {
|
||||
assertMicroGEmpty();
|
||||
assertAntoxEmpty();
|
||||
|
||||
|
@ -7,8 +7,8 @@ import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import org.fdroid.fdroid.IndexV1Updater;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.RepoUpdater.UpdateException;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater.UpdateException;
|
||||
import org.fdroid.fdroid.TestUtils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
@ -31,9 +31,9 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
||||
public abstract class MultiIndexUpdaterTest extends FDroidProviderTest {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = "AcceptableMultiRepoUpdaterTest"; // NOPMD
|
||||
private static final String TAG = "AcceptableMultiIndexUpdaterTest"; // NOPMD
|
||||
|
||||
protected static final String REPO_MAIN = "Test F-Droid repo";
|
||||
protected static final String REPO_ARCHIVE = "Test F-Droid repo (Archive)";
|
||||
@ -171,12 +171,12 @@ public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
||||
return RepoProvider.Helper.findByAddress(context, uri);
|
||||
}
|
||||
|
||||
protected RepoUpdater createRepoUpdater(String name, String uri, Context context) {
|
||||
return new RepoUpdater(context, createRepo(name, uri, context));
|
||||
protected IndexUpdater createRepoUpdater(String name, String uri, Context context) {
|
||||
return new IndexUpdater(context, createRepo(name, uri, context));
|
||||
}
|
||||
|
||||
protected RepoUpdater createRepoUpdater(String name, String uri, Context context, String signingCert) {
|
||||
return new RepoUpdater(context, createRepo(name, uri, context, signingCert));
|
||||
protected IndexUpdater createRepoUpdater(String name, String uri, Context context, String signingCert) {
|
||||
return new IndexUpdater(context, createRepo(name, uri, context, signingCert));
|
||||
}
|
||||
|
||||
protected IndexV1Updater createIndexV1Updater(String name, String uri, Context context, String signingCert) {
|
||||
@ -195,7 +195,7 @@ public abstract class MultiRepoUpdaterTest extends FDroidProviderTest {
|
||||
updateRepo(createRepoUpdater(REPO_ARCHIVE, REPO_ARCHIVE_URI, context), "multiRepo.archive.jar");
|
||||
}
|
||||
|
||||
protected void updateRepo(RepoUpdater updater, String indexJarPath) throws UpdateException {
|
||||
protected void updateRepo(IndexUpdater updater, String indexJarPath) throws UpdateException {
|
||||
File indexJar = TestUtils.copyResourceToTempFile(indexJarPath);
|
||||
try {
|
||||
if (updater instanceof IndexV1Updater) {
|
@ -5,7 +5,7 @@ import android.content.ContentValues;
|
||||
import android.support.annotation.StringDef;
|
||||
import android.util.Log;
|
||||
import org.fdroid.fdroid.BuildConfig;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.TestUtils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.ApkProvider;
|
||||
@ -34,9 +34,9 @@ import java.util.Map;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@Config(constants = BuildConfig.class, shadows = ProperMultiRepoUpdaterTest.ArmSystemProperties.class)
|
||||
@Config(constants = BuildConfig.class, shadows = ProperMultiIndexUpdaterTest.ArmSystemProperties.class)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
public class ProperMultiIndexUpdaterTest extends MultiIndexUpdaterTest {
|
||||
private static final String TAG = "ProperMultiRepoSupport";
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@ -44,7 +44,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
public @interface RepoIdentifier { }
|
||||
|
||||
@Test
|
||||
public void appsRemovedFromRepo() throws RepoUpdater.UpdateException {
|
||||
public void appsRemovedFromRepo() throws IndexUpdater.UpdateException {
|
||||
assertEquals(0, AppProvider.Helper.all(context.getContentResolver()).size());
|
||||
|
||||
updateMain();
|
||||
@ -56,7 +56,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
assertEquals(2, ApkProvider.Helper.findByPackageName(context, "com.uberspot.a2048").size());
|
||||
assertEquals(1, ApkProvider.Helper.findByPackageName(context, "siir.es.adbWireless").size());
|
||||
|
||||
RepoUpdater updater = new RepoUpdater(context, RepoProvider.Helper.findByAddress(context, repo.address));
|
||||
IndexUpdater updater = new IndexUpdater(context, RepoProvider.Helper.findByAddress(context, repo.address));
|
||||
updateRepo(updater, "multiRepo.conflicting.jar");
|
||||
|
||||
assertEquals(2, AppProvider.Helper.all(context.getContentResolver()).size());
|
||||
@ -66,7 +66,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mainRepo() throws RepoUpdater.UpdateException {
|
||||
public void mainRepo() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
updateMain();
|
||||
assertMainRepo();
|
||||
@ -76,7 +76,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void archiveRepo() throws RepoUpdater.UpdateException {
|
||||
public void archiveRepo() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
updateArchive();
|
||||
assertMainArchiveRepoMetadata();
|
||||
@ -85,7 +85,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void conflictingRepo() throws RepoUpdater.UpdateException {
|
||||
public void conflictingRepo() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
updateConflicting();
|
||||
assertConflictingRepo();
|
||||
@ -103,7 +103,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithRepoPriority() throws RepoUpdater.UpdateException {
|
||||
public void metadataWithRepoPriority() throws IndexUpdater.UpdateException {
|
||||
updateMain();
|
||||
updateArchive();
|
||||
updateConflicting();
|
||||
@ -163,7 +163,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectConflictingThenMainThenArchive() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectConflictingThenMainThenArchive() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateConflicting();
|
||||
@ -174,7 +174,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectConflictingThenArchiveThenMain() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectConflictingThenArchiveThenMain() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateConflicting();
|
||||
@ -185,7 +185,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectArchiveThenMainThenConflicting() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectArchiveThenMainThenConflicting() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateArchive();
|
||||
@ -196,7 +196,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectArchiveThenConflictingThenMain() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectArchiveThenConflictingThenMain() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateArchive();
|
||||
@ -207,7 +207,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectMainThenArchiveThenConflicting() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectMainThenArchiveThenConflicting() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateMain();
|
||||
@ -218,7 +218,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectMainThenConflictingThenArchive() throws RepoUpdater.UpdateException {
|
||||
public void testCorrectMainThenConflictingThenArchive() throws IndexUpdater.UpdateException {
|
||||
assertEmpty();
|
||||
|
||||
updateMain();
|
||||
@ -310,7 +310,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
assertAdAwayMetadata(adaway, id);
|
||||
}
|
||||
|
||||
/** @see ProperMultiRepoUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
/** @see ProperMultiIndexUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
private void assertAdAwayMetadata(App adaway, @RepoIdentifier String id) {
|
||||
assertNotNull(adaway);
|
||||
assertEquals(String.format("AdAway", id),
|
||||
@ -338,7 +338,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
assertAdbMetadata(adb, id);
|
||||
}
|
||||
|
||||
/** @see ProperMultiRepoUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
/** @see ProperMultiIndexUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
private void assertAdbMetadata(App adb, @RepoIdentifier String id) {
|
||||
assertNotNull(adb);
|
||||
assertEquals("adbWireless", adb.name);
|
||||
@ -355,7 +355,7 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
|
||||
assertCalendarMetadata(calendar, id);
|
||||
}
|
||||
|
||||
/** @see ProperMultiRepoUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
/** @see ProperMultiIndexUpdaterTest#assert2048Metadata(Repo, String) */
|
||||
private void assertCalendarMetadata(App calendar, @RepoIdentifier String id) {
|
||||
assertNotNull(calendar);
|
||||
assertEquals("Add to calendar",
|
@ -3,7 +3,7 @@ package org.fdroid.fdroid.localrepo;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.IndexUpdater;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -28,13 +28,13 @@ import static org.junit.Assert.assertNotNull;
|
||||
public class LocalRepoKeyStoreTest {
|
||||
|
||||
@Test
|
||||
public void testSignZip() throws IOException, LocalRepoKeyStore.InitException, RepoUpdater.SigningException {
|
||||
public void testSignZip() throws IOException, LocalRepoKeyStore.InitException, IndexUpdater.SigningException {
|
||||
Context context = RuntimeEnvironment.application;
|
||||
|
||||
File xmlIndexJarUnsigned = File.createTempFile(getClass().getName(), "unsigned.jar");
|
||||
BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(xmlIndexJarUnsigned));
|
||||
JarOutputStream jo = new JarOutputStream(bo);
|
||||
JarEntry je = new JarEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
JarEntry je = new JarEntry(IndexUpdater.DATA_FILE_NAME);
|
||||
jo.putNextEntry(je);
|
||||
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("smallRepo.xml");
|
||||
IOUtils.copy(inputStream, jo);
|
||||
@ -45,13 +45,13 @@ public class LocalRepoKeyStoreTest {
|
||||
Certificate localCert = localRepoKeyStore.getCertificate();
|
||||
assertFalse(TextUtils.isEmpty(Utils.calcFingerprint(localCert)));
|
||||
|
||||
File xmlIndexJar = File.createTempFile(getClass().getName(), RepoUpdater.SIGNED_FILE_NAME);
|
||||
File xmlIndexJar = File.createTempFile(getClass().getName(), IndexUpdater.SIGNED_FILE_NAME);
|
||||
localRepoKeyStore.signZip(xmlIndexJarUnsigned, xmlIndexJar);
|
||||
|
||||
JarFile jarFile = new JarFile(xmlIndexJar, true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(IndexUpdater.DATA_FILE_NAME);
|
||||
byte[] data = IOUtils.toByteArray(jarFile.getInputStream(indexEntry));
|
||||
assertEquals(17187, data.length);
|
||||
assertNotNull(RepoUpdater.getSigningCertFromJar(indexEntry));
|
||||
assertNotNull(IndexUpdater.getSigningCertFromJar(indexEntry));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user