MCPcopy Create free account
hub / github.com/M66B/FairEmail / getCacheSizeKb

Method getCacheSizeKb

app/src/main/java/eu/faircode/email/DB.java:670–684  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

668 }
669
670 static Integer getCacheSizeKb(Context context) {
671 try {
672 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
673 int sqlite_cache = prefs.getInt("sqlite_cache", DEFAULT_CACHE_SIZE);
674
675 ActivityManager am = Helper.getSystemService(context, ActivityManager.class);
676 int class_mb = am.getMemoryClass();
677 int cache_size = sqlite_cache * class_mb * 1024 / 100;
678
679 return (cache_size > 2000 ? cache_size : null);
680 } catch (Throwable ex) {
681 Log.e(ex);
682 return null;
683 }
684 }
685
686 private static void dropTriggers(@NonNull SupportSQLiteDatabase db) {
687 db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");

Callers 2

setOptionsMethod · 0.95
onOpenMethod · 0.95

Calls 3

getSystemServiceMethod · 0.95
eMethod · 0.95
getIntMethod · 0.45

Tested by

no test coverage detected