Search in sources :

Example 21 with MemoryInfo

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

the class RecentsView method getTotalMemory.

public long getTotalMemory() {
    MemoryInfo memInfo = new MemoryInfo();
    mAm.getMemoryInfo(memInfo);
    long totalMem = memInfo.totalMem;
    return totalMem;
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo)

Example 22 with MemoryInfo

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

the class RecentsView method updateMemoryStatus.

private void updateMemoryStatus() {
    if (mMemText.getVisibility() == View.GONE || mMemBar.getVisibility() == View.GONE)
        return;
    MemoryInfo memInfo = new MemoryInfo();
    mAm.getMemoryInfo(memInfo);
    int available = (int) (memInfo.availMem / 1048576L);
    int max = (int) (getTotalMemory() / 1048576L);
    mMemText.setText(String.format(getResources().getString(R.string.recents_free_ram), available));
    mMemBar.setMax(max);
    mMemBar.setProgress(available);
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo)

Example 23 with MemoryInfo

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

the class RecentsView method checkcolors.

public void checkcolors() {
    MemoryInfo memInfo = new MemoryInfo();
    mAm.getMemoryInfo(memInfo);
    updateMemoryStatus();
    if (mClearStyleSwitch) {
        mMemBar.getProgressDrawable().setColorFilter(mbarcolor, Mode.MULTIPLY);
        mMemText.setTextColor(mtextcolor);
        if (mClock != null) {
            mClock.setTextColor(mClockcolor);
        }
        if (mDate != null) {
            mDate.setTextColor(mDatecolor);
        }
    } else {
        mMemBar.getProgressDrawable().setColorFilter(null);
        mMemText.setTextColor(mDefaultcolor);
        mClock.setTextColor(mDefaultcolor);
        mDate.setTextColor(mDefaultcolor);
    }
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo)

Example 24 with MemoryInfo

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

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 25 with MemoryInfo

use of android.app.ActivityManager.MemoryInfo in project LshUtils by SenhLinsh.

the class AppUtils method getDeviceUsableMemory.

/**
     * 获取设备的可用内存大小,单位byte
     */
public static int getDeviceUsableMemory(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    MemoryInfo mi = new MemoryInfo();
    am.getMemoryInfo(mi);
    // 返回当前系统的可用内存
    return (int) (mi.availMem);
}
Also used : MemoryInfo(android.app.ActivityManager.MemoryInfo) ActivityManager(android.app.ActivityManager)

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