Search in sources :

Example 11 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project storymaker by StoryMaker.

the class StoryMakerApp method onLowMemory.

@Override
public void onLowMemory() {
    super.onLowMemory();
    MemoryInfo mi = new MemoryInfo();
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(mi);
    long availableMegs = mi.availMem / 1048576L;
    Timber.e("LOW MEMORY WARNING/ MEMORY AVAIL=" + availableMegs);
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo) ActivityManager(android.app.ActivityManager)

Example 12 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project android_frameworks_base by DirtyUnicorns.

the class SurfaceCompositionMeasuringActivity method getMemoryInfo.

private MemoryInfo getMemoryInfo() {
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    MemoryInfo memInfo = new MemoryInfo();
    activityManager.getMemoryInfo(memInfo);
    return memInfo;
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo) ActivityManager(android.app.ActivityManager)

Example 13 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project android_frameworks_base by DirtyUnicorns.

the class SurfaceCompositionMeasuringActivity method updateSystemInfo.

private void updateSystemInfo(int pixelFormat) {
    int visibleCnt = 0;
    for (int i = 0; i < mViews.size(); ++i) {
        if (mViews.get(i).getVisibility() == View.VISIBLE) {
            ++visibleCnt;
        }
    }
    MemoryInfo memInfo = getMemoryInfo();
    String platformName = mAndromeda ? "Andromeda" : "Android";
    String info = platformName + ": available " + getReadableMemory(memInfo.availMem) + " from " + getReadableMemory(memInfo.totalMem) + ".\nVisible " + visibleCnt + " from " + mViews.size() + " " + getPixelFormatInfo(pixelFormat) + " surfaces.\n" + "View size: " + mWidth + "x" + mHeight + ". Refresh rate: " + DOUBLE_FORMAT.format(mRefreshRate) + ".";
    mSystemInfoView.setText(info);
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo)

Example 14 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project JustAndroid by chinaltz.

the class AbAppUtil method getAvailMemory.

/**
     * 获取可用内存.
     *
     * @param context
     * @return
     */
public static long getAvailMemory(Context context) {
    //获取android当前可用内存大小
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    MemoryInfo memoryInfo = new MemoryInfo();
    activityManager.getMemoryInfo(memoryInfo);
    //当前系统可用内存 ,将获得的内存大小规格化
    return memoryInfo.availMem;
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo) ActivityManager(android.app.ActivityManager)

Example 15 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project android_frameworks_base by crdroidandroid.

the class RecentsView method updateMemoryStatus.

public void updateMemoryStatus() {
    if (!mShowMemDisplay)
        return;
    MemoryInfo memInfo = new MemoryInfo();
    mAm.getMemoryInfo(memInfo);
    int available = (int) (memInfo.availMem / 1048576L);
    int max = (int) (memInfo.totalMem / 1048576L);
    mMemText.setText("Free RAM: " + String.valueOf(available) + "MB");
    mMemBar.setMax(max);
    mMemBar.setProgress(available);
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo)

Aggregations

MemoryInfo (android.app.ActivityManager.MemoryInfo)26 ActivityManager (android.app.ActivityManager)12 Point (android.graphics.Point)2 SuppressLint (android.annotation.SuppressLint)1 DisplayMetrics (android.util.DisplayMetrics)1 Display (android.view.Display)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1