use of android.app.ActivityManager in project CloudReader by youlookwhat.
the class BaseTools method getTopActivityName.
/**
* 处于栈顶的Activity名
*/
public String getTopActivityName(Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List var2 = am.getRunningTasks(1);
return ((ActivityManager.RunningTaskInfo) var2.get(0)).topActivity.getClassName();
}
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);
}
use of android.app.ActivityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RunningProcessesView method doCreate.
public void doCreate() {
mAm = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
mState = RunningState.getInstance(getContext());
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.running_processes_view, this);
mListView = (ListView) findViewById(android.R.id.list);
View emptyView = findViewById(com.android.internal.R.id.empty);
if (emptyView != null) {
mListView.setEmptyView(emptyView);
}
mListView.setOnItemClickListener(this);
mListView.setRecyclerListener(this);
mAdapter = new ServiceListAdapter(mState);
mListView.setAdapter(mAdapter);
mHeader = inflater.inflate(R.layout.running_processes_header, null);
mListView.addHeaderView(mHeader, null, false);
mColorBar = (LinearColorBar) mHeader.findViewById(R.id.color_bar);
final Context context = getContext();
mColorBar.setColors(context.getColor(R.color.running_processes_system_ram), Utils.getColorAccent(context), context.getColor(R.color.running_processes_free_ram));
mBackgroundProcessPrefix = (TextView) mHeader.findViewById(R.id.freeSizePrefix);
mAppsProcessPrefix = (TextView) mHeader.findViewById(R.id.appsSizePrefix);
mForegroundProcessPrefix = (TextView) mHeader.findViewById(R.id.systemSizePrefix);
mBackgroundProcessText = (TextView) mHeader.findViewById(R.id.freeSize);
mAppsProcessText = (TextView) mHeader.findViewById(R.id.appsSize);
mForegroundProcessText = (TextView) mHeader.findViewById(R.id.systemSize);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
mAm.getMemoryInfo(memInfo);
SECONDARY_SERVER_MEM = memInfo.secondaryServerThreshold;
}
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);
}
use of android.app.ActivityManager in project ride-read-android by Ride-Read.
the class AppUtils method isServiceRunning.
/**
* 判断Service是否running
*
* @param context
* @param serviceClass
* @return
*/
public static boolean isServiceRunning(Context context, Class<? extends Service> serviceClass) {
try {
context = context.getApplicationContext();
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> serviceList = activityManager.getRunningServices(2000);
for (ActivityManager.RunningServiceInfo info : serviceList) {
String name = info.service.getClassName();
if (name != null && name.contains(serviceClass.getName())) {
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
Aggregations