Merge branch 'rename-id-to-package-name' into 'master'
Rename id to package name As suggested in issue #37, "id" is not the correct terminology to use in the code base. Instead, it should use "package name". I'm doing this now before I begin work on #511, where it is helpful to recoup the "id" name, as "rowid" in sqlite refers to a row's integer primary key. This changes the following Java symbols: * `Apk.id` -> `Apk.packageName` * `App.id` -> `App.packageName` * `ApkProvider.DataColumns.ID` -> `ApkProvider.DataColumns.PACKAGE_NAME` * `AppProvider.DataColumns.ID` -> `AppProvider.DataColumns.PACKAGE_NAME` * A small number of comments referring to `id`. It does _not_ change (and likely will not benefit from changing): * Any database columns, these are all still `id`. * Anything pertaining to the index, which still uses `id`. It does _not_ change (but future MR's will change): * Local variables referring to `id` * Method names referring to `id` By not changing any string literals, only changing the name of variables and constants, and ensuring that the original variables/constants are no longer present, then in theory if this compiles is should be good to merge. See merge request !183
This commit is contained in:
commit
feb7a2bd09
@ -171,7 +171,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
ApkListAdapter(Context context, App app) {
|
ApkListAdapter(Context context, App app) {
|
||||||
super(context, 0);
|
super(context, 0);
|
||||||
final List<Apk> apks = ApkProvider.Helper.findByApp(context, app.id);
|
final List<Apk> apks = ApkProvider.Helper.findByApp(context, app.packageName);
|
||||||
for (final Apk apk : apks) {
|
for (final Apk apk : apks) {
|
||||||
if (apk.compatible || Preferences.get().showIncompatibleVersions()) {
|
if (apk.compatible || Preferences.get().showIncompatibleVersions()) {
|
||||||
add(apk);
|
add(apk);
|
||||||
@ -192,9 +192,9 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Installed the same version, but from someplace else.
|
// Installed the same version, but from someplace else.
|
||||||
final String installerPkgName;
|
final String installerPkgName;
|
||||||
try {
|
try {
|
||||||
installerPkgName = mPm.getInstallerPackageName(app.id);
|
installerPkgName = mPm.getInstallerPackageName(app.packageName);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.w(TAG, "Application " + app.id + " is not installed anymore");
|
Log.w(TAG, "Application " + app.packageName + " is not installed anymore");
|
||||||
return getString(R.string.app_not_installed);
|
return getString(R.string.app_not_installed);
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(installerPkgName)) {
|
if (TextUtils.isEmpty(installerPkgName)) {
|
||||||
@ -431,13 +431,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
||||||
|
|
||||||
// Check if a download is running for this app
|
// Check if a download is running for this app
|
||||||
if (AsyncDownloaderFromAndroid.isDownloading(this, app.id) >= 0) {
|
if (AsyncDownloaderFromAndroid.isDownloading(this, app.packageName) >= 0) {
|
||||||
// call install() to re-setup the listeners and downloaders
|
// call install() to re-setup the listeners and downloaders
|
||||||
// the AsyncDownloader will not restart the download since the download is running,
|
// the AsyncDownloader will not restart the download since the download is running,
|
||||||
// and thus the version we pass to install() is not important
|
// and thus the version we pass to install() is not important
|
||||||
refreshHeader();
|
refreshHeader();
|
||||||
refreshApkList();
|
refreshApkList();
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(this, app.id, app.suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(this, app.packageName, app.suggestedVercode);
|
||||||
install(apkToInstall);
|
install(apkToInstall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// register observer to know when install status changes
|
// register observer to know when install status changes
|
||||||
myAppObserver = new AppObserver(new Handler());
|
myAppObserver = new AppObserver(new Handler());
|
||||||
getContentResolver().registerContentObserver(
|
getContentResolver().registerContentObserver(
|
||||||
AppProvider.getContentUri(app.id),
|
AppProvider.getContentUri(app.packageName),
|
||||||
true,
|
true,
|
||||||
myAppObserver);
|
myAppObserver);
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
||||||
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
||||||
Utils.debugLog(TAG, "Updating 'ignore updates', as it has changed since we started the activity...");
|
Utils.debugLog(TAG, "Updating 'ignore updates', as it has changed since we started the activity...");
|
||||||
setIgnoreUpdates(app.id, app.ignoreAllUpdates, app.ignoreThisUpdate);
|
setIgnoreUpdates(app.packageName, app.ignoreAllUpdates, app.ignoreThisUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
localBroadcastManager.unregisterReceiver(downloaderProgressReceiver);
|
localBroadcastManager.unregisterReceiver(downloaderProgressReceiver);
|
||||||
@ -531,7 +531,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void onAppChanged() {
|
private void onAppChanged() {
|
||||||
if (!reset(app.id)) {
|
if (!reset(app.packageName)) {
|
||||||
AppDetails.this.finish();
|
AppDetails.this.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
if (app == null)
|
if (app == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (mPm.getLaunchIntentForPackage(app.id) != null && app.canAndWantToUpdate()) {
|
if (mPm.getLaunchIntentForPackage(app.packageName) != null && app.canAndWantToUpdate()) {
|
||||||
MenuItemCompat.setShowAsAction(menu.add(
|
MenuItemCompat.setShowAsAction(menu.add(
|
||||||
Menu.NONE, LAUNCH, 1, R.string.menu_launch)
|
Menu.NONE, LAUNCH, 1, R.string.menu_launch)
|
||||||
.setIcon(R.drawable.ic_play_arrow_white),
|
.setIcon(R.drawable.ic_play_arrow_white),
|
||||||
@ -749,7 +749,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case LAUNCH:
|
case LAUNCH:
|
||||||
launchApk(app.id);
|
launchApk(app.packageName);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SHARE:
|
case SHARE:
|
||||||
@ -759,13 +759,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
case INSTALL:
|
case INSTALL:
|
||||||
// Note that this handles updating as well as installing.
|
// Note that this handles updating as well as installing.
|
||||||
if (app.suggestedVercode > 0) {
|
if (app.suggestedVercode > 0) {
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(this, app.id, app.suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(this, app.packageName, app.suggestedVercode);
|
||||||
install(apkToInstall);
|
install(apkToInstall);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case UNINSTALL:
|
case UNINSTALL:
|
||||||
removeApk(app.id);
|
removeApk(app.packageName);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case IGNOREALL:
|
case IGNOREALL:
|
||||||
@ -880,7 +880,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
private void installApk(File file) {
|
private void installApk(File file) {
|
||||||
try {
|
try {
|
||||||
installer.installPackage(file, app.id);
|
installer.installPackage(file, app.packageName);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
Log.e(TAG, "Android not compatible with this Installer!", e);
|
Log.e(TAG, "Android not compatible with this Installer!", e);
|
||||||
}
|
}
|
||||||
@ -903,7 +903,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (operation == Installer.InstallerCallback.OPERATION_INSTALL) {
|
if (operation == Installer.InstallerCallback.OPERATION_INSTALL) {
|
||||||
PackageManagerCompat.setInstaller(mPm, app.id);
|
PackageManagerCompat.setInstaller(mPm, app.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppChanged();
|
onAppChanged();
|
||||||
@ -962,7 +962,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
|
|
||||||
shareIntent.putExtra(Intent.EXTRA_SUBJECT, app.name);
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, app.name);
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, app.name + " (" + app.summary + ") - https://f-droid.org/app/" + app.id);
|
shareIntent.putExtra(Intent.EXTRA_TEXT, app.name + " (" + app.summary + ") - https://f-droid.org/app/" + app.packageName);
|
||||||
|
|
||||||
startActivity(Intent.createChooser(shareIntent, getString(R.string.menu_share)));
|
startActivity(Intent.createChooser(shareIntent, getString(R.string.menu_share)));
|
||||||
}
|
}
|
||||||
@ -1016,7 +1016,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case REQUEST_ENABLE_BLUETOOTH:
|
case REQUEST_ENABLE_BLUETOOTH:
|
||||||
fdroidApp.sendViaBluetooth(this, resultCode, app.id);
|
fdroidApp.sendViaBluetooth(this, resultCode, app.packageName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1210,7 +1210,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// App ID
|
// App ID
|
||||||
final TextView appIdView = (TextView) view.findViewById(R.id.appid);
|
final TextView appIdView = (TextView) view.findViewById(R.id.appid);
|
||||||
if (prefs.expertMode())
|
if (prefs.expertMode())
|
||||||
appIdView.setText(app.id);
|
appIdView.setText(app.packageName);
|
||||||
else
|
else
|
||||||
appIdView.setVisibility(View.GONE);
|
appIdView.setVisibility(View.GONE);
|
||||||
|
|
||||||
@ -1567,13 +1567,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
} else if (app.isInstalled()) {
|
} else if (app.isInstalled()) {
|
||||||
installed = true;
|
installed = true;
|
||||||
statusView.setText(getString(R.string.details_installed, app.installedVersionName));
|
statusView.setText(getString(R.string.details_installed, app.installedVersionName));
|
||||||
NfcHelper.setAndroidBeam(activity, app.id);
|
NfcHelper.setAndroidBeam(activity, app.packageName);
|
||||||
if (app.canAndWantToUpdate()) {
|
if (app.canAndWantToUpdate()) {
|
||||||
updateWanted = true;
|
updateWanted = true;
|
||||||
btMain.setText(R.string.menu_upgrade);
|
btMain.setText(R.string.menu_upgrade);
|
||||||
} else {
|
} else {
|
||||||
updateWanted = false;
|
updateWanted = false;
|
||||||
if (activity.mPm.getLaunchIntentForPackage(app.id) != null) {
|
if (activity.mPm.getLaunchIntentForPackage(app.packageName) != null) {
|
||||||
btMain.setText(R.string.menu_launch);
|
btMain.setText(R.string.menu_launch);
|
||||||
} else {
|
} else {
|
||||||
btMain.setText(R.string.menu_uninstall);
|
btMain.setText(R.string.menu_uninstall);
|
||||||
@ -1601,7 +1601,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
AppDetails activity = (AppDetails) getActivity();
|
AppDetails activity = (AppDetails) getActivity();
|
||||||
if (updateWanted) {
|
if (updateWanted) {
|
||||||
if (app.suggestedVercode > 0) {
|
if (app.suggestedVercode > 0) {
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(activity, app.id, app.suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(activity, app.packageName, app.suggestedVercode);
|
||||||
activity.install(apkToInstall);
|
activity.install(apkToInstall);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1609,16 +1609,16 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// If installed
|
// If installed
|
||||||
if (installed) {
|
if (installed) {
|
||||||
// If "launchable", launch
|
// If "launchable", launch
|
||||||
if (activity.mPm.getLaunchIntentForPackage(app.id) != null) {
|
if (activity.mPm.getLaunchIntentForPackage(app.packageName) != null) {
|
||||||
activity.launchApk(app.id);
|
activity.launchApk(app.packageName);
|
||||||
} else {
|
} else {
|
||||||
activity.removeApk(app.id);
|
activity.removeApk(app.packageName);
|
||||||
}
|
}
|
||||||
// If not installed, install
|
// If not installed, install
|
||||||
} else if (app.suggestedVercode > 0) {
|
} else if (app.suggestedVercode > 0) {
|
||||||
btMain.setEnabled(false);
|
btMain.setEnabled(false);
|
||||||
btMain.setText(R.string.system_install_installing);
|
btMain.setText(R.string.system_install_installing);
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(activity, app.id, app.suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(activity, app.packageName, app.suggestedVercode);
|
||||||
activity.install(apkToInstall);
|
activity.install(apkToInstall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1647,7 +1647,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void remove() {
|
protected void remove() {
|
||||||
installListener.removeApk(getApp().id);
|
installListener.removeApk(getApp().packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected App getApp() {
|
protected App getApp() {
|
||||||
|
@ -101,7 +101,7 @@ public class CompatibilityChecker extends Compatibility {
|
|||||||
}
|
}
|
||||||
if (!features.contains(feat)) {
|
if (!features.contains(feat)) {
|
||||||
Collections.addAll(incompatibleReasons, feat.split(","));
|
Collections.addAll(incompatibleReasons, feat.split(","));
|
||||||
Utils.debugLog(TAG, apk.id + " vercode " + apk.vercode
|
Utils.debugLog(TAG, apk.packageName + " vercode " + apk.vercode
|
||||||
+ " is incompatible based on lack of " + feat);
|
+ " is incompatible based on lack of " + feat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ public class CompatibilityChecker extends Compatibility {
|
|||||||
for (final String code : apk.nativecode) {
|
for (final String code : apk.nativecode) {
|
||||||
incompatibleReasons.add(code);
|
incompatibleReasons.add(code);
|
||||||
}
|
}
|
||||||
Utils.debugLog(TAG, apk.id + " vercode " + apk.vercode
|
Utils.debugLog(TAG, apk.packageName + " vercode " + apk.vercode
|
||||||
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
+ " only supports " + Utils.CommaSeparatedList.str(apk.nativecode)
|
||||||
+ " while your architectures are " + cpuAbisDesc);
|
+ " while your architectures are " + cpuAbisDesc);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
receiver.receiveApp(curapp, apksList);
|
receiver.receiveApp(curapp, apksList);
|
||||||
curapp = null;
|
curapp = null;
|
||||||
apksList = new ArrayList<>();
|
apksList = new ArrayList<>();
|
||||||
// If the app id is already present in this apps list, then it
|
// If the app packageName is already present in this apps list, then it
|
||||||
// means the same index file has a duplicate app, which should
|
// means the same index file has a duplicate app, which should
|
||||||
// not be allowed.
|
// not be allowed.
|
||||||
// However, I'm thinking that it should be undefined behaviour,
|
// However, I'm thinking that it should be undefined behaviour,
|
||||||
@ -249,10 +249,10 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
repoDescription = cleanWhiteSpace(attributes.getValue("", "description"));
|
repoDescription = cleanWhiteSpace(attributes.getValue("", "description"));
|
||||||
} else if ("application".equals(localName) && curapp == null) {
|
} else if ("application".equals(localName) && curapp == null) {
|
||||||
curapp = new App();
|
curapp = new App();
|
||||||
curapp.id = attributes.getValue("", "id");
|
curapp.packageName = attributes.getValue("", "id");
|
||||||
} else if ("package".equals(localName) && curapp != null && curapk == null) {
|
} else if ("package".equals(localName) && curapp != null && curapk == null) {
|
||||||
curapk = new Apk();
|
curapk = new Apk();
|
||||||
curapk.id = curapp.id;
|
curapk.packageName = curapp.packageName;
|
||||||
curapk.repo = repo.getId();
|
curapk.repo = repo.getId();
|
||||||
currentApkHashType = null;
|
currentApkHashType = null;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
public class Apk extends ValueObject implements Comparable<Apk> {
|
public class Apk extends ValueObject implements Comparable<Apk> {
|
||||||
|
|
||||||
public String id;
|
public String packageName;
|
||||||
public String version;
|
public String version;
|
||||||
public int vercode;
|
public int vercode;
|
||||||
public int size; // Size in bytes - 0 means we don't know!
|
public int size; // Size in bytes - 0 means we don't know!
|
||||||
@ -64,8 +64,8 @@ public class Apk extends ValueObject implements Comparable<Apk> {
|
|||||||
case ApkProvider.DataColumns.FEATURES:
|
case ApkProvider.DataColumns.FEATURES:
|
||||||
features = Utils.CommaSeparatedList.make(cursor.getString(i));
|
features = Utils.CommaSeparatedList.make(cursor.getString(i));
|
||||||
break;
|
break;
|
||||||
case ApkProvider.DataColumns.APK_ID:
|
case ApkProvider.DataColumns.PACKAGE_NAME:
|
||||||
id = cursor.getString(i);
|
packageName = cursor.getString(i);
|
||||||
break;
|
break;
|
||||||
case ApkProvider.DataColumns.IS_COMPATIBLE:
|
case ApkProvider.DataColumns.IS_COMPATIBLE:
|
||||||
compatible = cursor.getInt(i) == 1;
|
compatible = cursor.getInt(i) == 1;
|
||||||
@ -118,12 +118,12 @@ public class Apk extends ValueObject implements Comparable<Apk> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id + " (version " + vercode + ")";
|
return packageName + " (version " + vercode + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentValues toContentValues() {
|
public ContentValues toContentValues() {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(ApkProvider.DataColumns.APK_ID, id);
|
values.put(ApkProvider.DataColumns.PACKAGE_NAME, packageName);
|
||||||
values.put(ApkProvider.DataColumns.VERSION, version);
|
values.put(ApkProvider.DataColumns.VERSION, version);
|
||||||
values.put(ApkProvider.DataColumns.VERSION_CODE, vercode);
|
values.put(ApkProvider.DataColumns.VERSION_CODE, vercode);
|
||||||
values.put(ApkProvider.DataColumns.REPO_ID, repo);
|
values.put(ApkProvider.DataColumns.REPO_ID, repo);
|
||||||
|
@ -22,7 +22,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SQLite has a maximum of 999 parameters in a query. Each apk we add
|
* SQLite has a maximum of 999 parameters in a query. Each apk we add
|
||||||
* requires two (id and vercode) so we can only query half of that. Then,
|
* requires two (packageName and vercode) so we can only query half of that. Then,
|
||||||
* we may want to add additional constraints, so we give our self some
|
* we may want to add additional constraints, so we give our self some
|
||||||
* room by saying only 450 apks can be queried at once.
|
* room by saying only 450 apks can be queried at once.
|
||||||
*/
|
*/
|
||||||
@ -34,7 +34,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
|
|
||||||
public static void update(Context context, Apk apk) {
|
public static void update(Context context, Apk apk) {
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
Uri uri = getContentUri(apk.id, apk.vercode);
|
Uri uri = getContentUri(apk.packageName, apk.vercode);
|
||||||
resolver.update(uri, apk.toContentValues(), null, null);
|
resolver.update(uri, apk.toContentValues(), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
|
|
||||||
public static void deleteApksByApp(Context context, App app) {
|
public static void deleteApksByApp(Context context, App app) {
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
final Uri uri = getAppUri(app.id);
|
final Uri uri = getAppUri(app.packageName);
|
||||||
resolver.delete(uri, null, null);
|
resolver.delete(uri, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns apks in the database, which have the same id and version as
|
* Returns apks in the database, which have the same packageName and version as
|
||||||
* one of the apks in the "apks" argument.
|
* one of the apks in the "apks" argument.
|
||||||
*/
|
*/
|
||||||
public static List<Apk> knownApks(Context context, List<Apk> apks, String[] fields) {
|
public static List<Apk> knownApks(Context context, List<Apk> apks, String[] fields) {
|
||||||
@ -194,7 +194,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
|
|
||||||
String _COUNT_DISTINCT_ID = "countDistinct";
|
String _COUNT_DISTINCT_ID = "countDistinct";
|
||||||
|
|
||||||
String APK_ID = "id";
|
String PACKAGE_NAME = "id";
|
||||||
String VERSION = "version";
|
String VERSION = "version";
|
||||||
String REPO_ID = "repo";
|
String REPO_ID = "repo";
|
||||||
String HASH = "hash";
|
String HASH = "hash";
|
||||||
@ -216,7 +216,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
String REPO_ADDRESS = "repoAddress";
|
String REPO_ADDRESS = "repoAddress";
|
||||||
|
|
||||||
String[] ALL = {
|
String[] ALL = {
|
||||||
_ID, APK_ID, VERSION, REPO_ID, HASH, VERSION_CODE, NAME, SIZE,
|
_ID, PACKAGE_NAME, VERSION, REPO_ID, HASH, VERSION_CODE, NAME, SIZE,
|
||||||
SIGNATURE, SOURCE_NAME, MIN_SDK_VERSION, MAX_SDK_VERSION,
|
SIGNATURE, SOURCE_NAME, MIN_SDK_VERSION, MAX_SDK_VERSION,
|
||||||
PERMISSIONS, FEATURES, NATIVE_CODE, HASH_TYPE, ADDED_DATE,
|
PERMISSIONS, FEATURES, NATIVE_CODE, HASH_TYPE, ADDED_DATE,
|
||||||
IS_COMPATIBLE, REPO_VERSION, REPO_ADDRESS, INCOMPATIBLE_REASONS,
|
IS_COMPATIBLE, REPO_VERSION, REPO_ADDRESS, INCOMPATIBLE_REASONS,
|
||||||
@ -279,7 +279,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getContentUri(Apk apk) {
|
public static Uri getContentUri(Apk apk) {
|
||||||
return getContentUri(apk.id, apk.vercode);
|
return getContentUri(apk.packageName, apk.vercode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getContentUri(String id, int versionCode) {
|
public static Uri getContentUri(String id, int versionCode) {
|
||||||
@ -329,7 +329,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
builder.append(',');
|
builder.append(',');
|
||||||
}
|
}
|
||||||
final Apk a = apks.get(i);
|
final Apk a = apks.get(i);
|
||||||
builder.append(a.id).append(':').append(a.vercode);
|
builder.append(a.packageName).append(':').append(a.vercode);
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
builder.append(',');
|
builder.append(',');
|
||||||
}
|
}
|
||||||
builder.append(apks.get(i).id);
|
builder.append(apks.get(i).packageName);
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private QuerySelection queryApp(String appId) {
|
private QuerySelection queryApp(String appId) {
|
||||||
final String selection = DataColumns.APK_ID + " = ? ";
|
final String selection = DataColumns.PACKAGE_NAME + " = ? ";
|
||||||
final String[] args = {appId};
|
final String[] args = {appId};
|
||||||
return new QuerySelection(selection, args);
|
return new QuerySelection(selection, args);
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private QuerySelection queryRepoApps(long repoId, String appIds) {
|
private QuerySelection queryRepoApps(long repoId, String appIds) {
|
||||||
return queryRepo(repoId).add(AppProvider.queryApps(appIds, DataColumns.APK_ID));
|
return queryRepo(repoId).add(AppProvider.queryApps(appIds, DataColumns.PACKAGE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected QuerySelection queryApks(String apkKeys) {
|
protected QuerySelection queryApks(String apkKeys) {
|
||||||
@ -512,7 +512,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
getContext().getContentResolver().notifyChange(uri, null);
|
getContext().getContentResolver().notifyChange(uri, null);
|
||||||
}
|
}
|
||||||
return getContentUri(
|
return getContentUri(
|
||||||
values.getAsString(DataColumns.APK_ID),
|
values.getAsString(DataColumns.PACKAGE_NAME),
|
||||||
values.getAsInteger(DataColumns.VERSION_CODE));
|
values.getAsInteger(DataColumns.VERSION_CODE));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
// True if compatible with the device (i.e. if at least one apk is)
|
// True if compatible with the device (i.e. if at least one apk is)
|
||||||
public boolean compatible;
|
public boolean compatible;
|
||||||
|
|
||||||
public String id = "unknown";
|
public String packageName = "unknown";
|
||||||
public String name = "Unknown";
|
public String name = "Unknown";
|
||||||
public String summary = "Unknown application";
|
public String summary = "Unknown application";
|
||||||
public String icon;
|
public String icon;
|
||||||
@ -124,8 +124,8 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
case AppProvider.DataColumns.IS_COMPATIBLE:
|
case AppProvider.DataColumns.IS_COMPATIBLE:
|
||||||
compatible = cursor.getInt(i) == 1;
|
compatible = cursor.getInt(i) == 1;
|
||||||
break;
|
break;
|
||||||
case AppProvider.DataColumns.APP_ID:
|
case AppProvider.DataColumns.PACKAGE_NAME:
|
||||||
id = cursor.getString(i);
|
packageName = cursor.getString(i);
|
||||||
break;
|
break;
|
||||||
case AppProvider.DataColumns.NAME:
|
case AppProvider.DataColumns.NAME:
|
||||||
name = cursor.getString(i);
|
name = cursor.getString(i);
|
||||||
@ -252,7 +252,7 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
this.summary = "(installed by " + installerPackageLabel + ")";
|
this.summary = "(installed by " + installerPackageLabel + ")";
|
||||||
else
|
else
|
||||||
this.summary = (String) appDescription.subSequence(0, 40);
|
this.summary = (String) appDescription.subSequence(0, 40);
|
||||||
this.id = appInfo.packageName;
|
this.packageName = appInfo.packageName;
|
||||||
this.added = new Date(packageInfo.firstInstallTime);
|
this.added = new Date(packageInfo.firstInstallTime);
|
||||||
this.lastUpdated = new Date(packageInfo.lastUpdateTime);
|
this.lastUpdated = new Date(packageInfo.lastUpdateTime);
|
||||||
this.description = "<p>";
|
this.description = "<p>";
|
||||||
@ -273,10 +273,10 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
apk.added = this.added;
|
apk.added = this.added;
|
||||||
apk.minSdkVersion = Utils.getMinSdkVersion(context, packageName);
|
apk.minSdkVersion = Utils.getMinSdkVersion(context, packageName);
|
||||||
apk.maxSdkVersion = Utils.getMaxSdkVersion(context, packageName);
|
apk.maxSdkVersion = Utils.getMaxSdkVersion(context, packageName);
|
||||||
apk.id = this.id;
|
apk.packageName = this.packageName;
|
||||||
apk.installedFile = apkFile;
|
apk.installedFile = apkFile;
|
||||||
apk.permissions = Utils.CommaSeparatedList.make(packageInfo.requestedPermissions);
|
apk.permissions = Utils.CommaSeparatedList.make(packageInfo.requestedPermissions);
|
||||||
apk.apkName = apk.id + "_" + apk.vercode + ".apk";
|
apk.apkName = apk.packageName + "_" + apk.vercode + ".apk";
|
||||||
|
|
||||||
final FeatureInfo[] features = packageInfo.reqFeatures;
|
final FeatureInfo[] features = packageInfo.reqFeatures;
|
||||||
if (features != null && features.length > 0) {
|
if (features != null && features.length > 0) {
|
||||||
@ -352,7 +352,7 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if (TextUtils.isEmpty(this.name)
|
if (TextUtils.isEmpty(this.name)
|
||||||
|| TextUtils.isEmpty(this.id))
|
|| TextUtils.isEmpty(this.packageName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this.installedApk == null)
|
if (this.installedApk == null)
|
||||||
@ -369,7 +369,7 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
public ContentValues toContentValues() {
|
public ContentValues toContentValues() {
|
||||||
|
|
||||||
final ContentValues values = new ContentValues();
|
final ContentValues values = new ContentValues();
|
||||||
values.put(AppProvider.DataColumns.APP_ID, id);
|
values.put(AppProvider.DataColumns.PACKAGE_NAME, packageName);
|
||||||
values.put(AppProvider.DataColumns.NAME, name);
|
values.put(AppProvider.DataColumns.NAME, name);
|
||||||
values.put(AppProvider.DataColumns.SUMMARY, summary);
|
values.put(AppProvider.DataColumns.SUMMARY, summary);
|
||||||
values.put(AppProvider.DataColumns.ICON, icon);
|
values.put(AppProvider.DataColumns.ICON, icon);
|
||||||
|
@ -173,7 +173,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
String _ID = "rowid as _id"; // Required for CursorLoaders
|
String _ID = "rowid as _id"; // Required for CursorLoaders
|
||||||
String _COUNT = "_count";
|
String _COUNT = "_count";
|
||||||
String IS_COMPATIBLE = "compatible";
|
String IS_COMPATIBLE = "compatible";
|
||||||
String APP_ID = "id";
|
String PACKAGE_NAME = "id";
|
||||||
String NAME = "name";
|
String NAME = "name";
|
||||||
String SUMMARY = "summary";
|
String SUMMARY = "summary";
|
||||||
String ICON = "icon";
|
String ICON = "icon";
|
||||||
@ -211,7 +211,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String[] ALL = {
|
String[] ALL = {
|
||||||
_ID, IS_COMPATIBLE, APP_ID, NAME, SUMMARY, ICON, DESCRIPTION,
|
_ID, IS_COMPATIBLE, PACKAGE_NAME, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||||
LICENSE, WEB_URL, TRACKER_URL, SOURCE_URL, CHANGELOG_URL, DONATE_URL,
|
LICENSE, WEB_URL, TRACKER_URL, SOURCE_URL, CHANGELOG_URL, DONATE_URL,
|
||||||
BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID,
|
BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID,
|
||||||
UPSTREAM_VERSION, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
|
UPSTREAM_VERSION, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||||
@ -523,7 +523,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
builder.append(',');
|
builder.append(',');
|
||||||
}
|
}
|
||||||
builder.append(apps.get(i).id);
|
builder.append(apps.get(i).packageName);
|
||||||
}
|
}
|
||||||
return getContentUri().buildUpon()
|
return getContentUri().buildUpon()
|
||||||
.appendPath(PATH_APPS)
|
.appendPath(PATH_APPS)
|
||||||
@ -532,7 +532,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getContentUri(App app) {
|
public static Uri getContentUri(App app) {
|
||||||
return getContentUri(app.id);
|
return getContentUri(app.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getContentUri(String appId) {
|
public static Uri getContentUri(String appId) {
|
||||||
@ -851,7 +851,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
if (!isApplyingBatch()) {
|
if (!isApplyingBatch()) {
|
||||||
getContext().getContentResolver().notifyChange(uri, null);
|
getContext().getContentResolver().notifyChange(uri, null);
|
||||||
}
|
}
|
||||||
return getContentUri(values.getAsString(DataColumns.APP_ID));
|
return getContentUri(values.getAsString(DataColumns.PACKAGE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,7 +109,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
|||||||
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
|
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
|
||||||
Utils.debugLog(TAG, "Could not get application label", e);
|
Utils.debugLog(TAG, "Could not get application label", e);
|
||||||
}
|
}
|
||||||
return packageName; // all else fails, return id
|
return packageName; // all else fails, return packageName
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPackageSig(PackageInfo info) {
|
public static String getPackageSig(PackageInfo info) {
|
||||||
|
@ -73,7 +73,7 @@ public class RepoPersister {
|
|||||||
|
|
||||||
public void saveToDb(App app, List<Apk> packages) throws RepoUpdater.UpdateException {
|
public void saveToDb(App app, List<Apk> packages) throws RepoUpdater.UpdateException {
|
||||||
appsToSave.add(app);
|
appsToSave.add(app);
|
||||||
apksToSave.put(app.id, packages);
|
apksToSave.put(app.packageName, packages);
|
||||||
|
|
||||||
if (appsToSave.size() >= MAX_APP_BUFFER) {
|
if (appsToSave.size() >= MAX_APP_BUFFER) {
|
||||||
flushBufferToDb();
|
flushBufferToDb();
|
||||||
@ -161,7 +161,7 @@ public class RepoPersister {
|
|||||||
*/
|
*/
|
||||||
private ArrayList<ContentProviderOperation> insertOrUpdateApks(List<Apk> packages) {
|
private ArrayList<ContentProviderOperation> insertOrUpdateApks(List<Apk> packages) {
|
||||||
String[] projection = new String[]{
|
String[] projection = new String[]{
|
||||||
ApkProvider.DataColumns.APK_ID,
|
ApkProvider.DataColumns.PACKAGE_NAME,
|
||||||
ApkProvider.DataColumns.VERSION_CODE,
|
ApkProvider.DataColumns.VERSION_CODE,
|
||||||
};
|
};
|
||||||
List<Apk> existingApks = ApkProvider.Helper.knownApks(context, packages, projection);
|
List<Apk> existingApks = ApkProvider.Helper.knownApks(context, packages, projection);
|
||||||
@ -169,7 +169,7 @@ public class RepoPersister {
|
|||||||
for (Apk apk : packages) {
|
for (Apk apk : packages) {
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
for (Apk existing : existingApks) {
|
for (Apk existing : existingApks) {
|
||||||
if (existing.id.equals(apk.id) && existing.vercode == apk.vercode) {
|
if (existing.packageName.equals(apk.packageName) && existing.vercode == apk.vercode) {
|
||||||
exists = true;
|
exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -216,8 +216,8 @@ public class RepoPersister {
|
|||||||
* array.
|
* array.
|
||||||
*/
|
*/
|
||||||
private boolean isAppInDatabase(App app) {
|
private boolean isAppInDatabase(App app) {
|
||||||
String[] fields = {AppProvider.DataColumns.APP_ID};
|
String[] fields = {AppProvider.DataColumns.PACKAGE_NAME};
|
||||||
App found = AppProvider.Helper.findById(context.getContentResolver(), app.id, fields);
|
App found = AppProvider.Helper.findById(context.getContentResolver(), app.packageName, fields);
|
||||||
return found != null;
|
return found != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,15 +247,15 @@ public class RepoPersister {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private ContentProviderOperation deleteOrphanedApks(List<App> apps, Map<String, List<Apk>> packages) {
|
private ContentProviderOperation deleteOrphanedApks(List<App> apps, Map<String, List<Apk>> packages) {
|
||||||
String[] projection = new String[]{ApkProvider.DataColumns.APK_ID, ApkProvider.DataColumns.VERSION_CODE};
|
String[] projection = new String[]{ApkProvider.DataColumns.PACKAGE_NAME, ApkProvider.DataColumns.VERSION_CODE};
|
||||||
List<Apk> existing = ApkProvider.Helper.find(context, repo, apps, projection);
|
List<Apk> existing = ApkProvider.Helper.find(context, repo, apps, projection);
|
||||||
List<Apk> toDelete = new ArrayList<>();
|
List<Apk> toDelete = new ArrayList<>();
|
||||||
|
|
||||||
for (Apk existingApk : existing) {
|
for (Apk existingApk : existing) {
|
||||||
boolean shouldStay = false;
|
boolean shouldStay = false;
|
||||||
|
|
||||||
if (packages.containsKey(existingApk.id)) {
|
if (packages.containsKey(existingApk.packageName)) {
|
||||||
for (Apk newApk : packages.get(existingApk.id)) {
|
for (Apk newApk : packages.get(existingApk.packageName)) {
|
||||||
if (newApk.vercode == existingApk.vercode) {
|
if (newApk.vercode == existingApk.vercode) {
|
||||||
shouldStay = true;
|
shouldStay = true;
|
||||||
break;
|
break;
|
||||||
|
@ -49,7 +49,7 @@ public class TempApkProvider extends ApkProvider {
|
|||||||
.buildUpon()
|
.buildUpon()
|
||||||
.appendPath(PATH_APK)
|
.appendPath(PATH_APK)
|
||||||
.appendPath(Integer.toString(apk.vercode))
|
.appendPath(Integer.toString(apk.vercode))
|
||||||
.appendPath(apk.id)
|
.appendPath(apk.packageName)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class TempAppProvider extends AppProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getAppUri(App app) {
|
public static Uri getAppUri(App app) {
|
||||||
return Uri.withAppendedPath(getContentUri(), app.id);
|
return Uri.withAppendedPath(getContentUri(), app.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Helper {
|
public static class Helper {
|
||||||
|
@ -282,8 +282,8 @@ public final class LocalRepoManager {
|
|||||||
for (final App app : apps.values()) {
|
for (final App app : apps.values()) {
|
||||||
if (app.installedApk != null) {
|
if (app.installedApk != null) {
|
||||||
try {
|
try {
|
||||||
appInfo = pm.getApplicationInfo(app.id, PackageManager.GET_META_DATA);
|
appInfo = pm.getApplicationInfo(app.packageName, PackageManager.GET_META_DATA);
|
||||||
copyIconToRepo(appInfo.loadIcon(pm), app.id, app.installedApk.vercode);
|
copyIconToRepo(appInfo.loadIcon(pm), app.packageName, app.installedApk.vercode);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(TAG, "Error getting app icon", e);
|
Log.e(TAG, "Error getting app icon", e);
|
||||||
}
|
}
|
||||||
@ -413,9 +413,9 @@ public final class LocalRepoManager {
|
|||||||
|
|
||||||
private void tagApplication(App app) throws IOException {
|
private void tagApplication(App app) throws IOException {
|
||||||
serializer.startTag("", "application");
|
serializer.startTag("", "application");
|
||||||
serializer.attribute("", "id", app.id);
|
serializer.attribute("", "id", app.packageName);
|
||||||
|
|
||||||
tag("id", app.id);
|
tag("id", app.packageName);
|
||||||
tag("added", app.added);
|
tag("added", app.added);
|
||||||
tag("lastupdated", app.lastUpdated);
|
tag("lastupdated", app.lastUpdated);
|
||||||
tag("name", app.name);
|
tag("name", app.name);
|
||||||
|
@ -197,7 +197,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
|
|||||||
Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
Utils.debugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, app.name + " " + curApk.version, curApk.id, credentials, this);
|
dlWrapper = DownloaderFactory.createAsync(context, remoteAddress, localFile, app.name + " " + curApk.version, curApk.packageName, credentials, this);
|
||||||
dlWrapper.download();
|
dlWrapper.download();
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -35,7 +35,7 @@ public abstract class AppListFragment extends ListFragment implements
|
|||||||
|
|
||||||
public static final String[] APP_PROJECTION = {
|
public static final String[] APP_PROJECTION = {
|
||||||
AppProvider.DataColumns._ID, // Required for cursor loader to work.
|
AppProvider.DataColumns._ID, // Required for cursor loader to work.
|
||||||
AppProvider.DataColumns.APP_ID,
|
AppProvider.DataColumns.PACKAGE_NAME,
|
||||||
AppProvider.DataColumns.NAME,
|
AppProvider.DataColumns.NAME,
|
||||||
AppProvider.DataColumns.SUMMARY,
|
AppProvider.DataColumns.SUMMARY,
|
||||||
AppProvider.DataColumns.IS_COMPATIBLE,
|
AppProvider.DataColumns.IS_COMPATIBLE,
|
||||||
@ -156,7 +156,7 @@ public abstract class AppListFragment extends ListFragment implements
|
|||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
final App app = new App(cursor);
|
final App app = new App(cursor);
|
||||||
Intent intent = getAppDetailsIntent();
|
Intent intent = getAppDetailsIntent();
|
||||||
intent.putExtra(AppDetails.EXTRA_APPID, app.id);
|
intent.putExtra(AppDetails.EXTRA_APPID, app.packageName);
|
||||||
intent.putExtra(AppDetails.EXTRA_FROM, getFromTitle());
|
intent.putExtra(AppDetails.EXTRA_FROM, getFromTitle());
|
||||||
startActivityForResult(intent, REQUEST_APPDETAILS);
|
startActivityForResult(intent, REQUEST_APPDETAILS);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
|
|||||||
final App app = new App((Cursor) adapter.getItem(position));
|
final App app = new App((Cursor) adapter.getItem(position));
|
||||||
|
|
||||||
Intent intent = new Intent(getActivity(), AppDetails.class);
|
Intent intent = new Intent(getActivity(), AppDetails.class);
|
||||||
intent.putExtra(AppDetails.EXTRA_APPID, app.id);
|
intent.putExtra(AppDetails.EXTRA_APPID, app.packageName);
|
||||||
intent.putExtra(AppDetails.EXTRA_HINT_SEARCHING, true);
|
intent.putExtra(AppDetails.EXTRA_HINT_SEARCHING, true);
|
||||||
startActivityForResult(intent, REQUEST_APPDETAILS);
|
startActivityForResult(intent, REQUEST_APPDETAILS);
|
||||||
super.onListItemClick(l, v, position, id);
|
super.onListItemClick(l, v, position, id);
|
||||||
|
@ -125,7 +125,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
|
|
||||||
private void pollForUpdates() {
|
private void pollForUpdates() {
|
||||||
if (adapter.getCount() > 1 ||
|
if (adapter.getCount() > 1 ||
|
||||||
(adapter.getCount() == 1 && !new App((Cursor) adapter.getItem(0)).id.equals("org.fdroid.fdroid"))) {
|
(adapter.getCount() == 1 && !new App((Cursor) adapter.getItem(0)).packageName.equals("org.fdroid.fdroid"))) {
|
||||||
Utils.debugLog(TAG, "Not polling for new apps from swap repo, because we already have more than one.");
|
Utils.debugLog(TAG, "Not polling for new apps from swap repo, because we already have more than one.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
public void onChange(boolean selfChange) {
|
public void onChange(boolean selfChange) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
app = AppProvider.Helper.findById(getActivity().getContentResolver(), app.id);
|
app = AppProvider.Helper.findById(getActivity().getContentResolver(), app.packageName);
|
||||||
apkToInstall = null; // Force lazy loading to fetch correct apk next time.
|
apkToInstall = null; // Force lazy loading to fetch correct apk next time.
|
||||||
resetView();
|
resetView();
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setApp(@NonNull App app) {
|
public void setApp(@NonNull App app) {
|
||||||
if (this.app == null || !this.app.id.equals(app.id)) {
|
if (this.app == null || !this.app.packageName.equals(app.packageName)) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
apkToInstall = null; // Force lazy loading to fetch the correct apk next time.
|
apkToInstall = null; // Force lazy loading to fetch the correct apk next time.
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
// implemented on API-16, so leaving like this for now.
|
// implemented on API-16, so leaving like this for now.
|
||||||
getActivity().getContentResolver().unregisterContentObserver(appObserver);
|
getActivity().getContentResolver().unregisterContentObserver(appObserver);
|
||||||
getActivity().getContentResolver().registerContentObserver(
|
getActivity().getContentResolver().registerContentObserver(
|
||||||
AppProvider.getContentUri(this.app.id), true, appObserver);
|
AppProvider.getContentUri(this.app.packageName), true, appObserver);
|
||||||
}
|
}
|
||||||
resetView();
|
resetView();
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
*/
|
*/
|
||||||
private Apk getApkToInstall() {
|
private Apk getApkToInstall() {
|
||||||
if (apkToInstall == null) {
|
if (apkToInstall == null) {
|
||||||
apkToInstall = ApkProvider.Helper.find(getActivity(), app.id, app.suggestedVercode);
|
apkToInstall = ApkProvider.Helper.find(getActivity(), app.packageName, app.suggestedVercode);
|
||||||
}
|
}
|
||||||
return apkToInstall;
|
return apkToInstall;
|
||||||
}
|
}
|
||||||
|
@ -781,14 +781,14 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void install(@NonNull final App app) {
|
public void install(@NonNull final App app) {
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(this, app.id, app.suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(this, app.packageName, app.suggestedVercode);
|
||||||
final ApkDownloader downloader = new ApkDownloader(this, app, apkToInstall, apkToInstall.repoAddress);
|
final ApkDownloader downloader = new ApkDownloader(this, app, apkToInstall, apkToInstall.repoAddress);
|
||||||
downloader.setProgressListener(new ProgressListener() {
|
downloader.setProgressListener(new ProgressListener() {
|
||||||
@Override
|
@Override
|
||||||
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(), app.id);
|
handleDownloadComplete(downloader.localFile(), app.packageName);
|
||||||
break;
|
break;
|
||||||
case ApkDownloader.EVENT_ERROR:
|
case ApkDownloader.EVENT_ERROR:
|
||||||
break;
|
break;
|
||||||
|
@ -56,7 +56,7 @@ public class ApkProviderHelperTest extends BaseApkProviderTest {
|
|||||||
Collections.addAll(apksToCheck, unknown);
|
Collections.addAll(apksToCheck, unknown);
|
||||||
|
|
||||||
String[] projection = {
|
String[] projection = {
|
||||||
ApkProvider.DataColumns.APK_ID,
|
ApkProvider.DataColumns.PACKAGE_NAME,
|
||||||
ApkProvider.DataColumns.VERSION_CODE,
|
ApkProvider.DataColumns.VERSION_CODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class ApkProviderHelperTest extends BaseApkProviderTest {
|
|||||||
Apk apk = new Apk(cursor);
|
Apk apk = new Apk(cursor);
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
||||||
assertEquals("com.example", apk.id);
|
assertEquals("com.example", apk.packageName);
|
||||||
assertEquals(10, apk.vercode);
|
assertEquals(10, apk.vercode);
|
||||||
|
|
||||||
assertNull(apk.features);
|
assertNull(apk.features);
|
||||||
@ -138,7 +138,7 @@ public class ApkProviderHelperTest extends BaseApkProviderTest {
|
|||||||
Apk updatedApk = new Apk(updatedCursor);
|
Apk updatedApk = new Apk(updatedCursor);
|
||||||
updatedCursor.close();
|
updatedCursor.close();
|
||||||
|
|
||||||
assertEquals("com.example", updatedApk.id);
|
assertEquals("com.example", updatedApk.packageName);
|
||||||
assertEquals(10, updatedApk.vercode);
|
assertEquals(10, updatedApk.vercode);
|
||||||
|
|
||||||
assertNotNull(updatedApk.features);
|
assertNotNull(updatedApk.features);
|
||||||
@ -176,14 +176,14 @@ public class ApkProviderHelperTest extends BaseApkProviderTest {
|
|||||||
|
|
||||||
// The find() method populates ALL fields if you don't specify any,
|
// The find() method populates ALL fields if you don't specify any,
|
||||||
// so we expect to find each of the ones we inserted above...
|
// so we expect to find each of the ones we inserted above...
|
||||||
assertEquals("com.example", apk.id);
|
assertEquals("com.example", apk.packageName);
|
||||||
assertEquals(11, apk.vercode);
|
assertEquals(11, apk.vercode);
|
||||||
assertEquals("v1.1", apk.version);
|
assertEquals("v1.1", apk.version);
|
||||||
assertEquals("xxxxyyyy", apk.hash);
|
assertEquals("xxxxyyyy", apk.hash);
|
||||||
assertEquals("a hash type", apk.hashType);
|
assertEquals("a hash type", apk.hashType);
|
||||||
|
|
||||||
String[] projection = {
|
String[] projection = {
|
||||||
ApkProvider.DataColumns.APK_ID,
|
ApkProvider.DataColumns.PACKAGE_NAME,
|
||||||
ApkProvider.DataColumns.HASH,
|
ApkProvider.DataColumns.HASH,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ public class ApkProviderHelperTest extends BaseApkProviderTest {
|
|||||||
|
|
||||||
assertNotNull(apkLessFields);
|
assertNotNull(apkLessFields);
|
||||||
|
|
||||||
assertEquals("com.example", apkLessFields.id);
|
assertEquals("com.example", apkLessFields.packageName);
|
||||||
assertEquals("xxxxyyyy", apkLessFields.hash);
|
assertEquals("xxxxyyyy", apkLessFields.hash);
|
||||||
|
|
||||||
// Didn't ask for these fields, so should be their default values...
|
// Didn't ask for these fields, so should be their default values...
|
||||||
|
@ -127,9 +127,9 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
|
|
||||||
assertTotalApkCount(5);
|
assertTotalApkCount(5);
|
||||||
|
|
||||||
assertEquals("com.example.one", one.id);
|
assertEquals("com.example.one", one.packageName);
|
||||||
assertEquals("com.example.two", two.id);
|
assertEquals("com.example.two", two.packageName);
|
||||||
assertEquals("com.example.five", five.id);
|
assertEquals("com.example.five", five.packageName);
|
||||||
|
|
||||||
String[] expectedIds = {
|
String[] expectedIds = {
|
||||||
"com.example.one",
|
"com.example.one",
|
||||||
@ -142,7 +142,7 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
List<Apk> all = ApkProvider.Helper.findByRepo(getSwappableContext(), new MockRepo(10), ApkProvider.DataColumns.ALL);
|
List<Apk> all = ApkProvider.Helper.findByRepo(getSwappableContext(), new MockRepo(10), ApkProvider.DataColumns.ALL);
|
||||||
List<String> actualIds = new ArrayList<>();
|
List<String> actualIds = new ArrayList<>();
|
||||||
for (Apk apk : all) {
|
for (Apk apk : all) {
|
||||||
actualIds.add(apk.id);
|
actualIds.add(apk.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestUtils.assertContainsOnly(actualIds, expectedIds);
|
TestUtils.assertContainsOnly(actualIds, expectedIds);
|
||||||
@ -158,7 +158,7 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
List<Apk> allRemaining = ApkProvider.Helper.findByRepo(getSwappableContext(), new MockRepo(10), ApkProvider.DataColumns.ALL);
|
List<Apk> allRemaining = ApkProvider.Helper.findByRepo(getSwappableContext(), new MockRepo(10), ApkProvider.DataColumns.ALL);
|
||||||
List<String> actualRemainingIds = new ArrayList<>();
|
List<String> actualRemainingIds = new ArrayList<>();
|
||||||
for (Apk apk : allRemaining) {
|
for (Apk apk : allRemaining) {
|
||||||
actualRemainingIds.add(apk.id);
|
actualRemainingIds.add(apk.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] expectedRemainingIds = {
|
String[] expectedRemainingIds = {
|
||||||
@ -232,7 +232,7 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
Apk apk = new MockApk("org.fdroid.fdroid", 13);
|
Apk apk = new MockApk("org.fdroid.fdroid", 13);
|
||||||
|
|
||||||
// Insert a new record...
|
// Insert a new record...
|
||||||
Uri newUri = TestUtils.insertApk(this, apk.id, apk.vercode);
|
Uri newUri = TestUtils.insertApk(this, apk.packageName, apk.vercode);
|
||||||
assertEquals(ApkProvider.getContentUri(apk).toString(), newUri.toString());
|
assertEquals(ApkProvider.getContentUri(apk).toString(), newUri.toString());
|
||||||
cursor = queryAllApks();
|
cursor = queryAllApks();
|
||||||
assertNotNull(cursor);
|
assertNotNull(cursor);
|
||||||
@ -251,11 +251,11 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
|
|
||||||
// And now we should be able to recover these values from the apk
|
// And now we should be able to recover these values from the apk
|
||||||
// value object (because the queryAllApks() helper asks for VERSION_CODE and
|
// value object (because the queryAllApks() helper asks for VERSION_CODE and
|
||||||
// APK_ID.
|
// PACKAGE_NAME.
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
Apk toCheck = new Apk(cursor);
|
Apk toCheck = new Apk(cursor);
|
||||||
cursor.close();
|
cursor.close();
|
||||||
assertEquals("org.fdroid.fdroid", toCheck.id);
|
assertEquals("org.fdroid.fdroid", toCheck.packageName);
|
||||||
assertEquals(13, toCheck.vercode);
|
assertEquals(13, toCheck.vercode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ public class ApkProviderTest extends BaseApkProviderTest {
|
|||||||
|
|
||||||
// But this should have saved correctly...
|
// But this should have saved correctly...
|
||||||
assertEquals("Some features", apk.features.toString());
|
assertEquals("Some features", apk.features.toString());
|
||||||
assertEquals("com.example.com", apk.id);
|
assertEquals("com.example.com", apk.packageName);
|
||||||
assertEquals(1, apk.vercode);
|
assertEquals(1, apk.vercode);
|
||||||
assertEquals(10, apk.repo);
|
assertEquals(10, apk.repo);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getMinimalProjection() {
|
protected String[] getMinimalProjection() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
AppProvider.DataColumns.APP_ID,
|
AppProvider.DataColumns.PACKAGE_NAME,
|
||||||
AppProvider.DataColumns.NAME,
|
AppProvider.DataColumns.NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
assertValidUri(AppProvider.getCanUpdateUri());
|
assertValidUri(AppProvider.getCanUpdateUri());
|
||||||
|
|
||||||
App app = new App();
|
App app = new App();
|
||||||
app.id = "org.fdroid.fdroid";
|
app.packageName = "org.fdroid.fdroid";
|
||||||
|
|
||||||
List<App> apps = new ArrayList<>(1);
|
List<App> apps = new ArrayList<>(1);
|
||||||
apps.add(app);
|
apps.add(app);
|
||||||
@ -178,7 +178,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
canUpdateCursor.moveToFirst();
|
canUpdateCursor.moveToFirst();
|
||||||
List<String> canUpdateIds = new ArrayList<>(canUpdateCursor.getCount());
|
List<String> canUpdateIds = new ArrayList<>(canUpdateCursor.getCount());
|
||||||
while (!canUpdateCursor.isAfterLast()) {
|
while (!canUpdateCursor.isAfterLast()) {
|
||||||
canUpdateIds.add(new App(canUpdateCursor).id);
|
canUpdateIds.add(new App(canUpdateCursor).packageName);
|
||||||
canUpdateCursor.moveToNext();
|
canUpdateCursor.moveToNext();
|
||||||
}
|
}
|
||||||
canUpdateCursor.close();
|
canUpdateCursor.close();
|
||||||
@ -209,7 +209,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
|
|
||||||
assertResultCount(10, AppProvider.getContentUri());
|
assertResultCount(10, AppProvider.getContentUri());
|
||||||
|
|
||||||
String[] projection = {AppProvider.DataColumns.APP_ID};
|
String[] projection = {AppProvider.DataColumns.PACKAGE_NAME};
|
||||||
List<App> ignoredApps = AppProvider.Helper.findIgnored(getMockContext(), projection);
|
List<App> ignoredApps = AppProvider.Helper.findIgnored(getMockContext(), projection);
|
||||||
|
|
||||||
String[] expectedIgnored = {
|
String[] expectedIgnored = {
|
||||||
@ -230,7 +230,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
private void assertContainsOnlyIds(List<App> actualApps, String[] expectedIds) {
|
private void assertContainsOnlyIds(List<App> actualApps, String[] expectedIds) {
|
||||||
List<String> actualIds = new ArrayList<>(actualApps.size());
|
List<String> actualIds = new ArrayList<>(actualApps.size());
|
||||||
for (App app : actualApps) {
|
for (App app : actualApps) {
|
||||||
actualIds.add(app.id);
|
actualIds.add(app.packageName);
|
||||||
}
|
}
|
||||||
TestUtils.assertContainsOnly(actualIds, expectedIds);
|
TestUtils.assertContainsOnly(actualIds, expectedIds);
|
||||||
}
|
}
|
||||||
@ -278,11 +278,11 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
|
|||||||
|
|
||||||
// And now we should be able to recover these values from the app
|
// And now we should be able to recover these values from the app
|
||||||
// value object (because the queryAllApps() helper asks for NAME and
|
// value object (because the queryAllApps() helper asks for NAME and
|
||||||
// APP_ID.
|
// PACKAGE_NAME.
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
App app = new App(cursor);
|
App app = new App(cursor);
|
||||||
cursor.close();
|
cursor.close();
|
||||||
assertEquals("org.fdroid.fdroid", app.id);
|
assertEquals("org.fdroid.fdroid", app.packageName);
|
||||||
assertEquals("F-Droid", app.name);
|
assertEquals("F-Droid", app.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ abstract class BaseApkProviderTest extends FDroidProviderTest<ApkProvider> {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getMinimalProjection() {
|
protected String[] getMinimalProjection() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
ApkProvider.DataColumns.APK_ID,
|
ApkProvider.DataColumns.PACKAGE_NAME,
|
||||||
ApkProvider.DataColumns.VERSION_CODE,
|
ApkProvider.DataColumns.VERSION_CODE,
|
||||||
ApkProvider.DataColumns.NAME,
|
ApkProvider.DataColumns.NAME,
|
||||||
ApkProvider.DataColumns.REPO_ID,
|
ApkProvider.DataColumns.REPO_ID,
|
||||||
@ -40,7 +40,7 @@ abstract class BaseApkProviderTest extends FDroidProviderTest<ApkProvider> {
|
|||||||
protected void assertContains(List<Apk> apks, Apk apk) {
|
protected void assertContains(List<Apk> apks, Apk apk) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (Apk a : apks) {
|
for (Apk a : apks) {
|
||||||
if (a.vercode == apk.vercode && a.id.equals(apk.id)) {
|
if (a.vercode == apk.vercode && a.packageName.equals(apk.packageName)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ abstract class BaseApkProviderTest extends FDroidProviderTest<ApkProvider> {
|
|||||||
|
|
||||||
protected void assertBelongsToApp(List<Apk> apks, String appId) {
|
protected void assertBelongsToApp(List<Apk> apks, String appId) {
|
||||||
for (Apk apk : apks) {
|
for (Apk apk : apks) {
|
||||||
assertEquals(appId, apk.id);
|
assertEquals(appId, apk.packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class InstalledAppCacheTest extends FDroidProviderTest<InstalledAppProvid
|
|||||||
|
|
||||||
private String[] getInstalledAppIdsFromProvider() {
|
private String[] getInstalledAppIdsFromProvider() {
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
String[] projection = { InstalledAppProvider.DataColumns.APP_ID };
|
String[] projection = { InstalledAppProvider.DataColumns.PACKAGE_NAME };
|
||||||
Cursor result = getMockContext().getContentResolver().query(uri, projection, null, null, null);
|
Cursor result = getMockContext().getContentResolver().query(uri, projection, null, null, null);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
@ -81,7 +81,7 @@ public class InstalledAppCacheTest extends FDroidProviderTest<InstalledAppProvid
|
|||||||
result.moveToFirst();
|
result.moveToFirst();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (!result.isAfterLast()) {
|
while (!result.isAfterLast()) {
|
||||||
installedAppIds[i] = result.getString(result.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID));
|
installedAppIds[i] = result.getString(result.getColumnIndex(InstalledAppProvider.DataColumns.PACKAGE_NAME));
|
||||||
result.moveToNext();
|
result.moveToNext();
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ public class MultiRepoUpdaterTest extends InstrumentationTestCase {
|
|||||||
for (int versionCode : versionCodes) {
|
for (int versionCode : versionCodes) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (Apk apk : apksToCheck) {
|
for (Apk apk : apksToCheck) {
|
||||||
if (apk.vercode == versionCode && apk.id.equals(appId)) {
|
if (apk.vercode == versionCode && apk.packageName.equals(appId)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ public class RepoXMLHandlerTest extends AndroidTestCase {
|
|||||||
for (String id : expctedAppIds) {
|
for (String id : expctedAppIds) {
|
||||||
boolean thisAppMissing = true;
|
boolean thisAppMissing = true;
|
||||||
for (App app : actualApps) {
|
for (App app : actualApps) {
|
||||||
if (TextUtils.equals(app.id, id)) {
|
if (TextUtils.equals(app.packageName, id)) {
|
||||||
thisAppMissing = false;
|
thisAppMissing = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class TestUtils {
|
|||||||
public static void insertApp(ContentResolver resolver, String id, String name, ContentValues additionalValues) {
|
public static void insertApp(ContentResolver resolver, String id, String name, ContentValues additionalValues) {
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(AppProvider.DataColumns.APP_ID, id);
|
values.put(AppProvider.DataColumns.PACKAGE_NAME, id);
|
||||||
values.put(AppProvider.DataColumns.NAME, name);
|
values.put(AppProvider.DataColumns.NAME, name);
|
||||||
|
|
||||||
// Required fields (NOT NULL in the database).
|
// Required fields (NOT NULL in the database).
|
||||||
@ -127,7 +127,7 @@ public class TestUtils {
|
|||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
values.put(ApkProvider.DataColumns.APK_ID, id);
|
values.put(ApkProvider.DataColumns.PACKAGE_NAME, id);
|
||||||
values.put(ApkProvider.DataColumns.VERSION_CODE, versionCode);
|
values.put(ApkProvider.DataColumns.VERSION_CODE, versionCode);
|
||||||
|
|
||||||
// Required fields (NOT NULL in the database).
|
// Required fields (NOT NULL in the database).
|
||||||
|
@ -5,7 +5,7 @@ import org.fdroid.fdroid.data.Apk;
|
|||||||
public class MockApk extends Apk {
|
public class MockApk extends Apk {
|
||||||
|
|
||||||
public MockApk(String id, int versionCode) {
|
public MockApk(String id, int versionCode) {
|
||||||
this.id = id;
|
this.packageName = id;
|
||||||
this.vercode = versionCode;
|
this.vercode = versionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class MockApp extends App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MockApp(String id, String name) {
|
public MockApp(String id, String name) {
|
||||||
this.id = id;
|
this.packageName = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user