Remove all Log.d calls from release builds
This commit is contained in:
parent
d04f26b6e4
commit
c9cdc1a5dc
@ -390,10 +390,10 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Get the preferences we're going to use in this Activity...
|
// Get the preferences we're going to use in this Activity...
|
||||||
ConfigurationChangeHelper previousData = (ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
|
ConfigurationChangeHelper previousData = (ConfigurationChangeHelper)getLastCustomNonConfigurationInstance();
|
||||||
if (previousData != null) {
|
if (previousData != null) {
|
||||||
Log.d(TAG, "Recreating view after configuration change.");
|
Utils.DebugLog(TAG, "Recreating view after configuration change.");
|
||||||
downloadHandler = previousData.downloader;
|
downloadHandler = previousData.downloader;
|
||||||
if (downloadHandler != null) {
|
if (downloadHandler != null) {
|
||||||
Log.d(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again.");
|
Utils.DebugLog(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again.");
|
||||||
}
|
}
|
||||||
app = previousData.app;
|
app = previousData.app;
|
||||||
setApp(app);
|
setApp(app);
|
||||||
@ -499,7 +499,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
if (app != null && (app.ignoreAllUpdates != startingIgnoreAll
|
||||||
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
|| app.ignoreThisUpdate != startingIgnoreThis)) {
|
||||||
Log.d(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.id, app.ignoreAllUpdates, app.ignoreThisUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Return true if the app was found, false otherwise.
|
// Return true if the app was found, false otherwise.
|
||||||
private boolean reset(String appId) {
|
private boolean reset(String appId) {
|
||||||
|
|
||||||
Log.d(TAG, "Getting application details for " + appId);
|
Utils.DebugLog(TAG, "Getting application details for " + appId);
|
||||||
App newApp = null;
|
App newApp = null;
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(appId)) {
|
if (!TextUtils.isEmpty(appId)) {
|
||||||
@ -968,7 +968,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// the download thread to make sure that we check for cancellations before
|
// the download thread to make sure that we check for cancellations before
|
||||||
// sending events, but it is not possible to be perfect, because the interruption
|
// sending events, but it is not possible to be perfect, because the interruption
|
||||||
// which triggers the download can happen after the check to see if
|
// which triggers the download can happen after the check to see if
|
||||||
Log.d(TAG, "Discarding downloader event \"" + event.type + "\" as it is from an old (probably cancelled) downloader.");
|
Utils.DebugLog(TAG, "Discarding downloader event \"" + event.type + "\" as it is from an old (probably cancelled) downloader.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +184,11 @@ public class FDroid extends ActionBarActivity {
|
|||||||
|
|
||||||
Intent call = null;
|
Intent call = null;
|
||||||
if (!TextUtils.isEmpty(appId)) {
|
if (!TextUtils.isEmpty(appId)) {
|
||||||
Log.d(TAG, "FDroid launched via app link for '" + appId + "'");
|
Utils.DebugLog(TAG, "FDroid launched via app link for '" + appId + "'");
|
||||||
call = new Intent(this, AppDetails.class);
|
call = new Intent(this, AppDetails.class);
|
||||||
call.putExtra(AppDetails.EXTRA_APPID, appId);
|
call.putExtra(AppDetails.EXTRA_APPID, appId);
|
||||||
} else if (!TextUtils.isEmpty(query)) {
|
} else if (!TextUtils.isEmpty(query)) {
|
||||||
Log.d(TAG, "FDroid launched via search link for '" + query + "'");
|
Utils.DebugLog(TAG, "FDroid launched via search link for '" + query + "'");
|
||||||
call = new Intent(this, SearchResults.class);
|
call = new Intent(this, SearchResults.class);
|
||||||
call.setAction(Intent.ACTION_SEARCH);
|
call.setAction(Intent.ACTION_SEARCH);
|
||||||
call.putExtra(SearchManager.QUERY, query);
|
call.putExtra(SearchManager.QUERY, query);
|
||||||
|
@ -92,7 +92,7 @@ public class RepoUpdater {
|
|||||||
if (downloader.isCached()) {
|
if (downloader.isCached()) {
|
||||||
// The index is unchanged since we last read it. We just mark
|
// The index is unchanged since we last read it. We just mark
|
||||||
// everything that came from this repo as being updated.
|
// everything that came from this repo as being updated.
|
||||||
Log.d(TAG, "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
Utils.DebugLog(TAG, "Repo index for " + getIndexAddress() + " is up to date (by etag)");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -190,13 +190,13 @@ public class RepoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handler.getVersion() != -1 && handler.getVersion() != repo.version) {
|
if (handler.getVersion() != -1 && handler.getVersion() != repo.version) {
|
||||||
Log.d(TAG, "Repo specified a new version: from "
|
Utils.DebugLog(TAG, "Repo specified a new version: from "
|
||||||
+ repo.version + " to " + handler.getVersion());
|
+ repo.version + " to " + handler.getVersion());
|
||||||
values.put(RepoProvider.DataColumns.VERSION, handler.getVersion());
|
values.put(RepoProvider.DataColumns.VERSION, handler.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler.getMaxAge() != -1 && handler.getMaxAge() != repo.maxage) {
|
if (handler.getMaxAge() != -1 && handler.getMaxAge() != repo.maxage) {
|
||||||
Log.d(TAG, "Repo specified a new maximum age - updated");
|
Utils.DebugLog(TAG, "Repo specified a new maximum age - updated");
|
||||||
values.put(RepoProvider.DataColumns.MAX_AGE, handler.getMaxAge());
|
values.put(RepoProvider.DataColumns.MAX_AGE, handler.getMaxAge());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ public class RepoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trustNewSigningCertificate) {
|
if (trustNewSigningCertificate) {
|
||||||
Log.d(TAG, "Saving new signing certificate in the database for " + repo.address);
|
Utils.DebugLog(TAG, "Saving new signing certificate in the database for " + repo.address);
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), ""));
|
values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), ""));
|
||||||
values.put(RepoProvider.DataColumns.PUBLIC_KEY, Hasher.hex(rawCertFromJar));
|
values.put(RepoProvider.DataColumns.PUBLIC_KEY, Hasher.hex(rawCertFromJar));
|
||||||
|
@ -136,9 +136,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
|
alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
|
||||||
SystemClock.elapsedRealtime() + 5000,
|
SystemClock.elapsedRealtime() + 5000,
|
||||||
AlarmManager.INTERVAL_HOUR, pending);
|
AlarmManager.INTERVAL_HOUR, pending);
|
||||||
Log.d(TAG, "Update scheduler alarm set");
|
Utils.DebugLog(TAG, "Update scheduler alarm set");
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Update scheduler alarm not set");
|
Utils.DebugLog(TAG, "Update scheduler alarm not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
|
|
||||||
// See if it's time to actually do anything yet...
|
// See if it's time to actually do anything yet...
|
||||||
if (manualUpdate) {
|
if (manualUpdate) {
|
||||||
Log.d(TAG, "Unscheduled (manually requested) update");
|
Utils.DebugLog(TAG, "Unscheduled (manually requested) update");
|
||||||
} else if (!verifyIsTimeForScheduledRun()) {
|
} else if (!verifyIsTimeForScheduledRun()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!changes) {
|
if (!changes) {
|
||||||
Log.d(TAG, "Not checking app details or compatibility, because all repos were up to date.");
|
Utils.DebugLog(TAG, "Not checking app details or compatibility, because all repos were up to date.");
|
||||||
} else {
|
} else {
|
||||||
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAppUpdatesNotification(Cursor hasUpdates) {
|
private void showAppUpdatesNotification(Cursor hasUpdates) {
|
||||||
Log.d(TAG, "Notifying " + hasUpdates.getCount() + " updates.");
|
Utils.DebugLog(TAG, "Notifying " + hasUpdates.getCount() + " updates.");
|
||||||
|
|
||||||
final int icon = Build.VERSION.SDK_INT >= 11 ? R.drawable.ic_stat_notify_updates : R.drawable.ic_launcher;
|
final int icon = Build.VERSION.SDK_INT >= 11 ? R.drawable.ic_stat_notify_updates : R.drawable.ic_launcher;
|
||||||
|
|
||||||
@ -593,7 +593,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Updating/inserting " + operations.size() + " apps.");
|
Utils.DebugLog(TAG, "Updating/inserting " + operations.size() + " apps.");
|
||||||
try {
|
try {
|
||||||
executeBatchWithStatus(AppProvider.getAuthority(), operations, currentCount, totalUpdateCount);
|
executeBatchWithStatus(AppProvider.getAuthority(), operations, currentCount, totalUpdateCount);
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
@ -652,7 +652,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Updating/inserting " + operations.size() + " apks.");
|
Utils.DebugLog(TAG, "Updating/inserting " + operations.size() + " apks.");
|
||||||
try {
|
try {
|
||||||
executeBatchWithStatus(ApkProvider.getAuthority(), operations, currentCount, totalApksAppsCount);
|
executeBatchWithStatus(ApkProvider.getAuthority(), operations, currentCount, totalApksAppsCount);
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
@ -716,7 +716,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - startTime;
|
long duration = System.currentTimeMillis() - startTime;
|
||||||
Log.d(TAG, "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
Utils.DebugLog(TAG, "Found " + toRemove.size() + " apks no longer in the updated repos (took " + duration + "ms)");
|
||||||
|
|
||||||
if (toRemove.size() > 0) {
|
if (toRemove.size() > 0) {
|
||||||
ApkProvider.Helper.deleteApks(this, toRemove);
|
ApkProvider.Helper.deleteApks(this, toRemove);
|
||||||
@ -736,13 +736,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
for (final Repo repo : repos) {
|
for (final Repo repo : repos) {
|
||||||
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
||||||
int numDeleted = getContentResolver().delete(uri, null, null);
|
int numDeleted = getContentResolver().delete(uri, null, null);
|
||||||
Log.d(TAG, "Removing " + numDeleted + " apks from repo " + repo.address);
|
Utils.DebugLog(TAG, "Removing " + numDeleted + " apks from repo " + repo.address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeAppsWithoutApks() {
|
private void removeAppsWithoutApks() {
|
||||||
int numDeleted = getContentResolver().delete(AppProvider.getNoApksUri(), null, null);
|
int numDeleted = getContentResolver().delete(AppProvider.getNoApksUri(), null, null);
|
||||||
Log.d(TAG, "Removing " + numDeleted + " apks that don't have any apks");
|
Utils.DebugLog(TAG, "Removing " + numDeleted + " apks that don't have any apks");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,8 @@ import android.annotation.TargetApi;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
public class PackageManagerCompat extends Compatibility {
|
public class PackageManagerCompat extends Compatibility {
|
||||||
|
|
||||||
private static final String TAG = "PackageManagerCompat";
|
private static final String TAG = "PackageManagerCompat";
|
||||||
@ -13,8 +15,7 @@ public class PackageManagerCompat extends Compatibility {
|
|||||||
if (!hasApi(11)) return;
|
if (!hasApi(11)) return;
|
||||||
try {
|
try {
|
||||||
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
|
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
|
||||||
Log.d(TAG, "Installer package name for " +
|
Utils.DebugLog(TAG, "Installer package name for " + packageName + " set successfully");
|
||||||
packageName + " set successfully");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Many problems can occur:
|
// Many problems can occur:
|
||||||
// * App wasn't installed due to incompatibility
|
// * App wasn't installed due to incompatibility
|
||||||
|
@ -846,7 +846,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateSuggestedFromUpstream() {
|
private void updateSuggestedFromUpstream() {
|
||||||
|
|
||||||
Log.d(TAG, "Calculating suggested versions for all apps which specify an upstream version code.");
|
Utils.DebugLog(TAG, "Calculating suggested versions for all apps which specify an upstream version code.");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -880,7 +880,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateCompatibleFlags() {
|
private void updateCompatibleFlags() {
|
||||||
|
|
||||||
Log.d(TAG, "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
Utils.DebugLog(TAG, "Calculating whether apps are compatible, based on whether any of their apks are compatible");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -924,7 +924,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
private void updateSuggestedFromLatest() {
|
private void updateSuggestedFromLatest() {
|
||||||
|
|
||||||
Log.d(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
Utils.DebugLog(TAG, "Calculating suggested versions for all apps which don't specify an upstream version code.");
|
||||||
|
|
||||||
final String apk = DBHelper.TABLE_APK;
|
final String apk = DBHelper.TABLE_APK;
|
||||||
final String app = DBHelper.TABLE_APP;
|
final String app = DBHelper.TABLE_APP;
|
||||||
@ -951,10 +951,10 @@ public class AppProvider extends FDroidProvider {
|
|||||||
final String iconsDir = Utils.getIconsDir(context, 1.0);
|
final String iconsDir = Utils.getIconsDir(context, 1.0);
|
||||||
final String iconsDirLarge = Utils.getIconsDir(context, 1.5);
|
final String iconsDirLarge = Utils.getIconsDir(context, 1.5);
|
||||||
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||||
Log.d(TAG, "Updating icon paths for apps belonging to repos with version >= "
|
Utils.DebugLog(TAG, "Updating icon paths for apps belonging to repos with version >= "
|
||||||
+ repoVersion);
|
+ repoVersion);
|
||||||
Log.d(TAG, "Using icons dir '" + iconsDir + "'");
|
Utils.DebugLog(TAG, "Using icons dir '" + iconsDir + "'");
|
||||||
Log.d(TAG, "Using large icons dir '" + iconsDirLarge + "'");
|
Utils.DebugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
|
||||||
String query = getIconUpdateQuery();
|
String query = getIconUpdateQuery();
|
||||||
final String[] params = {
|
final String[] params = {
|
||||||
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
|
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
|
||||||
|
@ -139,7 +139,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
|
private void renameRepoId(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 36 && !columnExists(db, TABLE_REPO, "_id")) {
|
if (oldVersion < 36 && !columnExists(db, TABLE_REPO, "_id")) {
|
||||||
|
|
||||||
Log.d(TAG, "Renaming " + TABLE_REPO + ".id to _id");
|
Utils.DebugLog(TAG, "Renaming " + TABLE_REPO + ".id to _id");
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -476,7 +476,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createInstalledApp(SQLiteDatabase db) {
|
private void createInstalledApp(SQLiteDatabase db) {
|
||||||
Log.d(TAG, "Creating 'installed app' database table.");
|
Utils.DebugLog(TAG, "Creating 'installed app' database table.");
|
||||||
db.execSQL(CREATE_TABLE_INSTALLED_APP);
|
db.execSQL(CREATE_TABLE_INSTALLED_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares what is in the fdroid_installedApp SQLite database table with the package
|
* Compares what is in the fdroid_installedApp SQLite database table with the package
|
||||||
* info that we can gleam from the {@link android.content.pm.PackageManager}. If there
|
* info that we can gleam from the {@link android.content.pm.PackageManager}. If there
|
||||||
@ -64,7 +66,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
updateCache();
|
updateCache();
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - startTime;
|
long duration = System.currentTimeMillis() - startTime;
|
||||||
Log.d(TAG, "Took " + duration + "ms to compare the installed app cache with PackageManager.");
|
Utils.DebugLog(TAG, "Took " + duration + "ms to compare the installed app cache with PackageManager.");
|
||||||
|
|
||||||
return hasChanged();
|
return hasChanged();
|
||||||
}
|
}
|
||||||
@ -96,7 +98,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
if (ops.size() > 0) {
|
if (ops.size() > 0) {
|
||||||
try {
|
try {
|
||||||
context.getContentResolver().applyBatch(InstalledAppProvider.getAuthority(), ops);
|
context.getContentResolver().applyBatch(InstalledAppProvider.getAuthority(), ops);
|
||||||
Log.d(TAG, "Finished executing " + ops.size() + " CRUD operations on installed app cache.");
|
Utils.DebugLog(TAG, "Finished executing " + ops.size() + " CRUD operations on installed app cache.");
|
||||||
} catch (RemoteException | OperationApplicationException e) {
|
} catch (RemoteException | OperationApplicationException e) {
|
||||||
Log.e(TAG, "Error updating installed app cache: " + e);
|
Log.e(TAG, "Error updating installed app cache: " + e);
|
||||||
}
|
}
|
||||||
@ -126,7 +128,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
private List<ContentProviderOperation> insertIntoCache(List<PackageInfo> appsToInsert) {
|
private List<ContentProviderOperation> insertIntoCache(List<PackageInfo> appsToInsert) {
|
||||||
List<ContentProviderOperation> ops = new ArrayList<>(appsToInsert.size());
|
List<ContentProviderOperation> ops = new ArrayList<>(appsToInsert.size());
|
||||||
if (appsToInsert.size() > 0) {
|
if (appsToInsert.size() > 0) {
|
||||||
Log.d(TAG, "Preparing to cache installed info for " + appsToInsert.size() + " new apps.");
|
Utils.DebugLog(TAG, "Preparing to cache installed info for " + appsToInsert.size() + " new apps.");
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
for (PackageInfo info : appsToInsert) {
|
for (PackageInfo info : appsToInsert) {
|
||||||
ContentProviderOperation op = ContentProviderOperation.newInsert(uri)
|
ContentProviderOperation op = ContentProviderOperation.newInsert(uri)
|
||||||
@ -145,7 +147,7 @@ public class InstalledAppCacheUpdater {
|
|||||||
private List<ContentProviderOperation> deleteFromCache(List<String> appIds) {
|
private List<ContentProviderOperation> deleteFromCache(List<String> appIds) {
|
||||||
List<ContentProviderOperation> ops = new ArrayList<>(appIds.size());
|
List<ContentProviderOperation> ops = new ArrayList<>(appIds.size());
|
||||||
if (appIds.size() > 0) {
|
if (appIds.size() > 0) {
|
||||||
Log.d(TAG, "Preparing to remove " + appIds.size() + " apps from the installed app cache.");
|
Utils.DebugLog(TAG, "Preparing to remove " + appIds.size() + " apps from the installed app cache.");
|
||||||
for (final String appId : appIds) {
|
for (final String appId : appIds) {
|
||||||
Uri uri = InstalledAppProvider.getAppUri(appId);
|
Uri uri = InstalledAppProvider.getAppUri(appId);
|
||||||
ops.add(ContentProviderOperation.newDelete(uri).build());
|
ops.add(ContentProviderOperation.newDelete(uri).build());
|
||||||
|
@ -11,6 +11,7 @@ import android.net.Uri;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -102,7 +103,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
|||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Resources.NotFoundException e) {
|
} catch (Resources.NotFoundException e) {
|
||||||
Log.d(TAG, "getApplicationLabel: " + e.getMessage());
|
Utils.DebugLog(TAG, "getApplicationLabel: " + e.getMessage());
|
||||||
}
|
}
|
||||||
return packageName; // all else fails, return id
|
return packageName; // all else fails, return id
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.views.swap.ConnectSwapActivity;
|
import org.fdroid.fdroid.views.swap.ConnectSwapActivity;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -47,7 +48,7 @@ public class NewRepoConfig {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Parsing incoming intent looking for repo: " + incomingUri);
|
Utils.DebugLog(TAG, "Parsing incoming intent looking for repo: " + incomingUri);
|
||||||
|
|
||||||
// scheme and host should only ever be pure ASCII aka Locale.ENGLISH
|
// scheme and host should only ever be pure ASCII aka Locale.ENGLISH
|
||||||
scheme = uri.getScheme();
|
scheme = uri.getScheme();
|
||||||
|
@ -186,11 +186,11 @@ public class RepoProvider extends FDroidProvider {
|
|||||||
Uri apkUri = ApkProvider.getRepoUri(repo.getId());
|
Uri apkUri = ApkProvider.getRepoUri(repo.getId());
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
int apkCount = resolver.delete(apkUri, null, null);
|
int apkCount = resolver.delete(apkUri, null, null);
|
||||||
Log.d(TAG, "Removed " + apkCount + " apks from repo " + repo.name);
|
Utils.DebugLog(TAG, "Removed " + apkCount + " apks from repo " + repo.name);
|
||||||
|
|
||||||
Uri appUri = AppProvider.getNoApksUri();
|
Uri appUri = AppProvider.getNoApksUri();
|
||||||
int appCount = resolver.delete(appUri, null, null);
|
int appCount = resolver.delete(appUri, null, null);
|
||||||
Log.d(TAG, "Removed " + appCount + " apps with no apks.");
|
Utils.DebugLog(TAG, "Removed " + appCount + " apps with no apks.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int countAppsForRepo(Context context, long repoId) {
|
public static int countAppsForRepo(Context context, long repoId) {
|
||||||
|
@ -27,6 +27,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -103,7 +104,7 @@ abstract public class Installer {
|
|||||||
boolean isSystemInstallerEnabled = Preferences.get().isSystemInstallerEnabled();
|
boolean isSystemInstallerEnabled = Preferences.get().isSystemInstallerEnabled();
|
||||||
if (isSystemInstallerEnabled) {
|
if (isSystemInstallerEnabled) {
|
||||||
if (hasSystemPermissions(activity, pm)) {
|
if (hasSystemPermissions(activity, pm)) {
|
||||||
Log.d(TAG, "system permissions -> SystemInstaller");
|
Utils.DebugLog(TAG, "system permissions -> SystemInstaller");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new SystemInstaller(activity, pm, callback);
|
return new SystemInstaller(activity, pm, callback);
|
||||||
@ -119,7 +120,7 @@ abstract public class Installer {
|
|||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
// Default installer on Android >= 4.0
|
// Default installer on Android >= 4.0
|
||||||
try {
|
try {
|
||||||
Log.d(TAG, "try default installer for Android >= 4");
|
Utils.DebugLog(TAG, "try default installer for Android >= 4");
|
||||||
|
|
||||||
return new DefaultInstallerSdk14(activity, pm, callback);
|
return new DefaultInstallerSdk14(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
@ -128,7 +129,7 @@ abstract public class Installer {
|
|||||||
} else {
|
} else {
|
||||||
// Default installer on Android < 4.0
|
// Default installer on Android < 4.0
|
||||||
try {
|
try {
|
||||||
Log.d(TAG, "try default installer for Android < 4");
|
Utils.DebugLog(TAG, "try default installer for Android < 4");
|
||||||
|
|
||||||
return new DefaultInstaller(activity, pm, callback);
|
return new DefaultInstaller(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
|
@ -33,6 +33,7 @@ import android.support.v7.app.AlertDialog;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -107,7 +108,7 @@ public class SystemInstaller extends Installer {
|
|||||||
public void packageInstalled(String packageName, int returnCode) throws RemoteException {
|
public void packageInstalled(String packageName, int returnCode) throws RemoteException {
|
||||||
// TODO: propagate other return codes?
|
// TODO: propagate other return codes?
|
||||||
if (returnCode == INSTALL_SUCCEEDED) {
|
if (returnCode == INSTALL_SUCCEEDED) {
|
||||||
Log.d(TAG, "Install succeeded");
|
Utils.DebugLog(TAG, "Install succeeded");
|
||||||
|
|
||||||
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
||||||
} else {
|
} else {
|
||||||
@ -125,7 +126,7 @@ public class SystemInstaller extends Installer {
|
|||||||
public void packageDeleted(String packageName, int returnCode) throws RemoteException {
|
public void packageDeleted(String packageName, int returnCode) throws RemoteException {
|
||||||
// TODO: propagate other return codes?
|
// TODO: propagate other return codes?
|
||||||
if (returnCode == DELETE_SUCCEEDED) {
|
if (returnCode == DELETE_SUCCEEDED) {
|
||||||
Log.d(TAG, "Delete succeeded");
|
Utils.DebugLog(TAG, "Delete succeeded");
|
||||||
|
|
||||||
mCallback.onSuccess(InstallerCallback.OPERATION_DELETE);
|
mCallback.onSuccess(InstallerCallback.OPERATION_DELETE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.FDroidApp;
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.spongycastle.asn1.ASN1Sequence;
|
import org.spongycastle.asn1.ASN1Sequence;
|
||||||
import org.spongycastle.asn1.x500.X500Name;
|
import org.spongycastle.asn1.x500.X500Name;
|
||||||
import org.spongycastle.asn1.x509.GeneralName;
|
import org.spongycastle.asn1.x509.GeneralName;
|
||||||
@ -84,15 +85,15 @@ public class LocalRepoKeyStore {
|
|||||||
try {
|
try {
|
||||||
File appKeyStoreDir = context.getDir("keystore", Context.MODE_PRIVATE);
|
File appKeyStoreDir = context.getDir("keystore", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
Log.d(TAG, "Generating LocalRepoKeyStore instance: " + appKeyStoreDir.getAbsolutePath());
|
Utils.DebugLog(TAG, "Generating LocalRepoKeyStore instance: " + appKeyStoreDir.getAbsolutePath());
|
||||||
this.keyStoreFile = new File(appKeyStoreDir, "kerplapp.bks");
|
this.keyStoreFile = new File(appKeyStoreDir, "kerplapp.bks");
|
||||||
|
|
||||||
Log.d(TAG, "Using default KeyStore type: " + KeyStore.getDefaultType());
|
Utils.DebugLog(TAG, "Using default KeyStore type: " + KeyStore.getDefaultType());
|
||||||
this.keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
this.keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
|
||||||
if (keyStoreFile.exists()) {
|
if (keyStoreFile.exists()) {
|
||||||
try {
|
try {
|
||||||
Log.d(TAG, "Keystore already exists, loading...");
|
Utils.DebugLog(TAG, "Keystore already exists, loading...");
|
||||||
keyStore.load(new FileInputStream(keyStoreFile), "".toCharArray());
|
keyStore.load(new FileInputStream(keyStoreFile), "".toCharArray());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Error while loading existing keystore. Will delete and create a new one.");
|
Log.e(TAG, "Error while loading existing keystore. Will delete and create a new one.");
|
||||||
@ -109,7 +110,7 @@ public class LocalRepoKeyStore {
|
|||||||
// If there isn't a persisted BKS keystore on disk we need to
|
// If there isn't a persisted BKS keystore on disk we need to
|
||||||
// create a new empty keystore
|
// create a new empty keystore
|
||||||
// Init a new keystore with a blank passphrase
|
// Init a new keystore with a blank passphrase
|
||||||
Log.d(TAG, "Keystore doesn't exist, creating...");
|
Utils.DebugLog(TAG, "Keystore doesn't exist, creating...");
|
||||||
keyStore.load(null, "".toCharArray());
|
keyStore.load(null, "".toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ public class LocalRepoService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startNetworkServices() {
|
private void startNetworkServices() {
|
||||||
Log.d(TAG, "Starting local repo network services");
|
Utils.DebugLog(TAG, "Starting local repo network services");
|
||||||
startWebServer();
|
startWebServer();
|
||||||
if (Preferences.get().isLocalRepoBonjourEnabled())
|
if (Preferences.get().isLocalRepoBonjourEnabled())
|
||||||
registerMDNSService();
|
registerMDNSService();
|
||||||
@ -191,13 +191,13 @@ public class LocalRepoService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void stopNetworkServices() {
|
private void stopNetworkServices() {
|
||||||
Log.d(TAG, "Stopping local repo network services");
|
Utils.DebugLog(TAG, "Stopping local repo network services");
|
||||||
Preferences.get().unregisterLocalRepoHttpsListeners(localRepoHttpsChangeListener);
|
Preferences.get().unregisterLocalRepoHttpsListeners(localRepoHttpsChangeListener);
|
||||||
|
|
||||||
Log.d(TAG, "Unregistering MDNS service...");
|
Utils.DebugLog(TAG, "Unregistering MDNS service...");
|
||||||
unregisterMDNSService();
|
unregisterMDNSService();
|
||||||
|
|
||||||
Log.d(TAG, "Stopping web server...");
|
Utils.DebugLog(TAG, "Stopping web server...");
|
||||||
stopWebServer();
|
stopWebServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +137,10 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
private boolean verifyOrDelete(@NonNull final File apkFile) {
|
private boolean verifyOrDelete(@NonNull final File apkFile) {
|
||||||
if (apkFile.exists()) {
|
if (apkFile.exists()) {
|
||||||
if (hashMatches(apkFile)) {
|
if (hashMatches(apkFile)) {
|
||||||
Log.d(TAG, "Using cached apk at " + apkFile);
|
Utils.DebugLog(TAG, "Using cached apk at " + apkFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Not using cached apk at " + apkFile + "(hash doesn't match, will delete file)");
|
Utils.DebugLog(TAG, "Not using cached apk at " + apkFile + "(hash doesn't match, will delete file)");
|
||||||
delete(apkFile);
|
delete(apkFile);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -187,7 +187,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String remoteAddress = getRemoteAddress();
|
String remoteAddress = getRemoteAddress();
|
||||||
Log.d(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
Utils.DebugLog(TAG, "Downloading apk from " + remoteAddress + " to " + localFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Downloader downloader = DownloaderFactory.create(context, remoteAddress, localFile);
|
Downloader downloader = DownloaderFactory.create(context, remoteAddress, localFile);
|
||||||
@ -245,7 +245,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
|
|
||||||
cacheIfRequired();
|
cacheIfRequired();
|
||||||
|
|
||||||
Log.d(TAG, "Download finished: " + localFile);
|
Utils.DebugLog(TAG, "Download finished: " + localFile);
|
||||||
prepareApkFileAndSendCompleteMessage();
|
prepareApkFileAndSendCompleteMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public abstract class Downloader {
|
|||||||
public abstract boolean isCached();
|
public abstract boolean isCached();
|
||||||
|
|
||||||
protected void downloadFromStream() throws IOException, InterruptedException {
|
protected void downloadFromStream() throws IOException, InterruptedException {
|
||||||
Log.d(TAG, "Downloading from stream");
|
Utils.DebugLog(TAG, "Downloading from stream");
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
try {
|
try {
|
||||||
input = getInputStream();
|
input = getInputStream();
|
||||||
@ -133,7 +133,7 @@ public abstract class Downloader {
|
|||||||
*/
|
*/
|
||||||
private void throwExceptionIfInterrupted() throws InterruptedException {
|
private void throwExceptionIfInterrupted() throws InterruptedException {
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
Log.d(TAG, "Received interrupt, cancelling download");
|
Utils.DebugLog(TAG, "Received interrupt, cancelling download");
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ public abstract class Downloader {
|
|||||||
throwExceptionIfInterrupted();
|
throwExceptionIfInterrupted();
|
||||||
|
|
||||||
if (count == -1) {
|
if (count == -1) {
|
||||||
Log.d(TAG, "Finished downloading from stream");
|
Utils.DebugLog(TAG, "Finished downloading from stream");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bytesRead += count;
|
bytesRead += count;
|
||||||
|
@ -7,6 +7,7 @@ import android.util.Log;
|
|||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
import org.fdroid.fdroid.FDroidApp;
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.localrepo.LocalRepoKeyStore;
|
import org.fdroid.fdroid.localrepo.LocalRepoKeyStore;
|
||||||
import org.fdroid.fdroid.views.swap.ConnectSwapActivity;
|
import org.fdroid.fdroid.views.swap.ConnectSwapActivity;
|
||||||
|
|
||||||
@ -73,8 +74,8 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestSwap(String repo) {
|
private void requestSwap(String repo) {
|
||||||
Log.d(TAG, "Received request to swap with " + repo);
|
Utils.DebugLog(TAG, "Received request to swap with " + repo);
|
||||||
Log.d(TAG, "Showing confirm screen to check whether that is okay with the user.");
|
Utils.DebugLog(TAG, "Showing confirm screen to check whether that is okay with the user.");
|
||||||
|
|
||||||
Uri repoUri = Uri.parse(repo);
|
Uri repoUri = Uri.parse(repo);
|
||||||
Intent intent = new Intent(context, ConnectSwapActivity.class);
|
Intent intent = new Intent(context, ConnectSwapActivity.class);
|
||||||
|
@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.InstalledAppProvider;
|
import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||||
|
|
||||||
public class PackageAddedReceiver extends PackageReceiver {
|
public class PackageAddedReceiver extends PackageReceiver {
|
||||||
@ -34,7 +35,7 @@ public class PackageAddedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean toDiscard(Intent intent) {
|
protected boolean toDiscard(Intent intent) {
|
||||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||||
Log.d(TAG, "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
Utils.DebugLog(TAG, "Discarding since this PACKAGE_ADDED is just a PACKAGE_REPLACED");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -44,11 +45,11 @@ public class PackageAddedReceiver extends PackageReceiver {
|
|||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
PackageInfo info = getPackageInfo(context, appId);
|
PackageInfo info = getPackageInfo(context, appId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
Log.d(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
Utils.DebugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
Utils.DebugLog(TAG, "Inserting installed app info for '" + appId + "' (v" + info.versionCode + ")");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
ContentValues values = new ContentValues(4);
|
ContentValues values = new ContentValues(4);
|
||||||
|
@ -25,6 +25,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.ApkProvider;
|
import org.fdroid.fdroid.data.ApkProvider;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ abstract class PackageReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.d(TAG, "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
Utils.DebugLog(TAG, "PackageReceiver received [action = '" + intent.getAction() + "', data = '" + intent.getData() + "']");
|
||||||
if (toDiscard(intent)) {
|
if (toDiscard(intent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.InstalledAppProvider;
|
import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||||
|
|
||||||
public class PackageRemovedReceiver extends PackageReceiver {
|
public class PackageRemovedReceiver extends PackageReceiver {
|
||||||
@ -32,7 +33,7 @@ public class PackageRemovedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean toDiscard(Intent intent) {
|
protected boolean toDiscard(Intent intent) {
|
||||||
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
if (intent.hasExtra(Intent.EXTRA_REPLACING)) {
|
||||||
Log.d(TAG, "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
Utils.DebugLog(TAG, "Discarding since this PACKAGE_REMOVED is just a PACKAGE_REPLACED");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -41,7 +42,7 @@ public class PackageRemovedReceiver extends PackageReceiver {
|
|||||||
@Override
|
@Override
|
||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
|
|
||||||
Log.d(TAG, "Removing installed app info for '" + appId + "'");
|
Utils.DebugLog(TAG, "Removing installed app info for '" + appId + "'");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getAppUri(appId);
|
Uri uri = InstalledAppProvider.getAppUri(appId);
|
||||||
context.getContentResolver().delete(uri, null, null);
|
context.getContentResolver().delete(uri, null, null);
|
||||||
|
@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.InstalledAppProvider;
|
import org.fdroid.fdroid.data.InstalledAppProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,11 +47,11 @@ public class PackageUpgradedReceiver extends PackageReceiver {
|
|||||||
protected void handle(Context context, String appId) {
|
protected void handle(Context context, String appId) {
|
||||||
PackageInfo info = getPackageInfo(context, appId);
|
PackageInfo info = getPackageInfo(context, appId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
Log.d(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
Utils.DebugLog(TAG, "Could not get package info on '" + appId + "' - skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
Utils.DebugLog(TAG, "Updating installed app info for '" + appId + "' to v" + info.versionCode + " (" + info.versionName + ")");
|
||||||
|
|
||||||
Uri uri = InstalledAppProvider.getContentUri();
|
Uri uri = InstalledAppProvider.getContentUri();
|
||||||
ContentValues values = new ContentValues(4);
|
ContentValues values = new ContentValues(4);
|
||||||
|
@ -66,6 +66,7 @@ import org.fdroid.fdroid.FDroidApp;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.UpdateService;
|
import org.fdroid.fdroid.UpdateService;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.compat.ClipboardCompat;
|
import org.fdroid.fdroid.compat.ClipboardCompat;
|
||||||
import org.fdroid.fdroid.data.NewRepoConfig;
|
import org.fdroid.fdroid.data.NewRepoConfig;
|
||||||
import org.fdroid.fdroid.data.Repo;
|
import org.fdroid.fdroid.data.Repo;
|
||||||
@ -519,7 +520,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
final String[] pathsToCheck = {"", "fdroid/repo", "repo"};
|
final String[] pathsToCheck = {"", "fdroid/repo", "repo"};
|
||||||
for (final String path : pathsToCheck) {
|
for (final String path : pathsToCheck) {
|
||||||
|
|
||||||
Log.d(TAG, "Checking for repo at " + originalAddress + " with suffix \"" + path + "\".");
|
Utils.DebugLog(TAG, "Checking for repo at " + originalAddress + " with suffix \"" + path + "\".");
|
||||||
Uri.Builder builder = Uri.parse(originalAddress).buildUpon().appendEncodedPath(path);
|
Uri.Builder builder = Uri.parse(originalAddress).buildUpon().appendEncodedPath(path);
|
||||||
final String addressWithoutIndex = builder.build().toString();
|
final String addressWithoutIndex = builder.build().toString();
|
||||||
publishProgress(addressWithoutIndex);
|
publishProgress(addressWithoutIndex);
|
||||||
@ -537,7 +538,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
Log.d(TAG, "Not checking any more repo addresses, because process was skipped.");
|
Utils.DebugLog(TAG, "Not checking any more repo addresses, because process was skipped.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +639,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Enabling existing repo: " + url);
|
Utils.DebugLog(TAG, "Enabling existing repo: " + url);
|
||||||
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
Repo repo = RepoProvider.Helper.findByAddress(context, url);
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
values.put(RepoProvider.DataColumns.IN_USE, 1);
|
values.put(RepoProvider.DataColumns.IN_USE, 1);
|
||||||
|
@ -20,6 +20,7 @@ import org.fdroid.fdroid.AppDetails;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.UpdateService;
|
import org.fdroid.fdroid.UpdateService;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.App;
|
import org.fdroid.fdroid.data.App;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
import org.fdroid.fdroid.views.AppListAdapter;
|
import org.fdroid.fdroid.views.AppListAdapter;
|
||||||
@ -125,12 +126,12 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
|||||||
SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
|
SharedPreferences prefs = getActivity().getPreferences(Context.MODE_PRIVATE);
|
||||||
boolean hasTriedEmptyUpdate = prefs.getBoolean(TRIED_EMPTY_UPDATE, false);
|
boolean hasTriedEmptyUpdate = prefs.getBoolean(TRIED_EMPTY_UPDATE, false);
|
||||||
if (!hasTriedEmptyUpdate) {
|
if (!hasTriedEmptyUpdate) {
|
||||||
Log.d(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
Utils.DebugLog(TAG, "Empty app list, and we haven't done an update yet. Forcing repo update.");
|
||||||
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||||
UpdateService.updateNow(getActivity());
|
UpdateService.updateNow(getActivity());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
Utils.DebugLog(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import android.widget.Spinner;
|
|||||||
import org.fdroid.fdroid.FDroidApp;
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.compat.ArrayAdapterCompat;
|
import org.fdroid.fdroid.compat.ArrayAdapterCompat;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
import org.fdroid.fdroid.views.AppListAdapter;
|
import org.fdroid.fdroid.views.AppListAdapter;
|
||||||
@ -156,7 +157,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
getListView().setSelection(0);
|
getListView().setSelection(0);
|
||||||
Log.d(TAG, "Selected category: " + categories.get(pos));
|
Utils.DebugLog(TAG, "Selected category: " + categories.get(pos));
|
||||||
setCurrentCategory(categories.get(pos));
|
setCurrentCategory(categories.get(pos));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -194,7 +195,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
|||||||
|
|
||||||
private void setCurrentCategory(String category) {
|
private void setCurrentCategory(String category) {
|
||||||
currentCategory = category;
|
currentCategory = category;
|
||||||
Log.d(TAG, "Category '" + currentCategory + "' selected.");
|
Utils.DebugLog(TAG, "Category '" + currentCategory + "' selected.");
|
||||||
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this);
|
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import org.fdroid.fdroid.AppDetails;
|
import org.fdroid.fdroid.AppDetails;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.data.App;
|
import org.fdroid.fdroid.data.App;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
import org.fdroid.fdroid.views.AppListAdapter;
|
import org.fdroid.fdroid.views.AppListAdapter;
|
||||||
@ -102,7 +103,7 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
|
|||||||
headerText = getString(R.string.searchres_napps, count, query);
|
headerText = getString(R.string.searchres_napps, count, query);
|
||||||
}
|
}
|
||||||
tv.setText(headerText);
|
tv.setText(headerText);
|
||||||
Log.d(TAG, "Search for '" + query + "' returned " + count + " results");
|
Utils.DebugLog(TAG, "Search for '" + query + "' returned " + count + " results");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -192,7 +192,8 @@ public class ConnectSwapActivity extends ActionBarActivity {
|
|||||||
HttpHost host = new HttpHost(repoUri.getHost(), repoUri.getPort(), repoUri.getScheme());
|
HttpHost host = new HttpHost(repoUri.getHost(), repoUri.getPort(), repoUri.getScheme());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log.d(TAG, "Asking server at " + newRepoConfig.getRepoUriString() + " to swap with us in return (by POSTing to \"/request-swap\" with repo \"" + swapBackUri + "\")...");
|
Utils.DebugLog(TAG, "Asking server at " + newRepoConfig.getRepoUriString() +
|
||||||
|
" to swap with us in return (by POSTing to \"/request-swap\" with repo \"" + swapBackUri + "\")...");
|
||||||
populatePostParams(swapBackUri, request);
|
populatePostParams(swapBackUri, request);
|
||||||
client.execute(host, request);
|
client.execute(host, request);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user