Small improvements

This commit is contained in:
M66B 2024-01-13 10:17:23 +01:00
parent a1e7d5e638
commit f60afc497b
2 changed files with 8 additions and 5 deletions

View File

@ -177,7 +177,7 @@ public class ContactInfo {
// Favicons // Favicons
Log.i("Cleanup avatars"); Log.i("Cleanup avatars");
for (String type : new String[]{"favicons", "generated"}) { for (String type : new String[]{"notcontact", "favicons", "generated"}) {
File[] favicons = Helper.ensureExists(context, type).listFiles(); File[] favicons = Helper.ensureExists(context, type).listFiles();
if (favicons != null) if (favicons != null)
for (File file : favicons) for (File file : favicons)
@ -291,9 +291,10 @@ public class ContactInfo {
Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) { Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
File dir = Helper.ensureExists(context, "notcontact"); File dir = Helper.ensureExists(context, "notcontact");
File file = new File(dir, ekey); File file = new File(dir, ekey);
if (file.exists()) if (file.exists()) {
file.setLastModified(new Date().getTime());
Log.i("Contact negative cache key=" + ekey); Log.i("Contact negative cache key=" + ekey);
else { } else {
ContentResolver resolver = context.getContentResolver(); ContentResolver resolver = context.getContentResolver();
Uri uri = Uri.withAppendedPath( Uri uri = Uri.withAppendedPath(
ContactsContract.CommonDataKinds.Email.CONTENT_LOOKUP_URI, ContactsContract.CommonDataKinds.Email.CONTENT_LOOKUP_URI,

View File

@ -32,6 +32,8 @@ import java.util.concurrent.TimeUnit;
public class ApplicationSecure extends ApplicationEx implements ProviderInstaller.ProviderInstallListener { public class ApplicationSecure extends ApplicationEx implements ProviderInstaller.ProviderInstallListener {
private static final CountDownLatch lock = new CountDownLatch(1); private static final CountDownLatch lock = new CountDownLatch(1);
private static final long WAIT_INSTALLED = 750L; // milliseconds
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -61,11 +63,11 @@ public class ApplicationSecure extends ApplicationEx implements ProviderInstalle
public static boolean waitProviderInstalled() { public static boolean waitProviderInstalled() {
Log.i("Security provider wait"); Log.i("Security provider wait");
try { try {
boolean succeeded = lock.await(500L, TimeUnit.MILLISECONDS); boolean succeeded = lock.await(WAIT_INSTALLED, TimeUnit.MILLISECONDS);
Log.i("Security provider wait succeeded=" + succeeded); Log.i("Security provider wait succeeded=" + succeeded);
return succeeded; return succeeded;
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
Log.e(ex); Log.i(ex);
return false; return false;
} }
} }