From 3d503e356f2a4ca6b5baaceec9ea0f04cf038609 Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu Date: Wed, 24 Mar 2010 09:05:59 -0700 Subject: [PATCH] When unmounting the sdcard, we are currently checking for apps that have open file references on the sdcard. We also have to check for apps on sd that are currently running. Use the new ActivityManager api to get a list of these apps before deciding to show the dialog. Change-Id: Idb00fcbd0a3f314d75ee1662cb2b10a84569527a --- .../android/settings/deviceinfo/Memory.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/com/android/settings/deviceinfo/Memory.java b/src/com/android/settings/deviceinfo/Memory.java index 1f7f29de287..b57484908cf 100644 --- a/src/com/android/settings/deviceinfo/Memory.java +++ b/src/com/android/settings/deviceinfo/Memory.java @@ -231,23 +231,9 @@ public class Memory extends PreferenceActivity implements OnCancelListener { return true; } ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); - PackageManager pm = getPackageManager(); - List runningApps = am.getRunningAppProcesses(); - if (runningApps != null && runningApps.size() > 0) { - for (ActivityManager.RunningAppProcessInfo app : runningApps) { - if (app.pkgList == null) { - continue; - } - for (String pkg : app.pkgList) { - try { - ApplicationInfo info = pm.getApplicationInfo(pkg, 0); - if ((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) { - return true; - } - } catch (NameNotFoundException e) { - } - } - } + List list = am.getRunningExternalApplications(); + if (list != null && list.size() > 0) { + return true; } return false; }