Search in sources :

Example 21 with ActivityManager

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

the class DocumentsApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final int memoryClassBytes = am.getMemoryClass() * 1024 * 1024;
    mRoots = new RootsCache(this);
    mRoots.updateAsync(false);
    mThumbnails = new ThumbnailCache(memoryClassBytes / 4);
    final IntentFilter packageFilter = new IntentFilter();
    packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
    packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
    packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
    packageFilter.addAction(Intent.ACTION_PACKAGE_DATA_CLEARED);
    packageFilter.addDataScheme("package");
    registerReceiver(mCacheReceiver, packageFilter);
    final IntentFilter localeFilter = new IntentFilter();
    localeFilter.addAction(Intent.ACTION_LOCALE_CHANGED);
    registerReceiver(mCacheReceiver, localeFilter);
}
Also used : IntentFilter(android.content.IntentFilter) ActivityManager(android.app.ActivityManager) Point(android.graphics.Point)

Example 22 with ActivityManager

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

the class GLDepthTestActivity method detectOpenGLES20.

private boolean detectOpenGLES20() {
    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    return (info.reqGlEsVersion >= 0x20000);
}
Also used : ActivityManager(android.app.ActivityManager) ConfigurationInfo(android.content.pm.ConfigurationInfo)

Example 23 with ActivityManager

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

the class MffContext method getPlatformSupportsGLES2.

private static boolean getPlatformSupportsGLES2(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo configurationInfo = am.getDeviceConfigurationInfo();
    return configurationInfo.reqGlEsVersion >= 0x20000;
}
Also used : ActivityManager(android.app.ActivityManager) ConfigurationInfo(android.content.pm.ConfigurationInfo)

Example 24 with ActivityManager

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

the class MemoryUsageTest method reportError.

private void reportError(String appName, String processName, Bundle results) {
    ActivityManager am = (ActivityManager) getInstrumentation().getContext().getSystemService(Context.ACTIVITY_SERVICE);
    List<ProcessErrorStateInfo> crashes = am.getProcessesInErrorState();
    if (crashes != null) {
        for (ProcessErrorStateInfo crash : crashes) {
            if (!crash.processName.equals(processName))
                continue;
            Log.w(TAG, appName + " crashed: " + crash.shortMsg);
            results.putString(mNameToResultKey.get(appName), crash.shortMsg);
            return;
        }
    }
    results.putString(mNameToResultKey.get(appName), "Crashed for unknown reason");
    Log.w(TAG, appName + " not found in process list, most likely it is crashed");
}
Also used : ProcessErrorStateInfo(android.app.ActivityManager.ProcessErrorStateInfo) ActivityManager(android.app.ActivityManager) IActivityManager(android.app.IActivityManager)

Example 25 with ActivityManager

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

the class LaunchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_launch);
    mBackgroundPolling = new Runnable() {

        @Override
        public void run() {
            if (!mRunning) {
                return;
            }
            ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
            final int color = activityManager.getLockTaskModeState() != ActivityManager.LOCK_TASK_MODE_NONE ? 0xFFFFC0C0 : 0xFFFFFFFF;
            findViewById(R.id.root_launch).setBackgroundColor(color);
            mHandler.postDelayed(this, 1000);
        }
    };
    mHandler = new Handler(Looper.getMainLooper());
}
Also used : Handler(android.os.Handler) ActivityManager(android.app.ActivityManager)

Aggregations

ActivityManager (android.app.ActivityManager)612 Intent (android.content.Intent)61 RunningAppProcessInfo (android.app.ActivityManager.RunningAppProcessInfo)55 PackageManager (android.content.pm.PackageManager)50 Context (android.content.Context)47 ComponentName (android.content.ComponentName)44 RunningServiceInfo (android.app.ActivityManager.RunningServiceInfo)36 ArrayList (java.util.ArrayList)31 View (android.view.View)29 IOException (java.io.IOException)29 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)27 SuppressLint (android.annotation.SuppressLint)26 ImageView (android.widget.ImageView)25 TextView (android.widget.TextView)25 IActivityManager (android.app.IActivityManager)19 Point (android.graphics.Point)19 RemoteException (android.os.RemoteException)19 MemoryInfo (android.app.ActivityManager.MemoryInfo)18 Bitmap (android.graphics.Bitmap)18 AdapterView (android.widget.AdapterView)18