Java Code Examples for android.content.pm.ApplicationInfo#FLAG_LARGE_HEAP

The following examples show how to use android.content.pm.ApplicationInfo#FLAG_LARGE_HEAP . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitmapUtils.java    From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static int calculateMemoryCacheSize(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    boolean largeHeap =
            (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
    int memoryClass = am.getMemoryClass();
    if (largeHeap && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        memoryClass = ActivityManagerHoneycomb.getLargeMemoryClass(am);
    }
    Log.d(TAG, "LargeHeap enabled? = '" + largeHeap + "'");
    // Target ~15% of the available heap.
    int heapRes = 1024 * 1024 * memoryClass / 7;
    Log.d(TAG, "Heap Reserve Request For Cache Size = '" + heapRes + "'");
    ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
    am.getMemoryInfo(memoryInfo);
    Log.d(TAG, "Available Memory = '" + memoryInfo.availMem + "'");
    return heapRes;
}
 
Example 2
Source File: Util.java    From SoBitmap with Apache License 2.0 5 votes vote down vote up
static int getAvailableMemorySize(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    int ret = -1;
    boolean largeHeap = false;
    if (Build.VERSION.SDK_INT >= 11) {
        largeHeap = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
        if (largeHeap)
            ret = am.getLargeMemoryClass() * 1024;
    }
    if (!largeHeap || Build.VERSION.SDK_INT < 11) {
        ret = am.getMemoryClass() * 1024;
    }
    return ret / 5;
}
 
Example 3
Source File: Utils.java    From bubble with MIT License 5 votes vote down vote up
public static int getHeapSize(Context context) {
    ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
    boolean isLargeHeap = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
    int memoryClass = am.getMemoryClass();
    if (isLargeHeap && Utils.isHoneycombOrLater()) {
        memoryClass = am.getLargeMemoryClass();
    }
    return 1024 * memoryClass;
}
 
Example 4
Source File: DefaultConfigurationFactory.java    From candybar with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isLargeHeap(Context context) {
    return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}
 
Example 5
Source File: DefaultConfigurationFactory.java    From Android-Application-ZJB with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isLargeHeap(Context context) {
    return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}
 
Example 6
Source File: DefaultConfigurationFactory.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isLargeHeap(Context context) {
	return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}
 
Example 7
Source File: DefaultConfigurationFactory.java    From WliveTV with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isLargeHeap(Context context) {
	return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}
 
Example 8
Source File: AMApplicationInfoCompat.java    From ProjectX with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isLargeHeap(ApplicationInfo info) {
    return (info.flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}
 
Example 9
Source File: DefaultConfigurationFactory.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isLargeHeap(Context context) {
	return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
}