debug logging in release builds for disappearing F-Droid

This commit is contained in:
Hans-Christoph Steiner 2018-04-16 15:17:20 +02:00
parent c327cd788b
commit eac85e725f
3 changed files with 13 additions and 5 deletions

View File

@ -641,7 +641,13 @@ public class AppDetails2 extends AppCompatActivity
Log.e(TAG, "uninstall aborted with errorMessage: " + errorMessage);
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails2.this);
alertBuilder.setTitle(R.string.uninstall_error_notify_title);
Uri uri = intent.getData();
if (uri == null) {
alertBuilder.setTitle(getString(R.string.uninstall_error_notify_title, ""));
} else {
alertBuilder.setTitle(getString(R.string.uninstall_error_notify_title,
uri.getSchemeSpecificPart()));
}
alertBuilder.setMessage(errorMessage);
alertBuilder.setNeutralButton(android.R.string.ok, null);
alertBuilder.create().show();

View File

@ -10,6 +10,7 @@ import android.content.pm.Signature;
import android.net.Uri;
import android.os.Process;
import android.support.annotation.Nullable;
import android.util.Log;
import org.acra.ACRA;
import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.Hasher;
@ -290,6 +291,7 @@ public class InstalledAppProviderService extends IntentService {
* into the database when under test.
*/
static void insertAppIntoDb(Context context, PackageInfo packageInfo, String hashType, String hash) {
Log.d(TAG, "insertAppIntoDb " + packageInfo.packageName);
Uri uri = InstalledAppProvider.getContentUri();
ContentValues contentValues = new ContentValues();
contentValues.put(InstalledAppTable.Cols.Package.NAME, packageInfo.packageName);
@ -307,6 +309,7 @@ public class InstalledAppProviderService extends IntentService {
}
static void deleteAppFromDb(Context context, String packageName) {
Log.d(TAG, "deleteAppFromDb " + packageName);
Uri uri = InstalledAppProvider.getAppUri(packageName);
context.getContentResolver().delete(uri, null, null);
}

View File

@ -4,8 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import org.fdroid.fdroid.Utils;
import android.util.Log;
import org.fdroid.fdroid.data.InstalledAppProviderService;
/**
@ -28,12 +27,12 @@ public class PackageManagerReceiver extends BroadcastReceiver {
InstalledAppProviderService.insert(context, intent.getData());
} else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
if (TextUtils.equals(context.getPackageName(), intent.getData().getSchemeSpecificPart())) {
Utils.debugLog(TAG, "Ignoring request to remove ourselves from cache.");
Log.i(TAG, "Ignoring request to remove ourselves from cache.");
} else {
InstalledAppProviderService.delete(context, intent.getData());
}
} else {
Utils.debugLog(TAG, "unsupported action: " + action + " " + intent);
Log.i(TAG, "unsupported action: " + action + " " + intent);
}
}
}